diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a4656d75..ab3c0659 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,7 +60,7 @@ jobs: - name: Save AppMaps uses: actions/cache/save@v4 - if: runner.os == 'Linux' && matrix.ide_version == 'IC-2023.1' + if: runner.os == 'Linux' && matrix.ide_version == '2023.1' with: path: ./tmp/appmap key: appmaps-${{ github.sha }}-${{ github.run_attempt }} diff --git a/README.md b/README.md index 0226a629..35aaa15d 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,18 @@ AppMap is a developer tools platform powered by runtime analysis and AI. It's co * AppMap data - Runtime traces of your application runtime. * AppMap diagrams - Interactive visualizations of AppMap data. -By using AppMap data, Navie is the first AI code architect with the context to understand how your app works when it runs, like a principal engineer or software architect. AppMap data provides Navie with accurate information about application behavior, APIs, database queries, and more, providing valuable context so you can ask more challenging questions and get better answers. +Navie is the first AI code architect with the context to understand how your app works when it runs, like a principal engineer or software architect. AppMap data provides Navie with accurate information about application behavior, APIs, database queries, and more, providing valuable context so you can ask more challenging questions and get better answers. ![image](https://appmap.io/assets/img/appmap-navie-intellij-screenshot.png) + +## Requirements and Use + +**2023.1** and newer JetBrains IDEs are required to use this plugin. +Supported web applications and API frameworks: Ruby on Rails, Django, Flask, Express, Nest.js, Next.js, and Spring, Kotlin, and Scala +Supported programming languages: Java, Python, Ruby, TypeScript/JavaScript (for Node.js). + + ## Get started 1. **Install [the AppMap Plugin](https://plugins.jetbrains.com/plugin/16701-appmap)** from within the code editor or from the marketplace. @@ -20,15 +28,9 @@ By using AppMap data, Navie is the first AI code architect with the context to u 3. **Ask Navie** for guidance recording AppMap data specific to interactions or code scenarios you're interested in analyzing. - -## Examples -Here are some examples of Navie making context-aware suggestions, providing tactical solutions, and reasoning about the larger context of the specific code being worked on. -1. [Understand complex data flows and add a new feature in Java Spring](https://appmap.io/navie/how-to/understand-complex-data-flows-and-add-new-features-in-java-spring/) -2. [Find and fix slow API endpoints in a FastAPI app](https://appmap.io/navie/how-to/fix-slow-api-endpoints-in-a-fastapi-app-with-navie/) -3. [Find and fix a database performance issue in Ruby on Rails](https://appmap.io/navie/how-to/find-and-fix-a-database-performance-issue-in-ruby-on-rails/) -4. [Quickly add a new feature to a complex Python app](https://appmap.io/navie/how-to/adding-a-new-feature-to-a-complex-python-application/) -5. [Fixing performance issues with MongoDB in a MERN app](https://appmap.io/navie/how-to/fixing-performance-issues-with-mongodb-in-a-mern-app/) +## Examples +[Here are some examples](https://appmap.io/product/examples/navie) of Navie making context-aware suggestions, providing tactical solutions, and reasoning about the larger context of the specific code being worked on. ## Chat Modes @@ -37,18 +39,34 @@ Navie provides different modes of interaction to assist you with your code and p - **`@explain` (default)**: Navie makes context-aware suggestions, provides specific solutions, and reasons about the larger context of the specific code being worked on. -- **`@help`**: Activate help mode by beginning any question with the prefix "@help". This mode offers assistance with using AppMap, including guidance for generating and leveraging AppMap data effectively. +- **`@plan`**: Navie focuses the AI response on building a detailed implementation plan for the relevant query. This will focus Navie on only understanding the problem and the application to generate a step-by-step plan. - **`@generate`**: Activate code generation mode by beginning any question with the prefix "@generate". In this mode Navie's response are optimized to include code snippets you can use directly in the files are working on. +- **`@test`**: Navie's responses are optimized for test case creation, such as unit testing or integration testing. This prefix will understand how your tests are currently written and provide updated tests based on features or code that is provided. + +- **`@diagram`**: Navie will create and render a Mermaid compatible diagram within the Navie chat window. You can open this diagram in the [Mermaid Live Editor](https://mermaid.live), copy the Mermaid Definitions to your clipboard, save to disk, or expand a full window view. + +- **`@help`**: Activate help mode by beginning any question with the prefix "@help". This mode offers assistance with using AppMap, including guidance for generating and leveraging AppMap data effectively. + **Via the JetBrains Tools menu option** You can open Navie by clicking on the JetBrains menu option *Tools -> AppMap*. From there you can select *Explain with AppMap Navie*. -![image](https://appmap.io/assets/img/product/tools-appmap-vscode.webp) +![image](https://appmap.io/assets/img/product/tools-appmap-vscode.png) **Ask Navie about a specific AppMap visualization**: You can target your question more specifically to an AppMap, representing a test case, API call, or other interaction by clicking the “Ask Navie” box on any AppMap you open. -![image](https://appmap.io/assets/img/product/ask-navie-about-a-map.webp) +![image](https://appmap.io/assets/img/product/ask-navie-about-a-map.png) + +## Pin files to Navie's context + +Pin specific data files to your conversation with Navie to include data sources you know are relevant to the issue. This includes pinning the text of the issue itself. + +![image](https://appmap.io/assets/img/pinned-context.webp) + +Pin code from Navie responses to your conversation when a Navie response contains code that you want to reference in subsequent prompts. + +![image](https://appmap.io/assets/img/pin-from-response.webp) ## Bring your own key or model for Navie @@ -95,4 +113,4 @@ Make AppMap data by running your app—either by [running test cases](https://ap To learn more about security of AppMap, or the use of data with AI when using Navie, see the AppMap [security disclosure](https://appmap.io/security) for more detailed information and discussion. -There is [no fee](https://appmap.io/pricing) for personal use of AppMap for graphing and limited Navie use. Pricing for premium features and integrations are listed on [AppMap’s Pricing Page](https://appmap.io/pricing). +There is [no fee](https://appmap.io/pricing) for personal use of AppMap for graphing and limited Navie use. Pricing for premium features and integrations are listed on [AppMap’s Pricing Page](https://appmap.io/pricing). \ No newline at end of file diff --git a/appland-navie/.yarnrc.yml b/appland-navie/.yarnrc.yml deleted file mode 100644 index 8b757b29..00000000 --- a/appland-navie/.yarnrc.yml +++ /dev/null @@ -1 +0,0 @@ -nodeLinker: node-modules \ No newline at end of file diff --git a/appland-navie/dist/main.js b/appland-navie/dist/main.js index 1d16e9e8..964f4b85 100644 --- a/appland-navie/dist/main.js +++ b/appland-navie/dist/main.js @@ -1868,7 +1868,7 @@ var w2 = b2((t5) => t5.replace($3, (t6, e4) => e4 ? e4.toUpperCase() : "")); var C2 = b2((t5) => t5.charAt(0).toUpperCase() + t5.slice(1)); var x4 = /\B([A-Z])/g; - var O = b2((t5) => t5.replace(x4, "-$1").toLowerCase()); + var O2 = b2((t5) => t5.replace(x4, "-$1").toLowerCase()); var k3 = Function.prototype.bind ? function(t5, e4) { return t5.bind(e4); } : function(t5, e4) { @@ -1894,7 +1894,7 @@ for (let n3 = 0; n3 < t5.length; n3++) t5[n3] && j2(e4, t5[n3]); return e4; } - function T3(t5, e4, n3) { + function T2(t5, e4, n3) { } var E3 = (t5, e4, n3) => false; var P2 = (t5) => t5; @@ -1931,7 +1931,7 @@ var L = "data-server-rendered"; var R2 = ["component", "directive", "filter"]; var F2 = ["beforeCreate", "created", "beforeMount", "mounted", "beforeUpdate", "updated", "beforeDestroy", "destroyed", "activated", "deactivated", "errorCaptured", "serverPrefetch", "renderTracked", "renderTriggered"]; - var U = { optionMergeStrategies: /* @__PURE__ */ Object.create(null), silent: false, productionTip: false, devtools: false, performance: false, errorHandler: null, warnHandler: null, ignoredElements: [], keyCodes: /* @__PURE__ */ Object.create(null), isReservedTag: E3, isReservedAttr: E3, isUnknownElement: E3, getTagNamespace: T3, parsePlatformTagName: P2, mustUseProp: E3, async: true, _lifecycleHooks: F2 }; + var U = { optionMergeStrategies: /* @__PURE__ */ Object.create(null), silent: false, productionTip: false, devtools: false, performance: false, errorHandler: null, warnHandler: null, ignoredElements: [], keyCodes: /* @__PURE__ */ Object.create(null), isReservedTag: E3, isReservedAttr: E3, isUnknownElement: E3, getTagNamespace: T2, parsePlatformTagName: P2, mustUseProp: E3, async: true, _lifecycleHooks: F2 }; function B3(t5) { const e4 = (t5 + "").charCodeAt(0); return 36 === e4 || 95 === e4; @@ -2065,7 +2065,7 @@ function xt2(t5) { Ct2 = t5; } - var Ot2 = { notify: T3, depend: T3, addSub: T3, removeSub: T3 }; + var Ot2 = { notify: T2, depend: T2, addSub: T2, removeSub: T2 }; var kt2 = class { constructor(t5, n3 = false, o3 = false) { if (this.value = t5, this.shallow = n3, this.mock = o3, this.dep = o3 ? Ot2 : new mt2(), this.vmCount = 0, V2(t5, "__ob__", this), e3(t5)) { @@ -2211,7 +2211,7 @@ let d3, p4, h4 = false, m3 = false; if (Rt2(n3) ? (d3 = () => n3.value, h4 = Nt2(n3)) : Dt2(n3) ? (d3 = () => (n3.__ob__.dep.depend(), n3), s4 = true) : e3(n3) ? (m3 = true, h4 = n3.some((t5) => Dt2(t5) || Nt2(t5)), d3 = () => n3.map((t5) => Rt2(t5) ? t5.value : Dt2(t5) ? (t5.__ob__.dep.depend(), yn2(t5)) : i2(t5) ? f2(t5, Zt2) : void 0)) : d3 = i2(n3) ? o3 ? () => f2(n3, Zt2) : () => { if (!u3 || !u3._isDestroyed) return p4 && p4(), f2(n3, qt2, [_2]); - } : T3, o3 && s4) { + } : T2, o3 && s4) { const t5 = d3; d3 = () => yn2(t5()); } @@ -2220,8 +2220,8 @@ f2(t5, Jt2); }; }; - if (et2()) return _2 = T3, o3 ? r3 && f2(o3, Gt2, [d3(), m3 ? [] : void 0, _2]) : d3(), T3; - const v6 = new wn2(it2, d3, T3, { lazy: true }); + if (et2()) return _2 = T2, o3 ? r3 && f2(o3, Gt2, [d3(), m3 ? [] : void 0, _2]) : d3(), T2; + const v6 = new wn2(it2, d3, T2, { lazy: true }); v6.noRecurse = !o3; let y5 = m3 ? [] : Qt2; return v6.run = () => { @@ -2355,7 +2355,7 @@ } function _e2(t5, e4, n3, o3, r3) { const s4 = U.keyCodes[e4] || n3; - return r3 && o3 && !U.keyCodes[e4] ? me2(r3, o3) : s4 ? me2(s4, t5) : o3 ? O(o3) !== e4 : void 0 === t5; + return r3 && o3 && !U.keyCodes[e4] ? me2(r3, o3) : s4 ? me2(s4, t5) : o3 ? O2(o3) !== e4 : void 0 === t5; } function ve2(t5, n3, o3, r3, s4) { if (o3) if (c5(o3)) { @@ -2367,7 +2367,7 @@ const o4 = t5.attrs && t5.attrs.type; i3 = r3 || U.mustUseProp(n3, o4, e4) ? t5.domProps || (t5.domProps = {}) : t5.attrs || (t5.attrs = {}); } - const c6 = w2(e4), a4 = O(e4); + const c6 = w2(e4), a4 = O2(e4); if (!(c6 in i3) && !(a4 in i3) && (i3[e4] = o3[e4], s4)) { (t5.on || (t5.on = {}))[`update:${e4}`] = function(t6) { o3[e4] = t6; @@ -2599,7 +2599,7 @@ if ("undefined" != typeof Promise && ot2(Promise)) { const t5 = Promise.resolve(); Xe2 = () => { - t5.then(Ye2), J && setTimeout(T3); + t5.then(Ye2), J && setTimeout(T2); }, Ze2 = true; } else if (q || "undefined" == typeof MutationObserver || !ot2(MutationObserver) && "[object MutationObserverConstructor]" !== MutationObserver.toString()) Xe2 = "undefined" != typeof setImmediate && ot2(setImmediate) ? () => { setImmediate(Ye2); @@ -2691,8 +2691,8 @@ }, computed: function(t5, e4) { let n3, o3; const r3 = i2(t5); - r3 ? (n3 = t5, o3 = T3) : (n3 = t5.get, o3 = t5.set); - const s4 = et2() ? null : new wn2(it2, n3, T3, { lazy: true }), c6 = { effect: s4, get value() { + r3 ? (n3 = t5, o3 = T2) : (n3 = t5.get, o3 = t5.set); + const s4 = et2() ? null : new wn2(it2, n3, T2, { lazy: true }), c6 = { effect: s4, get value() { return s4 ? (s4.dirty && s4.evaluate(), mt2.target && s4.depend(), s4.value) : n3(); }, set value(t6) { o3(t6); @@ -2801,7 +2801,7 @@ } return t7; }; - }(e4), this.getter || (this.getter = T3)), this.value = this.lazy ? void 0 : this.get(); + }(e4), this.getter || (this.getter = T2)), this.value = this.lazy ? void 0 : this.get(); } get() { let t5; @@ -2970,7 +2970,7 @@ return n3; } } - function Wn(n3, o3, s4, i3, c6) { + function Wn2(n3, o3, s4, i3, c6) { const a4 = c6.options; let l3; g2(i3, "_uid") ? (l3 = Object.create(i3), l3._original = i3) : (l3 = i3, i3 = i3._original); @@ -2992,7 +2992,7 @@ function Gn2(t5) { return t5.name || t5.__name || t5._componentTag; } - ke2(Wn.prototype); + ke2(Wn2.prototype); var Zn3 = { init(t5, e4) { if (t5.componentInstance && !t5.componentInstance._isDestroyed && t5.data.keepAlive) { const e6 = t5; @@ -3077,7 +3077,7 @@ if (n2(s5)) return; const i4 = {}, { attrs: c6, props: a5 } = t5; if (o2(c6) || o2(a5)) for (const t6 in s5) { - const e6 = O(t6); + const e6 = O2(t6); ae2(i4, a5, t6, e6, true) || ae2(i4, c6, t6, e6, false); } return i4; @@ -3086,7 +3086,7 @@ const a5 = n3.options, l4 = {}, u4 = a5.props; if (o2(u4)) for (const e4 in u4) l4[e4] = ao(e4, u4, r3 || t4); else o2(s5.attrs) && qn2(l4, s5.attrs), o2(s5.props) && qn2(l4, s5.props); - const f2 = new Wn(s5, l4, c6, i4, n3), d4 = a5.render.call(null, f2._c, f2); + const f2 = new Wn2(s5, l4, c6, i4, n3), d4 = a5.render.call(null, f2._c, f2); if (d4 instanceof at2) return Kn2(d4, s5, f2.parent, a5); if (e3(d4)) { const t5 = le2(d4) || [], e4 = new Array(t5.length); @@ -3115,7 +3115,7 @@ }; return n3._merged = true, n3; } - var Yn3 = T3; + var Yn3 = T2; var to = U.optionMergeStrategies; function eo(t5, e4, n3 = true) { if (!e4) return t5; @@ -3225,7 +3225,7 @@ const a4 = po(Boolean, r3.type); if (a4 > -1) { if (s4 && !g2(r3, "default")) c6 = false; - else if ("" === c6 || c6 === O(t5)) { + else if ("" === c6 || c6 === O2(t5)) { const t6 = po(String, r3.type); (t6 < 0 || a4 < t6) && (c6 = true); } @@ -3255,7 +3255,7 @@ for (let e4 = 0, o3 = n3.length; e4 < o3; e4++) if (fo(n3[e4], t5)) return e4; return -1; } - var ho = { enumerable: true, configurable: true, get: T3, set: T3 }; + var ho = { enumerable: true, configurable: true, get: T2, set: T2 }; function mo(t5, e4, n3) { ho.get = function() { return this[e4][n3]; @@ -3287,7 +3287,7 @@ } }(t5), n3.methods && function(t6, e4) { t6.$options.props; - for (const n4 in e4) t6[n4] = "function" != typeof e4[n4] ? T3 : k3(e4[n4], t6); + for (const n4 in e4) t6[n4] = "function" != typeof e4[n4] ? T2 : k3(e4[n4], t6); }(t5, n3.methods), n3.data) !function(t6) { let e4 = t6.$options.data; e4 = t6._data = i2(e4) ? function(t7, e6) { @@ -3318,7 +3318,7 @@ const n4 = t6._computedWatchers = /* @__PURE__ */ Object.create(null), o3 = et2(); for (const r3 in e4) { const s4 = e4[r3], c6 = i2(s4) ? s4 : s4.get; - o3 || (n4[r3] = new wn2(t6, c6 || T3, T3, vo)), r3 in t6 || yo(t6, r3, s4); + o3 || (n4[r3] = new wn2(t6, c6 || T2, T2, vo)), r3 in t6 || yo(t6, r3, s4); } }(t5, n3.computed), n3.watch && n3.watch !== Q2 && function(t6, n4) { for (const o3 in n4) { @@ -3331,7 +3331,7 @@ var vo = { lazy: true }; function yo(t5, e4, n3) { const o3 = !et2(); - i2(n3) ? (ho.get = o3 ? go(e4) : bo(n3), ho.set = T3) : (ho.get = n3.get ? o3 && false !== n3.cache ? go(e4) : bo(n3.get) : T3, ho.set = n3.set || T3), Object.defineProperty(t5, e4, ho); + i2(n3) ? (ho.get = o3 ? go(e4) : bo(n3), ho.set = T2) : (ho.get = n3.get ? o3 && false !== n3.cache ? go(e4) : bo(n3.get) : T2, ho.set = n3.set || T2), Object.defineProperty(t5, e4, ho); } function go(t5) { return function() { @@ -3600,7 +3600,7 @@ }(t5); }(xo), Object.defineProperty(xo.prototype, "$isServer", { get: et2 }), Object.defineProperty(xo.prototype, "$ssrContext", { get() { return this.$vnode && this.$vnode.ssrContext; - } }), Object.defineProperty(xo, "FunctionalRenderContext", { value: Wn }), xo.version = mn2; + } }), Object.defineProperty(xo, "FunctionalRenderContext", { value: Wn2 }), xo.version = mn2; var Po = m2("style,class"); var Io = m2("input,textarea,option,select,progress"); var Do = m2("contenteditable,draggable,spellcheck"); @@ -3893,7 +3893,7 @@ var Mr = /\s*!important$/; var Lr = (t5, e4, n3) => { if (Nr.test(e4)) t5.style.setProperty(e4, n3); - else if (Mr.test(n3)) t5.style.setProperty(O(e4), n3.replace(Mr, ""), "important"); + else if (Mr.test(n3)) t5.style.setProperty(O2(e4), n3.replace(Mr, ""), "important"); else { const o3 = Ur(e4); if (Array.isArray(n3)) for (let e6 = 0, r3 = n3.length; e6 < r3; e6++) t5.style[o3] = n3[e6]; @@ -3965,25 +3965,25 @@ var Xr = "transition"; var Qr = "transitionend"; var Yr = "animation"; - var ts = "animationend"; - Gr && (void 0 === window.ontransitionend && void 0 !== window.onwebkittransitionend && (Xr = "WebkitTransition", Qr = "webkitTransitionEnd"), void 0 === window.onanimationend && void 0 !== window.onwebkitanimationend && (Yr = "WebkitAnimation", ts = "webkitAnimationEnd")); - var es = W ? window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : setTimeout : (t5) => t5(); + var ts2 = "animationend"; + Gr && (void 0 === window.ontransitionend && void 0 !== window.onwebkittransitionend && (Xr = "WebkitTransition", Qr = "webkitTransitionEnd"), void 0 === window.onanimationend && void 0 !== window.onwebkitanimationend && (Yr = "WebkitAnimation", ts2 = "webkitAnimationEnd")); + var es2 = W ? window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : setTimeout : (t5) => t5(); function ns(t5) { - es(() => { - es(t5); + es2(() => { + es2(t5); }); } - function os(t5, e4) { + function os2(t5, e4) { const n3 = t5._transitionClasses || (t5._transitionClasses = []); n3.indexOf(e4) < 0 && (n3.push(e4), Hr(t5, e4)); } - function rs(t5, e4) { + function rs2(t5, e4) { t5._transitionClasses && v(t5._transitionClasses, e4), Wr(t5, e4); } - function ss(t5, e4, n3) { + function ss2(t5, e4, n3) { const { type: o3, timeout: r3, propCount: s4 } = cs(t5, e4); if (!o3) return n3(); - const i3 = o3 === Zr ? Qr : ts; + const i3 = o3 === Zr ? Qr : ts2; let c6 = 0; const a4 = () => { t5.removeEventListener(i3, l3), n3(); @@ -3994,14 +3994,14 @@ c6 < s4 && a4(); }, r3 + 1), t5.addEventListener(i3, l3); } - var is2 = /\b(transform|all)(,|$)/; + var is3 = /\b(transform|all)(,|$)/; function cs(t5, e4) { - const n3 = window.getComputedStyle(t5), o3 = (n3[Xr + "Delay"] || "").split(", "), r3 = (n3[Xr + "Duration"] || "").split(", "), s4 = as(o3, r3), i3 = (n3[Yr + "Delay"] || "").split(", "), c6 = (n3[Yr + "Duration"] || "").split(", "), a4 = as(i3, c6); + const n3 = window.getComputedStyle(t5), o3 = (n3[Xr + "Delay"] || "").split(", "), r3 = (n3[Xr + "Duration"] || "").split(", "), s4 = as2(o3, r3), i3 = (n3[Yr + "Delay"] || "").split(", "), c6 = (n3[Yr + "Duration"] || "").split(", "), a4 = as2(i3, c6); let l3, u3 = 0, f2 = 0; e4 === Zr ? s4 > 0 && (l3 = Zr, u3 = s4, f2 = r3.length) : e4 === Jr ? a4 > 0 && (l3 = Jr, u3 = a4, f2 = c6.length) : (u3 = Math.max(s4, a4), l3 = u3 > 0 ? s4 > a4 ? Zr : Jr : null, f2 = l3 ? l3 === Zr ? r3.length : c6.length : 0); - return { type: l3, timeout: u3, propCount: f2, hasTransform: l3 === Zr && is2.test(n3[Xr + "Property"]) }; + return { type: l3, timeout: u3, propCount: f2, hasTransform: l3 === Zr && is3.test(n3[Xr + "Property"]) }; } - function as(t5, e4) { + function as2(t5, e4) { for (; t5.length < e4.length; ) t5 = t5.concat(t5); return Math.max.apply(null, e4.map((e6, n3) => ls(e6) + ls(t5[n3]))); } @@ -4014,19 +4014,19 @@ const s4 = Kr(t5.data.transition); if (n2(s4)) return; if (o2(r3._enterCb) || 1 !== r3.nodeType) return; - const { css: a4, type: l3, enterClass: u3, enterToClass: f2, enterActiveClass: d3, appearClass: p4, appearToClass: m3, appearActiveClass: _2, beforeEnter: v6, enter: y5, afterEnter: g3, enterCancelled: b3, beforeAppear: $4, appear: w3, afterAppear: C3, appearCancelled: x5, duration: O2 } = s4; + const { css: a4, type: l3, enterClass: u3, enterToClass: f2, enterActiveClass: d3, appearClass: p4, appearToClass: m3, appearActiveClass: _2, beforeEnter: v6, enter: y5, afterEnter: g3, enterCancelled: b3, beforeAppear: $4, appear: w3, afterAppear: C3, appearCancelled: x5, duration: O3 } = s4; let k4 = Sn2, S4 = Sn2.$vnode; for (; S4 && S4.parent; ) k4 = S4.context, S4 = S4.parent; const j3 = !k4._isMounted || !t5.isRootInsert; if (j3 && !w3 && "" !== w3) return; - const A3 = j3 && p4 ? p4 : u3, T4 = j3 && _2 ? _2 : d3, E4 = j3 && m3 ? m3 : f2, P3 = j3 && $4 || v6, I3 = j3 && i2(w3) ? w3 : y5, D5 = j3 && C3 || g3, M3 = j3 && x5 || b3, L2 = h3(c5(O2) ? O2.enter : O2), R3 = false !== a4 && !G, F3 = ps(I3), U2 = r3._enterCb = N(() => { - R3 && (rs(r3, E4), rs(r3, T4)), U2.cancelled ? (R3 && rs(r3, A3), M3 && M3(r3)) : D5 && D5(r3), r3._enterCb = null; + const A3 = j3 && p4 ? p4 : u3, T3 = j3 && _2 ? _2 : d3, E4 = j3 && m3 ? m3 : f2, P3 = j3 && $4 || v6, I3 = j3 && i2(w3) ? w3 : y5, D5 = j3 && C3 || g3, M3 = j3 && x5 || b3, L2 = h3(c5(O3) ? O3.enter : O3), R3 = false !== a4 && !G, F3 = ps(I3), U2 = r3._enterCb = N(() => { + R3 && (rs2(r3, E4), rs2(r3, T3)), U2.cancelled ? (R3 && rs2(r3, A3), M3 && M3(r3)) : D5 && D5(r3), r3._enterCb = null; }); t5.data.show || ce2(t5, "insert", () => { const e6 = r3.parentNode, n3 = e6 && e6._pending && e6._pending[t5.key]; n3 && n3.tag === t5.tag && n3.elm._leaveCb && n3.elm._leaveCb(), I3 && I3(r3, U2); - }), P3 && P3(r3), R3 && (os(r3, A3), os(r3, T4), ns(() => { - rs(r3, A3), U2.cancelled || (os(r3, E4), F3 || (ds(L2) ? setTimeout(U2, L2) : ss(r3, l3, U2))); + }), P3 && P3(r3), R3 && (os2(r3, A3), os2(r3, T3), ns(() => { + rs2(r3, A3), U2.cancelled || (os2(r3, E4), F3 || (ds(L2) ? setTimeout(U2, L2) : ss2(r3, l3, U2))); })), t5.data.show && (e4 && e4(), I3 && I3(r3, U2)), R3 || F3 || U2(); } function fs(t5, e4) { @@ -4036,11 +4036,11 @@ if (n2(s4) || 1 !== r3.nodeType) return e4(); if (o2(r3._leaveCb)) return; const { css: i3, type: a4, leaveClass: l3, leaveToClass: u3, leaveActiveClass: f2, beforeLeave: d3, leave: p4, afterLeave: m3, leaveCancelled: _2, delayLeave: v6, duration: y5 } = s4, g3 = false !== i3 && !G, b3 = ps(p4), $4 = h3(c5(y5) ? y5.leave : y5), w3 = r3._leaveCb = N(() => { - r3.parentNode && r3.parentNode._pending && (r3.parentNode._pending[t5.key] = null), g3 && (rs(r3, u3), rs(r3, f2)), w3.cancelled ? (g3 && rs(r3, l3), _2 && _2(r3)) : (e4(), m3 && m3(r3)), r3._leaveCb = null; + r3.parentNode && r3.parentNode._pending && (r3.parentNode._pending[t5.key] = null), g3 && (rs2(r3, u3), rs2(r3, f2)), w3.cancelled ? (g3 && rs2(r3, l3), _2 && _2(r3)) : (e4(), m3 && m3(r3)), r3._leaveCb = null; }); function C3() { - w3.cancelled || (!t5.data.show && r3.parentNode && ((r3.parentNode._pending || (r3.parentNode._pending = {}))[t5.key] = t5), d3 && d3(r3), g3 && (os(r3, l3), os(r3, f2), ns(() => { - rs(r3, l3), w3.cancelled || (os(r3, u3), b3 || (ds($4) ? setTimeout(w3, $4) : ss(r3, a4, w3))); + w3.cancelled || (!t5.data.show && r3.parentNode && ((r3.parentNode._pending || (r3.parentNode._pending = {}))[t5.key] = t5), d3 && d3(r3), g3 && (os2(r3, l3), os2(r3, f2), ns(() => { + rs2(r3, l3), w3.cancelled || (os2(r3, u3), b3 || (ds($4) ? setTimeout(w3, $4) : ss2(r3, a4, w3))); })), p4 && p4(r3, w3), g3 || b3 || w3()); } v6 ? v6(C3) : C3(); @@ -4144,7 +4144,7 @@ if (o2(n4) && rr(t6, n4)) return s4; } } - function O2(t6, e4, s4, i4, c7, l4) { + function O3(t6, e4, s4, i4, c7, l4) { if (t6 === e4) return; o2(e4.elm) && o2(i4) && (e4 = i4[c7] = ft2(e4)); const f3 = e4.elm = t6.elm; @@ -4161,7 +4161,7 @@ n2(e4.text) ? o2(m3) && o2(_3) ? m3 !== _3 && function(t7, e6, r3, s5, i5) { let c8, a5, l5, f4, p6 = 0, h6 = 0, m4 = e6.length - 1, _4 = e6[0], v7 = e6[m4], y6 = r3.length - 1, g4 = r3[0], $5 = r3[y6]; const C4 = !i5; - for (; p6 <= m4 && h6 <= y6; ) n2(_4) ? _4 = e6[++p6] : n2(v7) ? v7 = e6[--m4] : rr(_4, g4) ? (O2(_4, g4, s5, r3, h6), _4 = e6[++p6], g4 = r3[++h6]) : rr(v7, $5) ? (O2(v7, $5, s5, r3, y6), v7 = e6[--m4], $5 = r3[--y6]) : rr(_4, $5) ? (O2(_4, $5, s5, r3, y6), C4 && u3.insertBefore(t7, _4.elm, u3.nextSibling(v7.elm)), _4 = e6[++p6], $5 = r3[--y6]) : rr(v7, g4) ? (O2(v7, g4, s5, r3, h6), C4 && u3.insertBefore(t7, v7.elm, _4.elm), v7 = e6[--m4], g4 = r3[++h6]) : (n2(c8) && (c8 = sr(e6, p6, m4)), a5 = o2(g4.key) ? c8[g4.key] : x5(g4, e6, p6, m4), n2(a5) ? d3(g4, s5, t7, _4.elm, false, r3, h6) : (l5 = e6[a5], rr(l5, g4) ? (O2(l5, g4, s5, r3, h6), e6[a5] = void 0, C4 && u3.insertBefore(t7, l5.elm, _4.elm)) : d3(g4, s5, t7, _4.elm, false, r3, h6)), g4 = r3[++h6]); + for (; p6 <= m4 && h6 <= y6; ) n2(_4) ? _4 = e6[++p6] : n2(v7) ? v7 = e6[--m4] : rr(_4, g4) ? (O3(_4, g4, s5, r3, h6), _4 = e6[++p6], g4 = r3[++h6]) : rr(v7, $5) ? (O3(v7, $5, s5, r3, y6), v7 = e6[--m4], $5 = r3[--y6]) : rr(_4, $5) ? (O3(_4, $5, s5, r3, y6), C4 && u3.insertBefore(t7, _4.elm, u3.nextSibling(v7.elm)), _4 = e6[++p6], $5 = r3[--y6]) : rr(v7, g4) ? (O3(v7, g4, s5, r3, h6), C4 && u3.insertBefore(t7, v7.elm, _4.elm), v7 = e6[--m4], g4 = r3[++h6]) : (n2(c8) && (c8 = sr(e6, p6, m4)), a5 = o2(g4.key) ? c8[g4.key] : x5(g4, e6, p6, m4), n2(a5) ? d3(g4, s5, t7, _4.elm, false, r3, h6) : (l5 = e6[a5], rr(l5, g4) ? (O3(l5, g4, s5, r3, h6), e6[a5] = void 0, C4 && u3.insertBefore(t7, l5.elm, _4.elm)) : d3(g4, s5, t7, _4.elm, false, r3, h6)), g4 = r3[++h6]); p6 > m4 ? (f4 = n2(r3[y6 + 1]) ? null : r3[y6 + 1].elm, b3(t7, f4, r3, h6, y6, s5)) : h6 > y6 && w3(e6, p6, m4); }(f3, m3, _3, s4, l4) : o2(_3) ? (o2(t6.text) && u3.setTextContent(f3, ""), b3(f3, null, _3, 0, _3.length - 1, s4)) : o2(m3) ? w3(m3, 0, m3.length - 1) : o2(t6.text) && u3.setTextContent(f3, "") : t6.text !== e4.text && u3.setTextContent(f3, e4.text), o2(h5) && o2(p5 = h5.hook) && o2(p5 = p5.postpatch) && p5(t6, e4); } @@ -4208,7 +4208,7 @@ if (n2(t6)) c7 = true, d3(e4, l4); else { const n3 = o2(t6.nodeType); - if (!n3 && rr(t6, e4)) O2(t6, e4, l4, null, null, i4); + if (!n3 && rr(t6, e4)) O3(t6, e4, l4, null, null, i4); else { if (n3) { if (1 === t6.nodeType && t6.hasAttribute(L) && (t6.removeAttribute(L), s4 = true), r2(s4) && j3(t6, e4, l4)) return k4(e4, l4, true), t6; @@ -4384,8 +4384,8 @@ t5.length && this.hasMove(t5[0].elm, e4) && (t5.forEach(Ms), t5.forEach(Ls), t5.forEach(Rs), this._reflow = document.body.offsetHeight, t5.forEach((t6) => { if (t6.data.moved) { const n3 = t6.elm, o3 = n3.style; - os(n3, e4), o3.transform = o3.WebkitTransform = o3.transitionDuration = "", n3.addEventListener(Qr, n3._moveCb = function t7(o4) { - o4 && o4.target !== n3 || o4 && !/transform$/.test(o4.propertyName) || (n3.removeEventListener(Qr, t7), n3._moveCb = null, rs(n3, e4)); + os2(n3, e4), o3.transform = o3.WebkitTransform = o3.transitionDuration = "", n3.addEventListener(Qr, n3._moveCb = function t7(o4) { + o4 && o4.target !== n3 || o4 && !/transform$/.test(o4.propertyName) || (n3.removeEventListener(Qr, t7), n3._moveCb = null, rs2(n3, e4)); }); } })); @@ -4422,12 +4422,12 @@ if (t5 = t5.toLowerCase(), null != Jo[t5]) return Jo[t5]; const e4 = document.createElement(t5); return t5.indexOf("-") > -1 ? Jo[t5] = e4.constructor === window.HTMLUnknownElement || e4.constructor === window.HTMLElement : Jo[t5] = /HTMLUnknownElement/.test(e4.toString()); - }, j2(xo.options.directives, ks), j2(xo.options.components, Fs), xo.prototype.__patch__ = W ? ms3 : T3, xo.prototype.$mount = function(t5, e4) { + }, j2(xo.options.directives, ks), j2(xo.options.components, Fs), xo.prototype.__patch__ = W ? ms3 : T2, xo.prototype.$mount = function(t5, e4) { return function(t6, e6, n3) { let o3; t6.$el = e6, t6.$options.render || (t6.$options.render = lt2), Pn2(t6, "beforeMount"), o3 = () => { t6._update(t6._render(), n3); - }, new wn2(t6, o3, T3, { before() { + }, new wn2(t6, o3, T2, { before() { t6._isMounted && !t6._isDestroyed && Pn2(t6, "beforeUpdate"); } }, true), n3 = false; const r3 = t6._preWatchers; @@ -7386,21 +7386,21 @@ util.inherits = require_inherits_browser(); util.inherits(Transform2, Duplex); function afterTransform(er2, data4) { - var ts = this._transformState; - ts.transforming = false; - var cb = ts.writecb; + var ts2 = this._transformState; + ts2.transforming = false; + var cb = ts2.writecb; if (!cb) { return this.emit("error", new Error("write callback called multiple times")); } - ts.writechunk = null; - ts.writecb = null; + ts2.writechunk = null; + ts2.writecb = null; if (data4 != null) this.push(data4); cb(er2); - var rs = this._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); + var rs2 = this._readableState; + rs2.reading = false; + if (rs2.needReadable || rs2.length < rs2.highWaterMark) { + this._read(rs2.highWaterMark); } } function Transform2(options4) { @@ -7440,22 +7440,22 @@ throw new Error("_transform() is not implemented"); }; Transform2.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + var ts2 = this._transformState; + ts2.writecb = cb; + ts2.writechunk = chunk; + ts2.writeencoding = encoding; + if (!ts2.transforming) { + var rs2 = this._readableState; + if (ts2.needTransform || rs2.needReadable || rs2.length < rs2.highWaterMark) this._read(rs2.highWaterMark); } }; Transform2.prototype._read = function(n2) { - var ts = this._transformState; - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + var ts2 = this._transformState; + if (ts2.writechunk !== null && ts2.writecb && !ts2.transforming) { + ts2.transforming = true; + this._transform(ts2.writechunk, ts2.writeencoding, ts2.afterTransform); } else { - ts.needTransform = true; + ts2.needTransform = true; } }; Transform2.prototype._destroy = function(err2, cb) { @@ -9814,21 +9814,21 @@ var Duplex = require_stream_duplex2(); require_inherits_browser()(Transform2, Duplex); function afterTransform(er2, data4) { - var ts = this._transformState; - ts.transforming = false; - var cb = ts.writecb; + var ts2 = this._transformState; + ts2.transforming = false; + var cb = ts2.writecb; if (cb === null) { return this.emit("error", new ERR_MULTIPLE_CALLBACK()); } - ts.writechunk = null; - ts.writecb = null; + ts2.writechunk = null; + ts2.writecb = null; if (data4 != null) this.push(data4); cb(er2); - var rs = this._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); + var rs2 = this._readableState; + rs2.reading = false; + if (rs2.needReadable || rs2.length < rs2.highWaterMark) { + this._read(rs2.highWaterMark); } } function Transform2(options4) { @@ -9868,22 +9868,22 @@ cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()")); }; Transform2.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + var ts2 = this._transformState; + ts2.writecb = cb; + ts2.writechunk = chunk; + ts2.writeencoding = encoding; + if (!ts2.transforming) { + var rs2 = this._readableState; + if (ts2.needTransform || rs2.needReadable || rs2.length < rs2.highWaterMark) this._read(rs2.highWaterMark); } }; Transform2.prototype._read = function(n2) { - var ts = this._transformState; - if (ts.writechunk !== null && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + var ts2 = this._transformState; + if (ts2.writechunk !== null && !ts2.transforming) { + ts2.transforming = true; + this._transform(ts2.writechunk, ts2.writeencoding, ts2.afterTransform); } else { - ts.needTransform = true; + ts2.needTransform = true; } }; Transform2.prototype._destroy = function(err2, cb) { @@ -12416,21 +12416,21 @@ var Duplex = require_stream_duplex3(); require_inherits_browser()(Transform2, Duplex); function afterTransform(er2, data4) { - var ts = this._transformState; - ts.transforming = false; - var cb = ts.writecb; + var ts2 = this._transformState; + ts2.transforming = false; + var cb = ts2.writecb; if (cb === null) { return this.emit("error", new ERR_MULTIPLE_CALLBACK()); } - ts.writechunk = null; - ts.writecb = null; + ts2.writechunk = null; + ts2.writecb = null; if (data4 != null) this.push(data4); cb(er2); - var rs = this._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); + var rs2 = this._readableState; + rs2.reading = false; + if (rs2.needReadable || rs2.length < rs2.highWaterMark) { + this._read(rs2.highWaterMark); } } function Transform2(options4) { @@ -12470,22 +12470,22 @@ cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()")); }; Transform2.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + var ts2 = this._transformState; + ts2.writecb = cb; + ts2.writechunk = chunk; + ts2.writeencoding = encoding; + if (!ts2.transforming) { + var rs2 = this._readableState; + if (ts2.needTransform || rs2.needReadable || rs2.length < rs2.highWaterMark) this._read(rs2.highWaterMark); } }; Transform2.prototype._read = function(n2) { - var ts = this._transformState; - if (ts.writechunk !== null && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + var ts2 = this._transformState; + if (ts2.writechunk !== null && !ts2.transforming) { + ts2.transforming = true; + this._transform(ts2.writechunk, ts2.writeencoding, ts2.afterTransform); } else { - ts.needTransform = true; + ts2.needTransform = true; } }; Transform2.prototype._destroy = function(err2, cb) { @@ -13490,7 +13490,7 @@ for (; i2 < 64; ++i2) W2[i2] = gamma1(W2[i2 - 2]) + W2[i2 - 7] + gamma0(W2[i2 - 15]) + W2[i2 - 16] | 0; for (var j2 = 0; j2 < 64; ++j2) { var T1 = h3 + sigma1(e3) + ch(e3, f, g2) + K3[j2] + W2[j2] | 0; - var T22 = sigma0(a3) + maj(a3, b2, c5) | 0; + var T2 = sigma0(a3) + maj(a3, b2, c5) | 0; h3 = g2; g2 = f; f = e3; @@ -13498,7 +13498,7 @@ d2 = c5; c5 = b2; b2 = a3; - a3 = T1 + T22 | 0; + a3 = T1 + T2 | 0; } this._a = a3 + this._a | 0; this._b = b2 + this._b | 0; @@ -14471,13 +14471,13 @@ var l2 = Math.ceil(keylen / hLen); for (var i2 = 1; i2 <= l2; i2++) { block1.writeUInt32BE(i2, salt.length); - var T3 = createHmac(digest, password).update(block1).digest(); - var U = T3; + var T2 = createHmac(digest, password).update(block1).digest(); + var U = T2; for (var j2 = 1; j2 < iterations; j2++) { U = createHmac(digest, password).update(U).digest(); - for (var k3 = 0; k3 < hLen; k3++) T3[k3] ^= U[k3]; + for (var k3 = 0; k3 < hLen; k3++) T2[k3] ^= U[k3]; } - T3.copy(DK, destPos); + T2.copy(DK, destPos); destPos += hLen; } return DK; @@ -23199,14 +23199,11 @@ // node_modules/browserify-rsa/index.js var require_browserify_rsa = __commonJS({ "node_modules/browserify-rsa/index.js"(exports2, module2) { + "use strict"; init_polyfillShim(); var BN = require_bn2(); var randomBytes = require_browser2(); - function blind(priv) { - var r2 = getr(priv); - var blinder = r2.toRed(BN.mont(priv.modulus)).redPow(new BN(priv.publicExponent)).fromRed(); - return { blinder, unblinder: r2.invm(priv.modulus) }; - } + var Buffer4 = require_safe_buffer().Buffer; function getr(priv) { var len = priv.modulus.byteLength(); var r2; @@ -23215,6 +23212,11 @@ } while (r2.cmp(priv.modulus) >= 0 || !r2.umod(priv.prime1) || !r2.umod(priv.prime2)); return r2; } + function blind(priv) { + var r2 = getr(priv); + var blinder = r2.toRed(BN.mont(priv.modulus)).redPow(new BN(priv.publicExponent)).fromRed(); + return { blinder, unblinder: r2.invm(priv.modulus) }; + } function crt(msg, priv) { var blinds = blind(priv); var len = priv.modulus.byteLength(); @@ -23227,7 +23229,7 @@ var m1 = c1.redPow(priv.exponent1).fromRed(); var m2 = c22.redPow(priv.exponent2).fromRed(); var h3 = m1.isub(m2).imul(qinv).umod(p3).imul(q); - return m2.iadd(h3).imul(blinds.unblinder).umod(priv.modulus).toArrayLike(import_buffer.Buffer, "be", len); + return m2.iadd(h3).imul(blinds.unblinder).umod(priv.modulus).toArrayLike(Buffer4, "be", len); } crt.getr = getr; module2.exports = crt; @@ -25500,7 +25502,7 @@ assert4(this.k.length === W.length); for (i2 = 0; i2 < W.length; i2++) { var T1 = sum32_5(h3, s1_256(e3), ch32(e3, f, g2), this.k[i2], W[i2]); - var T22 = sum32(s0_256(a3), maj32(a3, b2, c5)); + var T2 = sum32(s0_256(a3), maj32(a3, b2, c5)); h3 = g2; g2 = f; f = e3; @@ -25508,7 +25510,7 @@ d2 = c5; c5 = b2; b2 = a3; - a3 = sum32(T1, T22); + a3 = sum32(T1, T2); } this.h[0] = sum32(this.h[0], a3); this.h[1] = sum32(this.h[1], b2); @@ -26100,7 +26102,7 @@ var Dh = D4; var Eh = E3; for (var j2 = 0; j2 < 80; j2++) { - var T3 = sum32( + var T2 = sum32( rotl32( sum32_4(A2, f(j2, B3, C2, D4), msg[r2[j2] + start3], K3(j2)), s3[j2] @@ -26111,8 +26113,8 @@ E3 = D4; D4 = rotl32(C2, 10); C2 = B3; - B3 = T3; - T3 = sum32( + B3 = T2; + T2 = sum32( rotl32( sum32_4(Ah, f(79 - j2, Bh, Ch, Dh), msg[rh[j2] + start3], Kh(j2)), sh[j2] @@ -26123,14 +26125,14 @@ Eh = Dh; Dh = rotl32(Ch, 10); Ch = Bh; - Bh = T3; + Bh = T2; } - T3 = sum32_3(this.h[1], C2, Dh); + T2 = sum32_3(this.h[1], C2, Dh); this.h[1] = sum32_3(this.h[2], D4, Eh); this.h[2] = sum32_3(this.h[3], E3, Ah); this.h[3] = sum32_3(this.h[4], A2, Bh); this.h[4] = sum32_3(this.h[0], B3, Ch); - this.h[0] = T3; + this.h[0] = T2; }; RIPEMD160.prototype._digest = function digest(enc) { if (enc === "hex") @@ -36325,7 +36327,7 @@ var st2 = (r2) => $e2(U({}, "__esModule", { value: true }), r2); var m2 = (r2, e3, t4) => (et2(r2, typeof e3 != "symbol" ? e3 + "" : e3, t4), t4); var jt2 = {}; - tt2(jt2, { AppMap: () => x4, AppMapFilter: () => y4, CallTree: () => L, ClassMap: () => w2, CodeObject: () => S3, CodeObjectType: () => c5, Event: () => b2, EventInfo: () => G, EventNavigator: () => O, EventSource: () => C2, abstractSqlAstJSON: () => V2, addHiddenProperty: () => p3, analyzeSQL: () => T3, base64UrlDecode: () => fe2, base64UrlEncode: () => St2, buildAppMap: () => D4, buildLabels: () => de2, capitalizeString: () => Pe2, codeObjectId: () => N, deserializeFilter: () => Xe2, filterStringToFilterState: () => Ce2, fullyQualifiedFunctionName: () => Ot2, getHttpLabel: () => Ie2, getLabel: () => ee2, getRepositoryUrl: () => vt2, getRootEvents: () => ue2, getSqlLabel: () => Fe2, getSqlLabelFromString: () => Z2, hasProp: () => q, hashify: () => Ue2, identityHashEvent: () => qt2, isCommand: () => Et2, isFalsey: () => gt2, isLocalPath: () => pe2, mergeFilterState: () => Ge2, normalizeSQL: () => j2, parseSQL: () => I2, resolveDifferences: () => te2, serializeFilter: () => Je2, setSQLErrorHandler: () => Te2, sizeof: () => F2, tokenizeIdentifier: () => _t2, transformToJSON: () => z2 }); + tt2(jt2, { AppMap: () => x4, AppMapFilter: () => y4, CallTree: () => L, ClassMap: () => w2, CodeObject: () => S3, CodeObjectType: () => c5, Event: () => b2, EventInfo: () => G, EventNavigator: () => O2, EventSource: () => C2, abstractSqlAstJSON: () => V2, addHiddenProperty: () => p3, analyzeSQL: () => T2, base64UrlDecode: () => fe2, base64UrlEncode: () => St2, buildAppMap: () => D4, buildLabels: () => de2, capitalizeString: () => Pe2, codeObjectId: () => N, deserializeFilter: () => Xe2, filterStringToFilterState: () => Ce2, fullyQualifiedFunctionName: () => Ot2, getHttpLabel: () => Ie2, getLabel: () => ee2, getRepositoryUrl: () => vt2, getRootEvents: () => ue2, getSqlLabel: () => Fe2, getSqlLabelFromString: () => Z2, hasProp: () => q, hashify: () => Ue2, identityHashEvent: () => qt2, isCommand: () => Et2, isFalsey: () => gt2, isLocalPath: () => pe2, mergeFilterState: () => Ge2, normalizeSQL: () => j2, parseSQL: () => I2, resolveDifferences: () => te2, serializeFilter: () => Je2, setSQLErrorHandler: () => Te2, sizeof: () => F2, tokenizeIdentifier: () => _t2, transformToJSON: () => z2 }); module2.exports = st2(jt2); var c5 = { ANALYSIS_FINDING: "analysis-finding", DATABASE: "database", QUERY: "query", HTTP: "http", EXTERNAL_ROUTE: "external-route", EXTERNAL_SERVICE: "external-service", ROUTE: "route", PACKAGE: "package", CLASS: "class", FUNCTION: "function" }; function rt2(r2) { @@ -36424,7 +36426,7 @@ return oe2(new k3(t4.message, e3)), null; } } - function T3(r2) { + function T2(r2) { let e3 = I2(r2); if (!e3) return null; let t4 = [], s3 = [], n2 = [], i2 = 0; @@ -36608,7 +36610,7 @@ if (r2.httpServerRequest) return "http"; let { sqlQuery: e3 } = r2; if (e3) { - let t4 = T3(e3), s3 = ["sql", t4.action, ...t4.tables].filter(Boolean).join(""); + let t4 = T2(e3), s3 = ["sql", t4.action, ...t4.tables].filter(Boolean).join(""); return (0, Ne2.default)(s3).toString(); } return r2.toString(); @@ -37469,7 +37471,7 @@ if (this.httpClientRequest) return { event_type: "http_client_request", route: this.route }; let { sqlQuery: e3 } = this; if (e3) { - let t4 = T3(e3); + let t4 = T2(e3); return t4 ? { event_type: "sql", actions: [...new Set(t4.actions)].sort(), tables: [...new Set(t4.tables)].sort() } : { event_type: "sql", sql_normalized: j2(e3, this.sql.database_type) }; } return { event_type: "function", id: this.codeObject.id }; @@ -37505,6 +37507,7 @@ if (t4) { t4.link(e3), this.stack.pop(); let s3 = this.stack[this.stack.length - 1]; + if (t4 === s3) throw new Error(`failed trying to compute event stack, call.id: ${t4.id}`); s3 && (s3.children.push(t4), t4.parent = s3); } else return; } @@ -37637,7 +37640,7 @@ function D4(r2 = null) { return new Ee2(r2); } - var O = class { + var O2 = class { constructor(e3) { this.event = e3; } @@ -37653,7 +37656,7 @@ } *ancestors() { let e3 = this.callEvent.parent; - for (; e3; ) yield new O(e3), e3 = e3.parent; + for (; e3; ) yield new O2(e3), e3 = e3.parent; } *preceding() { for (let e3 of [this, ...this.ancestors()]) { @@ -37675,19 +37678,19 @@ let { parent: e3 } = this.callEvent; if (!e3) return; let t4 = e3.children.indexOf(this.callEvent); - for (let s3 = t4 - 1; s3 >= 0; s3 -= 1) yield new O(e3.children[s3]); + for (let s3 = t4 - 1; s3 >= 0; s3 -= 1) yield new O2(e3.children[s3]); } *followingSiblings() { let { parent: e3 } = this.callEvent; if (!e3) return; let t4 = e3.children.indexOf(this.callEvent); - for (let s3 = t4 + 1; s3 < e3.children.length; s3 += 1) yield new O(e3.children[s3]); + for (let s3 = t4 + 1; s3 < e3.children.length; s3 += 1) yield new O2(e3.children[s3]); } *descendants(e3 = () => true) { let t4 = [...this.event.children]; for (; t4.length; ) { let s3 = t4.shift(); - e3(s3) && (yield new O(s3), s3.children && t4.unshift(...s3.children)); + e3(s3) && (yield new O2(s3), s3.children && t4.unshift(...s3.children)); } } hasLabel(e3) { @@ -41621,7 +41624,7 @@ } return mode; } - var version6 = "11.9.0"; + var version6 = "11.10.0"; var HTMLInjectionError = class extends Error { constructor(reason, html2) { super(reason); @@ -43929,8 +43932,8 @@ var hasShammedSymbols = typeof Symbol === "function" && typeof Symbol.iterator === "object"; var toStringTag = typeof Symbol === "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? "object" : "symbol") ? Symbol.toStringTag : null; var isEnumerable = Object.prototype.propertyIsEnumerable; - var gPO = (typeof Reflect === "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(O) { - return O.__proto__; + var gPO = (typeof Reflect === "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(O2) { + return O2.__proto__; } : null); function addNumericSeparator(num, str2) { if (num === Infinity || num === -Infinity || num !== num || num && num > -1e3 && num < 1e3 || $test.call(/e/, str2)) { @@ -44112,7 +44115,7 @@ if (typeof window !== "undefined" && obj === window) { return "{ [object Window] }"; } - if (obj === globalThis) { + if (typeof globalThis !== "undefined" && obj === globalThis || typeof globalThis !== "undefined" && obj === globalThis) { return "{ [object globalThis] }"; } if (!isDate(obj) && !isRegExp(obj)) { @@ -44524,9 +44527,9 @@ } }); - // node_modules/node-libs-browser/node_modules/qs/lib/formats.js + // node_modules/qs/lib/formats.js var require_formats = __commonJS({ - "node_modules/node-libs-browser/node_modules/qs/lib/formats.js"(exports2, module2) { + "node_modules/qs/lib/formats.js"(exports2, module2) { "use strict"; init_polyfillShim(); var replace2 = String.prototype.replace; @@ -44551,9 +44554,9 @@ } }); - // node_modules/node-libs-browser/node_modules/qs/lib/utils.js + // node_modules/qs/lib/utils.js var require_utils6 = __commonJS({ - "node_modules/node-libs-browser/node_modules/qs/lib/utils.js"(exports2, module2) { + "node_modules/qs/lib/utils.js"(exports2, module2) { "use strict"; init_polyfillShim(); var formats = require_formats(); @@ -44757,9 +44760,9 @@ } }); - // node_modules/node-libs-browser/node_modules/qs/lib/stringify.js + // node_modules/qs/lib/stringify.js var require_stringify = __commonJS({ - "node_modules/node-libs-browser/node_modules/qs/lib/stringify.js"(exports2, module2) { + "node_modules/qs/lib/stringify.js"(exports2, module2) { "use strict"; init_polyfillShim(); var getSideChannel = require_side_channel(); @@ -45038,9 +45041,9 @@ } }); - // node_modules/node-libs-browser/node_modules/qs/lib/parse.js + // node_modules/qs/lib/parse.js var require_parse = __commonJS({ - "node_modules/node-libs-browser/node_modules/qs/lib/parse.js"(exports2, module2) { + "node_modules/qs/lib/parse.js"(exports2, module2) { "use strict"; init_polyfillShim(); var utils3 = require_utils6(); @@ -45266,9 +45269,9 @@ } }); - // node_modules/node-libs-browser/node_modules/qs/lib/index.js + // node_modules/qs/lib/index.js var require_lib = __commonJS({ - "node_modules/node-libs-browser/node_modules/qs/lib/index.js"(exports2, module2) { + "node_modules/qs/lib/index.js"(exports2, module2) { "use strict"; init_polyfillShim(); var stringify4 = require_stringify(); @@ -45282,9 +45285,9 @@ } }); - // node_modules/node-libs-browser/node_modules/url/url.js + // node_modules/url/url.js var require_url = __commonJS({ - "node_modules/node-libs-browser/node_modules/url/url.js"(exports2) { + "node_modules/url/url.js"(exports2) { "use strict"; init_polyfillShim(); var punycode = require_punycode(); @@ -53075,14 +53078,14 @@ ${events.lines.join("\n")} Dispatch.prototype = dispatch2.prototype = { constructor: Dispatch, on: function(typename, callback) { - var _ = this._, T3 = parseTypenames2(typename + "", _), t4, i2 = -1, n2 = T3.length; + var _ = this._, T2 = parseTypenames2(typename + "", _), t4, i2 = -1, n2 = T2.length; if (arguments.length < 2) { - while (++i2 < n2) if ((t4 = (typename = T3[i2]).type) && (t4 = get2(_[t4], typename.name))) return t4; + while (++i2 < n2) if ((t4 = (typename = T2[i2]).type) && (t4 = get2(_[t4], typename.name))) return t4; return; } if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); while (++i2 < n2) { - if (t4 = (typename = T3[i2]).type) _[t4] = set2(_[t4], typename.name, callback); + if (t4 = (typename = T2[i2]).type) _[t4] = set2(_[t4], typename.name, callback); else if (callback == null) for (t4 in _) _[t4] = set2(_[t4], typename.name, null); } return this; @@ -68148,39 +68151,20 @@ ${events.lines.join("\n")} } }); - // node_modules/tty-browserify/index.js - var require_tty_browserify = __commonJS({ - "node_modules/tty-browserify/index.js"(exports2) { - init_polyfillShim(); - exports2.isatty = function() { - return false; - }; - function ReadStream() { - throw new Error("tty.ReadStream is not implemented"); - } - exports2.ReadStream = ReadStream; - function WriteStream() { - throw new Error("tty.ReadStream is not implemented"); - } - exports2.WriteStream = WriteStream; - } - }); - // node_modules/picocolors/picocolors.js var require_picocolors = __commonJS({ "node_modules/picocolors/picocolors.js"(exports2, module2) { init_polyfillShim(); - var argv = import_process.default.argv || []; - var env = import_process.default.env; - var isColorSupported = !("NO_COLOR" in env || argv.includes("--no-color")) && ("FORCE_COLOR" in env || argv.includes("--color") || import_process.default.platform === "win32" || __require != null && require_tty_browserify().isatty(1) && env.TERM !== "dumb" || "CI" in env); + var p3 = import_process.default || {}; + var argv = p3.argv || []; + var env = p3.env || {}; + var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p3.platform === "win32" || (p3.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI); var formatter = (open2, close2, replace2 = open2) => (input2) => { - let string5 = "" + input2; - let index3 = string5.indexOf(close2, open2.length); + let string5 = "" + input2, index3 = string5.indexOf(close2, open2.length); return ~index3 ? open2 + replaceClose(string5, close2, replace2, index3) + close2 : open2 + string5 + close2; }; var replaceClose = (string5, close2, replace2, index3) => { - let result = ""; - let cursor = 0; + let result = "", cursor = 0; do { result += string5.substring(cursor, index3) + replace2; cursor = index3 + close2.length; @@ -68189,34 +68173,50 @@ ${events.lines.join("\n")} return result + string5.substring(cursor); }; var createColors = (enabled = isColorSupported) => { - let init3 = enabled ? formatter : () => String; + let f = enabled ? formatter : () => String; return { isColorSupported: enabled, - reset: init3("\x1B[0m", "\x1B[0m"), - bold: init3("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"), - dim: init3("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"), - italic: init3("\x1B[3m", "\x1B[23m"), - underline: init3("\x1B[4m", "\x1B[24m"), - inverse: init3("\x1B[7m", "\x1B[27m"), - hidden: init3("\x1B[8m", "\x1B[28m"), - strikethrough: init3("\x1B[9m", "\x1B[29m"), - black: init3("\x1B[30m", "\x1B[39m"), - red: init3("\x1B[31m", "\x1B[39m"), - green: init3("\x1B[32m", "\x1B[39m"), - yellow: init3("\x1B[33m", "\x1B[39m"), - blue: init3("\x1B[34m", "\x1B[39m"), - magenta: init3("\x1B[35m", "\x1B[39m"), - cyan: init3("\x1B[36m", "\x1B[39m"), - white: init3("\x1B[37m", "\x1B[39m"), - gray: init3("\x1B[90m", "\x1B[39m"), - bgBlack: init3("\x1B[40m", "\x1B[49m"), - bgRed: init3("\x1B[41m", "\x1B[49m"), - bgGreen: init3("\x1B[42m", "\x1B[49m"), - bgYellow: init3("\x1B[43m", "\x1B[49m"), - bgBlue: init3("\x1B[44m", "\x1B[49m"), - bgMagenta: init3("\x1B[45m", "\x1B[49m"), - bgCyan: init3("\x1B[46m", "\x1B[49m"), - bgWhite: init3("\x1B[47m", "\x1B[49m") + reset: f("\x1B[0m", "\x1B[0m"), + bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"), + dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"), + italic: f("\x1B[3m", "\x1B[23m"), + underline: f("\x1B[4m", "\x1B[24m"), + inverse: f("\x1B[7m", "\x1B[27m"), + hidden: f("\x1B[8m", "\x1B[28m"), + strikethrough: f("\x1B[9m", "\x1B[29m"), + black: f("\x1B[30m", "\x1B[39m"), + red: f("\x1B[31m", "\x1B[39m"), + green: f("\x1B[32m", "\x1B[39m"), + yellow: f("\x1B[33m", "\x1B[39m"), + blue: f("\x1B[34m", "\x1B[39m"), + magenta: f("\x1B[35m", "\x1B[39m"), + cyan: f("\x1B[36m", "\x1B[39m"), + white: f("\x1B[37m", "\x1B[39m"), + gray: f("\x1B[90m", "\x1B[39m"), + bgBlack: f("\x1B[40m", "\x1B[49m"), + bgRed: f("\x1B[41m", "\x1B[49m"), + bgGreen: f("\x1B[42m", "\x1B[49m"), + bgYellow: f("\x1B[43m", "\x1B[49m"), + bgBlue: f("\x1B[44m", "\x1B[49m"), + bgMagenta: f("\x1B[45m", "\x1B[49m"), + bgCyan: f("\x1B[46m", "\x1B[49m"), + bgWhite: f("\x1B[47m", "\x1B[49m"), + blackBright: f("\x1B[90m", "\x1B[39m"), + redBright: f("\x1B[91m", "\x1B[39m"), + greenBright: f("\x1B[92m", "\x1B[39m"), + yellowBright: f("\x1B[93m", "\x1B[39m"), + blueBright: f("\x1B[94m", "\x1B[39m"), + magentaBright: f("\x1B[95m", "\x1B[39m"), + cyanBright: f("\x1B[96m", "\x1B[39m"), + whiteBright: f("\x1B[97m", "\x1B[39m"), + bgBlackBright: f("\x1B[100m", "\x1B[49m"), + bgRedBright: f("\x1B[101m", "\x1B[49m"), + bgGreenBright: f("\x1B[102m", "\x1B[49m"), + bgYellowBright: f("\x1B[103m", "\x1B[49m"), + bgBlueBright: f("\x1B[104m", "\x1B[49m"), + bgMagentaBright: f("\x1B[105m", "\x1B[49m"), + bgCyanBright: f("\x1B[106m", "\x1B[49m"), + bgWhiteBright: f("\x1B[107m", "\x1B[49m") }; }; module2.exports = createColors(); @@ -68255,8 +68255,8 @@ ${events.lines.join("\n")} module2.exports = function tokenizer(input2, options4 = {}) { let css = input2.css.valueOf(); let ignore = options4.ignoreErrors; - let code, next3, quote, content3, escape4; - let escaped, escapePos, prev2, n2, currentToken; + let code, content3, escape4, next3, quote; + let currentToken, escaped, escapePos, n2, prev2; let length2 = css.length; let pos = 0; let buffer = []; @@ -68552,29 +68552,40 @@ ${events.lines.join("\n")} if (!this.source) return ""; let css = this.source; if (color2 == null) color2 = pico.isColorSupported; - if (terminalHighlight) { - if (color2) css = terminalHighlight(css); - } - let lines = css.split(/\r?\n/); - let start3 = Math.max(this.line - 3, 0); - let end2 = Math.min(this.line + 2, lines.length); - let maxWidth = String(end2).length; - let mark, aside; + let aside = (text4) => text4; + let mark = (text4) => text4; + let highlight = (text4) => text4; if (color2) { let { bold, gray: gray2, red } = pico.createColors(true); mark = (text4) => bold(red(text4)); aside = (text4) => gray2(text4); - } else { - mark = aside = (str2) => str2; + if (terminalHighlight) { + highlight = (text4) => terminalHighlight(text4); + } } + let lines = css.split(/\r?\n/); + let start3 = Math.max(this.line - 3, 0); + let end2 = Math.min(this.line + 2, lines.length); + let maxWidth = String(end2).length; return lines.slice(start3, end2).map((line2, index3) => { let number7 = start3 + 1 + index3; let gutter = " " + (" " + number7).slice(-maxWidth) + " | "; if (number7 === this.line) { + if (line2.length > 160) { + let padding3 = 20; + let subLineStart = Math.max(0, this.column - padding3); + let subLineEnd = Math.max( + this.column + padding3, + this.endColumn + padding3 + ); + let subLine = line2.slice(subLineStart, subLineEnd); + let spacing3 = aside(gutter.replace(/\d/g, " ")) + line2.slice(0, Math.min(this.column - 1, padding3 - 1)).replace(/[^\t]/g, " "); + return mark(">") + aside(gutter) + highlight(subLine) + "\n " + spacing3 + mark("^"); + } let spacing2 = aside(gutter.replace(/\d/g, " ")) + line2.slice(0, this.column - 1).replace(/[^\t]/g, " "); - return mark(">") + aside(gutter) + line2 + "\n " + spacing2 + mark("^"); + return mark(">") + aside(gutter) + highlight(line2) + "\n " + spacing2 + mark("^"); } - return " " + aside(gutter) + line2; + return " " + aside(gutter) + highlight(line2); }).join("\n"); } toString() { @@ -68590,16 +68601,6 @@ ${events.lines.join("\n")} } }); - // node_modules/postcss/lib/symbols.js - var require_symbols = __commonJS({ - "node_modules/postcss/lib/symbols.js"(exports2, module2) { - "use strict"; - init_polyfillShim(); - module2.exports.isClean = Symbol("isClean"); - module2.exports.my = Symbol("my"); - } - }); - // node_modules/postcss/lib/stringifier.js var require_stringifier = __commonJS({ "node_modules/postcss/lib/stringifier.js"(exports2, module2) { @@ -68920,15 +68921,25 @@ ${events.lines.join("\n")} } }); + // node_modules/postcss/lib/symbols.js + var require_symbols = __commonJS({ + "node_modules/postcss/lib/symbols.js"(exports2, module2) { + "use strict"; + init_polyfillShim(); + module2.exports.isClean = Symbol("isClean"); + module2.exports.my = Symbol("my"); + } + }); + // node_modules/postcss/lib/node.js var require_node2 = __commonJS({ "node_modules/postcss/lib/node.js"(exports2, module2) { "use strict"; init_polyfillShim(); - var { isClean, my } = require_symbols(); var CssSyntaxError2 = require_css_syntax_error(); var Stringifier = require_stringifier(); var stringify4 = require_stringify2(); + var { isClean, my } = require_symbols(); function cloneNode(obj, parent4) { let cloned = new obj.constructor(); for (let i2 in obj) { @@ -69052,6 +69063,10 @@ ${events.lines.join("\n")} } }; } + /* c8 ignore next 3 */ + markClean() { + this[isClean] = true; + } markDirty() { if (this[isClean]) { this[isClean] = false; @@ -69113,7 +69128,10 @@ ${events.lines.join("\n")} let index3 = stringRepresentation.indexOf(opts.word); if (index3 !== -1) { start3 = this.positionInside(index3, stringRepresentation); - end2 = this.positionInside(index3 + opts.word.length, stringRepresentation); + end2 = this.positionInside( + index3 + opts.word.length, + stringRepresentation + ); } } else { if (opts.start) { @@ -69248,6 +69266,23 @@ ${events.lines.join("\n")} } }); + // node_modules/postcss/lib/comment.js + var require_comment = __commonJS({ + "node_modules/postcss/lib/comment.js"(exports2, module2) { + "use strict"; + init_polyfillShim(); + var Node3 = require_node2(); + var Comment2 = class extends Node3 { + constructor(defaults5) { + super(defaults5); + this.type = "comment"; + } + }; + module2.exports = Comment2; + Comment2.default = Comment2; + } + }); + // node_modules/postcss/lib/declaration.js var require_declaration = __commonJS({ "node_modules/postcss/lib/declaration.js"(exports2, module2) { @@ -69271,6 +69306,681 @@ ${events.lines.join("\n")} } }); + // node_modules/postcss/lib/container.js + var require_container = __commonJS({ + "node_modules/postcss/lib/container.js"(exports2, module2) { + "use strict"; + init_polyfillShim(); + var Comment2 = require_comment(); + var Declaration2 = require_declaration(); + var Node3 = require_node2(); + var { isClean, my } = require_symbols(); + var AtRule2; + var parse10; + var Root2; + var Rule2; + function cleanSource(nodes5) { + return nodes5.map((i2) => { + if (i2.nodes) i2.nodes = cleanSource(i2.nodes); + delete i2.source; + return i2; + }); + } + function markTreeDirty(node3) { + node3[isClean] = false; + if (node3.proxyOf.nodes) { + for (let i2 of node3.proxyOf.nodes) { + markTreeDirty(i2); + } + } + } + var Container2 = class _Container extends Node3 { + append(...children2) { + for (let child of children2) { + let nodes5 = this.normalize(child, this.last); + for (let node3 of nodes5) this.proxyOf.nodes.push(node3); + } + this.markDirty(); + return this; + } + cleanRaws(keepBetween) { + super.cleanRaws(keepBetween); + if (this.nodes) { + for (let node3 of this.nodes) node3.cleanRaws(keepBetween); + } + } + each(callback) { + if (!this.proxyOf.nodes) return void 0; + let iterator = this.getIterator(); + let index3, result; + while (this.indexes[iterator] < this.proxyOf.nodes.length) { + index3 = this.indexes[iterator]; + result = callback(this.proxyOf.nodes[index3], index3); + if (result === false) break; + this.indexes[iterator] += 1; + } + delete this.indexes[iterator]; + return result; + } + every(condition) { + return this.nodes.every(condition); + } + getIterator() { + if (!this.lastEach) this.lastEach = 0; + if (!this.indexes) this.indexes = {}; + this.lastEach += 1; + let iterator = this.lastEach; + this.indexes[iterator] = 0; + return iterator; + } + getProxyProcessor() { + return { + get(node3, prop) { + if (prop === "proxyOf") { + return node3; + } else if (!node3[prop]) { + return node3[prop]; + } else if (prop === "each" || typeof prop === "string" && prop.startsWith("walk")) { + return (...args) => { + return node3[prop]( + ...args.map((i2) => { + if (typeof i2 === "function") { + return (child, index3) => i2(child.toProxy(), index3); + } else { + return i2; + } + }) + ); + }; + } else if (prop === "every" || prop === "some") { + return (cb) => { + return node3[prop]( + (child, ...other) => cb(child.toProxy(), ...other) + ); + }; + } else if (prop === "root") { + return () => node3.root().toProxy(); + } else if (prop === "nodes") { + return node3.nodes.map((i2) => i2.toProxy()); + } else if (prop === "first" || prop === "last") { + return node3[prop].toProxy(); + } else { + return node3[prop]; + } + }, + set(node3, prop, value) { + if (node3[prop] === value) return true; + node3[prop] = value; + if (prop === "name" || prop === "params" || prop === "selector") { + node3.markDirty(); + } + return true; + } + }; + } + index(child) { + if (typeof child === "number") return child; + if (child.proxyOf) child = child.proxyOf; + return this.proxyOf.nodes.indexOf(child); + } + insertAfter(exist, add3) { + let existIndex = this.index(exist); + let nodes5 = this.normalize(add3, this.proxyOf.nodes[existIndex]).reverse(); + existIndex = this.index(exist); + for (let node3 of nodes5) this.proxyOf.nodes.splice(existIndex + 1, 0, node3); + let index3; + for (let id4 in this.indexes) { + index3 = this.indexes[id4]; + if (existIndex < index3) { + this.indexes[id4] = index3 + nodes5.length; + } + } + this.markDirty(); + return this; + } + insertBefore(exist, add3) { + let existIndex = this.index(exist); + let type3 = existIndex === 0 ? "prepend" : false; + let nodes5 = this.normalize( + add3, + this.proxyOf.nodes[existIndex], + type3 + ).reverse(); + existIndex = this.index(exist); + for (let node3 of nodes5) this.proxyOf.nodes.splice(existIndex, 0, node3); + let index3; + for (let id4 in this.indexes) { + index3 = this.indexes[id4]; + if (existIndex <= index3) { + this.indexes[id4] = index3 + nodes5.length; + } + } + this.markDirty(); + return this; + } + normalize(nodes5, sample) { + if (typeof nodes5 === "string") { + nodes5 = cleanSource(parse10(nodes5).nodes); + } else if (typeof nodes5 === "undefined") { + nodes5 = []; + } else if (Array.isArray(nodes5)) { + nodes5 = nodes5.slice(0); + for (let i2 of nodes5) { + if (i2.parent) i2.parent.removeChild(i2, "ignore"); + } + } else if (nodes5.type === "root" && this.type !== "document") { + nodes5 = nodes5.nodes.slice(0); + for (let i2 of nodes5) { + if (i2.parent) i2.parent.removeChild(i2, "ignore"); + } + } else if (nodes5.type) { + nodes5 = [nodes5]; + } else if (nodes5.prop) { + if (typeof nodes5.value === "undefined") { + throw new Error("Value field is missed in node creation"); + } else if (typeof nodes5.value !== "string") { + nodes5.value = String(nodes5.value); + } + nodes5 = [new Declaration2(nodes5)]; + } else if (nodes5.selector || nodes5.selectors) { + nodes5 = [new Rule2(nodes5)]; + } else if (nodes5.name) { + nodes5 = [new AtRule2(nodes5)]; + } else if (nodes5.text) { + nodes5 = [new Comment2(nodes5)]; + } else { + throw new Error("Unknown node type in node creation"); + } + let processed2 = nodes5.map((i2) => { + if (!i2[my]) _Container.rebuild(i2); + i2 = i2.proxyOf; + if (i2.parent) i2.parent.removeChild(i2); + if (i2[isClean]) markTreeDirty(i2); + if (!i2.raws) i2.raws = {}; + if (typeof i2.raws.before === "undefined") { + if (sample && typeof sample.raws.before !== "undefined") { + i2.raws.before = sample.raws.before.replace(/\S/g, ""); + } + } + i2.parent = this.proxyOf; + return i2; + }); + return processed2; + } + prepend(...children2) { + children2 = children2.reverse(); + for (let child of children2) { + let nodes5 = this.normalize(child, this.first, "prepend").reverse(); + for (let node3 of nodes5) this.proxyOf.nodes.unshift(node3); + for (let id4 in this.indexes) { + this.indexes[id4] = this.indexes[id4] + nodes5.length; + } + } + this.markDirty(); + return this; + } + push(child) { + child.parent = this; + this.proxyOf.nodes.push(child); + return this; + } + removeAll() { + for (let node3 of this.proxyOf.nodes) node3.parent = void 0; + this.proxyOf.nodes = []; + this.markDirty(); + return this; + } + removeChild(child) { + child = this.index(child); + this.proxyOf.nodes[child].parent = void 0; + this.proxyOf.nodes.splice(child, 1); + let index3; + for (let id4 in this.indexes) { + index3 = this.indexes[id4]; + if (index3 >= child) { + this.indexes[id4] = index3 - 1; + } + } + this.markDirty(); + return this; + } + replaceValues(pattern, opts, callback) { + if (!callback) { + callback = opts; + opts = {}; + } + this.walkDecls((decl2) => { + if (opts.props && !opts.props.includes(decl2.prop)) return; + if (opts.fast && !decl2.value.includes(opts.fast)) return; + decl2.value = decl2.value.replace(pattern, callback); + }); + this.markDirty(); + return this; + } + some(condition) { + return this.nodes.some(condition); + } + walk(callback) { + return this.each((child, i2) => { + let result; + try { + result = callback(child, i2); + } catch (e3) { + throw child.addToError(e3); + } + if (result !== false && child.walk) { + result = child.walk(callback); + } + return result; + }); + } + walkAtRules(name, callback) { + if (!callback) { + callback = name; + return this.walk((child, i2) => { + if (child.type === "atrule") { + return callback(child, i2); + } + }); + } + if (name instanceof RegExp) { + return this.walk((child, i2) => { + if (child.type === "atrule" && name.test(child.name)) { + return callback(child, i2); + } + }); + } + return this.walk((child, i2) => { + if (child.type === "atrule" && child.name === name) { + return callback(child, i2); + } + }); + } + walkComments(callback) { + return this.walk((child, i2) => { + if (child.type === "comment") { + return callback(child, i2); + } + }); + } + walkDecls(prop, callback) { + if (!callback) { + callback = prop; + return this.walk((child, i2) => { + if (child.type === "decl") { + return callback(child, i2); + } + }); + } + if (prop instanceof RegExp) { + return this.walk((child, i2) => { + if (child.type === "decl" && prop.test(child.prop)) { + return callback(child, i2); + } + }); + } + return this.walk((child, i2) => { + if (child.type === "decl" && child.prop === prop) { + return callback(child, i2); + } + }); + } + walkRules(selector, callback) { + if (!callback) { + callback = selector; + return this.walk((child, i2) => { + if (child.type === "rule") { + return callback(child, i2); + } + }); + } + if (selector instanceof RegExp) { + return this.walk((child, i2) => { + if (child.type === "rule" && selector.test(child.selector)) { + return callback(child, i2); + } + }); + } + return this.walk((child, i2) => { + if (child.type === "rule" && child.selector === selector) { + return callback(child, i2); + } + }); + } + get first() { + if (!this.proxyOf.nodes) return void 0; + return this.proxyOf.nodes[0]; + } + get last() { + if (!this.proxyOf.nodes) return void 0; + return this.proxyOf.nodes[this.proxyOf.nodes.length - 1]; + } + }; + Container2.registerParse = (dependant) => { + parse10 = dependant; + }; + Container2.registerRule = (dependant) => { + Rule2 = dependant; + }; + Container2.registerAtRule = (dependant) => { + AtRule2 = dependant; + }; + Container2.registerRoot = (dependant) => { + Root2 = dependant; + }; + module2.exports = Container2; + Container2.default = Container2; + Container2.rebuild = (node3) => { + if (node3.type === "atrule") { + Object.setPrototypeOf(node3, AtRule2.prototype); + } else if (node3.type === "rule") { + Object.setPrototypeOf(node3, Rule2.prototype); + } else if (node3.type === "decl") { + Object.setPrototypeOf(node3, Declaration2.prototype); + } else if (node3.type === "comment") { + Object.setPrototypeOf(node3, Comment2.prototype); + } else if (node3.type === "root") { + Object.setPrototypeOf(node3, Root2.prototype); + } + node3[my] = true; + if (node3.nodes) { + node3.nodes.forEach((child) => { + Container2.rebuild(child); + }); + } + }; + } + }); + + // node_modules/postcss/lib/at-rule.js + var require_at_rule = __commonJS({ + "node_modules/postcss/lib/at-rule.js"(exports2, module2) { + "use strict"; + init_polyfillShim(); + var Container2 = require_container(); + var AtRule2 = class extends Container2 { + constructor(defaults5) { + super(defaults5); + this.type = "atrule"; + } + append(...children2) { + if (!this.proxyOf.nodes) this.nodes = []; + return super.append(...children2); + } + prepend(...children2) { + if (!this.proxyOf.nodes) this.nodes = []; + return super.prepend(...children2); + } + }; + module2.exports = AtRule2; + AtRule2.default = AtRule2; + Container2.registerAtRule(AtRule2); + } + }); + + // node_modules/postcss/lib/document.js + var require_document = __commonJS({ + "node_modules/postcss/lib/document.js"(exports2, module2) { + "use strict"; + init_polyfillShim(); + var Container2 = require_container(); + var LazyResult; + var Processor2; + var Document2 = class extends Container2 { + constructor(defaults5) { + super({ type: "document", ...defaults5 }); + if (!this.nodes) { + this.nodes = []; + } + } + toResult(opts = {}) { + let lazy = new LazyResult(new Processor2(), this, opts); + return lazy.stringify(); + } + }; + Document2.registerLazyResult = (dependant) => { + LazyResult = dependant; + }; + Document2.registerProcessor = (dependant) => { + Processor2 = dependant; + }; + module2.exports = Document2; + Document2.default = Document2; + } + }); + + // node_modules/nanoid/non-secure/index.cjs + var require_non_secure = __commonJS({ + "node_modules/nanoid/non-secure/index.cjs"(exports2, module2) { + init_polyfillShim(); + var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"; + var customAlphabet = (alphabet, defaultSize = 21) => { + return (size5 = defaultSize) => { + let id4 = ""; + let i2 = size5; + while (i2--) { + id4 += alphabet[Math.random() * alphabet.length | 0]; + } + return id4; + }; + }; + var nanoid = (size5 = 21) => { + let id4 = ""; + let i2 = size5; + while (i2--) { + id4 += urlAlphabet[Math.random() * 64 | 0]; + } + return id4; + }; + module2.exports = { nanoid, customAlphabet }; + } + }); + + // node_modules/path-browserify/index.js + var require_path_browserify = __commonJS({ + "node_modules/path-browserify/index.js"(exports2) { + init_polyfillShim(); + function normalizeArray(parts, allowAboveRoot) { + var up = 0; + for (var i2 = parts.length - 1; i2 >= 0; i2--) { + var last3 = parts[i2]; + if (last3 === ".") { + parts.splice(i2, 1); + } else if (last3 === "..") { + parts.splice(i2, 1); + up++; + } else if (up) { + parts.splice(i2, 1); + up--; + } + } + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift(".."); + } + } + return parts; + } + exports2.resolve = function() { + var resolvedPath = "", resolvedAbsolute = false; + for (var i2 = arguments.length - 1; i2 >= -1 && !resolvedAbsolute; i2--) { + var path3 = i2 >= 0 ? arguments[i2] : import_process.default.cwd(); + if (typeof path3 !== "string") { + throw new TypeError("Arguments to path.resolve must be strings"); + } else if (!path3) { + continue; + } + resolvedPath = path3 + "/" + resolvedPath; + resolvedAbsolute = path3.charAt(0) === "/"; + } + resolvedPath = normalizeArray(filter6(resolvedPath.split("/"), function(p3) { + return !!p3; + }), !resolvedAbsolute).join("/"); + return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; + }; + exports2.normalize = function(path3) { + var isAbsolute = exports2.isAbsolute(path3), trailingSlash = substr2(path3, -1) === "/"; + path3 = normalizeArray(filter6(path3.split("/"), function(p3) { + return !!p3; + }), !isAbsolute).join("/"); + if (!path3 && !isAbsolute) { + path3 = "."; + } + if (path3 && trailingSlash) { + path3 += "/"; + } + return (isAbsolute ? "/" : "") + path3; + }; + exports2.isAbsolute = function(path3) { + return path3.charAt(0) === "/"; + }; + exports2.join = function() { + var paths = Array.prototype.slice.call(arguments, 0); + return exports2.normalize(filter6(paths, function(p3, index3) { + if (typeof p3 !== "string") { + throw new TypeError("Arguments to path.join must be strings"); + } + return p3; + }).join("/")); + }; + exports2.relative = function(from2, to) { + from2 = exports2.resolve(from2).substr(1); + to = exports2.resolve(to).substr(1); + function trim2(arr) { + var start3 = 0; + for (; start3 < arr.length; start3++) { + if (arr[start3] !== "") break; + } + var end2 = arr.length - 1; + for (; end2 >= 0; end2--) { + if (arr[end2] !== "") break; + } + if (start3 > end2) return []; + return arr.slice(start3, end2 - start3 + 1); + } + var fromParts = trim2(from2.split("/")); + var toParts = trim2(to.split("/")); + var length2 = Math.min(fromParts.length, toParts.length); + var samePartsLength = length2; + for (var i2 = 0; i2 < length2; i2++) { + if (fromParts[i2] !== toParts[i2]) { + samePartsLength = i2; + break; + } + } + var outputParts = []; + for (var i2 = samePartsLength; i2 < fromParts.length; i2++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); + }; + exports2.sep = "/"; + exports2.delimiter = ":"; + exports2.dirname = function(path3) { + if (typeof path3 !== "string") path3 = path3 + ""; + if (path3.length === 0) return "."; + var code = path3.charCodeAt(0); + var hasRoot = code === 47; + var end2 = -1; + var matchedSlash = true; + for (var i2 = path3.length - 1; i2 >= 1; --i2) { + code = path3.charCodeAt(i2); + if (code === 47) { + if (!matchedSlash) { + end2 = i2; + break; + } + } else { + matchedSlash = false; + } + } + if (end2 === -1) return hasRoot ? "/" : "."; + if (hasRoot && end2 === 1) { + return "/"; + } + return path3.slice(0, end2); + }; + function basename(path3) { + if (typeof path3 !== "string") path3 = path3 + ""; + var start3 = 0; + var end2 = -1; + var matchedSlash = true; + var i2; + for (i2 = path3.length - 1; i2 >= 0; --i2) { + if (path3.charCodeAt(i2) === 47) { + if (!matchedSlash) { + start3 = i2 + 1; + break; + } + } else if (end2 === -1) { + matchedSlash = false; + end2 = i2 + 1; + } + } + if (end2 === -1) return ""; + return path3.slice(start3, end2); + } + exports2.basename = function(path3, ext) { + var f = basename(path3); + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; + }; + exports2.extname = function(path3) { + if (typeof path3 !== "string") path3 = path3 + ""; + var startDot = -1; + var startPart = 0; + var end2 = -1; + var matchedSlash = true; + var preDotState = 0; + for (var i2 = path3.length - 1; i2 >= 0; --i2) { + var code = path3.charCodeAt(i2); + if (code === 47) { + if (!matchedSlash) { + startPart = i2 + 1; + break; + } + continue; + } + if (end2 === -1) { + matchedSlash = false; + end2 = i2 + 1; + } + if (code === 46) { + if (startDot === -1) + startDot = i2; + else if (preDotState !== 1) + preDotState = 1; + } else if (startDot !== -1) { + preDotState = -1; + } + } + if (startDot === -1 || end2 === -1 || // We saw a non-dot character immediately before the dot + preDotState === 0 || // The (right-most) trimmed path component is exactly '..' + preDotState === 1 && startDot === end2 - 1 && startDot === startPart + 1) { + return ""; + } + return path3.slice(startDot, end2); + }; + function filter6(xs, f) { + if (xs.filter) return xs.filter(f); + var res = []; + for (var i2 = 0; i2 < xs.length; i2++) { + if (f(xs[i2], i2, xs)) res.push(xs[i2]); + } + return res; + } + var substr2 = "ab".substr(-1) === "b" ? function(str2, start3, len) { + return str2.substr(start3, len); + } : function(str2, start3, len) { + if (start3 < 0) start3 = str2.length + start3; + return str2.substr(start3, len); + }; + } + }); + // node_modules/source-map-js/lib/base64.js var require_base64 = __commonJS({ "node_modules/source-map-js/lib/base64.js"(exports2) { @@ -70336,7 +71046,9 @@ ${events.lines.join("\n")} for (var i2 = 0, n2 = mappings.length; i2 < n2; i2++) { var mapping = mappings[i2]; var source = mapping.source === null ? null : sources.at(mapping.source); - source = util.computeSourceURL(sourceRoot, source, sourceMapURL); + if (source !== null) { + source = util.computeSourceURL(sourceRoot, source, sourceMapURL); + } boundCallback({ source, generatedLine: mapping.generatedLine, @@ -70875,7 +71587,9 @@ ${events.lines.join("\n")} for (var j2 = 0; j2 < sectionMappings.length; j2++) { var mapping = sectionMappings[j2]; var source = section.consumer._sources.at(mapping.source); - source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); + if (source !== null) { + source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); + } this._sources.add(source); source = this._sources.indexOf(source); var name = null; @@ -71181,238 +71895,6 @@ ${events.lines.join("\n")} } }); - // node_modules/path-browserify/index.js - var require_path_browserify = __commonJS({ - "node_modules/path-browserify/index.js"(exports2) { - init_polyfillShim(); - function normalizeArray(parts, allowAboveRoot) { - var up = 0; - for (var i2 = parts.length - 1; i2 >= 0; i2--) { - var last3 = parts[i2]; - if (last3 === ".") { - parts.splice(i2, 1); - } else if (last3 === "..") { - parts.splice(i2, 1); - up++; - } else if (up) { - parts.splice(i2, 1); - up--; - } - } - if (allowAboveRoot) { - for (; up--; up) { - parts.unshift(".."); - } - } - return parts; - } - exports2.resolve = function() { - var resolvedPath = "", resolvedAbsolute = false; - for (var i2 = arguments.length - 1; i2 >= -1 && !resolvedAbsolute; i2--) { - var path3 = i2 >= 0 ? arguments[i2] : import_process.default.cwd(); - if (typeof path3 !== "string") { - throw new TypeError("Arguments to path.resolve must be strings"); - } else if (!path3) { - continue; - } - resolvedPath = path3 + "/" + resolvedPath; - resolvedAbsolute = path3.charAt(0) === "/"; - } - resolvedPath = normalizeArray(filter6(resolvedPath.split("/"), function(p3) { - return !!p3; - }), !resolvedAbsolute).join("/"); - return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; - }; - exports2.normalize = function(path3) { - var isAbsolute = exports2.isAbsolute(path3), trailingSlash = substr2(path3, -1) === "/"; - path3 = normalizeArray(filter6(path3.split("/"), function(p3) { - return !!p3; - }), !isAbsolute).join("/"); - if (!path3 && !isAbsolute) { - path3 = "."; - } - if (path3 && trailingSlash) { - path3 += "/"; - } - return (isAbsolute ? "/" : "") + path3; - }; - exports2.isAbsolute = function(path3) { - return path3.charAt(0) === "/"; - }; - exports2.join = function() { - var paths = Array.prototype.slice.call(arguments, 0); - return exports2.normalize(filter6(paths, function(p3, index3) { - if (typeof p3 !== "string") { - throw new TypeError("Arguments to path.join must be strings"); - } - return p3; - }).join("/")); - }; - exports2.relative = function(from2, to) { - from2 = exports2.resolve(from2).substr(1); - to = exports2.resolve(to).substr(1); - function trim2(arr) { - var start3 = 0; - for (; start3 < arr.length; start3++) { - if (arr[start3] !== "") break; - } - var end2 = arr.length - 1; - for (; end2 >= 0; end2--) { - if (arr[end2] !== "") break; - } - if (start3 > end2) return []; - return arr.slice(start3, end2 - start3 + 1); - } - var fromParts = trim2(from2.split("/")); - var toParts = trim2(to.split("/")); - var length2 = Math.min(fromParts.length, toParts.length); - var samePartsLength = length2; - for (var i2 = 0; i2 < length2; i2++) { - if (fromParts[i2] !== toParts[i2]) { - samePartsLength = i2; - break; - } - } - var outputParts = []; - for (var i2 = samePartsLength; i2 < fromParts.length; i2++) { - outputParts.push(".."); - } - outputParts = outputParts.concat(toParts.slice(samePartsLength)); - return outputParts.join("/"); - }; - exports2.sep = "/"; - exports2.delimiter = ":"; - exports2.dirname = function(path3) { - if (typeof path3 !== "string") path3 = path3 + ""; - if (path3.length === 0) return "."; - var code = path3.charCodeAt(0); - var hasRoot = code === 47; - var end2 = -1; - var matchedSlash = true; - for (var i2 = path3.length - 1; i2 >= 1; --i2) { - code = path3.charCodeAt(i2); - if (code === 47) { - if (!matchedSlash) { - end2 = i2; - break; - } - } else { - matchedSlash = false; - } - } - if (end2 === -1) return hasRoot ? "/" : "."; - if (hasRoot && end2 === 1) { - return "/"; - } - return path3.slice(0, end2); - }; - function basename(path3) { - if (typeof path3 !== "string") path3 = path3 + ""; - var start3 = 0; - var end2 = -1; - var matchedSlash = true; - var i2; - for (i2 = path3.length - 1; i2 >= 0; --i2) { - if (path3.charCodeAt(i2) === 47) { - if (!matchedSlash) { - start3 = i2 + 1; - break; - } - } else if (end2 === -1) { - matchedSlash = false; - end2 = i2 + 1; - } - } - if (end2 === -1) return ""; - return path3.slice(start3, end2); - } - exports2.basename = function(path3, ext) { - var f = basename(path3); - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); - } - return f; - }; - exports2.extname = function(path3) { - if (typeof path3 !== "string") path3 = path3 + ""; - var startDot = -1; - var startPart = 0; - var end2 = -1; - var matchedSlash = true; - var preDotState = 0; - for (var i2 = path3.length - 1; i2 >= 0; --i2) { - var code = path3.charCodeAt(i2); - if (code === 47) { - if (!matchedSlash) { - startPart = i2 + 1; - break; - } - continue; - } - if (end2 === -1) { - matchedSlash = false; - end2 = i2 + 1; - } - if (code === 46) { - if (startDot === -1) - startDot = i2; - else if (preDotState !== 1) - preDotState = 1; - } else if (startDot !== -1) { - preDotState = -1; - } - } - if (startDot === -1 || end2 === -1 || // We saw a non-dot character immediately before the dot - preDotState === 0 || // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end2 - 1 && startDot === startPart + 1) { - return ""; - } - return path3.slice(startDot, end2); - }; - function filter6(xs, f) { - if (xs.filter) return xs.filter(f); - var res = []; - for (var i2 = 0; i2 < xs.length; i2++) { - if (f(xs[i2], i2, xs)) res.push(xs[i2]); - } - return res; - } - var substr2 = "ab".substr(-1) === "b" ? function(str2, start3, len) { - return str2.substr(start3, len); - } : function(str2, start3, len) { - if (start3 < 0) start3 = str2.length + start3; - return str2.substr(start3, len); - }; - } - }); - - // node_modules/nanoid/non-secure/index.cjs - var require_non_secure = __commonJS({ - "node_modules/nanoid/non-secure/index.cjs"(exports2, module2) { - init_polyfillShim(); - var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"; - var customAlphabet = (alphabet, defaultSize = 21) => { - return (size5 = defaultSize) => { - let id4 = ""; - let i2 = size5; - while (i2--) { - id4 += alphabet[Math.random() * alphabet.length | 0]; - } - return id4; - }; - }; - var nanoid = (size5 = 21) => { - let id4 = ""; - let i2 = size5; - while (i2--) { - id4 += urlAlphabet[Math.random() * 64 | 0]; - } - return id4; - }; - module2.exports = { nanoid, customAlphabet }; - } - }); - // node_modules/idb-wrapper/idbstore.js var require_idbstore = __commonJS({ "node_modules/idb-wrapper/idbstore.js"(exports2, module2) { @@ -73400,8 +73882,8 @@ ${events.lines.join("\n")} obj[key] = options4.value; return obj; }, makeOptions = function(value, options4) { - var oo = typeof options4 == "object", os = !oo && typeof options4 == "string", op2 = function(p3) { - return oo ? !!options4[p3] : os ? options4.indexOf(p3[0]) > -1 : false; + var oo = typeof options4 == "object", os2 = !oo && typeof options4 == "string", op2 = function(p3) { + return oo ? !!options4[p3] : os2 ? options4.indexOf(p3[0]) > -1 : false; }; return { enumerable: op2("enumerable"), @@ -73486,8 +73968,8 @@ ${events.lines.join("\n")} obj[key] = options4.value; return obj; }, makeOptions = function(value, options4) { - var oo = typeof options4 == "object", os = !oo && typeof options4 == "string", op2 = function(p3) { - return oo ? !!options4[p3] : os ? options4.indexOf(p3[0]) > -1 : false; + var oo = typeof options4 == "object", os2 = !oo && typeof options4 == "string", op2 = function(p3) { + return oo ? !!options4[p3] : os2 ? options4.indexOf(p3[0]) > -1 : false; }; return { enumerable: op2("enumerable"), @@ -74817,28 +75299,28 @@ ${events.lines.join("\n")} this.writechunk = null; } function afterTransform(stream, er2, data4) { - var ts = stream._transformState; - ts.transforming = false; - var cb = ts.writecb; + var ts2 = stream._transformState; + ts2.transforming = false; + var cb = ts2.writecb; if (!cb) return stream.emit("error", new Error("no writecb in Transform class")); - ts.writechunk = null; - ts.writecb = null; + ts2.writechunk = null; + ts2.writecb = null; if (data4 !== null && data4 !== void 0) stream.push(data4); if (cb) cb(er2); - var rs = stream._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); + var rs2 = stream._readableState; + rs2.reading = false; + if (rs2.needReadable || rs2.length < rs2.highWaterMark) { + stream._read(rs2.highWaterMark); } } function Transform2(options4) { if (!(this instanceof Transform2)) return new Transform2(options4); Duplex.call(this, options4); - var ts = this._transformState = new TransformState(options4, this); + var ts2 = this._transformState = new TransformState(options4, this); var stream = this; this._readableState.needReadable = true; this._readableState.sync = false; @@ -74859,34 +75341,34 @@ ${events.lines.join("\n")} throw new Error("not implemented"); }; Transform2.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) - this._read(rs.highWaterMark); + var ts2 = this._transformState; + ts2.writecb = cb; + ts2.writechunk = chunk; + ts2.writeencoding = encoding; + if (!ts2.transforming) { + var rs2 = this._readableState; + if (ts2.needTransform || rs2.needReadable || rs2.length < rs2.highWaterMark) + this._read(rs2.highWaterMark); } }; Transform2.prototype._read = function(n2) { - var ts = this._transformState; - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + var ts2 = this._transformState; + if (ts2.writechunk !== null && ts2.writecb && !ts2.transforming) { + ts2.transforming = true; + this._transform(ts2.writechunk, ts2.writeencoding, ts2.afterTransform); } else { - ts.needTransform = true; + ts2.needTransform = true; } }; function done(stream, er2) { if (er2) return stream.emit("error", er2); var ws = stream._writableState; - var rs = stream._readableState; - var ts = stream._transformState; + var rs2 = stream._readableState; + var ts2 = stream._transformState; if (ws.length) throw new Error("calling transform done when ws.length != 0"); - if (ts.transforming) + if (ts2.transforming) throw new Error("calling transform done when still transforming"); return stream.push(null); } @@ -76893,28 +77375,28 @@ ${events.lines.join("\n")} this.writechunk = null; } function afterTransform(stream, er2, data4) { - var ts = stream._transformState; - ts.transforming = false; - var cb = ts.writecb; + var ts2 = stream._transformState; + ts2.transforming = false; + var cb = ts2.writecb; if (!cb) return stream.emit("error", new Error("no writecb in Transform class")); - ts.writechunk = null; - ts.writecb = null; + ts2.writechunk = null; + ts2.writecb = null; if (data4 !== null && data4 !== void 0) stream.push(data4); if (cb) cb(er2); - var rs = stream._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); + var rs2 = stream._readableState; + rs2.reading = false; + if (rs2.needReadable || rs2.length < rs2.highWaterMark) { + stream._read(rs2.highWaterMark); } } function Transform2(options4) { if (!(this instanceof Transform2)) return new Transform2(options4); Duplex.call(this, options4); - var ts = this._transformState = new TransformState(options4, this); + var ts2 = this._transformState = new TransformState(options4, this); var stream = this; this._readableState.needReadable = true; this._readableState.sync = false; @@ -76935,34 +77417,34 @@ ${events.lines.join("\n")} throw new Error("not implemented"); }; Transform2.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) - this._read(rs.highWaterMark); + var ts2 = this._transformState; + ts2.writecb = cb; + ts2.writechunk = chunk; + ts2.writeencoding = encoding; + if (!ts2.transforming) { + var rs2 = this._readableState; + if (ts2.needTransform || rs2.needReadable || rs2.length < rs2.highWaterMark) + this._read(rs2.highWaterMark); } }; Transform2.prototype._read = function(n2) { - var ts = this._transformState; - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + var ts2 = this._transformState; + if (ts2.writechunk !== null && ts2.writecb && !ts2.transforming) { + ts2.transforming = true; + this._transform(ts2.writechunk, ts2.writeencoding, ts2.afterTransform); } else { - ts.needTransform = true; + ts2.needTransform = true; } }; function done(stream, er2) { if (er2) return stream.emit("error", er2); var ws = stream._writableState; - var rs = stream._readableState; - var ts = stream._transformState; + var rs2 = stream._readableState; + var ts2 = stream._transformState; if (ws.length) throw new Error("calling transform done when ws.length != 0"); - if (ts.transforming) + if (ts2.transforming) throw new Error("calling transform done when still transforming"); return stream.push(null); } @@ -78630,28 +79112,28 @@ ${events.lines.join("\n")} this.writechunk = null; } function afterTransform(stream, er2, data4) { - var ts = stream._transformState; - ts.transforming = false; - var cb = ts.writecb; + var ts2 = stream._transformState; + ts2.transforming = false; + var cb = ts2.writecb; if (!cb) return stream.emit("error", new Error("no writecb in Transform class")); - ts.writechunk = null; - ts.writecb = null; + ts2.writechunk = null; + ts2.writecb = null; if (data4 !== null && data4 !== void 0) stream.push(data4); if (cb) cb(er2); - var rs = stream._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); + var rs2 = stream._readableState; + rs2.reading = false; + if (rs2.needReadable || rs2.length < rs2.highWaterMark) { + stream._read(rs2.highWaterMark); } } function Transform2(options4) { if (!(this instanceof Transform2)) return new Transform2(options4); Duplex.call(this, options4); - var ts = this._transformState = new TransformState(options4, this); + var ts2 = this._transformState = new TransformState(options4, this); var stream = this; this._readableState.needReadable = true; this._readableState.sync = false; @@ -78672,34 +79154,34 @@ ${events.lines.join("\n")} throw new Error("not implemented"); }; Transform2.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) - this._read(rs.highWaterMark); + var ts2 = this._transformState; + ts2.writecb = cb; + ts2.writechunk = chunk; + ts2.writeencoding = encoding; + if (!ts2.transforming) { + var rs2 = this._readableState; + if (ts2.needTransform || rs2.needReadable || rs2.length < rs2.highWaterMark) + this._read(rs2.highWaterMark); } }; Transform2.prototype._read = function(n2) { - var ts = this._transformState; - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + var ts2 = this._transformState; + if (ts2.writechunk !== null && ts2.writecb && !ts2.transforming) { + ts2.transforming = true; + this._transform(ts2.writechunk, ts2.writeencoding, ts2.afterTransform); } else { - ts.needTransform = true; + ts2.needTransform = true; } }; function done(stream, er2) { if (er2) return stream.emit("error", er2); var ws = stream._writableState; - var rs = stream._readableState; - var ts = stream._transformState; + var rs2 = stream._readableState; + var ts2 = stream._transformState; if (ws.length) throw new Error("calling transform done when ws.length != 0"); - if (ts.transforming) + if (ts2.transforming) throw new Error("calling transform done when still transforming"); return stream.push(null); } @@ -78768,22 +79250,22 @@ ${events.lines.join("\n")} cb(null, fn4); }; }; - var onreadable = function(rs, init3) { + var onreadable = function(rs2, init3) { var reading = false; var destroyed2 = false; - rs._read = function() { + rs2._read = function() { reading = true; }; - rs.destroy = function() { + rs2.destroy = function() { destroyed2 = true; }; init3(function(err2, source) { - if (err2) return rs.emit("error", err2); + if (err2) return rs2.emit("error", err2); var fwd = function() { var data4; while ((data4 = source.read()) !== null) { reading = false; - rs.push(data4); + rs2.push(data4); } }; source.on("readable", function() { @@ -78791,34 +79273,34 @@ ${events.lines.join("\n")} }); source.on("end", function() { fwd(); - rs.push(null); + rs2.push(null); }); source.on("error", function(err3) { - rs.emit("error", err3); + rs2.emit("error", err3); }); source.on("close", function() { fwd(); import_process.default.nextTick(function() { - rs.emit("close"); + rs2.emit("close"); }); }); - rs._read = function() { + rs2._read = function() { reading = true; fwd(); }; - rs.destroy = function() { + rs2.destroy = function() { if (destroyed2) return; destroyed2 = true; if (source.destroy) source.destroy(); }; if (destroyed2) { destroyed2 = false; - rs.destroy(); + rs2.destroy(); return; } if (reading) fwd(); }); - return rs; + return rs2; }; var onwritable = function(ws, init3) { var ready4 = noop6; @@ -79079,14 +79561,14 @@ ${events.lines.join("\n")} "string": 1, "undefined": 1 }; - var is2 = module2.exports = {}; - is2.a = is2.type = function(value, type3) { + var is3 = module2.exports = {}; + is3.a = is3.type = function(value, type3) { return typeof value === type3; }; - is2.defined = function(value) { + is3.defined = function(value) { return value !== void 0; }; - is2.empty = function(value) { + is3.empty = function(value) { var type3 = toString7.call(value); var key; if ("[object Array]" === type3 || "[object Arguments]" === type3) { @@ -79101,7 +79583,7 @@ ${events.lines.join("\n")} } return false; }; - is2.equal = function(value, other) { + is3.equal = function(value, other) { var type3 = toString7.call(value); var key; if (type3 !== toString7.call(other)) { @@ -79109,7 +79591,7 @@ ${events.lines.join("\n")} } if ("[object Object]" === type3) { for (key in value) { - if (!is2.equal(value[key], other[key])) { + if (!is3.equal(value[key], other[key])) { return false; } } @@ -79121,7 +79603,7 @@ ${events.lines.join("\n")} return false; } while (--key) { - if (!is2.equal(value[key], other[key])) { + if (!is3.equal(value[key], other[key])) { return false; } } @@ -79135,80 +79617,80 @@ ${events.lines.join("\n")} } return value === other; }; - is2.hosted = function(value, host) { + is3.hosted = function(value, host) { var type3 = typeof host[value]; return type3 === "object" ? !!host[value] : !NON_HOST_TYPES[type3]; }; - is2.instance = is2["instanceof"] = function(value, constructor) { + is3.instance = is3["instanceof"] = function(value, constructor) { return value instanceof constructor; }; - is2["null"] = function(value) { + is3["null"] = function(value) { return value === null; }; - is2.undefined = function(value) { + is3.undefined = function(value) { return value === void 0; }; - is2.arguments = function(value) { + is3.arguments = function(value) { var isStandardArguments = "[object Arguments]" === toString7.call(value); - var isOldArguments = !is2.array(value) && is2.arraylike(value) && is2.object(value) && is2.fn(value.callee); + var isOldArguments = !is3.array(value) && is3.arraylike(value) && is3.object(value) && is3.fn(value.callee); return isStandardArguments || isOldArguments; }; - is2.array = function(value) { + is3.array = function(value) { return "[object Array]" === toString7.call(value); }; - is2.arguments.empty = function(value) { - return is2.arguments(value) && value.length === 0; + is3.arguments.empty = function(value) { + return is3.arguments(value) && value.length === 0; }; - is2.array.empty = function(value) { - return is2.array(value) && value.length === 0; + is3.array.empty = function(value) { + return is3.array(value) && value.length === 0; }; - is2.arraylike = function(value) { - return !!value && !is2.boolean(value) && owns.call(value, "length") && isFinite(value.length) && is2.number(value.length) && value.length >= 0; + is3.arraylike = function(value) { + return !!value && !is3.boolean(value) && owns.call(value, "length") && isFinite(value.length) && is3.number(value.length) && value.length >= 0; }; - is2.boolean = function(value) { + is3.boolean = function(value) { return "[object Boolean]" === toString7.call(value); }; - is2["false"] = function(value) { - return is2.boolean(value) && (value === false || value.valueOf() === false); + is3["false"] = function(value) { + return is3.boolean(value) && (value === false || value.valueOf() === false); }; - is2["true"] = function(value) { - return is2.boolean(value) && (value === true || value.valueOf() === true); + is3["true"] = function(value) { + return is3.boolean(value) && (value === true || value.valueOf() === true); }; - is2.date = function(value) { + is3.date = function(value) { return "[object Date]" === toString7.call(value); }; - is2.element = function(value) { + is3.element = function(value) { return value !== void 0 && typeof HTMLElement !== "undefined" && value instanceof HTMLElement && value.nodeType === 1; }; - is2.error = function(value) { + is3.error = function(value) { return "[object Error]" === toString7.call(value); }; - is2.fn = is2["function"] = function(value) { + is3.fn = is3["function"] = function(value) { var isAlert = typeof window !== "undefined" && value === window.alert; return isAlert || "[object Function]" === toString7.call(value); }; - is2.number = function(value) { + is3.number = function(value) { return "[object Number]" === toString7.call(value); }; - is2.infinite = function(value) { + is3.infinite = function(value) { return value === Infinity || value === -Infinity; }; - is2.decimal = function(value) { - return is2.number(value) && !isActualNaN(value) && !is2.infinite(value) && value % 1 !== 0; + is3.decimal = function(value) { + return is3.number(value) && !isActualNaN(value) && !is3.infinite(value) && value % 1 !== 0; }; - is2.divisibleBy = function(value, n2) { - var isDividendInfinite = is2.infinite(value); - var isDivisorInfinite = is2.infinite(n2); - var isNonZeroNumber = is2.number(value) && !isActualNaN(value) && is2.number(n2) && !isActualNaN(n2) && n2 !== 0; + is3.divisibleBy = function(value, n2) { + var isDividendInfinite = is3.infinite(value); + var isDivisorInfinite = is3.infinite(n2); + var isNonZeroNumber = is3.number(value) && !isActualNaN(value) && is3.number(n2) && !isActualNaN(n2) && n2 !== 0; return isDividendInfinite || isDivisorInfinite || isNonZeroNumber && value % n2 === 0; }; - is2.int = function(value) { - return is2.number(value) && !isActualNaN(value) && value % 1 === 0; + is3.int = function(value) { + return is3.number(value) && !isActualNaN(value) && value % 1 === 0; }; - is2.maximum = function(value, others) { + is3.maximum = function(value, others) { if (isActualNaN(value)) { throw new TypeError("NaN is not a valid value"); - } else if (!is2.arraylike(others)) { + } else if (!is3.arraylike(others)) { throw new TypeError("second argument must be array-like"); } var len = others.length; @@ -79219,10 +79701,10 @@ ${events.lines.join("\n")} } return true; }; - is2.minimum = function(value, others) { + is3.minimum = function(value, others) { if (isActualNaN(value)) { throw new TypeError("NaN is not a valid value"); - } else if (!is2.arraylike(others)) { + } else if (!is3.arraylike(others)) { throw new TypeError("second argument must be array-like"); } var len = others.length; @@ -79233,58 +79715,58 @@ ${events.lines.join("\n")} } return true; }; - is2.nan = function(value) { - return !is2.number(value) || value !== value; + is3.nan = function(value) { + return !is3.number(value) || value !== value; }; - is2.even = function(value) { - return is2.infinite(value) || is2.number(value) && value === value && value % 2 === 0; + is3.even = function(value) { + return is3.infinite(value) || is3.number(value) && value === value && value % 2 === 0; }; - is2.odd = function(value) { - return is2.infinite(value) || is2.number(value) && value === value && value % 2 !== 0; + is3.odd = function(value) { + return is3.infinite(value) || is3.number(value) && value === value && value % 2 !== 0; }; - is2.ge = function(value, other) { + is3.ge = function(value, other) { if (isActualNaN(value) || isActualNaN(other)) { throw new TypeError("NaN is not a valid value"); } - return !is2.infinite(value) && !is2.infinite(other) && value >= other; + return !is3.infinite(value) && !is3.infinite(other) && value >= other; }; - is2.gt = function(value, other) { + is3.gt = function(value, other) { if (isActualNaN(value) || isActualNaN(other)) { throw new TypeError("NaN is not a valid value"); } - return !is2.infinite(value) && !is2.infinite(other) && value > other; + return !is3.infinite(value) && !is3.infinite(other) && value > other; }; - is2.le = function(value, other) { + is3.le = function(value, other) { if (isActualNaN(value) || isActualNaN(other)) { throw new TypeError("NaN is not a valid value"); } - return !is2.infinite(value) && !is2.infinite(other) && value <= other; + return !is3.infinite(value) && !is3.infinite(other) && value <= other; }; - is2.lt = function(value, other) { + is3.lt = function(value, other) { if (isActualNaN(value) || isActualNaN(other)) { throw new TypeError("NaN is not a valid value"); } - return !is2.infinite(value) && !is2.infinite(other) && value < other; + return !is3.infinite(value) && !is3.infinite(other) && value < other; }; - is2.within = function(value, start3, finish) { + is3.within = function(value, start3, finish) { if (isActualNaN(value) || isActualNaN(start3) || isActualNaN(finish)) { throw new TypeError("NaN is not a valid value"); - } else if (!is2.number(value) || !is2.number(start3) || !is2.number(finish)) { + } else if (!is3.number(value) || !is3.number(start3) || !is3.number(finish)) { throw new TypeError("all arguments must be numbers"); } - var isAnyInfinite = is2.infinite(value) || is2.infinite(start3) || is2.infinite(finish); + var isAnyInfinite = is3.infinite(value) || is3.infinite(start3) || is3.infinite(finish); return isAnyInfinite || value >= start3 && value <= finish; }; - is2.object = function(value) { + is3.object = function(value) { return value && "[object Object]" === toString7.call(value); }; - is2.hash = function(value) { - return is2.object(value) && value.constructor === Object && !value.nodeType && !value.setInterval; + is3.hash = function(value) { + return is3.object(value) && value.constructor === Object && !value.nodeType && !value.setInterval; }; - is2.regexp = function(value) { + is3.regexp = function(value) { return "[object RegExp]" === toString7.call(value); }; - is2.string = function(value) { + is3.string = function(value) { return "[object String]" === toString7.call(value); }; } @@ -79322,7 +79804,7 @@ ${events.lines.join("\n")} init_polyfillShim(); (function() { "use strict"; - var has2 = Object.prototype.hasOwnProperty, is2 = require_is(), forEach4 = require_foreach2(), hasDontEnumBug = !{ "toString": null }.propertyIsEnumerable("toString"), dontEnums = [ + var has2 = Object.prototype.hasOwnProperty, is3 = require_is(), forEach4 = require_foreach2(), hasDontEnumBug = !{ "toString": null }.propertyIsEnumerable("toString"), dontEnums = [ "toString", "toLocaleString", "valueOf", @@ -79332,7 +79814,7 @@ ${events.lines.join("\n")} "constructor" ], keysShim; keysShim = function keys3(object3) { - if (!is2.object(object3) && !is2.array(object3)) { + if (!is3.object(object3) && !is3.array(object3)) { throw new TypeError("Object.keys called on a non-object"); } var name, theKeys = []; @@ -80862,21 +81344,21 @@ ${events.lines.join("\n")} this.writechunk = null; } function afterTransform(stream, er2, data4) { - var ts = stream._transformState; - ts.transforming = false; - var cb = ts.writecb; + var ts2 = stream._transformState; + ts2.transforming = false; + var cb = ts2.writecb; if (!cb) return stream.emit("error", new Error("no writecb in Transform class")); - ts.writechunk = null; - ts.writecb = null; + ts2.writechunk = null; + ts2.writecb = null; if (!util.isNullOrUndefined(data4)) stream.push(data4); if (cb) cb(er2); - var rs = stream._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); + var rs2 = stream._readableState; + rs2.reading = false; + if (rs2.needReadable || rs2.length < rs2.highWaterMark) { + stream._read(rs2.highWaterMark); } } function Transform2(options4) { @@ -80904,33 +81386,33 @@ ${events.lines.join("\n")} throw new Error("not implemented"); }; Transform2.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) - this._read(rs.highWaterMark); + var ts2 = this._transformState; + ts2.writecb = cb; + ts2.writechunk = chunk; + ts2.writeencoding = encoding; + if (!ts2.transforming) { + var rs2 = this._readableState; + if (ts2.needTransform || rs2.needReadable || rs2.length < rs2.highWaterMark) + this._read(rs2.highWaterMark); } }; Transform2.prototype._read = function(n2) { - var ts = this._transformState; - if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + var ts2 = this._transformState; + if (!util.isNull(ts2.writechunk) && ts2.writecb && !ts2.transforming) { + ts2.transforming = true; + this._transform(ts2.writechunk, ts2.writeencoding, ts2.afterTransform); } else { - ts.needTransform = true; + ts2.needTransform = true; } }; function done(stream, er2) { if (er2) return stream.emit("error", er2); var ws = stream._writableState; - var ts = stream._transformState; + var ts2 = stream._transformState; if (ws.length) throw new Error("calling transform done when ws.length != 0"); - if (ts.transforming) + if (ts2.transforming) throw new Error("calling transform done when still transforming"); return stream.push(null); } @@ -81433,13 +81915,13 @@ ${events.lines.join("\n")} blobs.read = function(name, opts2, cb) { if (typeof opts2 === "function") return blobs.read(name, null, opts2); if (!opts2) opts2 = {}; - var rs = blobs.createReadStream(name, opts2); + var rs2 = blobs.createReadStream(name, opts2); var list3 = []; - rs.on("error", cb); - rs.on("data", function(data4) { + rs2.on("error", cb); + rs2.on("data", function(data4) { list3.push(data4); }); - rs.on("end", function() { + rs2.on("end", function() { cb(null, list3.length === 1 ? list3[0] : import_buffer.Buffer.concat(list3)); }); }; @@ -82675,25 +83157,25 @@ ${events.lines.join("\n")} fs.createReadStream = function(key, opts2) { if (!opts2) opts2 = {}; var closed = false; - var rs = fwd.readable(function(cb) { + var rs2 = fwd.readable(function(cb) { ps.follow(key, function(err2, stat2, key2) { if (err2) return cb(err2); if (stat2.isDirectory()) return cb(errno.EISDIR(key2)); var blob = stat2 && stat2.blob || key2; var r2 = bl.createReadStream(blob, opts2); - rs.emit("open"); + rs2.emit("open"); r2.on("end", function() { import_process.default.nextTick(function() { - if (!closed) rs.emit("close"); + if (!closed) rs2.emit("close"); }); }); cb(null, r2); }); }); - rs.on("close", function() { + rs2.on("close", function() { closed = true; }); - return rs; + return rs2; }; fs.createWriteStream = function(key, opts2) { if (!opts2) opts2 = {}; @@ -82940,9 +83422,9 @@ ${events.lines.join("\n")} "node_modules/postcss/lib/previous-map.js"(exports2, module2) { "use strict"; init_polyfillShim(); - var { SourceMapConsumer, SourceMapGenerator } = require_source_map(); var { existsSync, readFileSync } = require_browserify_fs(); var { dirname, join: join2 } = require_path_browserify(); + var { SourceMapConsumer, SourceMapGenerator } = require_source_map(); function fromBase64(str2) { if (import_buffer.Buffer) { return import_buffer.Buffer.from(str2, "base64").toString(); @@ -82974,11 +83456,13 @@ ${events.lines.join("\n")} let baseUri = /^data:application\/json;base64,/; let charsetUri = /^data:application\/json;charset=utf-?8,/; let uri = /^data:application\/json,/; - if (charsetUri.test(text4) || uri.test(text4)) { - return decodeURIComponent(text4.substr(RegExp.lastMatch.length)); + let uriMatch = text4.match(charsetUri) || text4.match(uri); + if (uriMatch) { + return decodeURIComponent(text4.substr(uriMatch[0].length)); } - if (baseCharsetUri.test(text4) || baseUri.test(text4)) { - return fromBase64(text4.substr(RegExp.lastMatch.length)); + let baseUriMatch = text4.match(baseCharsetUri) || text4.match(baseUri); + if (baseUriMatch) { + return fromBase64(text4.substr(baseUriMatch[0].length)); } let encoding = text4.match(/data:application\/json;([^,]+),/)[1]; throw new Error("Unsupported source map encoding " + encoding); @@ -82991,7 +83475,7 @@ ${events.lines.join("\n")} return typeof map5.mappings === "string" || typeof map5._mappings === "string" || Array.isArray(map5.sections); } loadAnnotation(css) { - let comments = css.match(/\/\*\s*# sourceMappingURL=/gm); + let comments = css.match(/\/\*\s*# sourceMappingURL=/g); if (!comments) return; let start3 = css.lastIndexOf(comments.pop()); let end2 = css.indexOf("*/", start3); @@ -83059,13 +83543,13 @@ ${events.lines.join("\n")} "node_modules/postcss/lib/input.js"(exports2, module2) { "use strict"; init_polyfillShim(); + var { nanoid } = require_non_secure(); + var { isAbsolute, resolve: resolve3 } = require_path_browserify(); var { SourceMapConsumer, SourceMapGenerator } = require_source_map(); var { fileURLToPath, pathToFileURL } = require_url(); - var { isAbsolute, resolve: resolve3 } = require_path_browserify(); - var { nanoid } = require_non_secure(); - var terminalHighlight = require_terminal_highlight(); var CssSyntaxError2 = require_css_syntax_error(); var PreviousMap = require_previous_map(); + var terminalHighlight = require_terminal_highlight(); var fromOffsetCache = Symbol("fromOffsetCache"); var sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator); var pathAvailable = Boolean(resolve3 && isAbsolute); @@ -83102,7 +83586,7 @@ ${events.lines.join("\n")} if (this.map) this.map.file = this.from; } error(message, line2, column2, opts = {}) { - let result, endLine, endColumn; + let endColumn, endLine, result; if (line2 && typeof line2 === "object") { let start3 = line2; let end2 = column2; @@ -83263,13 +83747,210 @@ ${events.lines.join("\n")} } }); + // node_modules/postcss/lib/root.js + var require_root2 = __commonJS({ + "node_modules/postcss/lib/root.js"(exports2, module2) { + "use strict"; + init_polyfillShim(); + var Container2 = require_container(); + var LazyResult; + var Processor2; + var Root2 = class extends Container2 { + constructor(defaults5) { + super(defaults5); + this.type = "root"; + if (!this.nodes) this.nodes = []; + } + normalize(child, sample, type3) { + let nodes5 = super.normalize(child); + if (sample) { + if (type3 === "prepend") { + if (this.nodes.length > 1) { + sample.raws.before = this.nodes[1].raws.before; + } else { + delete sample.raws.before; + } + } else if (this.first !== sample) { + for (let node3 of nodes5) { + node3.raws.before = sample.raws.before; + } + } + } + return nodes5; + } + removeChild(child, ignore) { + let index3 = this.index(child); + if (!ignore && index3 === 0 && this.nodes.length > 1) { + this.nodes[1].raws.before = this.nodes[index3].raws.before; + } + return super.removeChild(child); + } + toResult(opts = {}) { + let lazy = new LazyResult(new Processor2(), this, opts); + return lazy.stringify(); + } + }; + Root2.registerLazyResult = (dependant) => { + LazyResult = dependant; + }; + Root2.registerProcessor = (dependant) => { + Processor2 = dependant; + }; + module2.exports = Root2; + Root2.default = Root2; + Container2.registerRoot(Root2); + } + }); + + // node_modules/postcss/lib/list.js + var require_list3 = __commonJS({ + "node_modules/postcss/lib/list.js"(exports2, module2) { + "use strict"; + init_polyfillShim(); + var list3 = { + comma(string5) { + return list3.split(string5, [","], true); + }, + space(string5) { + let spaces = [" ", "\n", " "]; + return list3.split(string5, spaces); + }, + split(string5, separators, last3) { + let array4 = []; + let current = ""; + let split = false; + let func = 0; + let inQuote = false; + let prevQuote = ""; + let escape4 = false; + for (let letter of string5) { + if (escape4) { + escape4 = false; + } else if (letter === "\\") { + escape4 = true; + } else if (inQuote) { + if (letter === prevQuote) { + inQuote = false; + } + } else if (letter === '"' || letter === "'") { + inQuote = true; + prevQuote = letter; + } else if (letter === "(") { + func += 1; + } else if (letter === ")") { + if (func > 0) func -= 1; + } else if (func === 0) { + if (separators.includes(letter)) split = true; + } + if (split) { + if (current !== "") array4.push(current.trim()); + current = ""; + split = false; + } else { + current += letter; + } + } + if (last3 || current !== "") array4.push(current.trim()); + return array4; + } + }; + module2.exports = list3; + list3.default = list3; + } + }); + + // node_modules/postcss/lib/rule.js + var require_rule = __commonJS({ + "node_modules/postcss/lib/rule.js"(exports2, module2) { + "use strict"; + init_polyfillShim(); + var Container2 = require_container(); + var list3 = require_list3(); + var Rule2 = class extends Container2 { + constructor(defaults5) { + super(defaults5); + this.type = "rule"; + if (!this.nodes) this.nodes = []; + } + get selectors() { + return list3.comma(this.selector); + } + set selectors(values2) { + let match2 = this.selector ? this.selector.match(/,\s*/) : null; + let sep2 = match2 ? match2[0] : "," + this.raw("between", "beforeOpen"); + this.selector = values2.join(sep2); + } + }; + module2.exports = Rule2; + Rule2.default = Rule2; + Container2.registerRule(Rule2); + } + }); + + // node_modules/postcss/lib/fromJSON.js + var require_fromJSON = __commonJS({ + "node_modules/postcss/lib/fromJSON.js"(exports2, module2) { + "use strict"; + init_polyfillShim(); + var AtRule2 = require_at_rule(); + var Comment2 = require_comment(); + var Declaration2 = require_declaration(); + var Input2 = require_input(); + var PreviousMap = require_previous_map(); + var Root2 = require_root2(); + var Rule2 = require_rule(); + function fromJSON2(json3, inputs) { + if (Array.isArray(json3)) return json3.map((n2) => fromJSON2(n2)); + let { inputs: ownInputs, ...defaults5 } = json3; + if (ownInputs) { + inputs = []; + for (let input2 of ownInputs) { + let inputHydrated = { ...input2, __proto__: Input2.prototype }; + if (inputHydrated.map) { + inputHydrated.map = { + ...inputHydrated.map, + __proto__: PreviousMap.prototype + }; + } + inputs.push(inputHydrated); + } + } + if (defaults5.nodes) { + defaults5.nodes = json3.nodes.map((n2) => fromJSON2(n2, inputs)); + } + if (defaults5.source) { + let { inputId, ...source } = defaults5.source; + defaults5.source = source; + if (inputId != null) { + defaults5.source.input = inputs[inputId]; + } + } + if (defaults5.type === "root") { + return new Root2(defaults5); + } else if (defaults5.type === "decl") { + return new Declaration2(defaults5); + } else if (defaults5.type === "rule") { + return new Rule2(defaults5); + } else if (defaults5.type === "comment") { + return new Comment2(defaults5); + } else if (defaults5.type === "atrule") { + return new AtRule2(defaults5); + } else { + throw new Error("Unknown node type: " + json3.type); + } + } + module2.exports = fromJSON2; + fromJSON2.default = fromJSON2; + } + }); + // node_modules/postcss/lib/map-generator.js var require_map_generator = __commonJS({ "node_modules/postcss/lib/map-generator.js"(exports2, module2) { "use strict"; init_polyfillShim(); - var { SourceMapConsumer, SourceMapGenerator } = require_source_map(); var { dirname, relative, resolve: resolve3, sep: sep2 } = require_path_browserify(); + var { SourceMapConsumer, SourceMapGenerator } = require_source_map(); var { pathToFileURL } = require_url(); var Input2 = require_input(); var sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator); @@ -83325,12 +84006,12 @@ ${events.lines.join("\n")} for (let i2 = this.root.nodes.length - 1; i2 >= 0; i2--) { node3 = this.root.nodes[i2]; if (node3.type !== "comment") continue; - if (node3.text.indexOf("# sourceMappingURL=") === 0) { + if (node3.text.startsWith("# sourceMappingURL=")) { this.root.removeChild(i2); } } } else if (this.css) { - this.css = this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm, ""); + this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, ""); } } generate() { @@ -83388,7 +84069,7 @@ ${events.lines.join("\n")} original: { column: 0, line: 0 }, source: "" }; - let lines, last3; + let last3, lines; this.stringify(this.root, (str2, node3, type3) => { this.css += str2; if (node3 && type3 !== "end") { @@ -83581,705 +84262,17 @@ ${events.lines.join("\n")} } }); - // node_modules/postcss/lib/comment.js - var require_comment = __commonJS({ - "node_modules/postcss/lib/comment.js"(exports2, module2) { - "use strict"; - init_polyfillShim(); - var Node3 = require_node2(); - var Comment2 = class extends Node3 { - constructor(defaults5) { - super(defaults5); - this.type = "comment"; - } - }; - module2.exports = Comment2; - Comment2.default = Comment2; - } - }); - - // node_modules/postcss/lib/container.js - var require_container = __commonJS({ - "node_modules/postcss/lib/container.js"(exports2, module2) { - "use strict"; - init_polyfillShim(); - var { isClean, my } = require_symbols(); - var Declaration2 = require_declaration(); - var Comment2 = require_comment(); - var Node3 = require_node2(); - var parse10; - var Rule2; - var AtRule2; - var Root2; - function cleanSource(nodes5) { - return nodes5.map((i2) => { - if (i2.nodes) i2.nodes = cleanSource(i2.nodes); - delete i2.source; - return i2; - }); - } - function markDirtyUp(node3) { - node3[isClean] = false; - if (node3.proxyOf.nodes) { - for (let i2 of node3.proxyOf.nodes) { - markDirtyUp(i2); - } - } - } - var Container2 = class _Container extends Node3 { - append(...children2) { - for (let child of children2) { - let nodes5 = this.normalize(child, this.last); - for (let node3 of nodes5) this.proxyOf.nodes.push(node3); - } - this.markDirty(); - return this; - } - cleanRaws(keepBetween) { - super.cleanRaws(keepBetween); - if (this.nodes) { - for (let node3 of this.nodes) node3.cleanRaws(keepBetween); - } - } - each(callback) { - if (!this.proxyOf.nodes) return void 0; - let iterator = this.getIterator(); - let index3, result; - while (this.indexes[iterator] < this.proxyOf.nodes.length) { - index3 = this.indexes[iterator]; - result = callback(this.proxyOf.nodes[index3], index3); - if (result === false) break; - this.indexes[iterator] += 1; - } - delete this.indexes[iterator]; - return result; - } - every(condition) { - return this.nodes.every(condition); - } - getIterator() { - if (!this.lastEach) this.lastEach = 0; - if (!this.indexes) this.indexes = {}; - this.lastEach += 1; - let iterator = this.lastEach; - this.indexes[iterator] = 0; - return iterator; - } - getProxyProcessor() { - return { - get(node3, prop) { - if (prop === "proxyOf") { - return node3; - } else if (!node3[prop]) { - return node3[prop]; - } else if (prop === "each" || typeof prop === "string" && prop.startsWith("walk")) { - return (...args) => { - return node3[prop]( - ...args.map((i2) => { - if (typeof i2 === "function") { - return (child, index3) => i2(child.toProxy(), index3); - } else { - return i2; - } - }) - ); - }; - } else if (prop === "every" || prop === "some") { - return (cb) => { - return node3[prop]( - (child, ...other) => cb(child.toProxy(), ...other) - ); - }; - } else if (prop === "root") { - return () => node3.root().toProxy(); - } else if (prop === "nodes") { - return node3.nodes.map((i2) => i2.toProxy()); - } else if (prop === "first" || prop === "last") { - return node3[prop].toProxy(); - } else { - return node3[prop]; - } - }, - set(node3, prop, value) { - if (node3[prop] === value) return true; - node3[prop] = value; - if (prop === "name" || prop === "params" || prop === "selector") { - node3.markDirty(); - } - return true; - } - }; - } - index(child) { - if (typeof child === "number") return child; - if (child.proxyOf) child = child.proxyOf; - return this.proxyOf.nodes.indexOf(child); - } - insertAfter(exist, add3) { - let existIndex = this.index(exist); - let nodes5 = this.normalize(add3, this.proxyOf.nodes[existIndex]).reverse(); - existIndex = this.index(exist); - for (let node3 of nodes5) this.proxyOf.nodes.splice(existIndex + 1, 0, node3); - let index3; - for (let id4 in this.indexes) { - index3 = this.indexes[id4]; - if (existIndex < index3) { - this.indexes[id4] = index3 + nodes5.length; - } - } - this.markDirty(); - return this; - } - insertBefore(exist, add3) { - let existIndex = this.index(exist); - let type3 = existIndex === 0 ? "prepend" : false; - let nodes5 = this.normalize(add3, this.proxyOf.nodes[existIndex], type3).reverse(); - existIndex = this.index(exist); - for (let node3 of nodes5) this.proxyOf.nodes.splice(existIndex, 0, node3); - let index3; - for (let id4 in this.indexes) { - index3 = this.indexes[id4]; - if (existIndex <= index3) { - this.indexes[id4] = index3 + nodes5.length; - } - } - this.markDirty(); - return this; - } - normalize(nodes5, sample) { - if (typeof nodes5 === "string") { - nodes5 = cleanSource(parse10(nodes5).nodes); - } else if (typeof nodes5 === "undefined") { - nodes5 = []; - } else if (Array.isArray(nodes5)) { - nodes5 = nodes5.slice(0); - for (let i2 of nodes5) { - if (i2.parent) i2.parent.removeChild(i2, "ignore"); - } - } else if (nodes5.type === "root" && this.type !== "document") { - nodes5 = nodes5.nodes.slice(0); - for (let i2 of nodes5) { - if (i2.parent) i2.parent.removeChild(i2, "ignore"); - } - } else if (nodes5.type) { - nodes5 = [nodes5]; - } else if (nodes5.prop) { - if (typeof nodes5.value === "undefined") { - throw new Error("Value field is missed in node creation"); - } else if (typeof nodes5.value !== "string") { - nodes5.value = String(nodes5.value); - } - nodes5 = [new Declaration2(nodes5)]; - } else if (nodes5.selector) { - nodes5 = [new Rule2(nodes5)]; - } else if (nodes5.name) { - nodes5 = [new AtRule2(nodes5)]; - } else if (nodes5.text) { - nodes5 = [new Comment2(nodes5)]; - } else { - throw new Error("Unknown node type in node creation"); - } - let processed2 = nodes5.map((i2) => { - if (!i2[my]) _Container.rebuild(i2); - i2 = i2.proxyOf; - if (i2.parent) i2.parent.removeChild(i2); - if (i2[isClean]) markDirtyUp(i2); - if (typeof i2.raws.before === "undefined") { - if (sample && typeof sample.raws.before !== "undefined") { - i2.raws.before = sample.raws.before.replace(/\S/g, ""); - } - } - i2.parent = this.proxyOf; - return i2; - }); - return processed2; - } - prepend(...children2) { - children2 = children2.reverse(); - for (let child of children2) { - let nodes5 = this.normalize(child, this.first, "prepend").reverse(); - for (let node3 of nodes5) this.proxyOf.nodes.unshift(node3); - for (let id4 in this.indexes) { - this.indexes[id4] = this.indexes[id4] + nodes5.length; - } - } - this.markDirty(); - return this; - } - push(child) { - child.parent = this; - this.proxyOf.nodes.push(child); - return this; - } - removeAll() { - for (let node3 of this.proxyOf.nodes) node3.parent = void 0; - this.proxyOf.nodes = []; - this.markDirty(); - return this; - } - removeChild(child) { - child = this.index(child); - this.proxyOf.nodes[child].parent = void 0; - this.proxyOf.nodes.splice(child, 1); - let index3; - for (let id4 in this.indexes) { - index3 = this.indexes[id4]; - if (index3 >= child) { - this.indexes[id4] = index3 - 1; - } - } - this.markDirty(); - return this; - } - replaceValues(pattern, opts, callback) { - if (!callback) { - callback = opts; - opts = {}; - } - this.walkDecls((decl2) => { - if (opts.props && !opts.props.includes(decl2.prop)) return; - if (opts.fast && !decl2.value.includes(opts.fast)) return; - decl2.value = decl2.value.replace(pattern, callback); - }); - this.markDirty(); - return this; - } - some(condition) { - return this.nodes.some(condition); - } - walk(callback) { - return this.each((child, i2) => { - let result; - try { - result = callback(child, i2); - } catch (e3) { - throw child.addToError(e3); - } - if (result !== false && child.walk) { - result = child.walk(callback); - } - return result; - }); - } - walkAtRules(name, callback) { - if (!callback) { - callback = name; - return this.walk((child, i2) => { - if (child.type === "atrule") { - return callback(child, i2); - } - }); - } - if (name instanceof RegExp) { - return this.walk((child, i2) => { - if (child.type === "atrule" && name.test(child.name)) { - return callback(child, i2); - } - }); - } - return this.walk((child, i2) => { - if (child.type === "atrule" && child.name === name) { - return callback(child, i2); - } - }); - } - walkComments(callback) { - return this.walk((child, i2) => { - if (child.type === "comment") { - return callback(child, i2); - } - }); - } - walkDecls(prop, callback) { - if (!callback) { - callback = prop; - return this.walk((child, i2) => { - if (child.type === "decl") { - return callback(child, i2); - } - }); - } - if (prop instanceof RegExp) { - return this.walk((child, i2) => { - if (child.type === "decl" && prop.test(child.prop)) { - return callback(child, i2); - } - }); - } - return this.walk((child, i2) => { - if (child.type === "decl" && child.prop === prop) { - return callback(child, i2); - } - }); - } - walkRules(selector, callback) { - if (!callback) { - callback = selector; - return this.walk((child, i2) => { - if (child.type === "rule") { - return callback(child, i2); - } - }); - } - if (selector instanceof RegExp) { - return this.walk((child, i2) => { - if (child.type === "rule" && selector.test(child.selector)) { - return callback(child, i2); - } - }); - } - return this.walk((child, i2) => { - if (child.type === "rule" && child.selector === selector) { - return callback(child, i2); - } - }); - } - get first() { - if (!this.proxyOf.nodes) return void 0; - return this.proxyOf.nodes[0]; - } - get last() { - if (!this.proxyOf.nodes) return void 0; - return this.proxyOf.nodes[this.proxyOf.nodes.length - 1]; - } - }; - Container2.registerParse = (dependant) => { - parse10 = dependant; - }; - Container2.registerRule = (dependant) => { - Rule2 = dependant; - }; - Container2.registerAtRule = (dependant) => { - AtRule2 = dependant; - }; - Container2.registerRoot = (dependant) => { - Root2 = dependant; - }; - module2.exports = Container2; - Container2.default = Container2; - Container2.rebuild = (node3) => { - if (node3.type === "atrule") { - Object.setPrototypeOf(node3, AtRule2.prototype); - } else if (node3.type === "rule") { - Object.setPrototypeOf(node3, Rule2.prototype); - } else if (node3.type === "decl") { - Object.setPrototypeOf(node3, Declaration2.prototype); - } else if (node3.type === "comment") { - Object.setPrototypeOf(node3, Comment2.prototype); - } else if (node3.type === "root") { - Object.setPrototypeOf(node3, Root2.prototype); - } - node3[my] = true; - if (node3.nodes) { - node3.nodes.forEach((child) => { - Container2.rebuild(child); - }); - } - }; - } - }); - - // node_modules/postcss/lib/document.js - var require_document = __commonJS({ - "node_modules/postcss/lib/document.js"(exports2, module2) { - "use strict"; - init_polyfillShim(); - var Container2 = require_container(); - var LazyResult; - var Processor2; - var Document2 = class extends Container2 { - constructor(defaults5) { - super({ type: "document", ...defaults5 }); - if (!this.nodes) { - this.nodes = []; - } - } - toResult(opts = {}) { - let lazy = new LazyResult(new Processor2(), this, opts); - return lazy.stringify(); - } - }; - Document2.registerLazyResult = (dependant) => { - LazyResult = dependant; - }; - Document2.registerProcessor = (dependant) => { - Processor2 = dependant; - }; - module2.exports = Document2; - Document2.default = Document2; - } - }); - - // node_modules/postcss/lib/warn-once.js - var require_warn_once = __commonJS({ - "node_modules/postcss/lib/warn-once.js"(exports2, module2) { - "use strict"; - init_polyfillShim(); - var printed = {}; - module2.exports = function warnOnce(message) { - if (printed[message]) return; - printed[message] = true; - if (typeof console !== "undefined" && console.warn) { - console.warn(message); - } - }; - } - }); - - // node_modules/postcss/lib/warning.js - var require_warning = __commonJS({ - "node_modules/postcss/lib/warning.js"(exports2, module2) { - "use strict"; - init_polyfillShim(); - var Warning2 = class { - constructor(text4, opts = {}) { - this.type = "warning"; - this.text = text4; - if (opts.node && opts.node.source) { - let range3 = opts.node.rangeBy(opts); - this.line = range3.start.line; - this.column = range3.start.column; - this.endLine = range3.end.line; - this.endColumn = range3.end.column; - } - for (let opt in opts) this[opt] = opts[opt]; - } - toString() { - if (this.node) { - return this.node.error(this.text, { - index: this.index, - plugin: this.plugin, - word: this.word - }).message; - } - if (this.plugin) { - return this.plugin + ": " + this.text; - } - return this.text; - } - }; - module2.exports = Warning2; - Warning2.default = Warning2; - } - }); - - // node_modules/postcss/lib/result.js - var require_result = __commonJS({ - "node_modules/postcss/lib/result.js"(exports2, module2) { - "use strict"; - init_polyfillShim(); - var Warning2 = require_warning(); - var Result2 = class { - constructor(processor, root5, opts) { - this.processor = processor; - this.messages = []; - this.root = root5; - this.opts = opts; - this.css = void 0; - this.map = void 0; - } - toString() { - return this.css; - } - warn(text4, opts = {}) { - if (!opts.plugin) { - if (this.lastPlugin && this.lastPlugin.postcssPlugin) { - opts.plugin = this.lastPlugin.postcssPlugin; - } - } - let warning = new Warning2(text4, opts); - this.messages.push(warning); - return warning; - } - warnings() { - return this.messages.filter((i2) => i2.type === "warning"); - } - get content() { - return this.css; - } - }; - module2.exports = Result2; - Result2.default = Result2; - } - }); - - // node_modules/postcss/lib/at-rule.js - var require_at_rule = __commonJS({ - "node_modules/postcss/lib/at-rule.js"(exports2, module2) { - "use strict"; - init_polyfillShim(); - var Container2 = require_container(); - var AtRule2 = class extends Container2 { - constructor(defaults5) { - super(defaults5); - this.type = "atrule"; - } - append(...children2) { - if (!this.proxyOf.nodes) this.nodes = []; - return super.append(...children2); - } - prepend(...children2) { - if (!this.proxyOf.nodes) this.nodes = []; - return super.prepend(...children2); - } - }; - module2.exports = AtRule2; - AtRule2.default = AtRule2; - Container2.registerAtRule(AtRule2); - } - }); - - // node_modules/postcss/lib/root.js - var require_root2 = __commonJS({ - "node_modules/postcss/lib/root.js"(exports2, module2) { - "use strict"; - init_polyfillShim(); - var Container2 = require_container(); - var LazyResult; - var Processor2; - var Root2 = class extends Container2 { - constructor(defaults5) { - super(defaults5); - this.type = "root"; - if (!this.nodes) this.nodes = []; - } - normalize(child, sample, type3) { - let nodes5 = super.normalize(child); - if (sample) { - if (type3 === "prepend") { - if (this.nodes.length > 1) { - sample.raws.before = this.nodes[1].raws.before; - } else { - delete sample.raws.before; - } - } else if (this.first !== sample) { - for (let node3 of nodes5) { - node3.raws.before = sample.raws.before; - } - } - } - return nodes5; - } - removeChild(child, ignore) { - let index3 = this.index(child); - if (!ignore && index3 === 0 && this.nodes.length > 1) { - this.nodes[1].raws.before = this.nodes[index3].raws.before; - } - return super.removeChild(child); - } - toResult(opts = {}) { - let lazy = new LazyResult(new Processor2(), this, opts); - return lazy.stringify(); - } - }; - Root2.registerLazyResult = (dependant) => { - LazyResult = dependant; - }; - Root2.registerProcessor = (dependant) => { - Processor2 = dependant; - }; - module2.exports = Root2; - Root2.default = Root2; - Container2.registerRoot(Root2); - } - }); - - // node_modules/postcss/lib/list.js - var require_list3 = __commonJS({ - "node_modules/postcss/lib/list.js"(exports2, module2) { - "use strict"; - init_polyfillShim(); - var list3 = { - comma(string5) { - return list3.split(string5, [","], true); - }, - space(string5) { - let spaces = [" ", "\n", " "]; - return list3.split(string5, spaces); - }, - split(string5, separators, last3) { - let array4 = []; - let current = ""; - let split = false; - let func = 0; - let inQuote = false; - let prevQuote = ""; - let escape4 = false; - for (let letter of string5) { - if (escape4) { - escape4 = false; - } else if (letter === "\\") { - escape4 = true; - } else if (inQuote) { - if (letter === prevQuote) { - inQuote = false; - } - } else if (letter === '"' || letter === "'") { - inQuote = true; - prevQuote = letter; - } else if (letter === "(") { - func += 1; - } else if (letter === ")") { - if (func > 0) func -= 1; - } else if (func === 0) { - if (separators.includes(letter)) split = true; - } - if (split) { - if (current !== "") array4.push(current.trim()); - current = ""; - split = false; - } else { - current += letter; - } - } - if (last3 || current !== "") array4.push(current.trim()); - return array4; - } - }; - module2.exports = list3; - list3.default = list3; - } - }); - - // node_modules/postcss/lib/rule.js - var require_rule = __commonJS({ - "node_modules/postcss/lib/rule.js"(exports2, module2) { - "use strict"; - init_polyfillShim(); - var Container2 = require_container(); - var list3 = require_list3(); - var Rule2 = class extends Container2 { - constructor(defaults5) { - super(defaults5); - this.type = "rule"; - if (!this.nodes) this.nodes = []; - } - get selectors() { - return list3.comma(this.selector); - } - set selectors(values2) { - let match2 = this.selector ? this.selector.match(/,\s*/) : null; - let sep2 = match2 ? match2[0] : "," + this.raw("between", "beforeOpen"); - this.selector = values2.join(sep2); - } - }; - module2.exports = Rule2; - Rule2.default = Rule2; - Container2.registerRule(Rule2); - } - }); - // node_modules/postcss/lib/parser.js var require_parser = __commonJS({ "node_modules/postcss/lib/parser.js"(exports2, module2) { "use strict"; init_polyfillShim(); - var Declaration2 = require_declaration(); - var tokenizer = require_tokenize(); - var Comment2 = require_comment(); var AtRule2 = require_at_rule(); + var Comment2 = require_comment(); + var Declaration2 = require_declaration(); var Root2 = require_root2(); var Rule2 = require_rule(); + var tokenizer = require_tokenize(); var SAFE_COMMENT_NEIGHBOR = { empty: true, space: true @@ -84398,7 +84391,7 @@ ${events.lines.join("\n")} } colon(tokens2) { let brackets = 0; - let token2, type3, prev2; + let prev2, token2, type3; for (let [i2, element3] of tokens2.entries()) { token2 = element3; type3 = token2[0]; @@ -84505,12 +84498,12 @@ ${events.lines.join("\n")} let str2 = ""; for (let j2 = i2; j2 > 0; j2--) { let type3 = cache3[j2][0]; - if (str2.trim().indexOf("!") === 0 && type3 !== "space") { + if (str2.trim().startsWith("!") && type3 !== "space") { break; } str2 = cache3.pop()[1] + str2; } - if (str2.trim().indexOf("!") === 0) { + if (str2.trim().startsWith("!")) { node3.important = true; node3.raws.important = str2; tokens2 = cache3; @@ -84808,8 +84801,8 @@ ${events.lines.join("\n")} "use strict"; init_polyfillShim(); var Container2 = require_container(); - var Parser2 = require_parser(); var Input2 = require_input(); + var Parser2 = require_parser(); function parse10(css, opts) { let input2 = new Input2(css, opts); let parser21 = new Parser2(input2); @@ -84837,20 +84830,113 @@ ${events.lines.join("\n")} } }); + // node_modules/postcss/lib/warning.js + var require_warning = __commonJS({ + "node_modules/postcss/lib/warning.js"(exports2, module2) { + "use strict"; + init_polyfillShim(); + var Warning2 = class { + constructor(text4, opts = {}) { + this.type = "warning"; + this.text = text4; + if (opts.node && opts.node.source) { + let range3 = opts.node.rangeBy(opts); + this.line = range3.start.line; + this.column = range3.start.column; + this.endLine = range3.end.line; + this.endColumn = range3.end.column; + } + for (let opt in opts) this[opt] = opts[opt]; + } + toString() { + if (this.node) { + return this.node.error(this.text, { + index: this.index, + plugin: this.plugin, + word: this.word + }).message; + } + if (this.plugin) { + return this.plugin + ": " + this.text; + } + return this.text; + } + }; + module2.exports = Warning2; + Warning2.default = Warning2; + } + }); + + // node_modules/postcss/lib/result.js + var require_result = __commonJS({ + "node_modules/postcss/lib/result.js"(exports2, module2) { + "use strict"; + init_polyfillShim(); + var Warning2 = require_warning(); + var Result2 = class { + constructor(processor, root5, opts) { + this.processor = processor; + this.messages = []; + this.root = root5; + this.opts = opts; + this.css = void 0; + this.map = void 0; + } + toString() { + return this.css; + } + warn(text4, opts = {}) { + if (!opts.plugin) { + if (this.lastPlugin && this.lastPlugin.postcssPlugin) { + opts.plugin = this.lastPlugin.postcssPlugin; + } + } + let warning = new Warning2(text4, opts); + this.messages.push(warning); + return warning; + } + warnings() { + return this.messages.filter((i2) => i2.type === "warning"); + } + get content() { + return this.css; + } + }; + module2.exports = Result2; + Result2.default = Result2; + } + }); + + // node_modules/postcss/lib/warn-once.js + var require_warn_once = __commonJS({ + "node_modules/postcss/lib/warn-once.js"(exports2, module2) { + "use strict"; + init_polyfillShim(); + var printed = {}; + module2.exports = function warnOnce(message) { + if (printed[message]) return; + printed[message] = true; + if (typeof console !== "undefined" && console.warn) { + console.warn(message); + } + }; + } + }); + // node_modules/postcss/lib/lazy-result.js var require_lazy_result = __commonJS({ "node_modules/postcss/lib/lazy-result.js"(exports2, module2) { "use strict"; init_polyfillShim(); - var { isClean, my } = require_symbols(); - var MapGenerator = require_map_generator(); - var stringify4 = require_stringify2(); var Container2 = require_container(); var Document2 = require_document(); - var warnOnce = require_warn_once(); - var Result2 = require_result(); + var MapGenerator = require_map_generator(); var parse10 = require_parse3(); + var Result2 = require_result(); var Root2 = require_root2(); + var stringify4 = require_stringify2(); + var { isClean, my } = require_symbols(); + var warnOnce = require_warn_once(); var TYPE_TO_CLASS_NAME = { atrule: "AtRule", comment: "Comment", @@ -85318,10 +85404,10 @@ ${events.lines.join("\n")} "use strict"; init_polyfillShim(); var MapGenerator = require_map_generator(); - var stringify4 = require_stringify2(); - var warnOnce = require_warn_once(); var parse10 = require_parse3(); var Result2 = require_result(); + var stringify4 = require_stringify2(); + var warnOnce = require_warn_once(); var NoWorkResult = class { constructor(processor, css, opts) { css = css.toString(); @@ -85434,13 +85520,13 @@ ${events.lines.join("\n")} "node_modules/postcss/lib/processor.js"(exports2, module2) { "use strict"; init_polyfillShim(); - var NoWorkResult = require_no_work_result(); - var LazyResult = require_lazy_result(); var Document2 = require_document(); + var LazyResult = require_lazy_result(); + var NoWorkResult = require_no_work_result(); var Root2 = require_root2(); var Processor2 = class { constructor(plugins = []) { - this.version = "8.4.38"; + this.version = "8.4.47"; this.plugins = this.normalize(plugins); } normalize(plugins) { @@ -85488,86 +85574,29 @@ ${events.lines.join("\n")} } }); - // node_modules/postcss/lib/fromJSON.js - var require_fromJSON = __commonJS({ - "node_modules/postcss/lib/fromJSON.js"(exports2, module2) { - "use strict"; - init_polyfillShim(); - var Declaration2 = require_declaration(); - var PreviousMap = require_previous_map(); - var Comment2 = require_comment(); - var AtRule2 = require_at_rule(); - var Input2 = require_input(); - var Root2 = require_root2(); - var Rule2 = require_rule(); - function fromJSON2(json3, inputs) { - if (Array.isArray(json3)) return json3.map((n2) => fromJSON2(n2)); - let { inputs: ownInputs, ...defaults5 } = json3; - if (ownInputs) { - inputs = []; - for (let input2 of ownInputs) { - let inputHydrated = { ...input2, __proto__: Input2.prototype }; - if (inputHydrated.map) { - inputHydrated.map = { - ...inputHydrated.map, - __proto__: PreviousMap.prototype - }; - } - inputs.push(inputHydrated); - } - } - if (defaults5.nodes) { - defaults5.nodes = json3.nodes.map((n2) => fromJSON2(n2, inputs)); - } - if (defaults5.source) { - let { inputId, ...source } = defaults5.source; - defaults5.source = source; - if (inputId != null) { - defaults5.source.input = inputs[inputId]; - } - } - if (defaults5.type === "root") { - return new Root2(defaults5); - } else if (defaults5.type === "decl") { - return new Declaration2(defaults5); - } else if (defaults5.type === "rule") { - return new Rule2(defaults5); - } else if (defaults5.type === "comment") { - return new Comment2(defaults5); - } else if (defaults5.type === "atrule") { - return new AtRule2(defaults5); - } else { - throw new Error("Unknown node type: " + json3.type); - } - } - module2.exports = fromJSON2; - fromJSON2.default = fromJSON2; - } - }); - // node_modules/postcss/lib/postcss.js var require_postcss = __commonJS({ "node_modules/postcss/lib/postcss.js"(exports2, module2) { "use strict"; init_polyfillShim(); + var AtRule2 = require_at_rule(); + var Comment2 = require_comment(); + var Container2 = require_container(); var CssSyntaxError2 = require_css_syntax_error(); var Declaration2 = require_declaration(); - var LazyResult = require_lazy_result(); - var Container2 = require_container(); - var Processor2 = require_processor(); - var stringify4 = require_stringify2(); - var fromJSON2 = require_fromJSON(); var Document2 = require_document(); - var Warning2 = require_warning(); - var Comment2 = require_comment(); - var AtRule2 = require_at_rule(); - var Result2 = require_result(); + var fromJSON2 = require_fromJSON(); var Input2 = require_input(); - var parse10 = require_parse3(); + var LazyResult = require_lazy_result(); var list3 = require_list3(); - var Rule2 = require_rule(); - var Root2 = require_root2(); var Node3 = require_node2(); + var parse10 = require_parse3(); + var Processor2 = require_processor(); + var Result2 = require_result(); + var Root2 = require_root2(); + var Rule2 = require_rule(); + var stringify4 = require_stringify2(); + var Warning2 = require_warning(); function postcss2(...plugins) { if (plugins.length === 1 && Array.isArray(plugins[0])) { plugins = plugins[0]; @@ -86524,6 +86553,11 @@ ${events.lines.join("\n")} } ] }; + const PUNCTUATION = { + match: /[;()+\-:=,]/, + className: "punctuation", + relevance: 0 + }; const COMMENTS = hljs.inherit(hljs.C_LINE_COMMENT_MODE); const META = { className: "meta", @@ -86601,7 +86635,8 @@ ${events.lines.join("\n")} SYMBOL, NUMBERS, STRINGS, - DATE + DATE, + PUNCTUATION ] }; } @@ -87543,34 +87578,44 @@ ${events.lines.join("\n")} "node_modules/highlight.js/lib/languages/arcade.js"(exports2, module2) { init_polyfillShim(); function arcade(hljs) { + const regex = hljs.regex; const IDENT_RE = "[A-Za-z_][0-9A-Za-z_]*"; const KEYWORDS = { keyword: [ - "if", + "break", + "case", + "catch", + "continue", + "debugger", + "do", + "else", + "export", "for", - "while", - "var", - "new", "function", - "do", + "if", + "import", + "in", + "new", "return", + "switch", + "try", + "var", "void", - "else", - "break" + "while" ], literal: [ "BackSlash", "DoubleQuote", - "false", "ForwardSlash", "Infinity", "NaN", "NewLine", - "null", "PI", "SingleQuote", "Tab", "TextFormatting", + "false", + "null", "true", "undefined" ], @@ -87595,19 +87640,22 @@ ${events.lines.join("\n")} "BufferGeodetic", "Ceil", "Centroid", + "ChangeTimeZone", "Clip", "Concatenate", "Console", "Constrain", "Contains", "ConvertDirection", + "ConvexHull", "Cos", "Count", "Crosses", "Cut", - "Date", + "Date|0", "DateAdd", "DateDiff", + "DateOnly", "Day", "Decode", "DefaultValue", @@ -87634,25 +87682,34 @@ ${events.lines.join("\n")} "FeatureSetById", "FeatureSetByName", "FeatureSetByPortalItem", + "FeatureSetByRelationshipClass", "FeatureSetByRelationshipName", "Filter", "Find", - "First", + "First|0", "Floor", "FromCharCode", "FromCodePoint", "FromJSON", + "Front", "GdbVersion", "Generalize", "Geometry", + "GetEnvironment", "GetFeatureSet", + "GetFeatureSetInfo", "GetUser", "GroupBy", "Guid", - "Hash", "HasKey", + "HasValue", + "Hash", "Hour", "IIf", + "ISOMonth", + "ISOWeek", + "ISOWeekday", + "ISOYear", "Includes", "IndexOf", "Insert", @@ -87660,10 +87717,6 @@ ${events.lines.join("\n")} "Intersects", "IsEmpty", "IsNan", - "ISOMonth", - "ISOWeek", - "ISOWeekday", - "ISOYear", "IsSelfIntersecting", "IsSimple", "Left|0", @@ -87682,11 +87735,13 @@ ${events.lines.join("\n")} "Month", "MultiPartToSinglePart", "Multipoint", + "NearestCoordinate", + "NearestVertex", "NextSequenceValue", "None", "Now", "Number", - "Offset|0", + "Offset", "OrderBy", "Overlaps", "Point", @@ -87717,6 +87772,7 @@ ${events.lines.join("\n")} "Splice", "Split", "Sqrt", + "StandardizeGuid", "Stdev", "SubtypeCode", "SubtypeName", @@ -87725,15 +87781,18 @@ ${events.lines.join("\n")} "SymmetricDifference", "Tan", "Text", + "Time", + "TimeZone", + "TimeZoneOffset", "Timestamp", "ToCharCode", "ToCodePoint", - "Today", "ToHex", "ToLocal", + "ToUTC", + "Today", "Top|0", "Touches", - "ToUTC", "TrackAccelerationAt", "TrackAccelerationWindow", "TrackCurrentAcceleration", @@ -87758,14 +87817,46 @@ ${events.lines.join("\n")} "Variance", "Week", "Weekday", - "When", + "When|0", "Within", - "Year" + "Year|0" ] }; + const PROFILE_VARS = [ + "aggregatedFeatures", + "analytic", + "config", + "datapoint", + "datastore", + "editcontext", + "feature", + "featureSet", + "feedfeature", + "fencefeature", + "fencenotificationtype", + "join", + "layer", + "locationupdate", + "map", + "measure", + "measure", + "originalFeature", + "record", + "reference", + "rowindex", + "sourcedatastore", + "sourcefeature", + "sourcelayer", + "target", + "targetdatastore", + "targetfeature", + "targetlayer", + "value", + "view" + ]; const SYMBOL = { className: "symbol", - begin: "\\$[datastore|feature|layer|map|measure|sourcefeature|sourcelayer|targetfeature|targetlayer|value|view]+" + begin: "\\$" + regex.either(...PROFILE_VARS) }; const NUMBER = { className: "number", @@ -87937,9 +88028,16 @@ ${events.lines.join("\n")} const NUMBERS = { className: "number", variants: [ - { begin: "\\b(0b[01']+)" }, - { begin: "(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)" }, - { begin: "(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)" } + // Floating-point literal. + { + begin: "[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)" + }, + // Integer literal. + { + begin: "[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)" + // Note: there are user-defined literal suffixes too, but perhaps having the custom suffix not part of the + // literal highlight actually makes it stand out more. + } ], relevance: 0 }; @@ -90213,6 +90311,18 @@ ${events.lines.join("\n")} end: /\)/, contains: [hljs.BACKSLASH_ESCAPE] }; + const COMMENT3 = hljs.inherit( + hljs.COMMENT(), + { + match: [ + /(^|\s)/, + /#.*$/ + ], + scope: { + 2: "comment" + } + } + ); const HERE_DOC = { begin: /<<-?\s*(?=\w+)/, starts: { contains: [ @@ -90339,6 +90449,7 @@ ${events.lines.join("\n")} "read", "readarray", "source", + "sudo", "type", "typeset", "ulimit", @@ -90521,7 +90632,10 @@ ${events.lines.join("\n")} ]; return { name: "Bash", - aliases: ["sh"], + aliases: [ + "sh", + "zsh" + ], keywords: { $pattern: /\b[a-z][a-z0-9._-]+\b/, keyword: KEYWORDS, @@ -90543,7 +90657,7 @@ ${events.lines.join("\n")} // to catch unknown shells but still highlight the shebang FUNCTION, ARITHMETIC, - hljs.HASH_COMMENT_MODE, + COMMENT3, HERE_DOC, PATH_MODE, QUOTE_STRING, @@ -90926,7 +91040,7 @@ ${events.lines.join("\n")} className: "meta", begin: /#\s*[a-z]+\b/, end: /$/, - keywords: { keyword: "if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include" }, + keywords: { keyword: "if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include" }, contains: [ { begin: /\\\n/, @@ -90967,6 +91081,8 @@ ${events.lines.join("\n")} "restrict", "return", "sizeof", + "typeof", + "typeof_unqual", "struct", "switch", "typedef", @@ -91000,14 +91116,26 @@ ${events.lines.join("\n")} "char", "void", "_Bool", + "_BitInt", "_Complex", "_Imaginary", "_Decimal32", "_Decimal64", + "_Decimal96", "_Decimal128", + "_Decimal64x", + "_Decimal128x", + "_Float16", + "_Float32", + "_Float64", + "_Float128", + "_Float32x", + "_Float64x", + "_Float128x", // modifiers "const", "static", + "constexpr", // aliases "complex", "bool", @@ -92757,9 +92885,16 @@ ${events.lines.join("\n")} const NUMBERS = { className: "number", variants: [ - { begin: "\\b(0b[01']+)" }, - { begin: "(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)" }, - { begin: "(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)" } + // Floating-point literal. + { + begin: "[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)" + }, + // Integer literal. + { + begin: "[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)" + // Note: there are user-defined literal suffixes too, but perhaps having the custom suffix not part of the + // literal highlight actually makes it stand out more. + } ], relevance: 0 }; @@ -93814,6 +93949,11 @@ ${events.lines.join("\n")} ], relevance: 0 }; + const RAW_STRING = { + className: "string", + begin: /"""("*)(?!")(.|\n)*?"""\1/, + relevance: 1 + }; const VERBATIM_STRING = { className: "string", begin: '@"', @@ -93879,6 +94019,7 @@ ${events.lines.join("\n")} hljs.inherit(hljs.C_BLOCK_COMMENT_MODE, { illegal: /\n/ }) ]; const STRING = { variants: [ + RAW_STRING, INTERPOLATED_VERBATIM_STRING, INTERPOLATED_STRING, VERBATIM_STRING, @@ -94141,7 +94282,7 @@ ${events.lines.join("\n")} } }; }; - var TAGS = [ + var HTML_TAGS = [ "a", "abbr", "address", @@ -94193,11 +94334,16 @@ ${events.lines.join("\n")} "nav", "object", "ol", + "optgroup", + "option", "p", + "picture", "q", "quote", "samp", "section", + "select", + "source", "span", "strong", "summary", @@ -94215,6 +94361,53 @@ ${events.lines.join("\n")} "var", "video" ]; + var SVG_TAGS = [ + "defs", + "g", + "marker", + "mask", + "pattern", + "svg", + "switch", + "symbol", + "feBlend", + "feColorMatrix", + "feComponentTransfer", + "feComposite", + "feConvolveMatrix", + "feDiffuseLighting", + "feDisplacementMap", + "feFlood", + "feGaussianBlur", + "feImage", + "feMerge", + "feMorphology", + "feOffset", + "feSpecularLighting", + "feTile", + "feTurbulence", + "linearGradient", + "radialGradient", + "stop", + "circle", + "ellipse", + "image", + "line", + "path", + "polygon", + "polyline", + "rect", + "text", + "use", + "textPath", + "tspan", + "foreignObject", + "clipPath" + ]; + var TAGS = [ + ...HTML_TAGS, + ...SVG_TAGS + ]; var MEDIA_FEATURES = [ "any-hover", "any-pointer", @@ -94250,7 +94443,7 @@ ${events.lines.join("\n")} "max-width", "min-height", "max-height" - ]; + ].sort().reverse(); var PSEUDO_CLASSES = [ "active", "any-link", @@ -94325,7 +94518,7 @@ ${events.lines.join("\n")} "visited", "where" // where() - ]; + ].sort().reverse(); var PSEUDO_ELEMENTS = [ "after", "backdrop", @@ -94341,11 +94534,13 @@ ${events.lines.join("\n")} "selection", "slotted", "spelling-error" - ]; + ].sort().reverse(); var ATTRIBUTES = [ + "accent-color", "align-content", "align-items", "align-self", + "alignment-baseline", "all", "animation", "animation-delay", @@ -94356,6 +94551,7 @@ ${events.lines.join("\n")} "animation-name", "animation-play-state", "animation-timing-function", + "appearance", "backface-visibility", "background", "background-attachment", @@ -94367,6 +94563,7 @@ ${events.lines.join("\n")} "background-position", "background-repeat", "background-size", + "baseline-shift", "block-size", "border", "border-block", @@ -94413,10 +94610,14 @@ ${events.lines.join("\n")} "border-left-width", "border-radius", "border-right", + "border-end-end-radius", + "border-end-start-radius", "border-right-color", "border-right-style", "border-right-width", "border-spacing", + "border-start-end-radius", + "border-start-start-radius", "border-style", "border-top", "border-top-color", @@ -94432,6 +94633,8 @@ ${events.lines.join("\n")} "break-after", "break-before", "break-inside", + "cx", + "cy", "caption-side", "caret-color", "clear", @@ -94439,6 +94642,11 @@ ${events.lines.join("\n")} "clip-path", "clip-rule", "color", + "color-interpolation", + "color-interpolation-filters", + "color-profile", + "color-rendering", + "color-scheme", "column-count", "column-fill", "column-gap", @@ -94460,7 +94668,12 @@ ${events.lines.join("\n")} "cursor", "direction", "display", + "dominant-baseline", "empty-cells", + "enable-background", + "fill", + "fill-opacity", + "fill-rule", "filter", "flex", "flex-basis", @@ -94471,6 +94684,8 @@ ${events.lines.join("\n")} "flex-wrap", "float", "flow", + "flood-color", + "flood-opacity", "font", "font-display", "font-family", @@ -94492,6 +94707,7 @@ ${events.lines.join("\n")} "font-variation-settings", "font-weight", "gap", + "glyph-orientation-horizontal", "glyph-orientation-vertical", "grid", "grid-area", @@ -94518,16 +94734,32 @@ ${events.lines.join("\n")} "image-resolution", "ime-mode", "inline-size", + "inset", + "inset-block", + "inset-block-end", + "inset-block-start", + "inset-inline", + "inset-inline-end", + "inset-inline-start", "isolation", + "kerning", "justify-content", + "justify-items", + "justify-self", "left", "letter-spacing", + "lighting-color", "line-break", "line-height", "list-style", "list-style-image", "list-style-position", "list-style-type", + "marker", + "marker-end", + "marker-mid", + "marker-start", + "mask", "margin", "margin-block", "margin-block-end", @@ -94609,12 +94841,15 @@ ${events.lines.join("\n")} "pointer-events", "position", "quotes", + "r", "resize", "rest", "rest-after", "rest-before", "right", + "rotate", "row-gap", + "scale", "scroll-margin", "scroll-margin-block", "scroll-margin-block-end", @@ -94646,12 +94881,24 @@ ${events.lines.join("\n")} "shape-image-threshold", "shape-margin", "shape-outside", + "shape-rendering", + "stop-color", + "stop-opacity", + "stroke", + "stroke-dasharray", + "stroke-dashoffset", + "stroke-linecap", + "stroke-linejoin", + "stroke-miterlimit", + "stroke-opacity", + "stroke-width", "speak", "speak-as", "src", // @font-face "tab-size", "table-layout", + "text-anchor", "text-align", "text-align-all", "text-align-last", @@ -94659,7 +94906,9 @@ ${events.lines.join("\n")} "text-decoration", "text-decoration-color", "text-decoration-line", + "text-decoration-skip-ink", "text-decoration-style", + "text-decoration-thickness", "text-emphasis", "text-emphasis-color", "text-emphasis-position", @@ -94671,6 +94920,7 @@ ${events.lines.join("\n")} "text-rendering", "text-shadow", "text-transform", + "text-underline-offset", "text-underline-position", "top", "transform", @@ -94682,7 +94932,9 @@ ${events.lines.join("\n")} "transition-duration", "transition-property", "transition-timing-function", + "translate", "unicode-bidi", + "vector-effect", "vertical-align", "visibility", "voice-balance", @@ -94701,10 +94953,10 @@ ${events.lines.join("\n")} "word-spacing", "word-wrap", "writing-mode", + "x", + "y", "z-index" - // reverse makes sure longer attributes `font-weight` are matched fully - // instead of getting false positives on say `font` - ].reverse(); + ].sort().reverse(); function css(hljs) { const regex = hljs.regex; const modes = MODES(hljs); @@ -95163,6 +95415,11 @@ ${events.lines.join("\n")} contains: CONTAINABLE, end: "$" }; + const ENTITY = { + //https://spec.commonmark.org/0.31.2/#entity-references + scope: "literal", + match: /&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/ + }; return { name: "Markdown", aliases: [ @@ -95180,7 +95437,8 @@ ${events.lines.join("\n")} CODE, HORIZONTAL_RULE, LINK, - LINK_REFERENCE + LINK_REFERENCE, + ENTITY ] }; } @@ -95603,23 +95861,42 @@ ${events.lines.join("\n")} relevance: 0, // Source: https://www.freepascal.org/docs-html/ref/refse6.html variants: [ + { + // Regular numbers, e.g., 123, 123.456. + match: /\b\d[\d_]*(\.\d[\d_]*)?/ + }, { // Hexadecimal notation, e.g., $7F. - begin: "\\$[0-9A-Fa-f]+" + match: /\$[\dA-Fa-f_]+/ + }, + { + // Hexadecimal literal with no digits + match: /\$/, + relevance: 0 }, { // Octal notation, e.g., &42. - begin: "&[0-7]+" + match: /&[0-7][0-7_]*/ }, { // Binary notation, e.g., %1010. - begin: "%[01]+" + match: /%[01_]+/ + }, + { + // Binary literal with no digits + match: /%/, + relevance: 0 } ] }; const CHAR_STRING = { className: "string", - begin: /(#\d+)+/ + variants: [ + { match: /#\d[\d_]*/ }, + { match: /#\$[\dA-Fa-f][\dA-Fa-f_]*/ }, + { match: /#&[0-7][0-7_]*/ }, + { match: /#%[01][01_]*/ } + ] }; const CLASS = { begin: hljs.IDENT_RE + "\\s*=\\s*class\\s*\\(", @@ -95661,7 +95938,6 @@ ${events.lines.join("\n")} contains: [ STRING, CHAR_STRING, - hljs.NUMBER_MODE, NUMBER, CLASS, FUNCTION, @@ -97335,6 +97611,10 @@ ${events.lines.join("\n")} } ] }; + const CHAR_LITERAL = { + scope: "string", + match: /\$(\\([^0-9]|[0-9]{1,3}|)|.)/ + }; const BLOCK_STATEMENTS = { beginKeywords: "fun receive if try case", end: "end", @@ -97351,7 +97631,8 @@ ${events.lines.join("\n")} TUPLE, VAR1, VAR2, - RECORD_ACCESS + RECORD_ACCESS, + CHAR_LITERAL ]; const BASIC_MODES = [ COMMENT3, @@ -97363,7 +97644,8 @@ ${events.lines.join("\n")} TUPLE, VAR1, VAR2, - RECORD_ACCESS + RECORD_ACCESS, + CHAR_LITERAL ]; FUNCTION_CALL.contains[1].contains = BASIC_MODES; TUPLE.contains = BASIC_MODES; @@ -97438,6 +97720,7 @@ ${events.lines.join("\n")} VAR1, VAR2, TUPLE, + CHAR_LITERAL, { begin: /\.$/ } // relevance booster ] @@ -98646,6 +98929,7 @@ ${events.lines.join("\n")} "f95" ], keywords: { + $pattern: /\b[a-z][a-z0-9_]+\b|\.[a-z][a-z0-9_]+\./, keyword: KEYWORDS, literal: LITERALS2, built_in: BUILT_INS @@ -99487,7 +99771,7 @@ ${events.lines.join("\n")} excludeEnd: true, contains: [].concat(PARSE_PARAMS) }, - inherits || {} + {} ); mode.contains.push(FUNCTION_DEF); mode.contains.push(hljs.C_NUMBER_MODE); @@ -99782,10 +100066,12 @@ ${events.lines.join("\n")} "globalvar", "if", "mod", + "new", "not", "or", "repeat", "return", + "static", "switch", "then", "until", @@ -99796,47 +100082,18 @@ ${events.lines.join("\n")} ]; const BUILT_INS = [ "abs", - "achievement_available", - "achievement_event", - "achievement_get_challenges", - "achievement_get_info", - "achievement_get_pic", - "achievement_increment", - "achievement_load_friends", - "achievement_load_leaderboard", - "achievement_load_progress", - "achievement_login", - "achievement_login_status", - "achievement_logout", - "achievement_post", - "achievement_post_score", - "achievement_reset", - "achievement_send_challenge", - "achievement_show", - "achievement_show_achievements", - "achievement_show_challenge_notifications", - "achievement_show_leaderboards", - "action_inherited", - "action_kill_object", - "ads_disable", - "ads_enable", - "ads_engagement_active", - "ads_engagement_available", - "ads_engagement_launch", - "ads_event", - "ads_event_preload", - "ads_get_display_height", - "ads_get_display_width", - "ads_interstitial_available", - "ads_interstitial_display", - "ads_move", - "ads_set_reward_callback", - "ads_setup", "alarm_get", "alarm_set", - "analytics_event", - "analytics_event_ext", "angle_difference", + "animcurve_channel_evaluate", + "animcurve_channel_new", + "animcurve_create", + "animcurve_destroy", + "animcurve_exists", + "animcurve_get", + "animcurve_get_channel", + "animcurve_get_channel_index", + "animcurve_point_new", "ansi_char", "application_get_position", "application_surface_draw_enable", @@ -99846,21 +100103,55 @@ ${events.lines.join("\n")} "arcsin", "arctan", "arctan2", + "array_all", + "array_any", + "array_concat", + "array_contains", + "array_contains_ext", "array_copy", + "array_copy_while", "array_create", + "array_create_ext", "array_delete", "array_equals", - "array_height_2d", + "array_filter", + "array_filter_ext", + "array_find_index", + "array_first", + "array_foreach", + "array_get", + "array_get_index", "array_insert", + "array_intersection", + "array_last", "array_length", - "array_length_1d", - "array_length_2d", + "array_map", + "array_map_ext", "array_pop", "array_push", + "array_reduce", "array_resize", + "array_reverse", + "array_reverse_ext", + "array_set", + "array_shuffle", + "array_shuffle_ext", "array_sort", + "array_union", + "array_unique", + "array_unique_ext", + "asset_add_tags", + "asset_clear_tags", + "asset_get_ids", "asset_get_index", + "asset_get_tags", "asset_get_type", + "asset_has_any_tag", + "asset_has_tags", + "asset_remove_tags", + "audio_bus_clear_emitters", + "audio_bus_create", + "audio_bus_get_emitters", "audio_channel_num", "audio_create_buffer_sound", "audio_create_play_queue", @@ -99869,11 +100160,14 @@ ${events.lines.join("\n")} "audio_debug", "audio_destroy_stream", "audio_destroy_sync_group", + "audio_effect_create", + "audio_emitter_bus", "audio_emitter_create", "audio_emitter_exists", "audio_emitter_falloff", "audio_emitter_free", "audio_emitter_gain", + "audio_emitter_get_bus", "audio_emitter_get_gain", "audio_emitter_get_listener_mask", "audio_emitter_get_pitch", @@ -99899,6 +100193,8 @@ ${events.lines.join("\n")} "audio_get_recorder_count", "audio_get_recorder_info", "audio_get_type", + "audio_group_get_assets", + "audio_group_get_gain", "audio_group_is_loaded", "audio_group_load", "audio_group_load_progress", @@ -99916,48 +100212,52 @@ ${events.lines.join("\n")} "audio_listener_set_velocity", "audio_listener_velocity", "audio_master_gain", - "audio_music_gain", - "audio_music_is_playing", "audio_pause_all", - "audio_pause_music", "audio_pause_sound", "audio_pause_sync_group", "audio_play_in_sync_group", - "audio_play_music", "audio_play_sound", "audio_play_sound_at", + "audio_play_sound_ext", "audio_play_sound_on", "audio_queue_sound", "audio_resume_all", - "audio_resume_music", "audio_resume_sound", "audio_resume_sync_group", "audio_set_listener_mask", "audio_set_master_gain", "audio_sound_gain", + "audio_sound_get_audio_group", "audio_sound_get_gain", "audio_sound_get_listener_mask", + "audio_sound_get_loop", + "audio_sound_get_loop_end", + "audio_sound_get_loop_start", "audio_sound_get_pitch", "audio_sound_get_track_position", + "audio_sound_is_playable", "audio_sound_length", + "audio_sound_loop", + "audio_sound_loop_end", + "audio_sound_loop_start", "audio_sound_pitch", "audio_sound_set_listener_mask", "audio_sound_set_track_position", "audio_start_recording", "audio_start_sync_group", "audio_stop_all", - "audio_stop_music", "audio_stop_recording", "audio_stop_sound", "audio_stop_sync_group", "audio_sync_group_debug", "audio_sync_group_get_track_pos", + "audio_sync_group_is_paused", "audio_sync_group_is_playing", - "audio_system", - "background_get_height", - "background_get_width", + "audio_system_is_available", + "audio_system_is_initialised", "base64_decode", "base64_encode", + "bool", "browser_input_capture", "buffer_async_group_begin", "buffer_async_group_end", @@ -99965,11 +100265,15 @@ ${events.lines.join("\n")} "buffer_base64_decode", "buffer_base64_decode_ext", "buffer_base64_encode", + "buffer_compress", "buffer_copy", "buffer_copy_from_vertex_buffer", + "buffer_copy_stride", + "buffer_crc32", "buffer_create", "buffer_create_from_vertex_buffer", "buffer_create_from_vertex_buffer_ext", + "buffer_decompress", "buffer_delete", "buffer_exists", "buffer_fill", @@ -99992,11 +100296,15 @@ ${events.lines.join("\n")} "buffer_save_ext", "buffer_seek", "buffer_set_surface", + "buffer_set_used_size", "buffer_sha1", "buffer_sizeof", "buffer_tell", "buffer_write", + "call_cancel", + "call_later", "camera_apply", + "camera_copy_transforms", "camera_create", "camera_create_view", "camera_destroy", @@ -100117,6 +100425,26 @@ ${events.lines.join("\n")} "date_valid_datetime", "date_week_span", "date_year_span", + "db_to_lin", + "dbg_add_font_glyphs", + "dbg_button", + "dbg_checkbox", + "dbg_color", + "dbg_colour", + "dbg_drop_down", + "dbg_same_line", + "dbg_section", + "dbg_section_delete", + "dbg_section_exists", + "dbg_slider", + "dbg_slider_int", + "dbg_sprite", + "dbg_text", + "dbg_text_input", + "dbg_view", + "dbg_view_delete", + "dbg_view_exists", + "dbg_watch", "dcos", "debug_event", "debug_get_callstack", @@ -100140,6 +100468,7 @@ ${events.lines.join("\n")} "directory_exists", "display_get_dpi_x", "display_get_dpi_y", + "display_get_frequency", "display_get_gui_height", "display_get_gui_width", "display_get_height", @@ -100166,10 +100495,6 @@ ${events.lines.join("\n")} "dot_product_normalised", "dot_product_normalized", "draw_arrow", - "draw_background", - "draw_background_ext", - "draw_background_part_ext", - "draw_background_tiled", "draw_button", "draw_circle", "draw_circle_color", @@ -100179,15 +100504,19 @@ ${events.lines.join("\n")} "draw_ellipse", "draw_ellipse_color", "draw_ellipse_colour", - "draw_enable_alphablend", "draw_enable_drawevent", + "draw_enable_skeleton_blendmodes", "draw_enable_swf_aa", "draw_flush", "draw_get_alpha", "draw_get_color", "draw_get_colour", + "draw_get_enable_skeleton_blendmodes", + "draw_get_font", + "draw_get_halign", "draw_get_lighting", "draw_get_swf_aa_level", + "draw_get_valign", "draw_getpixel", "draw_getpixel_ext", "draw_healthbar", @@ -100222,13 +100551,8 @@ ${events.lines.join("\n")} "draw_roundrect_ext", "draw_self", "draw_set_alpha", - "draw_set_alpha_test", - "draw_set_alpha_test_ref_value", - "draw_set_blend_mode", - "draw_set_blend_mode_ext", "draw_set_circle_precision", "draw_set_color", - "draw_set_color_write_enable", "draw_set_colour", "draw_set_font", "draw_set_halign", @@ -100313,6 +100637,7 @@ ${events.lines.join("\n")} "ds_grid_set_region", "ds_grid_shuffle", "ds_grid_sort", + "ds_grid_to_mp_grid", "ds_grid_value_disk_exists", "ds_grid_value_disk_x", "ds_grid_value_disk_y", @@ -100331,6 +100656,8 @@ ${events.lines.join("\n")} "ds_list_find_index", "ds_list_find_value", "ds_list_insert", + "ds_list_is_list", + "ds_list_is_map", "ds_list_mark_as_list", "ds_list_mark_as_map", "ds_list_read", @@ -100355,6 +100682,9 @@ ${events.lines.join("\n")} "ds_map_find_next", "ds_map_find_previous", "ds_map_find_value", + "ds_map_is_list", + "ds_map_is_map", + "ds_map_keys_to_array", "ds_map_read", "ds_map_replace", "ds_map_replace_list", @@ -100365,6 +100695,7 @@ ${events.lines.join("\n")} "ds_map_secure_save_buffer", "ds_map_set", "ds_map_size", + "ds_map_values_to_array", "ds_map_write", "ds_priority_add", "ds_priority_change_priority", @@ -100411,29 +100742,25 @@ ${events.lines.join("\n")} "effect_clear", "effect_create_above", "effect_create_below", + "effect_create_depth", + "effect_create_layer", "environment_get_variable", "event_inherited", "event_perform", + "event_perform_async", "event_perform_object", "event_user", + "exception_unhandled_handler", "exp", + "extension_exists", + "extension_get_option_count", + "extension_get_option_names", + "extension_get_option_value", + "extension_get_options", + "extension_get_version", "external_call", "external_define", "external_free", - "facebook_accesstoken", - "facebook_check_permission", - "facebook_dialog", - "facebook_graph_request", - "facebook_init", - "facebook_launch_offerwall", - "facebook_login", - "facebook_logout", - "facebook_post_message", - "facebook_request_publish_permissions", - "facebook_request_read_permissions", - "facebook_send_invite", - "facebook_status", - "facebook_user_id", "file_attributes", "file_bin_close", "file_bin_open", @@ -100475,23 +100802,38 @@ ${events.lines.join("\n")} "font_add_get_enable_aa", "font_add_sprite", "font_add_sprite_ext", + "font_cache_glyph", "font_delete", + "font_enable_effects", + "font_enable_sdf", "font_exists", "font_get_bold", "font_get_first", "font_get_fontname", + "font_get_info", "font_get_italic", "font_get_last", "font_get_name", + "font_get_sdf_enabled", + "font_get_sdf_spread", "font_get_size", "font_get_texture", "font_get_uvs", - "font_replace", "font_replace_sprite", "font_replace_sprite_ext", + "font_sdf_spread", "font_set_cache_size", - "font_texture_page_size", "frac", + "fx_create", + "fx_get_name", + "fx_get_parameter", + "fx_get_parameter_names", + "fx_get_parameters", + "fx_get_single_layer", + "fx_set_parameter", + "fx_set_parameters", + "fx_set_single_layer", + "game_change", "game_end", "game_get_speed", "game_load", @@ -100511,13 +100853,27 @@ ${events.lines.join("\n")} "gamepad_get_button_threshold", "gamepad_get_description", "gamepad_get_device_count", + "gamepad_get_guid", + "gamepad_get_mapping", + "gamepad_get_option", + "gamepad_hat_count", + "gamepad_hat_value", "gamepad_is_connected", "gamepad_is_supported", + "gamepad_remove_mapping", "gamepad_set_axis_deadzone", "gamepad_set_button_threshold", "gamepad_set_color", "gamepad_set_colour", + "gamepad_set_option", "gamepad_set_vibration", + "gamepad_test_mapping", + "gc_collect", + "gc_enable", + "gc_get_stats", + "gc_get_target_frame_time", + "gc_is_enabled", + "gc_target_frame_time", "gesture_double_tap_distance", "gesture_double_tap_time", "gesture_drag_distance", @@ -100550,10 +100906,13 @@ ${events.lines.join("\n")} "get_string", "get_string_async", "get_timer", + "gif_add_surface", + "gif_open", + "gif_save", + "gif_save_buffer", "gml_pragma", "gml_release_mode", "gpu_get_alphatestenable", - "gpu_get_alphatestfunc", "gpu_get_alphatestref", "gpu_get_blendenable", "gpu_get_blendmode", @@ -100566,8 +100925,8 @@ ${events.lines.join("\n")} "gpu_get_colorwriteenable", "gpu_get_colourwriteenable", "gpu_get_cullmode", + "gpu_get_depth", "gpu_get_fog", - "gpu_get_lightingenable", "gpu_get_state", "gpu_get_tex_filter", "gpu_get_tex_filter_ext", @@ -100595,7 +100954,6 @@ ${events.lines.join("\n")} "gpu_pop_state", "gpu_push_state", "gpu_set_alphatestenable", - "gpu_set_alphatestfunc", "gpu_set_alphatestref", "gpu_set_blendenable", "gpu_set_blendmode", @@ -100604,8 +100962,8 @@ ${events.lines.join("\n")} "gpu_set_colorwriteenable", "gpu_set_colourwriteenable", "gpu_set_cullmode", + "gpu_set_depth", "gpu_set_fog", - "gpu_set_lightingenable", "gpu_set_state", "gpu_set_tex_filter", "gpu_set_tex_filter_ext", @@ -100630,14 +100988,17 @@ ${events.lines.join("\n")} "gpu_set_zfunc", "gpu_set_ztestenable", "gpu_set_zwriteenable", + "handle_parse", "highscore_add", "highscore_clear", "highscore_name", "highscore_value", "http_get", "http_get_file", + "http_get_request_crossorigin", "http_post_string", "http_request", + "http_set_request_crossorigin", "iap_acquire", "iap_activate", "iap_consume", @@ -100663,7 +101024,6 @@ ${events.lines.join("\n")} "instance_activate_region", "instance_change", "instance_copy", - "instance_create", "instance_create_depth", "instance_create_layer", "instance_deactivate_all", @@ -100681,17 +101041,23 @@ ${events.lines.join("\n")} "instance_place_list", "instance_position", "instance_position_list", + "instanceof", "int64", "io_clear", "irandom", "irandom_range", "is_array", "is_bool", + "is_callable", + "is_debug_overlay_open", + "is_handle", "is_infinity", + "is_instanceof", "is_int32", "is_int64", - "is_matrix", + "is_keyboard_used_debug_overlay", "is_method", + "is_mouse_over_debug_overlay", "is_nan", "is_numeric", "is_ptr", @@ -100699,10 +101065,10 @@ ${events.lines.join("\n")} "is_string", "is_struct", "is_undefined", - "is_vec3", - "is_vec4", "json_decode", "json_encode", + "json_parse", + "json_stringify", "keyboard_check", "keyboard_check_direct", "keyboard_check_pressed", @@ -100747,19 +101113,23 @@ ${events.lines.join("\n")} "layer_background_vtiled", "layer_background_xscale", "layer_background_yscale", + "layer_clear_fx", "layer_create", "layer_depth", "layer_destroy", "layer_destroy_instances", "layer_element_move", + "layer_enable_fx", "layer_exists", "layer_force_draw_depth", + "layer_fx_is_enabled", "layer_get_all", "layer_get_all_elements", "layer_get_depth", "layer_get_element_layer", "layer_get_element_type", "layer_get_forced_depth", + "layer_get_fx", "layer_get_hspeed", "layer_get_id", "layer_get_id_at_depth", @@ -100779,6 +101149,33 @@ ${events.lines.join("\n")} "layer_reset_target_room", "layer_script_begin", "layer_script_end", + "layer_sequence_angle", + "layer_sequence_create", + "layer_sequence_destroy", + "layer_sequence_exists", + "layer_sequence_get_angle", + "layer_sequence_get_headdir", + "layer_sequence_get_headpos", + "layer_sequence_get_instance", + "layer_sequence_get_length", + "layer_sequence_get_sequence", + "layer_sequence_get_speedscale", + "layer_sequence_get_x", + "layer_sequence_get_xscale", + "layer_sequence_get_y", + "layer_sequence_get_yscale", + "layer_sequence_headdir", + "layer_sequence_headpos", + "layer_sequence_is_finished", + "layer_sequence_is_paused", + "layer_sequence_pause", + "layer_sequence_play", + "layer_sequence_speedscale", + "layer_sequence_x", + "layer_sequence_xscale", + "layer_sequence_y", + "layer_sequence_yscale", + "layer_set_fx", "layer_set_target_room", "layer_set_visible", "layer_shader", @@ -100837,6 +101234,7 @@ ${events.lines.join("\n")} "lengthdir_x", "lengthdir_y", "lerp", + "lin_to_db", "ln", "load_csv", "log10", @@ -100859,7 +101257,6 @@ ${events.lines.join("\n")} "matrix_set", "matrix_stack_clear", "matrix_stack_is_empty", - "matrix_stack_multiply", "matrix_stack_pop", "matrix_stack_push", "matrix_stack_set", @@ -100873,6 +101270,10 @@ ${events.lines.join("\n")} "median", "merge_color", "merge_colour", + "method", + "method_call", + "method_get_index", + "method_get_self", "min", "motion_add", "motion_set", @@ -100882,6 +101283,7 @@ ${events.lines.join("\n")} "mouse_clear", "mouse_wheel_down", "mouse_wheel_up", + "move_and_collide", "move_bounce_all", "move_bounce_solid", "move_contact_all", @@ -100913,8 +101315,11 @@ ${events.lines.join("\n")} "mp_potential_settings", "mp_potential_step", "mp_potential_step_object", + "nameof", "network_connect", + "network_connect_async", "network_connect_raw", + "network_connect_raw_async", "network_create_server", "network_create_server_raw", "network_create_socket", @@ -100929,7 +101334,6 @@ ${events.lines.join("\n")} "network_set_config", "network_set_timeout", "object_exists", - "object_get_depth", "object_get_mask", "object_get_name", "object_get_parent", @@ -100945,6 +101349,7 @@ ${events.lines.join("\n")} "object_set_sprite", "object_set_visible", "ord", + "os_check_permission", "os_get_config", "os_get_info", "os_get_language", @@ -100953,24 +101358,34 @@ ${events.lines.join("\n")} "os_is_paused", "os_lock_orientation", "os_powersave_enable", + "os_request_permission", + "os_set_orientation_lock", "parameter_count", "parameter_string", "part_emitter_burst", "part_emitter_clear", "part_emitter_create", + "part_emitter_delay", "part_emitter_destroy", "part_emitter_destroy_all", + "part_emitter_enable", "part_emitter_exists", + "part_emitter_interval", "part_emitter_region", + "part_emitter_relative", "part_emitter_stream", + "part_particles_burst", "part_particles_clear", "part_particles_count", "part_particles_create", "part_particles_create_color", "part_particles_create_colour", + "part_system_angle", "part_system_automatic_draw", "part_system_automatic_update", "part_system_clear", + "part_system_color", + "part_system_colour", "part_system_create", "part_system_create_layer", "part_system_depth", @@ -100978,7 +101393,9 @@ ${events.lines.join("\n")} "part_system_draw_order", "part_system_drawit", "part_system_exists", + "part_system_get_info", "part_system_get_layer", + "part_system_global_space", "part_system_layer", "part_system_position", "part_system_update", @@ -101010,9 +101427,14 @@ ${events.lines.join("\n")} "part_type_scale", "part_type_shape", "part_type_size", + "part_type_size_x", + "part_type_size_y", "part_type_speed", "part_type_sprite", "part_type_step", + "part_type_subimage", + "particle_exists", + "particle_get_info", "path_add", "path_add_point", "path_append", @@ -101035,7 +101457,6 @@ ${events.lines.join("\n")} "path_get_point_y", "path_get_precision", "path_get_speed", - "path_get_time", "path_get_x", "path_get_y", "path_insert_point", @@ -101162,10 +101583,6 @@ ${events.lines.join("\n")} "position_meeting", "power", "ptr", - "push_cancel_local_notification", - "push_get_first_local_notification", - "push_get_next_local_notification", - "push_local_notification", "radtodeg", "random", "random_get_seed", @@ -101177,11 +101594,33 @@ ${events.lines.join("\n")} "rectangle_in_circle", "rectangle_in_rectangle", "rectangle_in_triangle", + "ref_create", + "rollback_chat", + "rollback_create_game", + "rollback_define_extra_network_latency", + "rollback_define_input", + "rollback_define_input_frame_delay", + "rollback_define_mock_input", + "rollback_define_player", + "rollback_display_events", + "rollback_get_info", + "rollback_get_input", + "rollback_get_player_prefs", + "rollback_join_game", + "rollback_leave_game", + "rollback_set_player_prefs", + "rollback_start_game", + "rollback_sync_on_frame", + "rollback_use_late_join", + "rollback_use_manual_start", + "rollback_use_player_prefs", + "rollback_use_random_input", "room_add", "room_assign", "room_duplicate", "room_exists", "room_get_camera", + "room_get_info", "room_get_name", "room_get_viewport", "room_goto", @@ -101192,21 +101631,30 @@ ${events.lines.join("\n")} "room_next", "room_previous", "room_restart", - "room_set_background_color", - "room_set_background_colour", "room_set_camera", "room_set_height", "room_set_persistent", - "room_set_view", "room_set_view_enabled", "room_set_viewport", "room_set_width", "round", + "scheduler_resolution_get", + "scheduler_resolution_set", "screen_save", "screen_save_part", "script_execute", + "script_execute_ext", "script_exists", "script_get_name", + "sequence_create", + "sequence_destroy", + "sequence_exists", + "sequence_get", + "sequence_get_objects", + "sequence_instance_override_object", + "sequence_keyframe_new", + "sequence_keyframedata_new", + "sequence_track_new", "sha1_file", "sha1_string_unicode", "sha1_string_utf8", @@ -101220,6 +101668,7 @@ ${events.lines.join("\n")} "shader_set", "shader_set_uniform_f", "shader_set_uniform_f_array", + "shader_set_uniform_f_buffer", "shader_set_uniform_i", "shader_set_uniform_i_array", "shader_set_uniform_matrix", @@ -101227,6 +101676,7 @@ ${events.lines.join("\n")} "shaders_are_supported", "shop_leave_rating", "show_debug_message", + "show_debug_message_ext", "show_debug_overlay", "show_error", "show_message", @@ -101238,30 +101688,53 @@ ${events.lines.join("\n")} "skeleton_animation_clear", "skeleton_animation_get", "skeleton_animation_get_duration", + "skeleton_animation_get_event_frames", "skeleton_animation_get_ext", "skeleton_animation_get_frame", "skeleton_animation_get_frames", + "skeleton_animation_get_position", + "skeleton_animation_is_finished", + "skeleton_animation_is_looping", "skeleton_animation_list", "skeleton_animation_mix", "skeleton_animation_set", "skeleton_animation_set_ext", "skeleton_animation_set_frame", + "skeleton_animation_set_position", "skeleton_attachment_create", + "skeleton_attachment_create_color", + "skeleton_attachment_create_colour", + "skeleton_attachment_destroy", + "skeleton_attachment_exists", "skeleton_attachment_get", + "skeleton_attachment_replace", + "skeleton_attachment_replace_color", + "skeleton_attachment_replace_colour", "skeleton_attachment_set", "skeleton_bone_data_get", "skeleton_bone_data_set", + "skeleton_bone_list", "skeleton_bone_state_get", "skeleton_bone_state_set", "skeleton_collision_draw_set", + "skeleton_find_slot", "skeleton_get_bounds", "skeleton_get_minmax", "skeleton_get_num_bounds", + "skeleton_skin_create", "skeleton_skin_get", "skeleton_skin_list", "skeleton_skin_set", + "skeleton_slot_alpha_get", + "skeleton_slot_color_get", + "skeleton_slot_color_set", + "skeleton_slot_colour_get", + "skeleton_slot_colour_set", "skeleton_slot_data", + "skeleton_slot_data_instance", + "skeleton_slot_list", "sprite_add", + "sprite_add_ext", "sprite_add_from_surface", "sprite_assign", "sprite_collision_mask", @@ -101273,10 +101746,13 @@ ${events.lines.join("\n")} "sprite_flush_multi", "sprite_get_bbox_bottom", "sprite_get_bbox_left", + "sprite_get_bbox_mode", "sprite_get_bbox_right", "sprite_get_bbox_top", "sprite_get_height", + "sprite_get_info", "sprite_get_name", + "sprite_get_nineslice", "sprite_get_number", "sprite_get_speed", "sprite_get_speed_type", @@ -101287,136 +101763,88 @@ ${events.lines.join("\n")} "sprite_get_xoffset", "sprite_get_yoffset", "sprite_merge", + "sprite_nineslice_create", "sprite_prefetch", "sprite_prefetch_multi", "sprite_replace", "sprite_save", "sprite_save_strip", "sprite_set_alpha_from_sprite", + "sprite_set_bbox", + "sprite_set_bbox_mode", "sprite_set_cache_size", "sprite_set_cache_size_ext", + "sprite_set_nineslice", "sprite_set_offset", "sprite_set_speed", "sqr", "sqrt", - "steam_activate_overlay", - "steam_activate_overlay_browser", - "steam_activate_overlay_store", - "steam_activate_overlay_user", - "steam_available_languages", - "steam_clear_achievement", - "steam_create_leaderboard", - "steam_current_game_language", - "steam_download_friends_scores", - "steam_download_scores", - "steam_download_scores_around_user", - "steam_file_delete", - "steam_file_exists", - "steam_file_persisted", - "steam_file_read", - "steam_file_share", - "steam_file_size", - "steam_file_write", - "steam_file_write_file", - "steam_get_achievement", - "steam_get_app_id", - "steam_get_persona_name", - "steam_get_quota_free", - "steam_get_quota_total", - "steam_get_stat_avg_rate", - "steam_get_stat_float", - "steam_get_stat_int", - "steam_get_user_account_id", - "steam_get_user_persona_name", - "steam_get_user_steam_id", - "steam_initialised", - "steam_is_cloud_enabled_for_account", - "steam_is_cloud_enabled_for_app", - "steam_is_overlay_activated", - "steam_is_overlay_enabled", - "steam_is_screenshot_requested", - "steam_is_user_logged_on", - "steam_reset_all_stats", - "steam_reset_all_stats_achievements", - "steam_send_screenshot", - "steam_set_achievement", - "steam_set_stat_avg_rate", - "steam_set_stat_float", - "steam_set_stat_int", - "steam_stats_ready", - "steam_ugc_create_item", - "steam_ugc_create_query_all", - "steam_ugc_create_query_all_ex", - "steam_ugc_create_query_user", - "steam_ugc_create_query_user_ex", - "steam_ugc_download", - "steam_ugc_get_item_install_info", - "steam_ugc_get_item_update_info", - "steam_ugc_get_item_update_progress", - "steam_ugc_get_subscribed_items", - "steam_ugc_num_subscribed_items", - "steam_ugc_query_add_excluded_tag", - "steam_ugc_query_add_required_tag", - "steam_ugc_query_set_allow_cached_response", - "steam_ugc_query_set_cloud_filename_filter", - "steam_ugc_query_set_match_any_tag", - "steam_ugc_query_set_ranked_by_trend_days", - "steam_ugc_query_set_return_long_description", - "steam_ugc_query_set_return_total_only", - "steam_ugc_query_set_search_text", - "steam_ugc_request_item_details", - "steam_ugc_send_query", - "steam_ugc_set_item_content", - "steam_ugc_set_item_description", - "steam_ugc_set_item_preview", - "steam_ugc_set_item_tags", - "steam_ugc_set_item_title", - "steam_ugc_set_item_visibility", - "steam_ugc_start_item_update", - "steam_ugc_submit_item_update", - "steam_ugc_subscribe_item", - "steam_ugc_unsubscribe_item", - "steam_upload_score", - "steam_upload_score_buffer", - "steam_upload_score_buffer_ext", - "steam_upload_score_ext", - "steam_user_installed_dlc", - "steam_user_owns_dlc", + "static_get", + "static_set", "string", "string_byte_at", "string_byte_length", "string_char_at", + "string_concat", + "string_concat_ext", "string_copy", "string_count", "string_delete", "string_digits", + "string_ends_with", + "string_ext", + "string_foreach", "string_format", "string_hash_to_newline", "string_height", "string_height_ext", "string_insert", + "string_join", + "string_join_ext", + "string_last_pos", + "string_last_pos_ext", "string_length", "string_letters", "string_lettersdigits", "string_lower", "string_ord_at", "string_pos", + "string_pos_ext", "string_repeat", "string_replace", "string_replace_all", "string_set_byte_at", + "string_split", + "string_split_ext", + "string_starts_with", + "string_trim", + "string_trim_end", + "string_trim_start", "string_upper", "string_width", "string_width_ext", + "struct_exists", + "struct_foreach", + "struct_get", + "struct_get_from_hash", + "struct_get_names", + "struct_names_count", + "struct_remove", + "struct_set", + "struct_set_from_hash", "surface_copy", "surface_copy_part", "surface_create", "surface_create_ext", "surface_depth_disable", "surface_exists", + "surface_format_is_supported", "surface_free", "surface_get_depth_disable", + "surface_get_format", "surface_get_height", + "surface_get_target", + "surface_get_target_ext", "surface_get_texture", "surface_get_width", "surface_getpixel", @@ -101427,14 +101855,29 @@ ${events.lines.join("\n")} "surface_save_part", "surface_set_target", "surface_set_target_ext", + "tag_get_asset_ids", + "tag_get_assets", "tan", + "texture_debug_messages", + "texture_flush", "texture_get_height", "texture_get_texel_height", "texture_get_texel_width", "texture_get_uvs", "texture_get_width", "texture_global_scale", + "texture_is_ready", + "texture_prefetch", "texture_set_stage", + "texturegroup_get_fonts", + "texturegroup_get_names", + "texturegroup_get_sprites", + "texturegroup_get_status", + "texturegroup_get_textures", + "texturegroup_get_tilesets", + "texturegroup_load", + "texturegroup_set_mode", + "texturegroup_unload", "tile_get_empty", "tile_get_flip", "tile_get_index", @@ -101463,10 +101906,35 @@ ${events.lines.join("\n")} "tilemap_set", "tilemap_set_at_pixel", "tilemap_set_global_mask", + "tilemap_set_height", "tilemap_set_mask", + "tilemap_set_width", "tilemap_tileset", "tilemap_x", "tilemap_y", + "tileset_get_info", + "tileset_get_name", + "tileset_get_texture", + "tileset_get_uvs", + "time_bpm_to_seconds", + "time_seconds_to_bpm", + "time_source_create", + "time_source_destroy", + "time_source_exists", + "time_source_get_children", + "time_source_get_parent", + "time_source_get_period", + "time_source_get_reps_completed", + "time_source_get_reps_remaining", + "time_source_get_state", + "time_source_get_time_remaining", + "time_source_get_units", + "time_source_pause", + "time_source_reconfigure", + "time_source_reset", + "time_source_resume", + "time_source_start", + "time_source_stop", "timeline_add", "timeline_clear", "timeline_delete", @@ -101481,12 +101949,33 @@ ${events.lines.join("\n")} "url_open", "url_open_ext", "url_open_full", + "uwp_device_touchscreen_available", + "uwp_livetile_badge_clear", + "uwp_livetile_badge_notification", + "uwp_livetile_notification_begin", + "uwp_livetile_notification_end", + "uwp_livetile_notification_expiry", + "uwp_livetile_notification_image_add", + "uwp_livetile_notification_secondary_begin", + "uwp_livetile_notification_tag", + "uwp_livetile_notification_template_add", + "uwp_livetile_notification_text_add", + "uwp_livetile_queue_enable", + "uwp_livetile_tile_clear", + "uwp_secondarytile_badge_clear", + "uwp_secondarytile_badge_notification", + "uwp_secondarytile_delete", + "uwp_secondarytile_pin", + "uwp_secondarytile_tile_clear", + "variable_clone", + "variable_get_hash", "variable_global_exists", "variable_global_get", "variable_global_set", "variable_instance_exists", "variable_instance_get", "variable_instance_get_names", + "variable_instance_names_count", "variable_instance_set", "variable_struct_exists", "variable_struct_get", @@ -101515,10 +102004,10 @@ ${events.lines.join("\n")} "vertex_format_add_position", "vertex_format_add_position_3d", "vertex_format_add_texcoord", - "vertex_format_add_textcoord", "vertex_format_begin", "vertex_format_delete", "vertex_format_end", + "vertex_format_get_info", "vertex_freeze", "vertex_get_buffer_size", "vertex_get_number", @@ -101526,8 +102015,25 @@ ${events.lines.join("\n")} "vertex_position", "vertex_position_3d", "vertex_submit", + "vertex_submit_ext", "vertex_texcoord", "vertex_ubyte4", + "vertex_update_buffer_from_buffer", + "vertex_update_buffer_from_vertex", + "video_close", + "video_draw", + "video_enable_loop", + "video_get_duration", + "video_get_format", + "video_get_position", + "video_get_status", + "video_get_volume", + "video_is_looping", + "video_open", + "video_pause", + "video_resume", + "video_seek_to", + "video_set_volume", "view_get_camera", "view_get_hport", "view_get_surface_id", @@ -101546,58 +102052,35 @@ ${events.lines.join("\n")} "virtual_key_delete", "virtual_key_hide", "virtual_key_show", - "win8_appbar_add_element", - "win8_appbar_enable", - "win8_appbar_remove_element", - "win8_device_touchscreen_available", - "win8_license_initialize_sandbox", - "win8_license_trial_version", - "win8_livetile_badge_clear", - "win8_livetile_badge_notification", - "win8_livetile_notification_begin", - "win8_livetile_notification_end", - "win8_livetile_notification_expiry", - "win8_livetile_notification_image_add", - "win8_livetile_notification_secondary_begin", - "win8_livetile_notification_tag", - "win8_livetile_notification_text_add", - "win8_livetile_queue_enable", - "win8_livetile_tile_clear", - "win8_livetile_tile_notification", - "win8_search_add_suggestions", - "win8_search_disable", - "win8_search_enable", - "win8_secondarytile_badge_notification", - "win8_secondarytile_delete", - "win8_secondarytile_pin", - "win8_settingscharm_add_entry", - "win8_settingscharm_add_html_entry", - "win8_settingscharm_add_xaml_entry", - "win8_settingscharm_get_xaml_property", - "win8_settingscharm_remove_entry", - "win8_settingscharm_set_xaml_property", - "win8_share_file", - "win8_share_image", - "win8_share_screenshot", - "win8_share_text", - "win8_share_url", + "wallpaper_set_config", + "wallpaper_set_subscriptions", + "weak_ref_alive", + "weak_ref_any_alive", + "weak_ref_create", "window_center", "window_device", + "window_enable_borderless_fullscreen", + "window_get_borderless_fullscreen", "window_get_caption", "window_get_color", "window_get_colour", "window_get_cursor", "window_get_fullscreen", "window_get_height", + "window_get_showborder", "window_get_visible_rects", "window_get_width", "window_get_x", "window_get_y", "window_handle", "window_has_focus", + "window_mouse_get_delta_x", + "window_mouse_get_delta_y", + "window_mouse_get_locked", "window_mouse_get_x", "window_mouse_get_y", "window_mouse_set", + "window_mouse_set_locked", "window_set_caption", "window_set_color", "window_set_colour", @@ -101609,105 +102092,74 @@ ${events.lines.join("\n")} "window_set_min_width", "window_set_position", "window_set_rectangle", + "window_set_showborder", "window_set_size", "window_view_mouse_get_x", "window_view_mouse_get_y", "window_views_mouse_get_x", "window_views_mouse_get_y", - "winphone_license_trial_version", - "winphone_tile_back_content", - "winphone_tile_back_content_wide", - "winphone_tile_back_image", - "winphone_tile_back_image_wide", - "winphone_tile_back_title", "winphone_tile_background_color", "winphone_tile_background_colour", - "winphone_tile_count", - "winphone_tile_cycle_images", - "winphone_tile_front_image", - "winphone_tile_front_image_small", - "winphone_tile_front_image_wide", - "winphone_tile_icon_image", - "winphone_tile_small_background_image", - "winphone_tile_small_icon_image", - "winphone_tile_title", - "winphone_tile_wide_content", - "zip_unzip" - ]; - const LITERALS2 = [ - "all", - "false", - "noone", - "pointer_invalid", - "pointer_null", - "true", - "undefined" + "zip_add_file", + "zip_create", + "zip_save", + "zip_unzip", + "zip_unzip_async" ]; const SYMBOLS = [ - "ANSI_CHARSET", - "ARABIC_CHARSET", - "BALTIC_CHARSET", - "CHINESEBIG5_CHARSET", - "DEFAULT_CHARSET", - "EASTEUROPE_CHARSET", - "GB2312_CHARSET", + "AudioEffect", + "AudioEffectType", + "AudioLFOType", "GM_build_date", + "GM_build_type", + "GM_is_sandboxed", + "GM_project_filename", "GM_runtime_version", "GM_version", - "GREEK_CHARSET", - "HANGEUL_CHARSET", - "HEBREW_CHARSET", - "JOHAB_CHARSET", - "MAC_CHARSET", - "OEM_CHARSET", - "RUSSIAN_CHARSET", - "SHIFTJIS_CHARSET", - "SYMBOL_CHARSET", - "THAI_CHARSET", - "TURKISH_CHARSET", - "VIETNAMESE_CHARSET", - "achievement_achievement_info", - "achievement_filter_all_players", - "achievement_filter_favorites_only", - "achievement_filter_friends_only", - "achievement_friends_info", - "achievement_leaderboard_info", - "achievement_our_info", - "achievement_pic_loaded", - "achievement_show_achievement", - "achievement_show_bank", - "achievement_show_friend_picker", - "achievement_show_leaderboard", - "achievement_show_profile", - "achievement_show_purchase_prompt", - "achievement_show_ui", - "achievement_type_achievement_challenge", - "achievement_type_score_challenge", + "NaN", + "_GMFILE_", + "_GMFUNCTION_", + "_GMLINE_", + "alignmentH", + "alignmentV", + "all", + "animcurvetype_bezier", + "animcurvetype_catmullrom", + "animcurvetype_linear", + "asset_animationcurve", "asset_font", "asset_object", "asset_path", "asset_room", "asset_script", + "asset_sequence", "asset_shader", "asset_sound", "asset_sprite", "asset_tiles", "asset_timeline", "asset_unknown", - "audio_3d", + "audio_3D", + "audio_bus_main", "audio_falloff_exponent_distance", "audio_falloff_exponent_distance_clamped", + "audio_falloff_exponent_distance_scaled", "audio_falloff_inverse_distance", "audio_falloff_inverse_distance_clamped", + "audio_falloff_inverse_distance_scaled", "audio_falloff_linear_distance", "audio_falloff_linear_distance_clamped", "audio_falloff_none", "audio_mono", - "audio_new_system", - "audio_old_system", "audio_stereo", + "bboxkind_diamond", + "bboxkind_ellipse", + "bboxkind_precise", + "bboxkind_rectangular", + "bboxmode_automatic", + "bboxmode_fullimage", + "bboxmode_manual", "bm_add", - "bm_complex", "bm_dest_alpha", "bm_dest_color", "bm_dest_colour", @@ -101744,12 +102196,7 @@ ${events.lines.join("\n")} "buffer_f64", "buffer_fast", "buffer_fixed", - "buffer_generalerror", "buffer_grow", - "buffer_invalidtype", - "buffer_network", - "buffer_outofbounds", - "buffer_outofspace", "buffer_s16", "buffer_s32", "buffer_s8", @@ -101757,7 +102204,6 @@ ${events.lines.join("\n")} "buffer_seek_relative", "buffer_seek_start", "buffer_string", - "buffer_surface_copy", "buffer_text", "buffer_u16", "buffer_u32", @@ -101765,16 +102211,18 @@ ${events.lines.join("\n")} "buffer_u8", "buffer_vbuffer", "buffer_wrap", - "button_type", "c_aqua", "c_black", "c_blue", "c_dkgray", + "c_dkgrey", "c_fuchsia", "c_gray", "c_green", + "c_grey", "c_lime", "c_ltgray", + "c_ltgrey", "c_maroon", "c_navy", "c_olive", @@ -101785,6 +102233,8 @@ ${events.lines.join("\n")} "c_teal", "c_white", "c_yellow", + "cache_directory", + "characterSpacing", "cmpfunc_always", "cmpfunc_equal", "cmpfunc_greater", @@ -101793,6 +102243,8 @@ ${events.lines.join("\n")} "cmpfunc_lessequal", "cmpfunc_never", "cmpfunc_notequal", + "coreColor", + "coreColour", "cr_appstart", "cr_arrow", "cr_beam", @@ -101827,6 +102279,8 @@ ${events.lines.join("\n")} "display_portrait_flipped", "dll_cdecl", "dll_stdcall", + "dropShadowEnabled", + "dropShadowEnabled", "ds_type_grid", "ds_type_list", "ds_type_map", @@ -101845,18 +102299,49 @@ ${events.lines.join("\n")} "ef_snow", "ef_spark", "ef_star", - // for example ev_ are types of events + "effectsEnabled", + "effectsEnabled", "ev_alarm", "ev_animation_end", + "ev_animation_event", + "ev_animation_update", + "ev_async_audio_playback", + "ev_async_audio_playback_ended", + "ev_async_audio_recording", + "ev_async_dialog", + "ev_async_push_notification", + "ev_async_save_load", + "ev_async_save_load", + "ev_async_social", + "ev_async_system_event", + "ev_async_web", + "ev_async_web_cloud", + "ev_async_web_iap", + "ev_async_web_image_load", + "ev_async_web_networking", + "ev_async_web_steam", + "ev_audio_playback", + "ev_audio_playback_ended", + "ev_audio_recording", "ev_boundary", + "ev_boundary_view0", + "ev_boundary_view1", + "ev_boundary_view2", + "ev_boundary_view3", + "ev_boundary_view4", + "ev_boundary_view5", + "ev_boundary_view6", + "ev_boundary_view7", + "ev_broadcast_message", "ev_cleanup", - "ev_close_button", "ev_collision", "ev_create", "ev_destroy", + "ev_dialog_async", "ev_draw", "ev_draw_begin", "ev_draw_end", + "ev_draw_normal", "ev_draw_post", "ev_draw_pre", "ev_end_of_path", @@ -101944,18 +102429,36 @@ ${events.lines.join("\n")} "ev_no_more_lives", "ev_other", "ev_outside", + "ev_outside_view0", + "ev_outside_view1", + "ev_outside_view2", + "ev_outside_view3", + "ev_outside_view4", + "ev_outside_view5", + "ev_outside_view6", + "ev_outside_view7", + "ev_pre_create", + "ev_push_notification", "ev_right_button", "ev_right_press", "ev_right_release", "ev_room_end", "ev_room_start", + "ev_social", "ev_step", "ev_step_begin", "ev_step_end", "ev_step_normal", + "ev_system_event", "ev_trigger", "ev_user0", "ev_user1", + "ev_user10", + "ev_user11", + "ev_user12", + "ev_user13", + "ev_user14", + "ev_user15", "ev_user2", "ev_user3", "ev_user4", @@ -101964,12 +102467,13 @@ ${events.lines.join("\n")} "ev_user7", "ev_user8", "ev_user9", - "ev_user10", - "ev_user11", - "ev_user12", - "ev_user13", - "ev_user14", - "ev_user15", + "ev_web_async", + "ev_web_cloud", + "ev_web_iap", + "ev_web_image_load", + "ev_web_networking", + "ev_web_sound_load", + "ev_web_steam", "fa_archive", "fa_bottom", "fa_center", @@ -101977,21 +102481,34 @@ ${events.lines.join("\n")} "fa_hidden", "fa_left", "fa_middle", + "fa_none", "fa_readonly", "fa_right", "fa_sysfile", "fa_top", "fa_volumeid", - "fb_login_default", - "fb_login_fallback_to_webview", - "fb_login_forcing_safari", - "fb_login_forcing_webview", - "fb_login_no_fallback_to_webview", - "fb_login_use_system_account", + "false", + "frameSizeX", + "frameSizeY", "gamespeed_fps", "gamespeed_microseconds", - "ge_lose", "global", + "glowColor", + "glowColour", + "glowEnabled", + "glowEnabled", + "glowEnd", + "glowStart", + "gp_axis_acceleration_x", + "gp_axis_acceleration_y", + "gp_axis_acceleration_z", + "gp_axis_angular_velocity_x", + "gp_axis_angular_velocity_y", + "gp_axis_angular_velocity_z", + "gp_axis_orientation_w", + "gp_axis_orientation_x", + "gp_axis_orientation_y", + "gp_axis_orientation_z", "gp_axislh", "gp_axislv", "gp_axisrh", @@ -102031,7 +102548,7 @@ ${events.lines.join("\n")} "iap_storeload_failed", "iap_storeload_ok", "iap_unavailable", - "input_type", + "infinity", "kbv_autocapitalize_characters", "kbv_autocapitalize_none", "kbv_autocapitalize_sentences", @@ -102059,22 +102576,22 @@ ${events.lines.join("\n")} "layerelementtype_instance", "layerelementtype_oldtilemap", "layerelementtype_particlesystem", + "layerelementtype_sequence", "layerelementtype_sprite", "layerelementtype_tile", "layerelementtype_tilemap", "layerelementtype_undefined", - "lb_disp_none", - "lb_disp_numeric", - "lb_disp_time_ms", - "lb_disp_time_sec", - "lb_sort_ascending", - "lb_sort_descending", - "lb_sort_none", "leaderboard_type_number", "leaderboard_type_time_mins_secs", "lighttype_dir", "lighttype_point", - "local", + "lineSpacing", + "m_axisx", + "m_axisx_gui", + "m_axisy", + "m_axisy_gui", + "m_scroll_down", + "m_scroll_up", "matrix_projection", "matrix_view", "matrix_world", @@ -102083,52 +102600,83 @@ ${events.lines.join("\n")} "mb_middle", "mb_none", "mb_right", + "mb_side1", + "mb_side2", "mip_markedonly", "mip_off", "mip_on", + "network_config_avoid_time_wait", "network_config_connect_timeout", + "network_config_disable_multicast", "network_config_disable_reliable_udp", + "network_config_enable_multicast", "network_config_enable_reliable_udp", "network_config_use_non_blocking_socket", + "network_config_websocket_protocol", + "network_connect_active", + "network_connect_blocking", + "network_connect_nonblocking", + "network_connect_none", + "network_connect_passive", + "network_send_binary", + "network_send_text", "network_socket_bluetooth", "network_socket_tcp", "network_socket_udp", + "network_socket_ws", + "network_socket_wss", "network_type_connect", "network_type_data", "network_type_disconnect", + "network_type_down", "network_type_non_blocking_connect", - "of_challen", + "network_type_up", + "network_type_up_failed", + "nineslice_blank", + "nineslice_bottom", + "nineslice_center", + "nineslice_centre", + "nineslice_hide", + "nineslice_left", + "nineslice_mirror", + "nineslice_repeat", + "nineslice_right", + "nineslice_stretch", + "nineslice_top", + "noone", + "of_challenge_lose", "of_challenge_tie", "of_challenge_win", - "os_3ds", "os_android", - "os_bb10", + "os_gdk", + "os_gxgames", "os_ios", "os_linux", "os_macosx", + "os_operagx", + "os_permission_denied", + "os_permission_denied_dont_request", + "os_permission_granted", "os_ps3", "os_ps4", + "os_ps5", "os_psvita", "os_switch", - "os_symbian", - "os_tizen", "os_tvos", "os_unknown", "os_uwp", - "os_wiiu", - "os_win32", "os_win8native", "os_windows", "os_winphone", - "os_xbox360", "os_xboxone", + "os_xboxseriesxs", "other", - "ov_achievements", - "ov_community", - "ov_friends", - "ov_gamegroup", - "ov_players", - "ov_settings", + "outlineColor", + "outlineColour", + "outlineDist", + "outlineEnabled", + "outlineEnabled", + "paragraphSpacing", "path_action_continue", "path_action_restart", "path_action_reverse", @@ -102184,6 +102732,8 @@ ${events.lines.join("\n")} "phy_particle_group_flag_rigid", "phy_particle_group_flag_solid", "pi", + "pointer_invalid", + "pointer_null", "pr_linelist", "pr_linestrip", "pr_pointlist", @@ -102193,6 +102743,8 @@ ${events.lines.join("\n")} "ps_distr_gaussian", "ps_distr_invgaussian", "ps_distr_linear", + "ps_mode_burst", + "ps_mode_stream", "ps_shape_diamond", "ps_shape_ellipse", "ps_shape_line", @@ -102211,68 +102763,110 @@ ${events.lines.join("\n")} "pt_shape_sphere", "pt_shape_square", "pt_shape_star", + "rollback_chat_message", + "rollback_connect_error", + "rollback_connect_info", + "rollback_connected_to_peer", + "rollback_connection_rejected", + "rollback_disconnected_from_peer", + "rollback_end_game", + "rollback_game_full", + "rollback_game_info", + "rollback_game_interrupted", + "rollback_game_resumed", + "rollback_high_latency", + "rollback_player_prefs", + "rollback_protocol_rejected", + "rollback_synchronized_with_peer", + "rollback_synchronizing_with_peer", + "self", + "seqaudiokey_loop", + "seqaudiokey_oneshot", + "seqdir_left", + "seqdir_right", + "seqinterpolation_assign", + "seqinterpolation_lerp", + "seqplay_loop", + "seqplay_oneshot", + "seqplay_pingpong", + "seqtextkey_bottom", + "seqtextkey_center", + "seqtextkey_justify", + "seqtextkey_left", + "seqtextkey_middle", + "seqtextkey_right", + "seqtextkey_top", + "seqtracktype_audio", + "seqtracktype_bool", + "seqtracktype_clipmask", + "seqtracktype_clipmask_mask", + "seqtracktype_clipmask_subject", + "seqtracktype_color", + "seqtracktype_colour", + "seqtracktype_empty", + "seqtracktype_graphic", + "seqtracktype_group", + "seqtracktype_instance", + "seqtracktype_message", + "seqtracktype_moment", + "seqtracktype_particlesystem", + "seqtracktype_real", + "seqtracktype_sequence", + "seqtracktype_spriteframes", + "seqtracktype_string", + "seqtracktype_text", + "shadowColor", + "shadowColour", + "shadowOffsetX", + "shadowOffsetY", + "shadowSoftness", + "sprite_add_ext_error_cancelled", + "sprite_add_ext_error_decompressfailed", + "sprite_add_ext_error_loadfailed", + "sprite_add_ext_error_setupfailed", + "sprite_add_ext_error_spritenotfound", + "sprite_add_ext_error_unknown", "spritespeed_framespergameframe", "spritespeed_framespersecond", - "text_type", + "surface_r16float", + "surface_r32float", + "surface_r8unorm", + "surface_rg8unorm", + "surface_rgba16float", + "surface_rgba32float", + "surface_rgba4unorm", + "surface_rgba8unorm", + "texturegroup_status_fetched", + "texturegroup_status_loaded", + "texturegroup_status_loading", + "texturegroup_status_unloaded", "tf_anisotropic", "tf_linear", "tf_point", + "thickness", "tile_flip", "tile_index_mask", "tile_mirror", "tile_rotate", + "time_source_expire_after", + "time_source_expire_nearest", + "time_source_game", + "time_source_global", + "time_source_state_active", + "time_source_state_initial", + "time_source_state_paused", + "time_source_state_stopped", + "time_source_units_frames", + "time_source_units_seconds", "timezone_local", "timezone_utc", "tm_countvsyncs", "tm_sleep", + "tm_systemtiming", + "true", "ty_real", "ty_string", - "ugc_filetype_community", - "ugc_filetype_microtrans", - "ugc_list_Favorited", - "ugc_list_Followed", - "ugc_list_Published", - "ugc_list_Subscribed", - "ugc_list_UsedOrPlayed", - "ugc_list_VotedDown", - "ugc_list_VotedOn", - "ugc_list_VotedUp", - "ugc_list_WillVoteLater", - "ugc_match_AllGuides", - "ugc_match_Artwork", - "ugc_match_Collections", - "ugc_match_ControllerBindings", - "ugc_match_IntegratedGuides", - "ugc_match_Items", - "ugc_match_Items_Mtx", - "ugc_match_Items_ReadyToUse", - "ugc_match_Screenshots", - "ugc_match_UsableInGame", - "ugc_match_Videos", - "ugc_match_WebGuides", - "ugc_query_AcceptedForGameRankedByAcceptanceDate", - "ugc_query_CreatedByFollowedUsersRankedByPublicationDate", - "ugc_query_CreatedByFriendsRankedByPublicationDate", - "ugc_query_FavoritedByFriendsRankedByPublicationDate", - "ugc_query_NotYetRated", - "ugc_query_RankedByNumTimesReported", - "ugc_query_RankedByPublicationDate", - "ugc_query_RankedByTextSearch", - "ugc_query_RankedByTotalVotesAsc", - "ugc_query_RankedByTrend", - "ugc_query_RankedByVote", - "ugc_query_RankedByVotesUp", - "ugc_result_success", - "ugc_sortorder_CreationOrderAsc", - "ugc_sortorder_CreationOrderDesc", - "ugc_sortorder_ForModeration", - "ugc_sortorder_LastUpdatedDesc", - "ugc_sortorder_SubscriptionDateDesc", - "ugc_sortorder_TitleAsc", - "ugc_sortorder_VoteScoreDesc", - "ugc_visibility_friends_only", - "ugc_visibility_private", - "ugc_visibility_public", + "undefined", "vertex_type_color", "vertex_type_colour", "vertex_type_float1", @@ -102293,7 +102887,12 @@ ${events.lines.join("\n")} "vertex_usage_sample", "vertex_usage_tangent", "vertex_usage_texcoord", - "vertex_usage_textcoord", + "video_format_rgba", + "video_format_yuv", + "video_status_closed", + "video_status_paused", + "video_status_playing", + "video_status_preparing", "vk_add", "vk_alt", "vk_anykey", @@ -102307,6 +102906,9 @@ ${events.lines.join("\n")} "vk_enter", "vk_escape", "vk_f1", + "vk_f10", + "vk_f11", + "vk_f12", "vk_f2", "vk_f3", "vk_f4", @@ -102315,9 +102917,6 @@ ${events.lines.join("\n")} "vk_f7", "vk_f8", "vk_f9", - "vk_f10", - "vk_f11", - "vk_f12", "vk_home", "vk_insert", "vk_lalt", @@ -102349,7 +102948,10 @@ ${events.lines.join("\n")} "vk_space", "vk_subtract", "vk_tab", - "vk_up" + "vk_up", + "wallpaper_config", + "wallpaper_subscription_data", + "wrap" ]; const LANGUAGE_VARIABLES = [ "alarm", @@ -102372,7 +102974,6 @@ ${events.lines.join("\n")} "argument14", "argument15", "argument_count", - "argument_relative", "async_load", "background_color", "background_colour", @@ -102384,9 +102985,7 @@ ${events.lines.join("\n")} "bbox_top", "browser_height", "browser_width", - "caption_health", - "caption_lives", - "caption_score", + "colour?ColourTrack", "current_day", "current_hour", "current_minute", @@ -102401,13 +103000,13 @@ ${events.lines.join("\n")} "depth", "direction", "display_aa", - "error_last", - "error_occurred", + "drawn_by_sequence", "event_action", "event_data", "event_number", "event_object", "event_type", + "font_texture_page_size", "fps", "fps_real", "friction", @@ -102415,15 +103014,12 @@ ${events.lines.join("\n")} "game_id", "game_project_name", "game_save_id", - "gamemaker_pro", - "gamemaker_registered", - "gamemaker_version", "gravity", "gravity_direction", "health", "hspeed", "iap_data", - "id|0", + "id", "image_alpha", "image_angle", "image_blend", @@ -102432,6 +103028,8 @@ ${events.lines.join("\n")} "image_speed", "image_xscale", "image_yscale", + "in_collision_tree", + "in_sequence", "instance_count", "instance_id", "keyboard_key", @@ -102440,7 +103038,10 @@ ${events.lines.join("\n")} "keyboard_string", "layer", "lives", + "longMessage", + "managed", "mask_index", + "message", "mouse_button", "mouse_lastbutton", "mouse_x", @@ -102486,9 +103087,20 @@ ${events.lines.join("\n")} "phy_speed", "phy_speed_x", "phy_speed_y", + "player_avatar_sprite", + "player_avatar_url", + "player_id", + "player_local", + "player_type", + "player_user_id", "program_directory", + "rollback_api_server", + "rollback_confirmed_frame", + "rollback_current_frame", + "rollback_event_id", + "rollback_event_param", + "rollback_game_running", "room", - "room_caption", "room_first", "room_height", "room_last", @@ -102496,10 +103108,8 @@ ${events.lines.join("\n")} "room_speed", "room_width", "score", - "self", - "show_health", - "show_lives", - "show_score", + "script", + "sequence_instance", "solid", "speed", "sprite_height", @@ -102507,41 +103117,32 @@ ${events.lines.join("\n")} "sprite_width", "sprite_xoffset", "sprite_yoffset", + "stacktrace", "temp_directory", "timeline_index", "timeline_loop", "timeline_position", "timeline_running", "timeline_speed", - "view_angle", "view_camera", "view_current", "view_enabled", - "view_hborder", "view_hport", - "view_hspeed", - "view_hview", - "view_object", "view_surface_id", - "view_vborder", "view_visible", - "view_vspeed", "view_wport", - "view_wview", "view_xport", - "view_xview", "view_yport", - "view_yview", "visible", "vspeed", "webgl_enabled", "working_directory", + "x", "xprevious", "xstart", - "x|0", + "y", "yprevious", - "ystart", - "y|0" + "ystart" ]; return { name: "GML", @@ -102550,7 +103151,6 @@ ${events.lines.join("\n")} keywords: { keyword: KEYWORDS, built_in: BUILT_INS, - literal: LITERALS2, symbol: SYMBOLS, "variable.language": LANGUAGE_VARIABLES }, @@ -102673,10 +103273,30 @@ ${events.lines.join("\n")} className: "number", variants: [ { - begin: hljs.C_NUMBER_RE + "[i]", - relevance: 1 + match: /-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/, + // hex without a present digit before . (making a digit afterwards required) + relevance: 0 }, - hljs.C_NUMBER_MODE + { + match: /-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/, + // hex with a present digit before . (making a digit afterwards optional) + relevance: 0 + }, + { + match: /-?\b0[oO](_?[0-7])*i?/, + // leading 0o octal + relevance: 0 + }, + { + match: /-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/, + // decimal without a present digit before . (making a digit afterwards required) + relevance: 0 + }, + { + match: /-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/, + // decimal with a present digit before . (making a digit afterwards optional) + relevance: 0 + } ] }, { @@ -103860,7 +104480,7 @@ ${events.lines.join("\n")} { className: "type", // instantiation - begin: /new */, + beginKeywords: "new", end: /\W/, excludeBegin: true, excludeEnd: true @@ -104783,7 +105403,8 @@ ${events.lines.join("\n")} "do", "sealed", "yield", - "permits" + "permits", + "goto" ]; const BUILT_INS = [ "super", @@ -105204,7 +105825,7 @@ ${events.lines.join("\n")} // defined later }; const HTML_TEMPLATE = { - begin: "html`", + begin: ".?html`", end: "", starts: { end: "`", @@ -105217,7 +105838,7 @@ ${events.lines.join("\n")} } }; const CSS_TEMPLATE = { - begin: "css`", + begin: ".?css`", end: "", starts: { end: "`", @@ -105230,7 +105851,7 @@ ${events.lines.join("\n")} } }; const GRAPHQL_TEMPLATE = { - begin: "gql`", + begin: ".?gql`", end: "", starts: { end: "`", @@ -105326,7 +105947,7 @@ ${events.lines.join("\n")} const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([ // eat recursive parens in sub expressions { - begin: /\(/, + begin: /(\s*)\(/, end: /\)/, keywords: KEYWORDS$1, contains: ["self"].concat(SUBST_AND_COMMENTS) @@ -105334,7 +105955,9 @@ ${events.lines.join("\n")} ]); const PARAMS = { className: "params", - begin: /\(/, + // convert this to negative lookbehind in v12 + begin: /(\s*)\(/, + // to match the parms with end: /\)/, excludeBegin: true, excludeEnd: true, @@ -105447,9 +106070,9 @@ ${events.lines.join("\n")} ...BUILT_IN_GLOBALS, "super", "import" - ]), + ].map((x4) => `${x4}\\s*\\(`)), IDENT_RE$1, - regex.lookahead(/\(/) + regex.lookahead(/\s*\(/) ), className: "title.function", relevance: 0 @@ -105565,7 +106188,7 @@ ${events.lines.join("\n")} skip: true }, { - begin: /\(/, + begin: /(\s*)\(/, end: /\)/, excludeBegin: true, excludeEnd: true, @@ -105747,6 +106370,7 @@ ${events.lines.join("\n")} }; return { name: "JSON", + aliases: ["jsonc"], keywords: { literal: LITERALS2 }, @@ -107027,7 +107651,7 @@ ${events.lines.join("\n")} } }; }; - var TAGS = [ + var HTML_TAGS = [ "a", "abbr", "address", @@ -107079,11 +107703,16 @@ ${events.lines.join("\n")} "nav", "object", "ol", + "optgroup", + "option", "p", + "picture", "q", "quote", "samp", "section", + "select", + "source", "span", "strong", "summary", @@ -107101,6 +107730,53 @@ ${events.lines.join("\n")} "var", "video" ]; + var SVG_TAGS = [ + "defs", + "g", + "marker", + "mask", + "pattern", + "svg", + "switch", + "symbol", + "feBlend", + "feColorMatrix", + "feComponentTransfer", + "feComposite", + "feConvolveMatrix", + "feDiffuseLighting", + "feDisplacementMap", + "feFlood", + "feGaussianBlur", + "feImage", + "feMerge", + "feMorphology", + "feOffset", + "feSpecularLighting", + "feTile", + "feTurbulence", + "linearGradient", + "radialGradient", + "stop", + "circle", + "ellipse", + "image", + "line", + "path", + "polygon", + "polyline", + "rect", + "text", + "use", + "textPath", + "tspan", + "foreignObject", + "clipPath" + ]; + var TAGS = [ + ...HTML_TAGS, + ...SVG_TAGS + ]; var MEDIA_FEATURES = [ "any-hover", "any-pointer", @@ -107136,7 +107812,7 @@ ${events.lines.join("\n")} "max-width", "min-height", "max-height" - ]; + ].sort().reverse(); var PSEUDO_CLASSES = [ "active", "any-link", @@ -107211,7 +107887,7 @@ ${events.lines.join("\n")} "visited", "where" // where() - ]; + ].sort().reverse(); var PSEUDO_ELEMENTS = [ "after", "backdrop", @@ -107227,11 +107903,13 @@ ${events.lines.join("\n")} "selection", "slotted", "spelling-error" - ]; + ].sort().reverse(); var ATTRIBUTES = [ + "accent-color", "align-content", "align-items", "align-self", + "alignment-baseline", "all", "animation", "animation-delay", @@ -107242,6 +107920,7 @@ ${events.lines.join("\n")} "animation-name", "animation-play-state", "animation-timing-function", + "appearance", "backface-visibility", "background", "background-attachment", @@ -107253,6 +107932,7 @@ ${events.lines.join("\n")} "background-position", "background-repeat", "background-size", + "baseline-shift", "block-size", "border", "border-block", @@ -107299,10 +107979,14 @@ ${events.lines.join("\n")} "border-left-width", "border-radius", "border-right", + "border-end-end-radius", + "border-end-start-radius", "border-right-color", "border-right-style", "border-right-width", "border-spacing", + "border-start-end-radius", + "border-start-start-radius", "border-style", "border-top", "border-top-color", @@ -107318,6 +108002,8 @@ ${events.lines.join("\n")} "break-after", "break-before", "break-inside", + "cx", + "cy", "caption-side", "caret-color", "clear", @@ -107325,6 +108011,11 @@ ${events.lines.join("\n")} "clip-path", "clip-rule", "color", + "color-interpolation", + "color-interpolation-filters", + "color-profile", + "color-rendering", + "color-scheme", "column-count", "column-fill", "column-gap", @@ -107346,7 +108037,12 @@ ${events.lines.join("\n")} "cursor", "direction", "display", + "dominant-baseline", "empty-cells", + "enable-background", + "fill", + "fill-opacity", + "fill-rule", "filter", "flex", "flex-basis", @@ -107357,6 +108053,8 @@ ${events.lines.join("\n")} "flex-wrap", "float", "flow", + "flood-color", + "flood-opacity", "font", "font-display", "font-family", @@ -107378,6 +108076,7 @@ ${events.lines.join("\n")} "font-variation-settings", "font-weight", "gap", + "glyph-orientation-horizontal", "glyph-orientation-vertical", "grid", "grid-area", @@ -107404,16 +108103,32 @@ ${events.lines.join("\n")} "image-resolution", "ime-mode", "inline-size", + "inset", + "inset-block", + "inset-block-end", + "inset-block-start", + "inset-inline", + "inset-inline-end", + "inset-inline-start", "isolation", + "kerning", "justify-content", + "justify-items", + "justify-self", "left", "letter-spacing", + "lighting-color", "line-break", "line-height", "list-style", "list-style-image", "list-style-position", "list-style-type", + "marker", + "marker-end", + "marker-mid", + "marker-start", + "mask", "margin", "margin-block", "margin-block-end", @@ -107495,12 +108210,15 @@ ${events.lines.join("\n")} "pointer-events", "position", "quotes", + "r", "resize", "rest", "rest-after", "rest-before", "right", + "rotate", "row-gap", + "scale", "scroll-margin", "scroll-margin-block", "scroll-margin-block-end", @@ -107532,12 +108250,24 @@ ${events.lines.join("\n")} "shape-image-threshold", "shape-margin", "shape-outside", + "shape-rendering", + "stop-color", + "stop-opacity", + "stroke", + "stroke-dasharray", + "stroke-dashoffset", + "stroke-linecap", + "stroke-linejoin", + "stroke-miterlimit", + "stroke-opacity", + "stroke-width", "speak", "speak-as", "src", // @font-face "tab-size", "table-layout", + "text-anchor", "text-align", "text-align-all", "text-align-last", @@ -107545,7 +108275,9 @@ ${events.lines.join("\n")} "text-decoration", "text-decoration-color", "text-decoration-line", + "text-decoration-skip-ink", "text-decoration-style", + "text-decoration-thickness", "text-emphasis", "text-emphasis-color", "text-emphasis-position", @@ -107557,6 +108289,7 @@ ${events.lines.join("\n")} "text-rendering", "text-shadow", "text-transform", + "text-underline-offset", "text-underline-position", "top", "transform", @@ -107568,7 +108301,9 @@ ${events.lines.join("\n")} "transition-duration", "transition-property", "transition-timing-function", + "translate", "unicode-bidi", + "vector-effect", "vertical-align", "visibility", "voice-balance", @@ -107587,11 +108322,11 @@ ${events.lines.join("\n")} "word-spacing", "word-wrap", "writing-mode", + "x", + "y", "z-index" - // reverse makes sure longer attributes `font-weight` are matched fully - // instead of getting false positives on say `font` - ].reverse(); - var PSEUDO_SELECTORS = PSEUDO_CLASSES.concat(PSEUDO_ELEMENTS); + ].sort().reverse(); + var PSEUDO_SELECTORS = PSEUDO_CLASSES.concat(PSEUDO_ELEMENTS).sort().reverse(); function less(hljs) { const modes = MODES(hljs); const PSEUDO_SELECTORS$1 = PSEUDO_SELECTORS; @@ -108468,7 +109203,10 @@ ${events.lines.join("\n")} return { name: "LLVM IR", // TODO: split into different categories of keywords - keywords: "begin end true false declare define global constant private linker_private internal available_externally linkonce linkonce_odr weak weak_odr appending dllimport dllexport common default hidden protected extern_weak external thread_local zeroinitializer undef null to tail target triple datalayout volatile nuw nsw nnan ninf nsz arcp fast exact inbounds align addrspace section alias module asm sideeffect gc dbg linker_private_weak attributes blockaddress initialexec localdynamic localexec prefix unnamed_addr ccc fastcc coldcc x86_stdcallcc x86_fastcallcc arm_apcscc arm_aapcscc arm_aapcs_vfpcc ptx_device ptx_kernel intel_ocl_bicc msp430_intrcc spir_func spir_kernel x86_64_sysvcc x86_64_win64cc x86_thiscallcc cc c signext zeroext inreg sret nounwind noreturn noalias nocapture byval nest readnone readonly inlinehint noinline alwaysinline optsize ssp sspreq noredzone noimplicitfloat naked builtin cold nobuiltin noduplicate nonlazybind optnone returns_twice sanitize_address sanitize_memory sanitize_thread sspstrong uwtable returned type opaque eq ne slt sgt sle sge ult ugt ule uge oeq one olt ogt ole oge ord uno ueq une x acq_rel acquire alignstack atomic catch cleanup filter inteldialect max min monotonic nand personality release seq_cst singlethread umax umin unordered xchg add fadd sub fsub mul fmul udiv sdiv fdiv urem srem frem shl lshr ashr and or xor icmp fcmp phi call trunc zext sext fptrunc fpext uitofp sitofp fptoui fptosi inttoptr ptrtoint bitcast addrspacecast select va_arg ret br switch invoke unwind unreachable indirectbr landingpad resume malloc alloca free load store getelementptr extractelement insertelement shufflevector getresult extractvalue insertvalue atomicrmw cmpxchg fence argmemonly double", + keywords: { + keyword: "begin end true false declare define global constant private linker_private internal available_externally linkonce linkonce_odr weak weak_odr appending dllimport dllexport common default hidden protected extern_weak external thread_local zeroinitializer undef null to tail target triple datalayout volatile nuw nsw nnan ninf nsz arcp fast exact inbounds align addrspace section alias module asm sideeffect gc dbg linker_private_weak attributes blockaddress initialexec localdynamic localexec prefix unnamed_addr ccc fastcc coldcc x86_stdcallcc x86_fastcallcc arm_apcscc arm_aapcscc arm_aapcs_vfpcc ptx_device ptx_kernel intel_ocl_bicc msp430_intrcc spir_func spir_kernel x86_64_sysvcc x86_64_win64cc x86_thiscallcc cc c signext zeroext inreg sret nounwind noreturn noalias nocapture byval nest readnone readonly inlinehint noinline alwaysinline optsize ssp sspreq noredzone noimplicitfloat naked builtin cold nobuiltin noduplicate nonlazybind optnone returns_twice sanitize_address sanitize_memory sanitize_thread sspstrong uwtable returned type opaque eq ne slt sgt sle sge ult ugt ule uge oeq one olt ogt ole oge ord uno ueq une x acq_rel acquire alignstack atomic catch cleanup filter inteldialect max min monotonic nand personality release seq_cst singlethread umax umin unordered xchg add fadd sub fsub mul fmul udiv sdiv fdiv urem srem frem shl lshr ashr and or xor icmp fcmp phi call trunc zext sext fptrunc fpext uitofp sitofp fptoui fptosi inttoptr ptrtoint bitcast addrspacecast select va_arg ret br switch invoke unwind unreachable indirectbr landingpad resume malloc alloca free load store getelementptr extractelement insertelement shufflevector getresult extractvalue insertvalue atomicrmw cmpxchg fence argmemonly", + type: "void half bfloat float double fp128 x86_fp80 ppc_fp128 x86_amx x86_mmx ptr label token metadata opaque" + }, contains: [ TYPE3, // this matches "empty comments"... @@ -116425,6 +117163,7 @@ ${events.lines.join("\n")} "chown", "chr", "chroot", + "class", "close", "closedir", "connect", @@ -116454,6 +117193,7 @@ ${events.lines.join("\n")} "exit", "exp", "fcntl", + "field", "fileno", "flock", "for", @@ -116513,6 +117253,7 @@ ${events.lines.join("\n")} "lt", "ma", "map", + "method", "mkdir", "msgctl", "msgget", @@ -116655,19 +117396,46 @@ ${events.lines.join("\n")} end: /\}/ // contains defined later }; - const VAR = { variants: [ - { begin: /\$\d/ }, - { begin: regex.concat( - /[$%@](\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/, - // negative look-ahead tries to avoid matching patterns that are not - // Perl at all like $ident$, @ident@, etc. - `(?![A-Za-z])(?![@$%])` - ) }, - { - begin: /[$%@][^\s\w{]/, - relevance: 0 - } - ] }; + const ATTR = { + scope: "attr", + match: /\s+:\s*\w+(\s*\(.*?\))?/ + }; + const VAR = { + scope: "variable", + variants: [ + { begin: /\$\d/ }, + { + begin: regex.concat( + /[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/, + // negative look-ahead tries to avoid matching patterns that are not + // Perl at all like $ident$, @ident@, etc. + `(?![A-Za-z])(?![@$%])` + ) + }, + { + // Only $= is a special Perl variable and one can't declare @= or %=. + begin: /[$%@](?!")[^\s\w{=]|\$=/, + relevance: 0 + } + ], + contains: [ATTR] + }; + const NUMBER = { + className: "number", + variants: [ + // decimal numbers: + // include the case where a number starts with a dot (eg. .9), and + // the leading 0? avoids mixing the first and second match on 0.x cases + { match: /0?\.[0-9][0-9_]+\b/ }, + // include the special versioned number (eg. v5.38) + { match: /\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/ }, + // non-decimal numbers: + { match: /\b0[0-7][0-7_]*\b/ }, + { match: /\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/ }, + { match: /\b0b[0-1][0-1_]*\b/ } + ], + relevance: 0 + }; const STRING_CONTAINS = [ hljs.BACKSLASH_ESCAPE, SUBST, @@ -116772,11 +117540,7 @@ ${events.lines.join("\n")} } ] }, - { - className: "number", - begin: "(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b", - relevance: 0 - }, + NUMBER, { // regexp container begin: "(\\/\\/|" + hljs.RE_STARTERS_RE + "|\\b(split|return|print|reverse|grep)\\b)\\s*", @@ -116819,11 +117583,19 @@ ${events.lines.join("\n")} }, { className: "function", - beginKeywords: "sub", + beginKeywords: "sub method", end: "(\\s*\\(.*?\\))?[;{]", excludeEnd: true, relevance: 5, - contains: [hljs.TITLE_MODE] + contains: [hljs.TITLE_MODE, ATTR] + }, + { + className: "class", + beginKeywords: "class", + end: "[;{]", + excludeEnd: true, + relevance: 5, + contains: [hljs.TITLE_MODE, ATTR, NUMBER] }, { begin: "-\\w\\b", @@ -121718,7 +122490,8 @@ ${events.lines.join("\n")} NUMBER, { // very common convention - begin: /\bself\b/ + scope: "variable.language", + match: /\bself\b/ }, { // eat "if" prior to string so that it won't accidentally be @@ -121726,6 +122499,7 @@ ${events.lines.join("\n")} beginKeywords: "if", relevance: 0 }, + { match: /\bor\b/, scope: "keyword" }, STRING, COMMENT_TYPE, hljs.HASH_COMMENT_MODE, @@ -122793,13 +123567,16 @@ ${events.lines.join("\n")} init_polyfillShim(); function rust(hljs) { const regex = hljs.regex; + const RAW_IDENTIFIER = /(r#)?/; + const UNDERSCORE_IDENT_RE = regex.concat(RAW_IDENTIFIER, hljs.UNDERSCORE_IDENT_RE); + const IDENT_RE = regex.concat(RAW_IDENTIFIER, hljs.IDENT_RE); const FUNCTION_INVOKE = { className: "title.function.invoke", relevance: 0, begin: regex.concat( /\b/, /(?!let|for|while|if|else|match\b)/, - hljs.IDENT_RE, + IDENT_RE, regex.lookahead(/\s*\(/) ) }; @@ -122849,6 +123626,7 @@ ${events.lines.join("\n")} "try", "type", "typeof", + "union", "unsafe", "unsized", "use", @@ -123000,7 +123778,7 @@ ${events.lines.join("\n")} begin: [ /fn/, /\s+/, - hljs.UNDERSCORE_IDENT_RE + UNDERSCORE_IDENT_RE ], className: { 1: "keyword", @@ -123015,7 +123793,10 @@ ${events.lines.join("\n")} { className: "string", begin: /"/, - end: /"/ + end: /"/, + contains: [ + hljs.BACKSLASH_ESCAPE + ] } ] }, @@ -123024,7 +123805,7 @@ ${events.lines.join("\n")} /let/, /\s+/, /(?:mut\s+)?/, - hljs.UNDERSCORE_IDENT_RE + UNDERSCORE_IDENT_RE ], className: { 1: "keyword", @@ -123037,7 +123818,7 @@ ${events.lines.join("\n")} begin: [ /for/, /\s+/, - hljs.UNDERSCORE_IDENT_RE, + UNDERSCORE_IDENT_RE, /\s+/, /in/ ], @@ -123051,7 +123832,7 @@ ${events.lines.join("\n")} begin: [ /type/, /\s+/, - hljs.UNDERSCORE_IDENT_RE + UNDERSCORE_IDENT_RE ], className: { 1: "keyword", @@ -123062,7 +123843,7 @@ ${events.lines.join("\n")} begin: [ /(?:trait|enum|struct|union|impl|for)/, /\s+/, - hljs.UNDERSCORE_IDENT_RE + UNDERSCORE_IDENT_RE ], className: { 1: "keyword", @@ -124084,7 +124865,7 @@ ${events.lines.join("\n")} } }; }; - var TAGS = [ + var HTML_TAGS = [ "a", "abbr", "address", @@ -124136,11 +124917,16 @@ ${events.lines.join("\n")} "nav", "object", "ol", + "optgroup", + "option", "p", + "picture", "q", "quote", "samp", "section", + "select", + "source", "span", "strong", "summary", @@ -124158,6 +124944,53 @@ ${events.lines.join("\n")} "var", "video" ]; + var SVG_TAGS = [ + "defs", + "g", + "marker", + "mask", + "pattern", + "svg", + "switch", + "symbol", + "feBlend", + "feColorMatrix", + "feComponentTransfer", + "feComposite", + "feConvolveMatrix", + "feDiffuseLighting", + "feDisplacementMap", + "feFlood", + "feGaussianBlur", + "feImage", + "feMerge", + "feMorphology", + "feOffset", + "feSpecularLighting", + "feTile", + "feTurbulence", + "linearGradient", + "radialGradient", + "stop", + "circle", + "ellipse", + "image", + "line", + "path", + "polygon", + "polyline", + "rect", + "text", + "use", + "textPath", + "tspan", + "foreignObject", + "clipPath" + ]; + var TAGS = [ + ...HTML_TAGS, + ...SVG_TAGS + ]; var MEDIA_FEATURES = [ "any-hover", "any-pointer", @@ -124193,7 +125026,7 @@ ${events.lines.join("\n")} "max-width", "min-height", "max-height" - ]; + ].sort().reverse(); var PSEUDO_CLASSES = [ "active", "any-link", @@ -124268,7 +125101,7 @@ ${events.lines.join("\n")} "visited", "where" // where() - ]; + ].sort().reverse(); var PSEUDO_ELEMENTS = [ "after", "backdrop", @@ -124284,11 +125117,13 @@ ${events.lines.join("\n")} "selection", "slotted", "spelling-error" - ]; + ].sort().reverse(); var ATTRIBUTES = [ + "accent-color", "align-content", "align-items", "align-self", + "alignment-baseline", "all", "animation", "animation-delay", @@ -124299,6 +125134,7 @@ ${events.lines.join("\n")} "animation-name", "animation-play-state", "animation-timing-function", + "appearance", "backface-visibility", "background", "background-attachment", @@ -124310,6 +125146,7 @@ ${events.lines.join("\n")} "background-position", "background-repeat", "background-size", + "baseline-shift", "block-size", "border", "border-block", @@ -124356,10 +125193,14 @@ ${events.lines.join("\n")} "border-left-width", "border-radius", "border-right", + "border-end-end-radius", + "border-end-start-radius", "border-right-color", "border-right-style", "border-right-width", "border-spacing", + "border-start-end-radius", + "border-start-start-radius", "border-style", "border-top", "border-top-color", @@ -124375,6 +125216,8 @@ ${events.lines.join("\n")} "break-after", "break-before", "break-inside", + "cx", + "cy", "caption-side", "caret-color", "clear", @@ -124382,6 +125225,11 @@ ${events.lines.join("\n")} "clip-path", "clip-rule", "color", + "color-interpolation", + "color-interpolation-filters", + "color-profile", + "color-rendering", + "color-scheme", "column-count", "column-fill", "column-gap", @@ -124403,7 +125251,12 @@ ${events.lines.join("\n")} "cursor", "direction", "display", + "dominant-baseline", "empty-cells", + "enable-background", + "fill", + "fill-opacity", + "fill-rule", "filter", "flex", "flex-basis", @@ -124414,6 +125267,8 @@ ${events.lines.join("\n")} "flex-wrap", "float", "flow", + "flood-color", + "flood-opacity", "font", "font-display", "font-family", @@ -124435,6 +125290,7 @@ ${events.lines.join("\n")} "font-variation-settings", "font-weight", "gap", + "glyph-orientation-horizontal", "glyph-orientation-vertical", "grid", "grid-area", @@ -124461,16 +125317,32 @@ ${events.lines.join("\n")} "image-resolution", "ime-mode", "inline-size", + "inset", + "inset-block", + "inset-block-end", + "inset-block-start", + "inset-inline", + "inset-inline-end", + "inset-inline-start", "isolation", + "kerning", "justify-content", + "justify-items", + "justify-self", "left", "letter-spacing", + "lighting-color", "line-break", "line-height", "list-style", "list-style-image", "list-style-position", "list-style-type", + "marker", + "marker-end", + "marker-mid", + "marker-start", + "mask", "margin", "margin-block", "margin-block-end", @@ -124552,12 +125424,15 @@ ${events.lines.join("\n")} "pointer-events", "position", "quotes", + "r", "resize", "rest", "rest-after", "rest-before", "right", + "rotate", "row-gap", + "scale", "scroll-margin", "scroll-margin-block", "scroll-margin-block-end", @@ -124589,12 +125464,24 @@ ${events.lines.join("\n")} "shape-image-threshold", "shape-margin", "shape-outside", + "shape-rendering", + "stop-color", + "stop-opacity", + "stroke", + "stroke-dasharray", + "stroke-dashoffset", + "stroke-linecap", + "stroke-linejoin", + "stroke-miterlimit", + "stroke-opacity", + "stroke-width", "speak", "speak-as", "src", // @font-face "tab-size", "table-layout", + "text-anchor", "text-align", "text-align-all", "text-align-last", @@ -124602,7 +125489,9 @@ ${events.lines.join("\n")} "text-decoration", "text-decoration-color", "text-decoration-line", + "text-decoration-skip-ink", "text-decoration-style", + "text-decoration-thickness", "text-emphasis", "text-emphasis-color", "text-emphasis-position", @@ -124614,6 +125503,7 @@ ${events.lines.join("\n")} "text-rendering", "text-shadow", "text-transform", + "text-underline-offset", "text-underline-position", "top", "transform", @@ -124625,7 +125515,9 @@ ${events.lines.join("\n")} "transition-duration", "transition-property", "transition-timing-function", + "translate", "unicode-bidi", + "vector-effect", "vertical-align", "visibility", "voice-balance", @@ -124644,10 +125536,10 @@ ${events.lines.join("\n")} "word-spacing", "word-wrap", "writing-mode", + "x", + "y", "z-index" - // reverse makes sure longer attributes `font-weight` are matched fully - // instead of getting false positives on say `font` - ].reverse(); + ].sort().reverse(); function scss(hljs) { const modes = MODES(hljs); const PSEUDO_ELEMENTS$1 = PSEUDO_ELEMENTS; @@ -128971,7 +129863,7 @@ ${events.lines.join("\n")} } }; }; - var TAGS = [ + var HTML_TAGS = [ "a", "abbr", "address", @@ -129023,11 +129915,16 @@ ${events.lines.join("\n")} "nav", "object", "ol", + "optgroup", + "option", "p", + "picture", "q", "quote", "samp", "section", + "select", + "source", "span", "strong", "summary", @@ -129045,6 +129942,53 @@ ${events.lines.join("\n")} "var", "video" ]; + var SVG_TAGS = [ + "defs", + "g", + "marker", + "mask", + "pattern", + "svg", + "switch", + "symbol", + "feBlend", + "feColorMatrix", + "feComponentTransfer", + "feComposite", + "feConvolveMatrix", + "feDiffuseLighting", + "feDisplacementMap", + "feFlood", + "feGaussianBlur", + "feImage", + "feMerge", + "feMorphology", + "feOffset", + "feSpecularLighting", + "feTile", + "feTurbulence", + "linearGradient", + "radialGradient", + "stop", + "circle", + "ellipse", + "image", + "line", + "path", + "polygon", + "polyline", + "rect", + "text", + "use", + "textPath", + "tspan", + "foreignObject", + "clipPath" + ]; + var TAGS = [ + ...HTML_TAGS, + ...SVG_TAGS + ]; var MEDIA_FEATURES = [ "any-hover", "any-pointer", @@ -129080,7 +130024,7 @@ ${events.lines.join("\n")} "max-width", "min-height", "max-height" - ]; + ].sort().reverse(); var PSEUDO_CLASSES = [ "active", "any-link", @@ -129155,7 +130099,7 @@ ${events.lines.join("\n")} "visited", "where" // where() - ]; + ].sort().reverse(); var PSEUDO_ELEMENTS = [ "after", "backdrop", @@ -129171,11 +130115,13 @@ ${events.lines.join("\n")} "selection", "slotted", "spelling-error" - ]; + ].sort().reverse(); var ATTRIBUTES = [ + "accent-color", "align-content", "align-items", "align-self", + "alignment-baseline", "all", "animation", "animation-delay", @@ -129186,6 +130132,7 @@ ${events.lines.join("\n")} "animation-name", "animation-play-state", "animation-timing-function", + "appearance", "backface-visibility", "background", "background-attachment", @@ -129197,6 +130144,7 @@ ${events.lines.join("\n")} "background-position", "background-repeat", "background-size", + "baseline-shift", "block-size", "border", "border-block", @@ -129243,10 +130191,14 @@ ${events.lines.join("\n")} "border-left-width", "border-radius", "border-right", + "border-end-end-radius", + "border-end-start-radius", "border-right-color", "border-right-style", "border-right-width", "border-spacing", + "border-start-end-radius", + "border-start-start-radius", "border-style", "border-top", "border-top-color", @@ -129262,6 +130214,8 @@ ${events.lines.join("\n")} "break-after", "break-before", "break-inside", + "cx", + "cy", "caption-side", "caret-color", "clear", @@ -129269,6 +130223,11 @@ ${events.lines.join("\n")} "clip-path", "clip-rule", "color", + "color-interpolation", + "color-interpolation-filters", + "color-profile", + "color-rendering", + "color-scheme", "column-count", "column-fill", "column-gap", @@ -129290,7 +130249,12 @@ ${events.lines.join("\n")} "cursor", "direction", "display", + "dominant-baseline", "empty-cells", + "enable-background", + "fill", + "fill-opacity", + "fill-rule", "filter", "flex", "flex-basis", @@ -129301,6 +130265,8 @@ ${events.lines.join("\n")} "flex-wrap", "float", "flow", + "flood-color", + "flood-opacity", "font", "font-display", "font-family", @@ -129322,6 +130288,7 @@ ${events.lines.join("\n")} "font-variation-settings", "font-weight", "gap", + "glyph-orientation-horizontal", "glyph-orientation-vertical", "grid", "grid-area", @@ -129348,16 +130315,32 @@ ${events.lines.join("\n")} "image-resolution", "ime-mode", "inline-size", + "inset", + "inset-block", + "inset-block-end", + "inset-block-start", + "inset-inline", + "inset-inline-end", + "inset-inline-start", "isolation", + "kerning", "justify-content", + "justify-items", + "justify-self", "left", "letter-spacing", + "lighting-color", "line-break", "line-height", "list-style", "list-style-image", "list-style-position", "list-style-type", + "marker", + "marker-end", + "marker-mid", + "marker-start", + "mask", "margin", "margin-block", "margin-block-end", @@ -129439,12 +130422,15 @@ ${events.lines.join("\n")} "pointer-events", "position", "quotes", + "r", "resize", "rest", "rest-after", "rest-before", "right", + "rotate", "row-gap", + "scale", "scroll-margin", "scroll-margin-block", "scroll-margin-block-end", @@ -129476,12 +130462,24 @@ ${events.lines.join("\n")} "shape-image-threshold", "shape-margin", "shape-outside", + "shape-rendering", + "stop-color", + "stop-opacity", + "stroke", + "stroke-dasharray", + "stroke-dashoffset", + "stroke-linecap", + "stroke-linejoin", + "stroke-miterlimit", + "stroke-opacity", + "stroke-width", "speak", "speak-as", "src", // @font-face "tab-size", "table-layout", + "text-anchor", "text-align", "text-align-all", "text-align-last", @@ -129489,7 +130487,9 @@ ${events.lines.join("\n")} "text-decoration", "text-decoration-color", "text-decoration-line", + "text-decoration-skip-ink", "text-decoration-style", + "text-decoration-thickness", "text-emphasis", "text-emphasis-color", "text-emphasis-position", @@ -129501,6 +130501,7 @@ ${events.lines.join("\n")} "text-rendering", "text-shadow", "text-transform", + "text-underline-offset", "text-underline-position", "top", "transform", @@ -129512,7 +130513,9 @@ ${events.lines.join("\n")} "transition-duration", "transition-property", "transition-timing-function", + "translate", "unicode-bidi", + "vector-effect", "vertical-align", "visibility", "voice-balance", @@ -129531,10 +130534,10 @@ ${events.lines.join("\n")} "word-spacing", "word-wrap", "writing-mode", + "x", + "y", "z-index" - // reverse makes sure longer attributes `font-weight` are matched fully - // instead of getting false positives on say `font` - ].reverse(); + ].sort().reverse(); function stylus(hljs) { const modes = MODES(hljs); const AT_MODIFIERS = "and or not only"; @@ -129883,6 +130886,7 @@ ${events.lines.join("\n")} // contextual "override", // contextual + "package", "postfix", // contextual "precedencegroup", @@ -130325,7 +131329,7 @@ ${events.lines.join("\n")} }; const KEYWORD_ATTRIBUTE = { scope: "keyword", - match: concat(/@/, either(...keywordAttributes)) + match: concat(/@/, either(...keywordAttributes), lookahead(either(/\(/, /\s+/))) }; const USER_DEFINED_ATTRIBUTE = { scope: "meta", @@ -130512,6 +131516,36 @@ ${events.lines.join("\n")} ], end: /}/ }; + const TYPE_DECLARATION = { + begin: [ + /(struct|protocol|class|extension|enum|actor)/, + /\s+/, + identifier2, + /\s*/ + ], + beginScope: { + 1: "keyword", + 3: "title.class" + }, + keywords: KEYWORDS, + contains: [ + GENERIC_PARAMETERS, + ...KEYWORD_MODES, + { + begin: /:/, + end: /\{/, + keywords: KEYWORDS, + contains: [ + { + scope: "title.class.inherited", + match: typeIdentifier + }, + ...KEYWORD_MODES + ], + relevance: 0 + } + ] + }; for (const variant of STRING.variants) { const interpolation = variant.contains.find((mode) => mode.label === "interpol"); interpolation.keywords = KEYWORDS; @@ -130542,19 +131576,7 @@ ${events.lines.join("\n")} ...COMMENTS, FUNCTION_OR_MACRO, INIT_SUBSCRIPT, - { - beginKeywords: "struct protocol class extension enum actor", - end: "\\{", - excludeEnd: true, - keywords: KEYWORDS, - contains: [ - hljs.inherit(hljs.TITLE_MODE, { - className: "title.class", - begin: /[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/ - }), - ...KEYWORD_MODES - ] - }, + TYPE_DECLARATION, OPERATOR_DECLARATION, PRECEDENCEGROUP, { @@ -130643,14 +131665,15 @@ ${events.lines.join("\n")} const KEY = { className: "attr", variants: [ - { begin: "\\w[\\w :\\/.-]*:(?=[ ]|$)" }, + // added brackets support + { begin: /\w[\w :()\./-]*:(?=[ \t]|$)/ }, { - // double quoted keys - begin: '"\\w[\\w :\\/.-]*":(?=[ ]|$)' + // double quoted keys - with brackets + begin: /"\w[\w :()\./-]*":(?=[ \t]|$)/ }, { - // single quoted keys - begin: "'\\w[\\w :\\/.-]*':(?=[ ]|$)" + // single quoted keys - with brackets + begin: /'\w[\w :()\./-]*':(?=[ \t]|$)/ } ] }; @@ -131790,7 +132813,7 @@ ${events.lines.join("\n")} // defined later }; const HTML_TEMPLATE = { - begin: "html`", + begin: ".?html`", end: "", starts: { end: "`", @@ -131803,7 +132826,7 @@ ${events.lines.join("\n")} } }; const CSS_TEMPLATE = { - begin: "css`", + begin: ".?css`", end: "", starts: { end: "`", @@ -131816,7 +132839,7 @@ ${events.lines.join("\n")} } }; const GRAPHQL_TEMPLATE = { - begin: "gql`", + begin: ".?gql`", end: "", starts: { end: "`", @@ -131912,7 +132935,7 @@ ${events.lines.join("\n")} const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([ // eat recursive parens in sub expressions { - begin: /\(/, + begin: /(\s*)\(/, end: /\)/, keywords: KEYWORDS$1, contains: ["self"].concat(SUBST_AND_COMMENTS) @@ -131920,7 +132943,9 @@ ${events.lines.join("\n")} ]); const PARAMS = { className: "params", - begin: /\(/, + // convert this to negative lookbehind in v12 + begin: /(\s*)\(/, + // to match the parms with end: /\)/, excludeBegin: true, excludeEnd: true, @@ -132033,9 +133058,9 @@ ${events.lines.join("\n")} ...BUILT_IN_GLOBALS, "super", "import" - ]), + ].map((x4) => `${x4}\\s*\\(`)), IDENT_RE$1, - regex.lookahead(/\(/) + regex.lookahead(/\s*\(/) ), className: "title.function", relevance: 0 @@ -132151,7 +133176,7 @@ ${events.lines.join("\n")} skip: true }, { - begin: /\(/, + begin: /(\s*)\(/, end: /\)/, excludeBegin: true, excludeEnd: true, @@ -132260,10 +133285,15 @@ ${events.lines.join("\n")} "unknown" ]; const NAMESPACE = { - beginKeywords: "namespace", - end: /\{/, - excludeEnd: true, - contains: [tsLanguage.exports.CLASS_REFERENCE] + begin: [ + /namespace/, + /\s+/, + hljs.IDENT_RE + ], + beginScope: { + 1: "keyword", + 3: "title.class" + } }; const INTERFACE = { beginKeywords: "interface", @@ -132282,7 +133312,7 @@ ${events.lines.join("\n")} }; const TS_SPECIFIC_KEYWORDS = [ "type", - "namespace", + // "namespace", "interface", "public", "private", @@ -132292,7 +133322,8 @@ ${events.lines.join("\n")} "abstract", "readonly", "enum", - "override" + "override", + "satisfies" ]; const KEYWORDS$1 = { $pattern: IDENT_RE, @@ -132314,6 +133345,13 @@ ${events.lines.join("\n")} }; Object.assign(tsLanguage.keywords, KEYWORDS$1); tsLanguage.exports.PARAMS_CONTAINS.push(DECORATOR); + const ATTRIBUTE_HIGHLIGHT = tsLanguage.contains.find((c5) => c5.className === "attr"); + tsLanguage.exports.PARAMS_CONTAINS.push([ + tsLanguage.exports.CLASS_REFERENCE, + // class reference for highlighting the params types + ATTRIBUTE_HIGHLIGHT + // highlight the params key + ]); tsLanguage.contains = tsLanguage.contains.concat([ DECORATOR, NAMESPACE, @@ -135031,13 +136069,13 @@ ${events.lines.join("\n")} D4[a4] = e4, i3 = a4; } return !r3 && i3 && (g2 = i3), i3 || !r3 && g2; - }, O = function(t5, e4) { + }, O2 = function(t5, e4) { if (S3(t5)) return t5.clone(); var n3 = "object" == typeof e4 ? e4 : {}; return n3.date = t5, n3.args = arguments, new _(n3); }, b2 = v; b2.l = w2, b2.i = S3, b2.w = function(t5, e4) { - return O(t5, { locale: e4.$L, utc: e4.$u, x: e4.$x, $offset: e4.$offset }); + return O2(t5, { locale: e4.$L, utc: e4.$u, x: e4.$x, $offset: e4.$offset }); }; var _ = function() { function M3(t5) { @@ -135067,12 +136105,12 @@ ${events.lines.join("\n")} }, m3.isValid = function() { return !(this.$d.toString() === l2); }, m3.isSame = function(t5, e4) { - var n3 = O(t5); + var n3 = O2(t5); return this.startOf(e4) <= n3 && n3 <= this.endOf(e4); }, m3.isAfter = function(t5, e4) { - return O(t5) < this.startOf(e4); + return O2(t5) < this.startOf(e4); }, m3.isBefore = function(t5, e4) { - return this.endOf(e4) < O(t5); + return this.endOf(e4) < O2(t5); }, m3.$g = function(t5, e4, n3) { return b2.u(t5) ? this[e4] : this.set(n3, t5); }, m3.unix = function() { @@ -135123,7 +136161,7 @@ ${events.lines.join("\n")} var d3, l3 = this; r3 = Number(r3); var $4 = b2.p(f2), y5 = function(t5) { - var e4 = O(l3); + var e4 = O2(l3); return b2.w(e4.date(e4.date() + Math.round(t5 * r3)), l3); }; if ($4 === c5) return this.set(c5, this.$M + r3); @@ -135203,7 +136241,7 @@ ${events.lines.join("\n")} }, m3.utcOffset = function() { return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); }, m3.diff = function(r3, d3, l3) { - var $4, y5 = this, M4 = b2.p(d3), m4 = O(r3), v6 = (m4.utcOffset() - this.utcOffset()) * e3, g3 = this - m4, D5 = function() { + var $4, y5 = this, M4 = b2.p(d3), m4 = O2(r3), v6 = (m4.utcOffset() - this.utcOffset()) * e3, g3 = this - m4, D5 = function() { return b2.m(y5, m4); }; switch (M4) { @@ -135255,15 +136293,15 @@ ${events.lines.join("\n")} return this.$d.toUTCString(); }, M3; }(), k3 = _.prototype; - return O.prototype = k3, [["$ms", r2], ["$s", i2], ["$m", s3], ["$H", u2], ["$W", a3], ["$M", c5], ["$y", h3], ["$D", d2]].forEach(function(t5) { + return O2.prototype = k3, [["$ms", r2], ["$s", i2], ["$m", s3], ["$H", u2], ["$W", a3], ["$M", c5], ["$y", h3], ["$D", d2]].forEach(function(t5) { k3[t5[1]] = function(e4) { return this.$g(e4, t5[0], t5[1]); }; - }), O.extend = function(t5, e4) { - return t5.$i || (t5(e4, _, O), t5.$i = true), O; - }, O.locale = w2, O.isDayjs = S3, O.unix = function(t5) { - return O(1e3 * t5); - }, O.en = D4[g2], O.Ls = D4, O.p = {}, O; + }), O2.extend = function(t5, e4) { + return t5.$i || (t5(e4, _, O2), t5.$i = true), O2; + }, O2.locale = w2, O2.isDayjs = S3, O2.unix = function(t5) { + return O2(1e3 * t5); + }, O2.en = D4[g2], O2.Ls = D4, O2.p = {}, O2; }); } }); @@ -141721,6 +142759,7 @@ ${events.lines.join("\n")} case 42: case 47: append2(comment2(commenter(next2(), caret()), root5, parent4, declarations), declarations); + if ((token(previous2 || 1) == 5 || token(peek() || 1) == 5) && strlen(characters2) && substr(characters2, -1, void 0) !== " ") characters2 += " "; break; default: characters2 += "/"; @@ -141741,7 +142780,7 @@ ${events.lines.join("\n")} // ; case 59 + offset: if (ampersand == -1) characters2 = replace(characters2, /\f/g, ""); - if (property2 > 0 && strlen(characters2) - length2) + if (property2 > 0 && (strlen(characters2) - length2 || variable === 0 && previous2 === 47)) append2(property2 > 32 ? declaration(characters2 + ";", rule2, parent4, length2 - 1, declarations) : declaration(replace(characters2, " ", "") + ";", rule2, parent4, length2 - 2, declarations), declarations); break; // @ ; @@ -156523,13 +157562,13 @@ ${events.lines.join("\n")} } }); - // node_modules/mermaid/dist/svgDrawCommon-5e1cfd1d.js + // node_modules/mermaid/dist/svgDrawCommon-9d162435.js var import_sanitize_url, drawRect, drawBackgroundRect, drawText, drawImage, drawEmbeddedImage, getNoteRect, getTextObj; - var init_svgDrawCommon_5e1cfd1d = __esm({ - "node_modules/mermaid/dist/svgDrawCommon-5e1cfd1d.js"() { + var init_svgDrawCommon_9d162435 = __esm({ + "node_modules/mermaid/dist/svgDrawCommon-9d162435.js"() { init_polyfillShim(); import_sanitize_url = __toESM(require_dist5(), 1); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); drawRect = (element3, rectData) => { const rectElement = element3.append("rect"); rectElement.attr("x", rectData.x); @@ -156623,9 +157662,9 @@ ${events.lines.join("\n")} } }); - // node_modules/mermaid/dist/c4Diagram-ae766693.js - var c4Diagram_ae766693_exports = {}; - __export(c4Diagram_ae766693_exports, { + // node_modules/mermaid/dist/c4Diagram-dc8f04df.js + var c4Diagram_dc8f04df_exports = {}; + __export(c4Diagram_dc8f04df_exports, { diagram: () => diagram }); function calcC4ShapeTextWH(textType, c4Shape, c4ShapeTextWrap, textConf, textLimitWidth) { @@ -156750,12 +157789,12 @@ ${events.lines.join("\n")} } } var import_sanitize_url2, import_ts_dedent, import_dayjs, import_dompurify, parser2, parser$1, c4ShapeArray, boundaryParseStack, currentBoundaryParse, parentBoundaryParse, boundaries, rels, title, wrapEnabled, c4ShapeInRow$1, c4BoundaryInRow$1, c4Type, getC4Type, setC4Type, addRel, addPersonOrSystem, addContainer, addComponent, addPersonOrSystemBoundary, addContainerBoundary, addDeploymentNode, popBoundaryParseStack, updateElStyle, updateRelStyle, updateLayoutConfig, getC4ShapeInRow, getC4BoundaryInRow, getCurrentBoundaryParse, getParentBoundaryParse, getC4ShapeArray, getC4Shape, getC4ShapeKeys, getBoundaries, getBoundarys, getRels, getTitle, setWrap, autoWrap, clear, LINETYPE, ARROWTYPE, PLACEMENT, setTitle, db2, drawRect2, drawImage2, drawRels$1, drawBoundary$1, drawC4Shape, insertDatabaseIcon, insertComputerIcon, insertClockIcon, insertArrowHead, insertArrowEnd, insertArrowFilledHead, insertDynamicNumber, insertArrowCrossHead, getC4ShapeFont, _drawTextCandidateFunc, svgDraw, globalBoundaryMaxX, globalBoundaryMaxY, c4ShapeInRow, c4BoundaryInRow, conf, Bounds, setConf, c4ShapeFont, boundaryFont, messageFont, drawBoundary, drawC4ShapeArray, Point2, getIntersectPoint, getIntersectPoints, drawRels, draw, renderer, getStyles, styles2, diagram; - var init_c4Diagram_ae766693 = __esm({ - "node_modules/mermaid/dist/c4Diagram-ae766693.js"() { + var init_c4Diagram_dc8f04df = __esm({ + "node_modules/mermaid/dist/c4Diagram-dc8f04df.js"() { init_polyfillShim(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); init_src32(); - init_svgDrawCommon_5e1cfd1d(); + init_svgDrawCommon_9d162435(); import_sanitize_url2 = __toESM(require_dist5(), 1); import_ts_dedent = __toESM(require_dist4(), 1); import_dayjs = __toESM(require_dayjs_min(), 1); @@ -159100,13 +160139,13 @@ ${events.lines.join("\n")} } }); - // node_modules/mermaid/dist/flowDb-c1833063.js + // node_modules/mermaid/dist/flowDb-0da60e67.js var parser3, parser$12, MERMAID_DOM_ID_PREFIX, vertexCounter, config, vertices, edges, classes, subGraphs, subGraphLookup, tooltips, subCount, firstGraphFlag, direction, version2, funs, sanitizeText, lookUpDomId, addVertex, addSingleLink, addLink, updateLinkInterpolate, updateLink, addClass, setDirection, setClass, setTooltip, setClickFun, setLink, getTooltip, setClickEvent, bindFunctions, getDirection, getVertices, getEdges, getClasses, setupToolTips, clear3, setGen, defaultStyle, addSubGraph, getPosForId, secCount, posCrossRef, indexNodes2, getDepthFirstPos, indexNodes, getSubGraphs, firstGraph, destructStartLink, countChar, destructEndLink, destructLink, exists, makeUniq, lex, flowDb, db3; - var init_flowDb_c1833063 = __esm({ - "node_modules/mermaid/dist/flowDb-c1833063.js"() { + var init_flowDb_0da60e67 = __esm({ + "node_modules/mermaid/dist/flowDb-0da60e67.js"() { init_polyfillShim(); init_src32(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); parser3 = function() { var o2 = function(k3, v, o22, l2) { for (o22 = o22 || {}, l2 = k3.length; l2--; o22[k3[l2]] = v) @@ -174776,7 +175815,7 @@ You have to call mermaid.initialize.` } }); - // node_modules/mermaid/dist/createText-ca0c5216.js + // node_modules/mermaid/dist/createText-4a4f35c9.js function preprocessMarkdown(markdown) { const withoutMultipleNewlines = markdown.replace(/\n{2,}/g, "\n"); const withoutExtraSpaces = (0, import_ts_dedent2.dedent)(withoutMultipleNewlines); @@ -174993,10 +176032,10 @@ You have to call mermaid.initialize.` }); } var import_ts_dedent2, createText; - var init_createText_ca0c5216 = __esm({ - "node_modules/mermaid/dist/createText-ca0c5216.js"() { + var init_createText_4a4f35c9 = __esm({ + "node_modules/mermaid/dist/createText-4a4f35c9.js"() { init_polyfillShim(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); init_mdast_util_from_markdown(); import_ts_dedent2 = __toESM(require_dist4(), 1); createText = (el, text4 = "", { @@ -175031,7 +176070,7 @@ You have to call mermaid.initialize.` } }); - // node_modules/mermaid/dist/edges-066a5561.js + // node_modules/mermaid/dist/edges-5962ec63.js function applyStyle3(dom, styleFn) { if (styleFn) { dom.attr("style", styleFn); @@ -175215,12 +176254,12 @@ You have to call mermaid.initialize.` } } var insertMarkers, extension2, composition, aggregation, dependency, lollipop, point8, circle$1, cross, barb, markers, insertMarkers$1, createLabel, createLabel$1, labelHelper, updateNodeBounds, intersectRect3, intersectRect$1, intersect2, note, note$1, expandAndDeduplicateDirections, getArrowPoints, formatClass, getClassesFromNode, question, choice, hexagon, block_arrow, rect_left_inv_arrow, lean_right, lean_left, trapezoid, inv_trapezoid, rect_right_inv_arrow, cylinder, rect2, composite, labelRect, rectWithTitle, stadium, circle2, doublecircle, subroutine, start2, forkJoin, end, class_box, shapes2, nodeElems, insertNode, setNodeElem, clear$1, positionNode, getSubGraphTitleMargins, markerOffsets, pointTransformer, getLineFunctionsWithOffset, addEdgeMarkers, arrowTypesMap, addEdgeMarker, edgeLabels, terminalLabels, clear4, insertEdgeLabel, positionEdgeLabel, outsideNode, intersection, cutPathAtIntersect, insertEdge; - var init_edges_066a5561 = __esm({ - "node_modules/mermaid/dist/edges-066a5561.js"() { + var init_edges_5962ec63 = __esm({ + "node_modules/mermaid/dist/edges-5962ec63.js"() { init_polyfillShim(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); init_src32(); - init_createText_ca0c5216(); + init_createText_4a4f35c9(); insertMarkers = (elem, markerArray, type3, id4) => { markerArray.forEach((markerName) => { markers[markerName](elem, type3, id4); @@ -176861,17 +177900,17 @@ You have to call mermaid.initialize.` } }); - // node_modules/mermaid/dist/index-01f381cb.js + // node_modules/mermaid/dist/index-9620d214.js var clusterDb, descendants, parents, clear$12, isDescendant2, edgeInCluster, copy2, extractDescendants, findNonClusterChild, getAnchorId, adjustClustersAndEdges, extractor, sorter, sortNodesByHierarchy, rect3, noteGroup, roundedWithTitle, divider, shapes3, clusterElems, insertCluster, clear5, recursiveRender, render4; - var init_index_01f381cb = __esm({ - "node_modules/mermaid/dist/index-01f381cb.js"() { + var init_index_9620d214 = __esm({ + "node_modules/mermaid/dist/index-9620d214.js"() { init_polyfillShim(); init_dagre(); init_json(); - init_edges_066a5561(); - init_mermaid_6dc72991(); + init_edges_5962ec63(); + init_mermaid_2490e8f2(); init_graphlib(); - init_createText_ca0c5216(); + init_createText_4a4f35c9(); init_src32(); clusterDb = {}; descendants = {}; @@ -177488,15 +178527,15 @@ You have to call mermaid.initialize.` } }); - // node_modules/mermaid/dist/styles-483fbfea.js + // node_modules/mermaid/dist/styles-422bd1c9.js var conf2, setConf2, addVertices, addEdges, getClasses2, draw2, flowRendererV2, fade, getStyles2, flowStyles; - var init_styles_483fbfea = __esm({ - "node_modules/mermaid/dist/styles-483fbfea.js"() { + var init_styles_422bd1c9 = __esm({ + "node_modules/mermaid/dist/styles-422bd1c9.js"() { init_polyfillShim(); init_graphlib(); init_src32(); - init_mermaid_6dc72991(); - init_index_01f381cb(); + init_mermaid_2490e8f2(); + init_index_9620d214(); init_add_html_label(); init_dist(); conf2 = {}; @@ -178001,9 +179040,9 @@ You have to call mermaid.initialize.` } }); - // node_modules/mermaid/dist/flowDiagram-b222e15a.js - var flowDiagram_b222e15a_exports = {}; - __export(flowDiagram_b222e15a_exports, { + // node_modules/mermaid/dist/flowDiagram-622f9fc1.js + var flowDiagram_622f9fc1_exports = {}; + __export(flowDiagram_622f9fc1_exports, { diagram: () => diagram2 }); function question2(parent4, bbox, node3) { @@ -178223,19 +179262,19 @@ You have to call mermaid.initialize.` ).attr("transform", "translate(" + -w2 / 2 + "," + h3 / 2 + ")"); } var import_ts_dedent3, import_dayjs2, import_sanitize_url3, import_dompurify2, flowChartShapes, conf3, setConf3, addVertices2, addEdges2, getClasses3, draw3, flowRenderer, diagram2; - var init_flowDiagram_b222e15a = __esm({ - "node_modules/mermaid/dist/flowDiagram-b222e15a.js"() { + var init_flowDiagram_622f9fc1 = __esm({ + "node_modules/mermaid/dist/flowDiagram-622f9fc1.js"() { init_polyfillShim(); - init_flowDb_c1833063(); + init_flowDb_0da60e67(); init_graphlib(); init_src32(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); init_src33(); init_util3(); init_add_html_label(); init_intersect_polygon(); init_intersect_rect(); - init_styles_483fbfea(); + init_styles_422bd1c9(); import_ts_dedent3 = __toESM(require_dist4(), 1); import_dayjs2 = __toESM(require_dayjs_min(), 1); import_sanitize_url3 = __toESM(require_dist5(), 1); @@ -178615,18 +179654,18 @@ You have to call mermaid.initialize.` } }); - // node_modules/mermaid/dist/flowDiagram-v2-13329dc7.js - var flowDiagram_v2_13329dc7_exports = {}; - __export(flowDiagram_v2_13329dc7_exports, { + // node_modules/mermaid/dist/flowDiagram-v2-a33b4996.js + var flowDiagram_v2_a33b4996_exports = {}; + __export(flowDiagram_v2_a33b4996_exports, { diagram: () => diagram3 }); var import_ts_dedent4, import_dayjs3, import_sanitize_url4, import_dompurify3, diagram3; - var init_flowDiagram_v2_13329dc7 = __esm({ - "node_modules/mermaid/dist/flowDiagram-v2-13329dc7.js"() { + var init_flowDiagram_v2_a33b4996 = __esm({ + "node_modules/mermaid/dist/flowDiagram-v2-a33b4996.js"() { init_polyfillShim(); - init_flowDb_c1833063(); - init_styles_483fbfea(); - init_mermaid_6dc72991(); + init_flowDb_0da60e67(); + init_styles_422bd1c9(); + init_mermaid_2490e8f2(); init_src32(); init_graphlib(); init_dagre(); @@ -178819,9 +179858,9 @@ You have to call mermaid.initialize.` } }); - // node_modules/mermaid/dist/erDiagram-09d1c15f.js - var erDiagram_09d1c15f_exports = {}; - __export(erDiagram_09d1c15f_exports, { + // node_modules/mermaid/dist/erDiagram-51d2b61e.js + var erDiagram_51d2b61e_exports = {}; + __export(erDiagram_51d2b61e_exports, { diagram: () => diagram4 }); function generateId(str2 = "", prefix = "") { @@ -178835,10 +179874,10 @@ You have to call mermaid.initialize.` return str2.length > 0 ? `${str2}-` : ""; } var import_ts_dedent5, import_dayjs4, import_sanitize_url5, import_dompurify4, parser4, erParser, entities, relationships, Cardinality, Identification, addEntity, getEntities, addAttributes, addRelationship, getRelationships, clear6, erDb, ERMarkers, insertMarkers2, erMarkers, BAD_ID_CHARS_REGEXP, conf4, entityNameIds, setConf4, drawAttributes, drawEntities, adjustEntities, getEdgeName, addRelationships, relCnt, drawRelationshipFromLayout, draw4, MERMAID_ERDIAGRAM_UUID, erRenderer, getStyles3, erStyles, diagram4; - var init_erDiagram_09d1c15f = __esm({ - "node_modules/mermaid/dist/erDiagram-09d1c15f.js"() { + var init_erDiagram_51d2b61e = __esm({ + "node_modules/mermaid/dist/erDiagram-51d2b61e.js"() { init_polyfillShim(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); init_graphlib(); init_src32(); init_dagre(); @@ -179999,9 +181038,9 @@ You have to call mermaid.initialize.` } }); - // node_modules/mermaid/dist/gitGraphDiagram-942e62fe.js - var gitGraphDiagram_942e62fe_exports = {}; - __export(gitGraphDiagram_942e62fe_exports, { + // node_modules/mermaid/dist/gitGraphDiagram-23af1bdb.js + var gitGraphDiagram_23af1bdb_exports = {}; + __export(gitGraphDiagram_23af1bdb_exports, { diagram: () => diagram5 }); function getId() { @@ -180062,10 +181101,10 @@ You have to call mermaid.initialize.` prettyPrintCommitHistory(commitArr); } var import_ts_dedent6, import_dayjs5, import_sanitize_url6, import_dompurify5, parser5, gitGraphParser, mainBranchName, mainBranchOrder, commits, head, branchesConfig, branches, curBranch, direction2, seq, setDirection2, options, setOptions, getOptions, commit2, branch, merge2, cherryPick, checkout, prettyPrint, clear$13, getBranchesAsObjArray, getBranches, getCommits, getCommitsArray, getCurrentBranch, getDirection2, getHead, commitType$1, gitGraphDb, allCommitsDict, commitType, THEME_COLOR_LIMIT, branchPos, commitPos, lanes, maxPos, dir, clear7, drawText2, findClosestParent, drawCommits, shouldRerouteArrow, findLane, drawArrow, drawArrows, drawBranches, draw5, gitGraphRenderer, getStyles4, gitGraphStyles, diagram5; - var init_gitGraphDiagram_942e62fe = __esm({ - "node_modules/mermaid/dist/gitGraphDiagram-942e62fe.js"() { + var init_gitGraphDiagram_23af1bdb = __esm({ + "node_modules/mermaid/dist/gitGraphDiagram-23af1bdb.js"() { init_polyfillShim(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); init_src32(); import_ts_dedent6 = __toESM(require_dist4(), 1); import_dayjs5 = __toESM(require_dayjs_min(), 1); @@ -181843,25 +182882,25 @@ You have to call mermaid.initialize.` "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = t4() : "function" == typeof define && define.amd ? define(t4) : (e3 = "undefined" != typeof globalThis ? globalThis : e3 || self).dayjs_plugin_customParseFormat = t4(); }(exports2, function() { "use strict"; - var e3 = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t4 = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n2 = /\d\d/, r2 = /\d\d?/, i2 = /\d*[^-_:/,()\s\d]+/, o2 = {}, s3 = function(e4) { + var e3 = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t4 = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n2 = /\d/, r2 = /\d\d/, i2 = /\d\d?/, o2 = /\d*[^-_:/,()\s\d]+/, s3 = {}, a3 = function(e4) { return (e4 = +e4) + (e4 > 68 ? 1900 : 2e3); }; - var a3 = function(e4) { + var f = function(e4) { return function(t5) { this[e4] = +t5; }; - }, f = [/[+-]\d\d:?(\d\d)?|Z/, function(e4) { + }, h3 = [/[+-]\d\d:?(\d\d)?|Z/, function(e4) { (this.zone || (this.zone = {})).offset = function(e6) { if (!e6) return 0; if ("Z" === e6) return 0; var t5 = e6.match(/([+-]|\d\d)/g), n3 = 60 * t5[1] + (+t5[2] || 0); return 0 === n3 ? 0 : "+" === t5[0] ? -n3 : n3; }(e4); - }], h3 = function(e4) { - var t5 = o2[e4]; + }], u2 = function(e4) { + var t5 = s3[e4]; return t5 && (t5.indexOf ? t5 : t5.s.concat(t5.f)); - }, u2 = function(e4, t5) { - var n3, r3 = o2.meridiem; + }, d2 = function(e4, t5) { + var n3, r3 = s3.meridiem; if (r3) { for (var i3 = 1; i3 <= 24; i3 += 1) if (e4.indexOf(r3(i3, 0, t5)) > -1) { n3 = i3 > 12; @@ -181869,50 +182908,52 @@ You have to call mermaid.initialize.` } } else n3 = e4 === (t5 ? "pm" : "PM"); return n3; - }, d2 = { A: [i2, function(e4) { - this.afternoon = u2(e4, false); - }], a: [i2, function(e4) { - this.afternoon = u2(e4, true); - }], S: [/\d/, function(e4) { + }, c5 = { A: [o2, function(e4) { + this.afternoon = d2(e4, false); + }], a: [o2, function(e4) { + this.afternoon = d2(e4, true); + }], Q: [n2, function(e4) { + this.month = 3 * (e4 - 1) + 1; + }], S: [n2, function(e4) { this.milliseconds = 100 * +e4; - }], SS: [n2, function(e4) { + }], SS: [r2, function(e4) { this.milliseconds = 10 * +e4; }], SSS: [/\d{3}/, function(e4) { this.milliseconds = +e4; - }], s: [r2, a3("seconds")], ss: [r2, a3("seconds")], m: [r2, a3("minutes")], mm: [r2, a3("minutes")], H: [r2, a3("hours")], h: [r2, a3("hours")], HH: [r2, a3("hours")], hh: [r2, a3("hours")], D: [r2, a3("day")], DD: [n2, a3("day")], Do: [i2, function(e4) { - var t5 = o2.ordinal, n3 = e4.match(/\d+/); + }], s: [i2, f("seconds")], ss: [i2, f("seconds")], m: [i2, f("minutes")], mm: [i2, f("minutes")], H: [i2, f("hours")], h: [i2, f("hours")], HH: [i2, f("hours")], hh: [i2, f("hours")], D: [i2, f("day")], DD: [r2, f("day")], Do: [o2, function(e4) { + var t5 = s3.ordinal, n3 = e4.match(/\d+/); if (this.day = n3[0], t5) for (var r3 = 1; r3 <= 31; r3 += 1) t5(r3).replace(/\[|\]/g, "") === e4 && (this.day = r3); - }], M: [r2, a3("month")], MM: [n2, a3("month")], MMM: [i2, function(e4) { - var t5 = h3("months"), n3 = (h3("monthsShort") || t5.map(function(e6) { + }], w: [i2, f("week")], ww: [r2, f("week")], M: [i2, f("month")], MM: [r2, f("month")], MMM: [o2, function(e4) { + var t5 = u2("months"), n3 = (u2("monthsShort") || t5.map(function(e6) { return e6.slice(0, 3); })).indexOf(e4) + 1; if (n3 < 1) throw new Error(); this.month = n3 % 12 || n3; - }], MMMM: [i2, function(e4) { - var t5 = h3("months").indexOf(e4) + 1; + }], MMMM: [o2, function(e4) { + var t5 = u2("months").indexOf(e4) + 1; if (t5 < 1) throw new Error(); this.month = t5 % 12 || t5; - }], Y: [/[+-]?\d+/, a3("year")], YY: [n2, function(e4) { - this.year = s3(e4); - }], YYYY: [/\d{4}/, a3("year")], Z: f, ZZ: f }; - function c5(n3) { + }], Y: [/[+-]?\d+/, f("year")], YY: [r2, function(e4) { + this.year = a3(e4); + }], YYYY: [/\d{4}/, f("year")], Z: h3, ZZ: h3 }; + function l2(n3) { var r3, i3; - r3 = n3, i3 = o2 && o2.formats; - for (var s4 = (n3 = r3.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t5, n4, r4) { - var o3 = r4 && r4.toUpperCase(); - return n4 || i3[r4] || e3[r4] || i3[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e4, t6, n5) { + r3 = n3, i3 = s3 && s3.formats; + for (var o3 = (n3 = r3.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t5, n4, r4) { + var o4 = r4 && r4.toUpperCase(); + return n4 || i3[r4] || e3[r4] || i3[o4].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e4, t6, n5) { return t6 || n5.slice(1); }); - })).match(t4), a4 = s4.length, f2 = 0; f2 < a4; f2 += 1) { - var h4 = s4[f2], u3 = d2[h4], c6 = u3 && u3[0], l2 = u3 && u3[1]; - s4[f2] = l2 ? { regex: c6, parser: l2 } : h4.replace(/^\[|\]$/g, ""); + })).match(t4), a4 = o3.length, f2 = 0; f2 < a4; f2 += 1) { + var h4 = o3[f2], u3 = c5[h4], d3 = u3 && u3[0], l3 = u3 && u3[1]; + o3[f2] = l3 ? { regex: d3, parser: l3 } : h4.replace(/^\[|\]$/g, ""); } return function(e4) { for (var t5 = {}, n4 = 0, r4 = 0; n4 < a4; n4 += 1) { - var i4 = s4[n4]; + var i4 = o3[n4]; if ("string" == typeof i4) r4 += i4.length; else { - var o3 = i4.regex, f3 = i4.parser, h5 = e4.slice(r4), u4 = o3.exec(h5)[0]; + var s4 = i4.regex, f3 = i4.parser, h5 = e4.slice(r4), u4 = s4.exec(h5)[0]; f3.call(t5, u4), e4 = e4.replace(u4, ""); } } @@ -181926,33 +182967,33 @@ You have to call mermaid.initialize.` }; } return function(e4, t5, n3) { - n3.p.customParseFormat = true, e4 && e4.parseTwoDigitYear && (s3 = e4.parseTwoDigitYear); + n3.p.customParseFormat = true, e4 && e4.parseTwoDigitYear && (a3 = e4.parseTwoDigitYear); var r3 = t5.prototype, i3 = r3.parse; r3.parse = function(e6) { - var t6 = e6.date, r4 = e6.utc, s4 = e6.args; + var t6 = e6.date, r4 = e6.utc, o3 = e6.args; this.$u = r4; - var a4 = s4[1]; + var a4 = o3[1]; if ("string" == typeof a4) { - var f2 = true === s4[2], h4 = true === s4[3], u3 = f2 || h4, d3 = s4[2]; - h4 && (d3 = s4[2]), o2 = this.$locale(), !f2 && d3 && (o2 = n3.Ls[d3]), this.$d = function(e7, t7, n4) { + var f2 = true === o3[2], h4 = true === o3[3], u3 = f2 || h4, d3 = o3[2]; + h4 && (d3 = o3[2]), s3 = this.$locale(), !f2 && d3 && (s3 = n3.Ls[d3]), this.$d = function(e7, t7, n4, r5) { try { if (["x", "X"].indexOf(t7) > -1) return new Date(("X" === t7 ? 1e3 : 1) * e7); - var r5 = c5(t7)(e7), i4 = r5.year, o3 = r5.month, s5 = r5.day, a5 = r5.hours, f3 = r5.minutes, h5 = r5.seconds, u4 = r5.milliseconds, d4 = r5.zone, l3 = /* @__PURE__ */ new Date(), m3 = s5 || (i4 || o3 ? 1 : l3.getDate()), M3 = i4 || l3.getFullYear(), Y3 = 0; - i4 && !o3 || (Y3 = o3 > 0 ? o3 - 1 : l3.getMonth()); - var p3 = a5 || 0, v = f3 || 0, D4 = h5 || 0, g2 = u4 || 0; - return d4 ? new Date(Date.UTC(M3, Y3, m3, p3, v, D4, g2 + 60 * d4.offset * 1e3)) : n4 ? new Date(Date.UTC(M3, Y3, m3, p3, v, D4, g2)) : new Date(M3, Y3, m3, p3, v, D4, g2); + var i4 = l2(t7)(e7), o4 = i4.year, s4 = i4.month, a5 = i4.day, f3 = i4.hours, h5 = i4.minutes, u4 = i4.seconds, d4 = i4.milliseconds, c7 = i4.zone, m3 = i4.week, M3 = /* @__PURE__ */ new Date(), Y3 = a5 || (o4 || s4 ? 1 : M3.getDate()), p3 = o4 || M3.getFullYear(), v = 0; + o4 && !s4 || (v = s4 > 0 ? s4 - 1 : M3.getMonth()); + var D4, w2 = f3 || 0, g2 = h5 || 0, y4 = u4 || 0, L = d4 || 0; + return c7 ? new Date(Date.UTC(p3, v, Y3, w2, g2, y4, L + 60 * c7.offset * 1e3)) : n4 ? new Date(Date.UTC(p3, v, Y3, w2, g2, y4, L)) : (D4 = new Date(p3, v, Y3, w2, g2, y4, L), m3 && (D4 = r5(D4).week(m3).toDate()), D4); } catch (e8) { return /* @__PURE__ */ new Date(""); } - }(t6, a4, r4), this.init(), d3 && true !== d3 && (this.$L = this.locale(d3).$L), u3 && t6 != this.format(a4) && (this.$d = /* @__PURE__ */ new Date("")), o2 = {}; - } else if (a4 instanceof Array) for (var l2 = a4.length, m2 = 1; m2 <= l2; m2 += 1) { - s4[1] = a4[m2 - 1]; - var M2 = n3.apply(this, s4); + }(t6, a4, r4, n3), this.init(), d3 && true !== d3 && (this.$L = this.locale(d3).$L), u3 && t6 != this.format(a4) && (this.$d = /* @__PURE__ */ new Date("")), s3 = {}; + } else if (a4 instanceof Array) for (var c6 = a4.length, m2 = 1; m2 <= c6; m2 += 1) { + o3[1] = a4[m2 - 1]; + var M2 = n3.apply(this, o3); if (M2.isValid()) { this.$d = M2.$d, this.$L = M2.$L, this.init(); break; } - m2 === l2 && (this.$d = /* @__PURE__ */ new Date("")); + m2 === c6 && (this.$d = /* @__PURE__ */ new Date("")); } else i3.call(this, e6); }; @@ -182014,9 +183055,9 @@ You have to call mermaid.initialize.` } }); - // node_modules/mermaid/dist/ganttDiagram-b62c793e.js - var ganttDiagram_b62c793e_exports = {}; - __export(ganttDiagram_b62c793e_exports, { + // node_modules/mermaid/dist/ganttDiagram-a649f789.js + var ganttDiagram_a649f789_exports = {}; + __export(ganttDiagram_a649f789_exports, { diagram: () => diagram6 }); function getTaskTags(data4, task, tags2) { @@ -182035,15 +183076,15 @@ You have to call mermaid.initialize.` } } var import_sanitize_url7, import_dayjs6, import_isoWeek, import_customParseFormat, import_advancedFormat, import_ts_dedent7, import_dompurify6, parser6, ganttParser, dateFormat, axisFormat, tickInterval, todayMarker, includes, excludes, links, sections, tasks, currentSection, displayMode, tags, funs2, inclusiveEndDates, topAxis, weekday, lastOrder, clear8, setAxisFormat, getAxisFormat, setTickInterval, getTickInterval, setTodayMarker, getTodayMarker, setDateFormat, enableInclusiveEndDates, endDatesAreInclusive, enableTopAxis, topAxisEnabled, setDisplayMode, getDisplayMode, getDateFormat, setIncludes, getIncludes, setExcludes, getExcludes, getLinks, addSection, getSections, getTasks, isInvalidDate, setWeekday, getWeekday, checkTaskDates, fixTaskDates, getStartDate, parseDuration, getEndDate, taskCnt, parseId, compileData, parseData, lastTask, lastTaskID, rawTasks, taskDb, addTask, findTaskById, addTaskOrg, compileTasks, setLink2, setClass2, setClickFun2, pushFun, setClickEvent2, bindFunctions2, ganttDb, setConf5, mapWeekdayToTimeFunction, getMaxIntersections, w, draw6, ganttRenderer, getStyles5, ganttStyles, diagram6; - var init_ganttDiagram_b62c793e = __esm({ - "node_modules/mermaid/dist/ganttDiagram-b62c793e.js"() { + var init_ganttDiagram_a649f789 = __esm({ + "node_modules/mermaid/dist/ganttDiagram-a649f789.js"() { init_polyfillShim(); import_sanitize_url7 = __toESM(require_dist5(), 1); import_dayjs6 = __toESM(require_dayjs_min(), 1); import_isoWeek = __toESM(require_isoWeek(), 1); import_customParseFormat = __toESM(require_customParseFormat(), 1); import_advancedFormat = __toESM(require_advancedFormat(), 1); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); init_src32(); import_ts_dedent7 = __toESM(require_dist4(), 1); import_dompurify6 = __toESM(require_purify(), 1); @@ -184076,16 +185117,16 @@ You have to call mermaid.initialize.` } }); - // node_modules/mermaid/dist/infoDiagram-94cd232f.js - var infoDiagram_94cd232f_exports = {}; - __export(infoDiagram_94cd232f_exports, { + // node_modules/mermaid/dist/infoDiagram-f86e0131.js + var infoDiagram_f86e0131_exports = {}; + __export(infoDiagram_f86e0131_exports, { diagram: () => diagram7 }); var import_ts_dedent8, import_dayjs7, import_sanitize_url8, import_dompurify7, parser7, parser$13, DEFAULT_INFO_DB, info, setInfo, getInfo, clear9, db4, draw7, renderer2, diagram7; - var init_infoDiagram_94cd232f = __esm({ - "node_modules/mermaid/dist/infoDiagram-94cd232f.js"() { + var init_infoDiagram_f86e0131 = __esm({ + "node_modules/mermaid/dist/infoDiagram-f86e0131.js"() { init_polyfillShim(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); import_ts_dedent8 = __toESM(require_dist4(), 1); import_dayjs7 = __toESM(require_dayjs_min(), 1); import_sanitize_url8 = __toESM(require_dist5(), 1); @@ -184600,16 +185641,16 @@ You have to call mermaid.initialize.` } }); - // node_modules/mermaid/dist/pieDiagram-bb1d19e5.js - var pieDiagram_bb1d19e5_exports = {}; - __export(pieDiagram_bb1d19e5_exports, { + // node_modules/mermaid/dist/pieDiagram-31d824a1.js + var pieDiagram_31d824a1_exports = {}; + __export(pieDiagram_31d824a1_exports, { diagram: () => diagram8 }); var import_ts_dedent9, import_dayjs8, import_sanitize_url9, import_dompurify8, parser8, parser$14, DEFAULT_PIE_CONFIG, DEFAULT_PIE_DB, sections2, showData, config2, getConfig2, clear10, addSection2, getSections2, cleanupValue, setShowData, getShowData, db5, getStyles6, styles3, createPieArcs, draw8, renderer3, diagram8; - var init_pieDiagram_bb1d19e5 = __esm({ - "node_modules/mermaid/dist/pieDiagram-bb1d19e5.js"() { + var init_pieDiagram_31d824a1 = __esm({ + "node_modules/mermaid/dist/pieDiagram-31d824a1.js"() { init_polyfillShim(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); init_src32(); import_ts_dedent9 = __toESM(require_dist4(), 1); import_dayjs8 = __toESM(require_dayjs_min(), 1); @@ -185326,9 +186367,9 @@ You have to call mermaid.initialize.` } }); - // node_modules/mermaid/dist/quadrantDiagram-c759a472.js - var quadrantDiagram_c759a472_exports = {}; - __export(quadrantDiagram_c759a472_exports, { + // node_modules/mermaid/dist/quadrantDiagram-a712a7d9.js + var quadrantDiagram_a712a7d9_exports = {}; + __export(quadrantDiagram_a712a7d9_exports, { diagram: () => diagram9 }); function textSanitizer(text4) { @@ -185394,10 +186435,10 @@ You have to call mermaid.initialize.` return quadrantBuilder.build(); } var import_ts_dedent10, import_dayjs9, import_sanitize_url10, import_dompurify9, parser9, parser$15, defaultThemeVariables, QuadrantBuilder, config3, quadrantBuilder, clear11, db6, draw9, renderer4, diagram9; - var init_quadrantDiagram_c759a472 = __esm({ - "node_modules/mermaid/dist/quadrantDiagram-c759a472.js"() { + var init_quadrantDiagram_a712a7d9 = __esm({ + "node_modules/mermaid/dist/quadrantDiagram-a712a7d9.js"() { init_polyfillShim(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); init_src32(); import_ts_dedent10 = __toESM(require_dist4(), 1); import_dayjs9 = __toESM(require_dayjs_min(), 1); @@ -186537,9 +187578,9 @@ You have to call mermaid.initialize.` } }); - // node_modules/mermaid/dist/xychartDiagram-f11f50a6.js - var xychartDiagram_f11f50a6_exports = {}; - __export(xychartDiagram_f11f50a6_exports, { + // node_modules/mermaid/dist/xychartDiagram-4a8b8217.js + var xychartDiagram_4a8b8217_exports = {}; + __export(xychartDiagram_4a8b8217_exports, { diagram: () => diagram10 }); function isBarPlot(data4) { @@ -186718,11 +187759,11 @@ You have to call mermaid.initialize.` return xyChartConfig; } var import_ts_dedent11, import_dayjs10, import_sanitize_url11, import_dompurify10, parser10, parser$16, TextDimensionCalculatorWithFont, BAR_WIDTH_TO_TICK_WIDTH_RATIO, MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL, BaseAxis, BandAxis, LinearAxis, ChartTitle, LinePlot, BarPlot, BasePlot, Orchestrator, XYChartBuilder, plotIndex, tmpSVGGroup, xyChartConfig, xyChartThemeConfig, xyChartData, plotColorPalette, hasSetXAxis, hasSetYAxis, clear12, db7, draw10, renderer5, diagram10; - var init_xychartDiagram_f11f50a6 = __esm({ - "node_modules/mermaid/dist/xychartDiagram-f11f50a6.js"() { + var init_xychartDiagram_4a8b8217 = __esm({ + "node_modules/mermaid/dist/xychartDiagram-4a8b8217.js"() { init_polyfillShim(); - init_mermaid_6dc72991(); - init_createText_ca0c5216(); + init_mermaid_2490e8f2(); + init_createText_4a4f35c9(); init_src32(); import_ts_dedent11 = __toESM(require_dist4(), 1); import_dayjs10 = __toESM(require_dayjs_min(), 1); @@ -188284,16 +189325,16 @@ You have to call mermaid.initialize.` } }); - // node_modules/mermaid/dist/requirementDiagram-87253d64.js - var requirementDiagram_87253d64_exports = {}; - __export(requirementDiagram_87253d64_exports, { + // node_modules/mermaid/dist/requirementDiagram-eb878fee.js + var requirementDiagram_eb878fee_exports = {}; + __export(requirementDiagram_eb878fee_exports, { diagram: () => diagram11 }); var import_ts_dedent12, import_dayjs11, import_sanitize_url12, import_dompurify11, parser11, parser$17, relations, latestRequirement, requirements, latestElement, elements, RequirementType, RiskLevel, VerifyType, Relationships, addRequirement, getRequirements, setNewReqId, setNewReqText, setNewReqRisk, setNewReqVerifyMethod, addElement, getElements, setNewElementType, setNewElementDocRef, addRelationship2, getRelationships2, clear13, db8, getStyles7, styles4, ReqMarkers, insertLineEndings, markers2, conf5, relCnt2, newRectNode, newTitleNode, newBodyNode, addEdgeLabel, drawRelationshipFromLayout2, drawReqs, drawElements, addRelationships2, adjustEntities2, elementString, draw11, renderer6, diagram11; - var init_requirementDiagram_87253d64 = __esm({ - "node_modules/mermaid/dist/requirementDiagram-87253d64.js"() { + var init_requirementDiagram_eb878fee = __esm({ + "node_modules/mermaid/dist/requirementDiagram-eb878fee.js"() { init_polyfillShim(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); init_src32(); init_dagre(); init_graphlib(); @@ -189386,9 +190427,9 @@ You have to call mermaid.initialize.` } }); - // node_modules/mermaid/dist/sequenceDiagram-6894f283.js - var sequenceDiagram_6894f283_exports = {}; - __export(sequenceDiagram_6894f283_exports, { + // node_modules/mermaid/dist/sequenceDiagram-66748113.js + var sequenceDiagram_66748113_exports = {}; + __export(sequenceDiagram_66748113_exports, { diagram: () => diagram12 }); function insertLinks(actor, links3) { @@ -189651,12 +190692,12 @@ You have to call mermaid.initialize.` return common$1.getMax(maxHeight, conf6.height); } var import_sanitize_url13, import_ts_dedent13, import_dayjs12, import_dompurify12, parser12, parser$18, ImperativeState, state, addBox, addActor, activationCount, addMessage, addSignal, hasAtLeastOneBox, hasAtLeastOneBoxWithTitle, getMessages, getBoxes, getActors, getCreatedActors, getDestroyedActors, getActor, getActorKeys, enableSequenceNumbers, disableSequenceNumbers, showSequenceNumbers, setWrap2, autoWrap2, clear14, parseMessage, parseBoxData, LINETYPE2, ARROWTYPE2, PLACEMENT2, addNote, addLinks, addALink, addProperties, addDetails, getActorProperty, apply2, db9, getStyles8, styles5, ACTOR_TYPE_WIDTH, TOP_ACTOR_CLASS, BOTTOM_ACTOR_CLASS, drawRect3, drawPopup, popupMenuToggle, drawKatex, drawText3, drawLabel, actorCnt, fixLifeLineHeights, drawActorTypeParticipant, drawActorTypeActor, drawActor, drawBox, anchorElement, drawActivation, drawLoop, drawBackgroundRect2, insertDatabaseIcon2, insertComputerIcon2, insertClockIcon2, insertArrowHead2, insertArrowFilledHead2, insertSequenceNumber, insertArrowCrossHead2, getTextObj2, getNoteRect2, _drawTextCandidateFunc2, _drawMenuItemTextCandidateFunc, svgDraw2, conf6, bounds, drawNote, messageFont2, noteFont, actorFont, drawMessage, addActorRenderingData, drawActors, drawActorsPopup, setConf6, actorActivations, activationBounds, draw12, getRequiredPopupWidth, buildNoteModel, buildMessageModel, calculateLoopBounds, renderer7, diagram12; - var init_sequenceDiagram_6894f283 = __esm({ - "node_modules/mermaid/dist/sequenceDiagram-6894f283.js"() { + var init_sequenceDiagram_66748113 = __esm({ + "node_modules/mermaid/dist/sequenceDiagram-66748113.js"() { init_polyfillShim(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); init_src32(); - init_svgDrawCommon_5e1cfd1d(); + init_svgDrawCommon_9d162435(); import_sanitize_url13 = __toESM(require_dist5(), 1); import_ts_dedent13 = __toESM(require_dist4(), 1); import_dayjs12 = __toESM(require_dayjs_min(), 1); @@ -192736,13 +193777,13 @@ You have to call mermaid.initialize.` } }); - // node_modules/mermaid/dist/styles-b83b31c9.js + // node_modules/mermaid/dist/styles-e2b9d258.js var parser13, parser$19, visibilityValues, ClassMember, MERMAID_DOM_ID_PREFIX2, relations2, classes2, notes, classCounter, namespaces, namespaceCounter, functions2, sanitizeText2, splitClassNameAndType, setClassLabel, addClass2, lookUpDomId2, clear15, getClass, getClasses4, getRelations, getNotes, addRelation, addAnnotation, addMember, addMembers, addNote2, cleanupLabel, setCssClass, setTooltip2, getTooltip2, setLink3, setClickEvent3, setClickFunc, bindFunctions3, lineType, relationType, setupToolTips2, direction3, getDirection3, setDirection3, addNamespace, getNamespace2, getNamespaces, addClassesToNamespace, setCssStyle, db10, getStyles9, styles6; - var init_styles_b83b31c9 = __esm({ - "node_modules/mermaid/dist/styles-b83b31c9.js"() { + var init_styles_e2b9d258 = __esm({ + "node_modules/mermaid/dist/styles-e2b9d258.js"() { init_polyfillShim(); init_src32(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); parser13 = function() { var o2 = function(k3, v, o22, l2) { for (o22 = o22 || {}, l2 = k3.length; l2--; o22[k3[l2]] = v) @@ -194223,20 +195264,20 @@ g.classGroup line { } }); - // node_modules/mermaid/dist/classDiagram-fb54d2a0.js - var classDiagram_fb54d2a0_exports = {}; - __export(classDiagram_fb54d2a0_exports, { + // node_modules/mermaid/dist/classDiagram-8298e144.js + var classDiagram_8298e144_exports = {}; + __export(classDiagram_8298e144_exports, { diagram: () => diagram13 }); var import_ts_dedent14, import_dayjs13, import_sanitize_url14, import_dompurify13, edgeCount, drawEdge, drawClass, getClassTitleString, drawNote2, addTspan, svgDraw3, idCache, padding, getGraphId, insertMarkers3, draw13, renderer8, diagram13; - var init_classDiagram_fb54d2a0 = __esm({ - "node_modules/mermaid/dist/classDiagram-fb54d2a0.js"() { + var init_classDiagram_8298e144 = __esm({ + "node_modules/mermaid/dist/classDiagram-8298e144.js"() { init_polyfillShim(); - init_styles_b83b31c9(); + init_styles_e2b9d258(); init_src32(); init_dagre(); init_graphlib(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); import_ts_dedent14 = __toESM(require_dist4(), 1); import_dayjs13 = __toESM(require_dayjs_min(), 1); import_sanitize_url14 = __toESM(require_dist5(), 1); @@ -194590,9 +195631,9 @@ g.classGroup line { } }); - // node_modules/mermaid/dist/classDiagram-v2-a2b738ad.js - var classDiagram_v2_a2b738ad_exports = {}; - __export(classDiagram_v2_a2b738ad_exports, { + // node_modules/mermaid/dist/classDiagram-v2-296fb1cd.js + var classDiagram_v2_296fb1cd_exports = {}; + __export(classDiagram_v2_296fb1cd_exports, { diagram: () => diagram14 }); function getArrowMarker(type3) { @@ -194619,14 +195660,14 @@ g.classGroup line { return marker; } var import_ts_dedent15, import_dayjs14, import_sanitize_url15, import_dompurify14, sanitizeText3, conf7, addNamespaces, addClasses, addNotes, addRelations, setConf7, draw14, renderer9, diagram14; - var init_classDiagram_v2_a2b738ad = __esm({ - "node_modules/mermaid/dist/classDiagram-v2-a2b738ad.js"() { + var init_classDiagram_v2_296fb1cd = __esm({ + "node_modules/mermaid/dist/classDiagram-v2-296fb1cd.js"() { init_polyfillShim(); - init_styles_b83b31c9(); + init_styles_e2b9d258(); init_src32(); init_graphlib(); - init_mermaid_6dc72991(); - init_index_01f381cb(); + init_mermaid_2490e8f2(); + init_index_9620d214(); import_ts_dedent15 = __toESM(require_dist4(), 1); import_dayjs14 = __toESM(require_dayjs_min(), 1); import_sanitize_url15 = __toESM(require_dist5(), 1); @@ -194889,7 +195930,7 @@ g.classGroup line { } }); - // node_modules/mermaid/dist/styles-0784dbeb.js + // node_modules/mermaid/dist/styles-de3becd0.js function newClassesList() { return {}; } @@ -194947,10 +195988,10 @@ g.classGroup line { }); } var parser14, parser$110, DEFAULT_DIAGRAM_DIRECTION, DEFAULT_NESTED_DOC_DIR, STMT_STATE, STMT_RELATION, STMT_CLASSDEF, STMT_APPLYCLASS, DEFAULT_STATE_TYPE, DIVIDER_TYPE, START_NODE, START_TYPE, END_NODE, END_TYPE, COLOR_KEYWORD, FILL_KEYWORD, BG_FILL, STYLECLASS_SEP, direction4, rootDoc, classes3, newDoc, documents, currentDocument, startEndCount, dividerCnt, lineType2, relationType2, clone2, setRootDoc, getRootDoc, docTranslator, getRootDocV2, extract, addState, clear16, getState, getStates, logDocuments, getRelations2, addRelation2, addDescription, cleanupLabel2, getDividerId, addStyleClass, getClasses5, setCssClass2, setStyle, setTextStyle, getDirection4, setDirection4, trimColon, db11, getStyles10, styles7; - var init_styles_0784dbeb = __esm({ - "node_modules/mermaid/dist/styles-0784dbeb.js"() { + var init_styles_de3becd0 = __esm({ + "node_modules/mermaid/dist/styles-de3becd0.js"() { init_polyfillShim(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); parser14 = function() { var o2 = function(k3, v, o22, l2) { for (o22 = o22 || {}, l2 = k3.length; l2--; o22[k3[l2]] = v) @@ -196250,20 +197291,20 @@ g.stateGroup line { } }); - // node_modules/mermaid/dist/stateDiagram-5dee940d.js - var stateDiagram_5dee940d_exports = {}; - __export(stateDiagram_5dee940d_exports, { + // node_modules/mermaid/dist/stateDiagram-35d39939.js + var stateDiagram_35d39939_exports = {}; + __export(stateDiagram_35d39939_exports, { diagram: () => diagram15 }); var import_ts_dedent16, import_dayjs15, import_sanitize_url16, import_dompurify15, idCache2, set4, get5, keys2, size2, idCache$1, drawStartState, drawDivider, drawSimpleState, drawDescrState, addTitleAndBox, drawEndState, drawForkJoinState, _drawLongText, drawNote3, drawState, edgeCount2, drawEdge2, conf8, transformationLog, setConf8, insertMarkers4, draw15, getLabelWidth, renderDoc, renderer10, diagram15; - var init_stateDiagram_5dee940d = __esm({ - "node_modules/mermaid/dist/stateDiagram-5dee940d.js"() { + var init_stateDiagram_35d39939 = __esm({ + "node_modules/mermaid/dist/stateDiagram-35d39939.js"() { init_polyfillShim(); - init_styles_0784dbeb(); + init_styles_de3becd0(); init_src32(); init_dagre(); init_graphlib(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); import_ts_dedent16 = __toESM(require_dist4(), 1); import_dayjs15 = __toESM(require_dayjs_min(), 1); import_sanitize_url16 = __toESM(require_dist5(), 1); @@ -196727,9 +197768,9 @@ g.stateGroup line { } }); - // node_modules/mermaid/dist/stateDiagram-v2-1992cada.js - var stateDiagram_v2_1992cada_exports = {}; - __export(stateDiagram_v2_1992cada_exports, { + // node_modules/mermaid/dist/stateDiagram-v2-6c43c13a.js + var stateDiagram_v2_6c43c13a_exports = {}; + __export(stateDiagram_v2_6c43c13a_exports, { diagram: () => diagram16 }); function getClassesFromDbInfo(dbInfoItem) { @@ -196748,14 +197789,14 @@ g.stateGroup line { return `${DOMID_STATE}-${itemId}${typeStr}-${counter}`; } var import_ts_dedent17, import_dayjs16, import_sanitize_url17, import_dompurify16, SHAPE_STATE, SHAPE_STATE_WITH_DESC, SHAPE_START, SHAPE_END, SHAPE_DIVIDER, SHAPE_GROUP, SHAPE_NOTE, SHAPE_NOTEGROUP, CSS_DIAGRAM, CSS_STATE, CSS_DIAGRAM_STATE, CSS_EDGE, CSS_NOTE, CSS_NOTE_EDGE, CSS_EDGE_NOTE_EDGE, CSS_DIAGRAM_NOTE, CSS_CLUSTER, CSS_DIAGRAM_CLUSTER, CSS_CLUSTER_ALT, CSS_DIAGRAM_CLUSTER_ALT, PARENT, NOTE, DOMID_STATE, DOMID_TYPE_SPACER, NOTE_ID, PARENT_ID, G_EDGE_STYLE, G_EDGE_ARROWHEADSTYLE, G_EDGE_LABELPOS, G_EDGE_LABELTYPE, G_EDGE_THICKNESS, nodeDb, graphItemCount, setConf9, getClasses6, setupNode, setupDoc, getDir, draw16, renderer11, diagram16; - var init_stateDiagram_v2_1992cada = __esm({ - "node_modules/mermaid/dist/stateDiagram-v2-1992cada.js"() { + var init_stateDiagram_v2_6c43c13a = __esm({ + "node_modules/mermaid/dist/stateDiagram-v2-6c43c13a.js"() { init_polyfillShim(); - init_styles_0784dbeb(); + init_styles_de3becd0(); init_graphlib(); init_src32(); - init_mermaid_6dc72991(); - init_index_01f381cb(); + init_mermaid_2490e8f2(); + init_index_9620d214(); import_ts_dedent17 = __toESM(require_dist4(), 1); import_dayjs16 = __toESM(require_dayjs_min(), 1); import_sanitize_url17 = __toESM(require_dist5(), 1); @@ -197061,9 +198102,9 @@ g.stateGroup line { } }); - // node_modules/mermaid/dist/journeyDiagram-6625b456.js - var journeyDiagram_6625b456_exports = {}; - __export(journeyDiagram_6625b456_exports, { + // node_modules/mermaid/dist/journeyDiagram-de0d04b7.js + var journeyDiagram_de0d04b7_exports = {}; + __export(journeyDiagram_de0d04b7_exports, { diagram: () => diagram17 }); function drawActorLegend(diagram24) { @@ -197092,12 +198133,12 @@ g.stateGroup line { }); } var import_ts_dedent18, import_dayjs17, import_sanitize_url18, import_dompurify17, parser15, parser$111, currentSection2, sections3, tasks2, rawTasks2, clear17, addSection3, getSections3, getTasks2, updateActors, addTask2, addTaskOrg2, compileTasks2, getActors2, db12, getStyles11, styles8, drawRect4, drawFace, drawCircle, drawText4, drawLabel2, drawSection, taskCount, drawTask, drawBackgroundRect3, _drawTextCandidateFunc3, initGraphics, svgDraw4, setConf10, actors, conf9, LEFT_MARGIN, draw17, bounds2, fills, textColours, drawTasks, renderer12, diagram17; - var init_journeyDiagram_6625b456 = __esm({ - "node_modules/mermaid/dist/journeyDiagram-6625b456.js"() { + var init_journeyDiagram_de0d04b7 = __esm({ + "node_modules/mermaid/dist/journeyDiagram-de0d04b7.js"() { init_polyfillShim(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); init_src32(); - init_svgDrawCommon_5e1cfd1d(); + init_svgDrawCommon_9d162435(); import_ts_dedent18 = __toESM(require_dist4(), 1); import_dayjs17 = __toESM(require_dayjs_min(), 1); import_sanitize_url18 = __toESM(require_dist5(), 1); @@ -203420,15 +204461,15 @@ g.stateGroup line { } function pMb() { pMb = geb; - oMb = ss(nMb()); + oMb = ss2(nMb()); } function ncc() { ncc = geb; - mcc = ss(lcc()); + mcc = ss2(lcc()); } function aZc() { aZc = geb; - _Yc = ss($Yc()); + _Yc = ss2($Yc()); } function WA() { WA = geb; @@ -204401,7 +205442,7 @@ g.stateGroup line { function vzb(a10) { return a10.b = RD(Bkb(a10.a), 44); } - function os(a10) { + function os2(a10) { return a10.f != null ? a10.f : "" + a10.g; } function ps(a10) { @@ -206646,7 +207687,7 @@ g.stateGroup line { this.b = new cnb(11); this.a = (urb(), a10); } - function is2(a10) { + function is3(a10) { this.a = (cs(), bs); this.d = RD(Qb(a10), 51); } @@ -206842,7 +207883,7 @@ g.stateGroup line { return lhb(a10.substr(0, b10.length), b10); } function Fl(a10) { - return new is2(new Il(a10.a.length, a10.a)); + return new is3(new Il(a10.a.length, a10.a)); } function Oid(a10) { return new rjd(a10.c + a10.b / 2, a10.d + a10.a / 2); @@ -208026,7 +209067,7 @@ g.stateGroup line { } function er2(a10) { Qb(a10); - return Er(new is2(Mr(a10.a.Kc(), new ir()))); + return Er(new is3(Mr(a10.a.Kc(), new ir()))); } function hfd(a10, b10) { rb(a10); @@ -208506,7 +209547,7 @@ g.stateGroup line { } function Is() { Is = geb; - Hs = ss((zs(), cD(WC(RG, 1), jwe, 549, 0, [ys]))); + Hs = ss2((zs(), cD(WC(RG, 1), jwe, 549, 0, [ys]))); } function Wx(a10) { var b10; @@ -209489,7 +210530,7 @@ g.stateGroup line { } function $Rb() { $Rb = geb; - ZRb = ss((VRb(), cD(WC($O, 1), jwe, 489, 0, [URb]))); + ZRb = ss2((VRb(), cD(WC($O, 1), jwe, 489, 0, [URb]))); } function CHc() { CHc = geb; @@ -209649,15 +210690,15 @@ g.stateGroup line { } function Abd() { Abd = geb; - zbd = ss((sbd(), cD(WC(M1, 1), jwe, 490, 0, [rbd]))); + zbd = ss2((sbd(), cD(WC(M1, 1), jwe, 490, 0, [rbd]))); } function Jbd() { Jbd = geb; - Ibd = ss((Cbd(), cD(WC(N1, 1), jwe, 558, 0, [Bbd]))); + Ibd = ss2((Cbd(), cD(WC(N1, 1), jwe, 558, 0, [Bbd]))); } function idd() { idd = geb; - hdd = ss((_cd(), cD(WC(V1, 1), jwe, 539, 0, [$cd]))); + hdd = ss2((_cd(), cD(WC(V1, 1), jwe, 539, 0, [$cd]))); } function X$b() { U$b(); @@ -210150,91 +211191,91 @@ g.stateGroup line { } function IHb() { IHb = geb; - HHb = ss((DHb(), cD(WC(uN, 1), jwe, 436, 0, [CHb, BHb]))); + HHb = ss2((DHb(), cD(WC(uN, 1), jwe, 436, 0, [CHb, BHb]))); } function QHb() { QHb = geb; - PHb = ss((LHb(), cD(WC(vN, 1), jwe, 435, 0, [JHb, KHb]))); + PHb = ss2((LHb(), cD(WC(vN, 1), jwe, 435, 0, [JHb, KHb]))); } function YUb() { YUb = geb; - XUb = ss((TUb(), cD(WC(BP, 1), jwe, 432, 0, [RUb, SUb]))); + XUb = ss2((TUb(), cD(WC(BP, 1), jwe, 432, 0, [RUb, SUb]))); } function U8b() { U8b = geb; - T8b = ss((P8b(), cD(WC(vS, 1), jwe, 517, 0, [O8b, N8b]))); + T8b = ss2((P8b(), cD(WC(vS, 1), jwe, 517, 0, [O8b, N8b]))); } function Tvc() { Tvc = geb; - Svc = ss((Ovc(), cD(WC(lX, 1), jwe, 429, 0, [Mvc, Nvc]))); + Svc = ss2((Ovc(), cD(WC(lX, 1), jwe, 429, 0, [Mvc, Nvc]))); } function duc() { duc = geb; - cuc = ss(($tc(), cD(WC(cX, 1), jwe, 428, 0, [Ytc, Ztc]))); + cuc = ss2(($tc(), cD(WC(cX, 1), jwe, 428, 0, [Ytc, Ztc]))); } function Huc() { Huc = geb; - Guc = ss((Cuc(), cD(WC(fX, 1), jwe, 488, 0, [Buc, Auc]))); + Guc = ss2((Cuc(), cD(WC(fX, 1), jwe, 488, 0, [Buc, Auc]))); } function xEc() { xEc = geb; - wEc = ss((sEc(), cD(WC(xX, 1), jwe, 430, 0, [qEc, rEc]))); + wEc = ss2((sEc(), cD(WC(xX, 1), jwe, 430, 0, [qEc, rEc]))); } function xNc() { xNc = geb; - wNc = ss((sNc(), cD(WC(MY, 1), jwe, 531, 0, [rNc, qNc]))); + wNc = ss2((sNc(), cD(WC(MY, 1), jwe, 531, 0, [rNc, qNc]))); } function otc() { otc = geb; - ntc = ss((jtc(), cD(WC($W, 1), jwe, 431, 0, [htc, itc]))); + ntc = ss2((jtc(), cD(WC($W, 1), jwe, 431, 0, [htc, itc]))); } function F_c() { F_c = geb; - E_c = ss((A_c(), cD(WC(K_, 1), jwe, 433, 0, [z_c, y_c]))); + E_c = ss2((A_c(), cD(WC(K_, 1), jwe, 433, 0, [z_c, y_c]))); } function F2c() { F2c = geb; - E2c = ss((x2c(), cD(WC(s0, 1), jwe, 501, 0, [v2c, w2c]))); + E2c = ss2((x2c(), cD(WC(s0, 1), jwe, 501, 0, [v2c, w2c]))); } function BQc() { BQc = geb; - AQc = ss((wQc(), cD(WC(FZ, 1), jwe, 523, 0, [vQc, uQc]))); + AQc = ss2((wQc(), cD(WC(FZ, 1), jwe, 523, 0, [vQc, uQc]))); } function JQc() { JQc = geb; - IQc = ss((EQc(), cD(WC(GZ, 1), jwe, 522, 0, [CQc, DQc]))); + IQc = ss2((EQc(), cD(WC(GZ, 1), jwe, 522, 0, [CQc, DQc]))); } function kTc() { kTc = geb; - jTc = ss((fTc(), cD(WC(b$, 1), jwe, 528, 0, [eTc, dTc]))); + jTc = ss2((fTc(), cD(WC(b$, 1), jwe, 528, 0, [eTc, dTc]))); } function iVc() { iVc = geb; - hVc = ss((dVc(), cD(WC(w$, 1), jwe, 465, 0, [bVc, cVc]))); + hVc = ss2((dVc(), cD(WC(w$, 1), jwe, 465, 0, [bVc, cVc]))); } function c4c() { c4c = geb; - b4c = ss((Y3c(), cD(WC(H0, 1), jwe, 434, 0, [W3c, X3c]))); + b4c = ss2((Y3c(), cD(WC(H0, 1), jwe, 434, 0, [W3c, X3c]))); } function H8c() { H8c = geb; - G8c = ss((z8c(), cD(WC(l1, 1), jwe, 491, 0, [x8c, y8c]))); + G8c = ss2((z8c(), cD(WC(l1, 1), jwe, 491, 0, [x8c, y8c]))); } function J9c() { J9c = geb; - I9c = ss((B9c(), cD(WC(t13, 1), jwe, 492, 0, [z9c, A9c]))); + I9c = ss2((B9c(), cD(WC(t13, 1), jwe, 492, 0, [z9c, A9c]))); } function Rbd() { Rbd = geb; - Qbd = ss((Mbd(), cD(WC(O1, 1), jwe, 438, 0, [Lbd, Kbd]))); + Qbd = ss2((Mbd(), cD(WC(O1, 1), jwe, 438, 0, [Lbd, Kbd]))); } function tdd() { tdd = geb; - sdd = ss((ldd(), cD(WC(W1, 1), jwe, 437, 0, [kdd, jdd]))); + sdd = ss2((ldd(), cD(WC(W1, 1), jwe, 437, 0, [kdd, jdd]))); } function Eqd() { Eqd = geb; - Dqd = ss((uqd(), cD(WC(M3, 1), jwe, 347, 0, [sqd, tqd]))); + Dqd = ss2((uqd(), cD(WC(M3, 1), jwe, 347, 0, [sqd, tqd]))); } function Imd() { Cmd(); @@ -210884,123 +211925,123 @@ g.stateGroup line { } function Atc() { Atc = geb; - ztc = ss((stc(), cD(WC(_W, 1), jwe, 322, 0, [qtc, ptc, rtc]))); + ztc = ss2((stc(), cD(WC(_W, 1), jwe, 322, 0, [qtc, ptc, rtc]))); } function Jtc() { Jtc = geb; - Itc = ss((Etc(), cD(WC(aX, 1), jwe, 351, 0, [Btc, Dtc, Ctc]))); + Itc = ss2((Etc(), cD(WC(aX, 1), jwe, 351, 0, [Btc, Dtc, Ctc]))); } function ooc() { ooc = geb; - noc = ss((joc(), cD(WC(UV, 1), jwe, 372, 0, [ioc, hoc, goc]))); + noc = ss2((joc(), cD(WC(UV, 1), jwe, 372, 0, [ioc, hoc, goc]))); } function muc() { muc = geb; - luc = ss((huc(), cD(WC(dX, 1), jwe, 460, 0, [fuc, euc, guc]))); + luc = ss2((huc(), cD(WC(dX, 1), jwe, 460, 0, [fuc, euc, guc]))); } function Cvc() { Cvc = geb; - Bvc = ss((xvc(), cD(WC(jX, 1), jwe, 299, 0, [vvc, wvc, uvc]))); + Bvc = ss2((xvc(), cD(WC(jX, 1), jwe, 299, 0, [vvc, wvc, uvc]))); } function Lvc() { Lvc = geb; - Kvc = ss((Gvc(), cD(WC(kX, 1), jwe, 311, 0, [Evc, Fvc, Dvc]))); + Kvc = ss2((Gvc(), cD(WC(kX, 1), jwe, 311, 0, [Evc, Fvc, Dvc]))); } function rDc() { rDc = geb; - qDc = ss((lDc(), cD(WC(sX, 1), jwe, 390, 0, [iDc, jDc, kDc]))); + qDc = ss2((lDc(), cD(WC(sX, 1), jwe, 390, 0, [iDc, jDc, kDc]))); } function PEc() { PEc = geb; - OEc = ss((KEc(), cD(WC(zX, 1), jwe, 387, 0, [HEc, IEc, JEc]))); + OEc = ss2((KEc(), cD(WC(zX, 1), jwe, 387, 0, [HEc, IEc, JEc]))); } function YEc() { YEc = geb; - XEc = ss((TEc(), cD(WC(AX, 1), jwe, 349, 0, [SEc, QEc, REc]))); + XEc = ss2((TEc(), cD(WC(AX, 1), jwe, 349, 0, [SEc, QEc, REc]))); } function GEc() { GEc = geb; - FEc = ss((BEc(), cD(WC(yX, 1), jwe, 463, 0, [AEc, yEc, zEc]))); + FEc = ss2((BEc(), cD(WC(yX, 1), jwe, 463, 0, [AEc, yEc, zEc]))); } function qFc() { qFc = geb; - pFc = ss((lFc(), cD(WC(CX, 1), jwe, 350, 0, [iFc, jFc, kFc]))); + pFc = ss2((lFc(), cD(WC(CX, 1), jwe, 350, 0, [iFc, jFc, kFc]))); } function zFc() { zFc = geb; - yFc = ss((uFc(), cD(WC(DX, 1), jwe, 352, 0, [tFc, rFc, sFc]))); + yFc = ss2((uFc(), cD(WC(DX, 1), jwe, 352, 0, [tFc, rFc, sFc]))); } function IFc() { IFc = geb; - HFc = ss((DFc(), cD(WC(EX, 1), jwe, 388, 0, [BFc, CFc, AFc]))); + HFc = ss2((DFc(), cD(WC(EX, 1), jwe, 388, 0, [BFc, CFc, AFc]))); } function QZc() { QZc = geb; - PZc = ss((LZc(), cD(WC(F_, 1), jwe, 392, 0, [KZc, JZc, IZc]))); + PZc = ss2((LZc(), cD(WC(F_, 1), jwe, 392, 0, [KZc, JZc, IZc]))); } function m4c() { m4c = geb; - l4c = ss((g4c(), cD(WC(I0, 1), jwe, 393, 0, [d4c, e4c, f4c]))); + l4c = ss2((g4c(), cD(WC(I0, 1), jwe, 393, 0, [d4c, e4c, f4c]))); } function z5c() { z5c = geb; - y5c = ss((t5c(), cD(WC(N0, 1), jwe, 300, 0, [r5c, s5c, q5c]))); + y5c = ss2((t5c(), cD(WC(N0, 1), jwe, 300, 0, [r5c, s5c, q5c]))); } function k6c() { k6c = geb; - j6c = ss((f6c(), cD(WC(V0, 1), jwe, 445, 0, [c6c, d6c, e6c]))); + j6c = ss2((f6c(), cD(WC(V0, 1), jwe, 445, 0, [c6c, d6c, e6c]))); } function F6c() { F6c = geb; - E6c = ss((z6c(), cD(WC(Z0, 1), jwe, 456, 0, [w6c, y6c, x6c]))); + E6c = ss2((z6c(), cD(WC(Z0, 1), jwe, 456, 0, [w6c, y6c, x6c]))); } function e7c() { e7c = geb; - d7c = ss((_6c(), cD(WC(a1, 1), jwe, 394, 0, [Z6c, $6c, Y6c]))); + d7c = ss2((_6c(), cD(WC(a1, 1), jwe, 394, 0, [Z6c, $6c, Y6c]))); } function j9c() { j9c = geb; - i9c = ss((b9c(), cD(WC(o1, 1), jwe, 439, 0, [$8c, a9c, _8c]))); + i9c = ss2((b9c(), cD(WC(o1, 1), jwe, 439, 0, [$8c, a9c, _8c]))); } function WKc() { WKc = geb; - VKc = ss((RKc(), cD(WC(nY, 1), jwe, 464, 0, [OKc, PKc, QKc]))); + VKc = ss2((RKc(), cD(WC(nY, 1), jwe, 464, 0, [OKc, PKc, QKc]))); } function JKb() { JKb = geb; - IKb = ss((EKb(), cD(WC(MN, 1), jwe, 471, 0, [CKb, BKb, DKb]))); + IKb = ss2((EKb(), cD(WC(MN, 1), jwe, 471, 0, [CKb, BKb, DKb]))); } function cKb() { cKb = geb; - bKb = ss((ZJb(), cD(WC(JN, 1), jwe, 237, 0, [WJb, XJb, YJb]))); + bKb = ss2((ZJb(), cD(WC(JN, 1), jwe, 237, 0, [WJb, XJb, YJb]))); } function ALb() { ALb = geb; - zLb = ss((vLb(), cD(WC(TN, 1), jwe, 472, 0, [uLb, tLb, sLb]))); + zLb = ss2((vLb(), cD(WC(TN, 1), jwe, 472, 0, [uLb, tLb, sLb]))); } function CBb() { CBb = geb; - BBb = ss((xBb(), cD(WC(QL, 1), jwe, 108, 0, [uBb, vBb, wBb]))); + BBb = ss2((xBb(), cD(WC(QL, 1), jwe, 108, 0, [uBb, vBb, wBb]))); } function FWb() { FWb = geb; - EWb = ss((AWb(), cD(WC(JP, 1), jwe, 391, 0, [yWb, xWb, zWb]))); + EWb = ss2((AWb(), cD(WC(JP, 1), jwe, 391, 0, [yWb, xWb, zWb]))); } function Knd() { Knd = geb; - Jnd = ss((Fnd(), cD(WC(y32, 1), jwe, 346, 0, [Dnd, Cnd, End]))); + Jnd = ss2((Fnd(), cD(WC(y32, 1), jwe, 346, 0, [Dnd, Cnd, End]))); } function lbd() { lbd = geb; - kbd = ss((gbd(), cD(WC(I1, 1), jwe, 444, 0, [dbd, ebd, fbd]))); + kbd = ss2((gbd(), cD(WC(I1, 1), jwe, 444, 0, [dbd, ebd, fbd]))); } function Tmd() { Tmd = geb; - Smd = ss((Omd(), cD(WC(t32, 1), jwe, 278, 0, [Lmd, Mmd, Nmd]))); + Smd = ss2((Omd(), cD(WC(t32, 1), jwe, 278, 0, [Lmd, Mmd, Nmd]))); } function rqd() { rqd = geb; - qqd = ss((mqd(), cD(WC(J3, 1), jwe, 280, 0, [kqd, jqd, lqd]))); + qqd = ss2((mqd(), cD(WC(J3, 1), jwe, 280, 0, [kqd, jqd, lqd]))); } function Hxd(a10, b10) { return !a10.o && (a10.o = new DVd((pvd(), mvd), X4, a10, 0)), QNd(a10.o, b10); @@ -211413,7 +212454,7 @@ g.stateGroup line { } function qAb() { qAb = geb; - pAb = ss((cAb(), cD(WC(AL, 1), jwe, 304, 0, [$zb, _zb, aAb, bAb]))); + pAb = ss2((cAb(), cD(WC(AL, 1), jwe, 304, 0, [$zb, _zb, aAb, bAb]))); } function cAb() { cAb = geb; @@ -211438,39 +212479,39 @@ g.stateGroup line { } function rOb() { rOb = geb; - qOb = ss((mOb(), cD(WC(hO, 1), jwe, 417, 0, [lOb, iOb, jOb, kOb]))); + qOb = ss2((mOb(), cD(WC(hO, 1), jwe, 417, 0, [lOb, iOb, jOb, kOb]))); } function NRb() { NRb = geb; - MRb = ss((IRb(), cD(WC(WO, 1), jwe, 406, 0, [FRb, ERb, GRb, HRb]))); + MRb = ss2((IRb(), cD(WC(WO, 1), jwe, 406, 0, [FRb, ERb, GRb, HRb]))); } function NPb() { NPb = geb; - MPb = ss((IPb(), cD(WC(DO, 1), jwe, 332, 0, [FPb, EPb, GPb, HPb]))); + MPb = ss2((IPb(), cD(WC(DO, 1), jwe, 332, 0, [FPb, EPb, GPb, HPb]))); } function Z$b() { Z$b = geb; - Y$b = ss((U$b(), cD(WC(CQ, 1), jwe, 389, 0, [T$b, R$b, Q$b, S$b]))); + Y$b = ss2((U$b(), cD(WC(CQ, 1), jwe, 389, 0, [T$b, R$b, Q$b, S$b]))); } function wZb() { wZb = geb; - vZb = ss((nZb(), cD(WC(lQ, 1), jwe, 416, 0, [jZb, mZb, kZb, lZb]))); + vZb = ss2((nZb(), cD(WC(lQ, 1), jwe, 416, 0, [jZb, mZb, kZb, lZb]))); } function jnc() { jnc = geb; - inc = ss((enc(), cD(WC(LV, 1), jwe, 421, 0, [anc, bnc, cnc, dnc]))); + inc = ss2((enc(), cD(WC(LV, 1), jwe, 421, 0, [anc, bnc, cnc, dnc]))); } function Bec() { Bec = geb; - Aec = ss((vec(), cD(WC(qT, 1), jwe, 371, 0, [uec, sec, tec, rec]))); + Aec = ss2((vec(), cD(WC(qT, 1), jwe, 371, 0, [uec, sec, tec, rec]))); } function DDc() { DDc = geb; - CDc = ss((wDc(), cD(WC(tX, 1), jwe, 203, 0, [uDc, vDc, tDc, sDc]))); + CDc = ss2((wDc(), cD(WC(tX, 1), jwe, 203, 0, [uDc, vDc, tDc, sDc]))); } function pEc() { pEc = geb; - oEc = ss((kEc(), cD(WC(wX, 1), jwe, 284, 0, [hEc, gEc, iEc, jEc]))); + oEc = ss2((kEc(), cD(WC(wX, 1), jwe, 284, 0, [hEc, gEc, iEc, jEc]))); } function Cuc() { Cuc = geb; @@ -211553,35 +212594,35 @@ g.stateGroup line { } function p5c() { p5c = geb; - o5c = ss((j5c(), cD(WC(M0, 1), jwe, 354, 0, [i5c, g5c, h5c, f5c]))); + o5c = ss2((j5c(), cD(WC(M0, 1), jwe, 354, 0, [i5c, g5c, h5c, f5c]))); } function x_c() { x_c = geb; - w_c = ss((s_c(), cD(WC(J_, 1), jwe, 353, 0, [r_c, p_c, q_c, o_c]))); + w_c = ss2((s_c(), cD(WC(J_, 1), jwe, 353, 0, [r_c, p_c, q_c, o_c]))); } function eWc() { eWc = geb; - dWc = ss((YVc(), cD(WC(H$, 1), jwe, 405, 0, [UVc, VVc, WVc, XVc]))); + dWc = ss2((YVc(), cD(WC(H$, 1), jwe, 405, 0, [UVc, VVc, WVc, XVc]))); } function bnd() { bnd = geb; - and = ss((Ymd(), cD(WC(u3, 1), jwe, 223, 0, [Xmd, Vmd, Umd, Wmd]))); + and = ss2((Ymd(), cD(WC(u3, 1), jwe, 223, 0, [Xmd, Vmd, Umd, Wmd]))); } function Vnd() { Vnd = geb; - Und = ss((Pnd(), cD(WC(z3, 1), jwe, 291, 0, [Ond, Lnd, Mnd, Nnd]))); + Und = ss2((Pnd(), cD(WC(z3, 1), jwe, 291, 0, [Ond, Lnd, Mnd, Nnd]))); } function Vpd() { Vpd = geb; - Upd = ss((Qpd(), cD(WC(H3, 1), jwe, 386, 0, [Opd, Ppd, Npd, Mpd]))); + Upd = ss2((Qpd(), cD(WC(H3, 1), jwe, 386, 0, [Opd, Ppd, Npd, Mpd]))); } function Lrd() { Lrd = geb; - Krd = ss((Grd(), cD(WC(R3, 1), jwe, 320, 0, [Frd, Crd, Erd, Drd]))); + Krd = ss2((Grd(), cD(WC(R3, 1), jwe, 320, 0, [Frd, Crd, Erd, Drd]))); } function ytd() { ytd = geb; - xtd = ss((ttd(), cD(WC(n4, 1), jwe, 415, 0, [qtd, rtd, ptd, std]))); + xtd = ss2((ttd(), cD(WC(n4, 1), jwe, 415, 0, [qtd, rtd, ptd, std]))); } function b9c() { b9c = geb; @@ -212091,51 +213132,51 @@ g.stateGroup line { } function xXb() { xXb = geb; - wXb = ss((sXb(), cD(WC(UP, 1), jwe, 367, 0, [nXb, oXb, pXb, qXb, rXb]))); + wXb = ss2((sXb(), cD(WC(UP, 1), jwe, 367, 0, [nXb, oXb, pXb, qXb, rXb]))); } function Hnc() { Hnc = geb; - Gnc = ss((Bnc(), cD(WC(TV, 1), jwe, 375, 0, [xnc, znc, Anc, ync, wnc]))); + Gnc = ss2((Bnc(), cD(WC(TV, 1), jwe, 375, 0, [xnc, znc, Anc, ync, wnc]))); } function Xtc() { Xtc = geb; - Wtc = ss((Ptc(), cD(WC(bX, 1), jwe, 348, 0, [Ltc, Ktc, Ntc, Otc, Mtc]))); + Wtc = ss2((Ptc(), cD(WC(bX, 1), jwe, 348, 0, [Ltc, Ktc, Ntc, Otc, Mtc]))); } function RDc() { RDc = geb; - QDc = ss((JDc(), cD(WC(uX, 1), jwe, 323, 0, [IDc, FDc, GDc, EDc, HDc]))); + QDc = ss2((JDc(), cD(WC(uX, 1), jwe, 323, 0, [IDc, FDc, GDc, EDc, HDc]))); } function hxc() { hxc = geb; - gxc = ss((cxc(), cD(WC(mX, 1), jwe, 171, 0, [bxc, Zwc, $wc, _wc, axc]))); + gxc = ss2((cxc(), cD(WC(mX, 1), jwe, 171, 0, [bxc, Zwc, $wc, _wc, axc]))); } function m3c() { m3c = geb; - l3c = ss((g3c(), cD(WC(x0, 1), jwe, 368, 0, [e3c, b3c, f3c, c3c, d3c]))); + l3c = ss2((g3c(), cD(WC(x0, 1), jwe, 368, 0, [e3c, b3c, f3c, c3c, d3c]))); } function xad() { xad = geb; - wad = ss((sad(), cD(WC(x1, 1), jwe, 373, 0, [oad, nad, qad, pad4, rad]))); + wad = ss2((sad(), cD(WC(x1, 1), jwe, 373, 0, [oad, nad, qad, pad4, rad]))); } function acd() { acd = geb; - _bd = ss((Xbd(), cD(WC(P1, 1), jwe, 324, 0, [Sbd, Tbd, Wbd, Ubd, Vbd]))); + _bd = ss2((Xbd(), cD(WC(P1, 1), jwe, 324, 0, [Sbd, Tbd, Wbd, Ubd, Vbd]))); } function Kmd() { Kmd = geb; - Jmd = ss((Cmd(), cD(WC(s3, 1), jwe, 88, 0, [Amd, zmd, ymd, xmd, Bmd]))); + Jmd = ss2((Cmd(), cD(WC(s3, 1), jwe, 88, 0, [Amd, zmd, ymd, xmd, Bmd]))); } function bid() { bid = geb; - aid = ss((Yhd(), cD(WC(d3, 1), jwe, 170, 0, [Whd, Vhd, Thd, Xhd, Uhd]))); + aid = ss2((Yhd(), cD(WC(d3, 1), jwe, 170, 0, [Whd, Vhd, Thd, Xhd, Uhd]))); } function uod() { uod = geb; - tod = ss((pod(), cD(WC(B3, 1), jwe, 256, 0, [mod, ood, kod, lod, nod]))); + tod = ss2((pod(), cD(WC(B3, 1), jwe, 256, 0, [mod, ood, kod, lod, nod]))); } function zpd() { zpd = geb; - ypd = ss((qpd(), cD(WC(E3, 1), NAe, 64, 0, [opd, Yod, Xod, npd, ppd]))); + ypd = ss2((qpd(), cD(WC(E3, 1), NAe, 64, 0, [opd, Yod, Xod, npd, ppd]))); } function LHb() { LHb = geb; @@ -212569,43 +213610,43 @@ g.stateGroup line { } function gtc() { gtc = geb; - ftc = ss((btc(), cD(WC(ZW, 1), jwe, 232, 0, [Zsc, _sc, Ysc, $sc, atc, Xsc]))); + ftc = ss2((btc(), cD(WC(ZW, 1), jwe, 232, 0, [Zsc, _sc, Ysc, $sc, atc, Xsc]))); } function zuc() { zuc = geb; - yuc = ss((tuc(), cD(WC(eX, 1), jwe, 283, 0, [ouc, nuc, quc, puc, suc, ruc]))); + yuc = ss2((tuc(), cD(WC(eX, 1), jwe, 283, 0, [ouc, nuc, quc, puc, suc, ruc]))); } function Tuc() { Tuc = geb; - Suc = ss((Ouc(), cD(WC(gX, 1), jwe, 281, 0, [Luc, Kuc, Nuc, Juc, Muc, Iuc]))); + Suc = ss2((Ouc(), cD(WC(gX, 1), jwe, 281, 0, [Luc, Kuc, Nuc, Juc, Muc, Iuc]))); } function dvc() { dvc = geb; - cvc = ss(($uc(), cD(WC(hX, 1), jwe, 282, 0, [Yuc, Vuc, Zuc, Xuc, Wuc, Uuc]))); + cvc = ss2(($uc(), cD(WC(hX, 1), jwe, 282, 0, [Yuc, Vuc, Zuc, Xuc, Wuc, Uuc]))); } function w3b() { w3b = geb; - v3b = ss((r3b(), cD(WC(hR, 1), jwe, 273, 0, [p3b, o3b, m3b, q3b, n3b, l3b]))); + v3b = ss2((r3b(), cD(WC(hR, 1), jwe, 273, 0, [p3b, o3b, m3b, q3b, n3b, l3b]))); } function Wjd() { Wjd = geb; - Vjd = ss((Rjd(), cD(WC(n3, 1), jwe, 255, 0, [Ljd, Ojd, Pjd, Qjd, Mjd, Njd]))); + Vjd = ss2((Rjd(), cD(WC(n3, 1), jwe, 255, 0, [Ljd, Ojd, Pjd, Qjd, Mjd, Njd]))); } function zkd() { zkd = geb; - ykd = ss((ukd(), cD(WC(q3, 1), jwe, 298, 0, [tkd, skd, rkd, pkd, okd, qkd]))); + ykd = ss2((ukd(), cD(WC(q3, 1), jwe, 298, 0, [tkd, skd, rkd, pkd, okd, qkd]))); } function nnd() { nnd = geb; - mnd = ss((ind(), cD(WC(v32, 1), jwe, 321, 0, [gnd, end2, hnd, cnd, fnd, dnd]))); + mnd = ss2((ind(), cD(WC(v32, 1), jwe, 321, 0, [gnd, end2, hnd, cnd, fnd, dnd]))); } function Iod() { Iod = geb; - Hod = ss((Bod(), cD(WC(C3, 1), jwe, 101, 0, [Aod, zod, yod, vod, xod, wod]))); + Hod = ss2((Bod(), cD(WC(C3, 1), jwe, 101, 0, [Aod, zod, yod, vod, xod, wod]))); } function Wod() { Wod = geb; - Vod = ss((Pod(), cD(WC(D32, 1), jwe, 279, 0, [Nod, Lod, Mod, Kod, Jod, Ood]))); + Vod = ss2((Pod(), cD(WC(D32, 1), jwe, 279, 0, [Nod, Lod, Mod, Kod, Jod, Ood]))); } function kKb() { kKb = geb; @@ -214016,15 +215057,15 @@ g.stateGroup line { } function pid() { pid = geb; - oid = ss((kid(), cD(WC(e3, 1), jwe, 285, 0, [jid, cid, gid, iid, did, eid, fid, hid]))); + oid = ss2((kid(), cD(WC(e3, 1), jwe, 285, 0, [jid, cid, gid, iid, did, eid, fid, hid]))); } function fGd() { fGd = geb; - eGd = ss((aGd(), cD(WC(T5, 1), jwe, 245, 0, [_Fd, YFd, ZFd, XFd, $Fd, VFd, UFd, WFd]))); + eGd = ss2((aGd(), cD(WC(T5, 1), jwe, 245, 0, [_Fd, YFd, ZFd, XFd, $Fd, VFd, UFd, WFd]))); } function jpc() { jpc = geb; - ipc = ss((epc(), cD(WC(hW, 1), jwe, 276, 0, [Zoc, apc, Yoc, dpc, _oc, $oc, cpc, bpc]))); + ipc = ss2((epc(), cD(WC(hW, 1), jwe, 276, 0, [Zoc, apc, Yoc, dpc, _oc, $oc, cpc, bpc]))); } function $Yc() { WYc(); @@ -214435,19 +215476,19 @@ g.stateGroup line { } function hDc() { hDc = geb; - gDc = ss((_Cc(), cD(WC(rX, 1), jwe, 265, 0, [ZCc, WCc, XCc, TCc, VCc, $Cc, YCc, SCc, UCc]))); + gDc = ss2((_Cc(), cD(WC(rX, 1), jwe, 265, 0, [ZCc, WCc, XCc, TCc, VCc, $Cc, YCc, SCc, UCc]))); } function iqd() { iqd = geb; - hqd = ss((dqd(), cD(WC(I3, 1), jwe, 264, 0, [Ypd, $pd, Xpd, _pd, aqd, cqd, bqd, Zpd, Wpd]))); + hqd = ss2((dqd(), cD(WC(I3, 1), jwe, 264, 0, [Ypd, $pd, Xpd, _pd, aqd, cqd, bqd, Zpd, Wpd]))); } function jod() { jod = geb; - iod = ss((dod(), cD(WC(A3, 1), jwe, 95, 0, [Xnd, Wnd, Znd, cod, bod, aod, $nd, _nd, Ynd]))); + iod = ss2((dod(), cD(WC(A3, 1), jwe, 95, 0, [Xnd, Wnd, Znd, cod, bod, aod, $nd, _nd, Ynd]))); } function nIb() { nIb = geb; - mIb = ss((iIb(), cD(WC(xN, 1), jwe, 257, 0, [hIb, cIb, dIb, bIb, fIb, gIb, eIb, aIb, _Hb]))); + mIb = ss2((iIb(), cD(WC(xN, 1), jwe, 257, 0, [hIb, cIb, dIb, bIb, fIb, gIb, eIb, aIb, _Hb]))); } function oSc(a10) { var b10; @@ -215007,11 +216048,11 @@ g.stateGroup line { } function tvc() { tvc = geb; - svc = ss((ovc(), cD(WC(iX, 1), jwe, 259, 0, [fvc, hvc, ivc, jvc, kvc, lvc, nvc, evc, gvc, mvc]))); + svc = ss2((ovc(), cD(WC(iX, 1), jwe, 259, 0, [fvc, hvc, ivc, jvc, kvc, lvc, nvc, evc, gvc, mvc]))); } function fEc() { fEc = geb; - eEc = ss((aEc(), cD(WC(vX, 1), jwe, 243, 0, [$Dc, VDc, YDc, WDc, XDc, SDc, ZDc, _Dc, TDc, UDc]))); + eEc = ss2((aEc(), cD(WC(vX, 1), jwe, 243, 0, [$Dc, VDc, YDc, WDc, XDc, SDc, ZDc, _Dc, TDc, UDc]))); } function huc() { huc = geb; @@ -215962,7 +217003,7 @@ g.stateGroup line { } return f; } - function ss(a10) { + function ss2(a10) { var b10, c10, d10, e11, f; b10 = {}; for (d10 = a10, e11 = 0, f = d10.length; e11 < f; ++e11) { @@ -216016,7 +217057,7 @@ g.stateGroup line { function EHc(a10) { var b10, c10, d10; d10 = 0; - for (c10 = new is2(Mr(a10.a.Kc(), new ir())); gs(c10); ) { + for (c10 = new is3(Mr(a10.a.Kc(), new ir())); gs(c10); ) { b10 = RD(hs(c10), 18); b10.c.i == b10.d.i || ++d10; } @@ -217883,7 +218924,7 @@ g.stateGroup line { if (a10.k != (r3b(), p3b)) { return false; } - return yDb(new SDb(null, new Twb(new is2(Mr(a3b(a10).a.Kc(), new ir())))), new qnc()); + return yDb(new SDb(null, new Twb(new is3(Mr(a3b(a10).a.Kc(), new ir())))), new qnc()); } function hv(a10) { var b10, c10; @@ -218608,7 +219649,7 @@ g.stateGroup line { var b10; b10 = a10.a; do { - b10 = RD(hs(new is2(Mr(a3b(b10).a.Kc(), new ir()))), 18).d.i; + b10 = RD(hs(new is3(Mr(a3b(b10).a.Kc(), new ir()))), 18).d.i; b10.k == (r3b(), o3b) && Rmb(a10.e, b10); } while (b10.k == (r3b(), o3b)); } @@ -218777,7 +219818,7 @@ g.stateGroup line { } function zGc(a10, b10) { var c10, d10, e11; - for (d10 = new is2(Mr(a3b(a10).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(a3b(a10).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); e11 = c10.d.i; if (e11.c == b10) { @@ -219292,7 +220333,7 @@ g.stateGroup line { function dRc(a10, b10) { WQc(); var c10, d10; - for (d10 = new is2(Mr(W2b(a10).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(W2b(a10).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); if (c10.d.i == b10 || c10.c.i == b10) { return c10; @@ -219699,7 +220740,7 @@ g.stateGroup line { if (d10 == (r3b(), p3b) || d10 == l3b) { return; } - c10 = new is2(Mr(a3b(e11).a.Kc(), new ir())); + c10 = new is3(Mr(a3b(e11).a.Kc(), new ir())); gs(c10) && Zjb(a10.k, b10, RD(hs(c10), 18)); } function O0c(a10, b10) { @@ -220059,7 +221100,7 @@ g.stateGroup line { var b10; b10 = a10.a; do { - b10 = RD(hs(new is2(Mr(Z2b(b10).a.Kc(), new ir()))), 18).c.i; + b10 = RD(hs(new is3(Mr(Z2b(b10).a.Kc(), new ir()))), 18).c.i; b10.k == (r3b(), o3b) && a10.b.Fc(b10); } while (b10.k == (r3b(), o3b)); a10.b = hv(a10.b); @@ -220067,7 +221108,7 @@ g.stateGroup line { function UGc(a10, b10) { var c10, d10, e11; e11 = a10; - for (d10 = new is2(Mr(Z2b(b10).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(Z2b(b10).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); !!c10.c.i.c && (e11 = $wnd.Math.max(e11, c10.c.i.c.p)); } @@ -220321,7 +221362,7 @@ g.stateGroup line { } function aec(a10, b10, c10) { var d10, e11, f; - for (e11 = new is2(Mr((b10 ? Z2b(a10) : a3b(a10)).a.Kc(), new ir())); gs(e11); ) { + for (e11 = new is3(Mr((b10 ? Z2b(a10) : a3b(a10)).a.Kc(), new ir())); gs(e11); ) { d10 = RD(hs(e11), 18); f = b10 ? d10.c.i : d10.d.i; f.k == (r3b(), n3b) && g3b(f, c10); @@ -220617,7 +221658,7 @@ g.stateGroup line { b10 = 0; for (d10 = new Anb(a10.c.a); d10.a < d10.c.c.length; ) { c10 = RD(ynb(d10), 10); - b10 += Kr(new is2(Mr(a3b(c10).a.Kc(), new ir()))); + b10 += Kr(new is3(Mr(a3b(c10).a.Kc(), new ir()))); } return b10 / a10.c.a.c.length; } @@ -221990,7 +223031,7 @@ g.stateGroup line { } function Gac(a10, b10) { var c10, d10, e11; - for (d10 = new is2(Mr(W2b(a10).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(W2b(a10).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); e11 = RD(b10.Kb(c10), 10); return new cc(Qb(e11.n.b + e11.o.b / 2)); @@ -222378,7 +223419,7 @@ g.stateGroup line { function Yrc(a10) { var b10, c10; if (a10.k == (r3b(), o3b)) { - for (c10 = new is2(Mr(W2b(a10).a.Kc(), new ir())); gs(c10); ) { + for (c10 = new is3(Mr(W2b(a10).a.Kc(), new ir())); gs(c10); ) { b10 = RD(hs(c10), 18); if (!W0b(b10) && a10.c == T0b(b10, a10).c) { return true; @@ -222390,7 +223431,7 @@ g.stateGroup line { function hSc(a10) { var b10, c10; if (a10.k == (r3b(), o3b)) { - for (c10 = new is2(Mr(W2b(a10).a.Kc(), new ir())); gs(c10); ) { + for (c10 = new is3(Mr(W2b(a10).a.Kc(), new ir())); gs(c10); ) { b10 = RD(hs(c10), 18); if (!W0b(b10) && b10.c.i.c == b10.d.i.c) { return true; @@ -223063,7 +224104,7 @@ g.stateGroup line { function Zrc(a10, b10) { var c10, d10, e11, f; e11 = b10 ? a3b(a10) : Z2b(a10); - for (d10 = new is2(Mr(e11.a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(e11.a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); f = T0b(c10, a10); if (f.k == (r3b(), o3b) && f.c != a10.c) { @@ -223375,7 +224416,7 @@ g.stateGroup line { for (f = new Anb(b10.a); f.a < f.c.c.length; ) { e11 = RD(ynb(f), 10); Nnb(a10.d); - for (d10 = new is2(Mr(a3b(e11).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(a3b(e11).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); CGc(a10, e11, c10.d.i); } @@ -223417,7 +224458,7 @@ g.stateGroup line { if (gr(c10)) { return null; } else { - b10 = (Qb(c10), RD(Er(new is2(Mr(c10.a.Kc(), new ir()))), 74)); + b10 = (Qb(c10), RD(Er(new is3(Mr(c10.a.Kc(), new ir()))), 74)); return AGd(RD(QHd((!b10.b && (b10.b = new Yie(E4, b10, 4, 7)), b10.b), 0), 84)); } } @@ -223715,8 +224756,8 @@ g.stateGroup line { } function jdc(a10) { var b10, c10; - b10 = RD(hs(new is2(Mr(Z2b(a10.a).a.Kc(), new ir()))), 18); - c10 = RD(hs(new is2(Mr(a3b(a10.a).a.Kc(), new ir()))), 18); + b10 = RD(hs(new is3(Mr(Z2b(a10.a).a.Kc(), new ir()))), 18); + c10 = RD(hs(new is3(Mr(a3b(a10.a).a.Kc(), new ir()))), 18); return Heb(TD(mQb(b10, (Ywc(), Nwc)))) || Heb(TD(mQb(c10, Nwc))); } function Bnc() { @@ -223749,7 +224790,7 @@ g.stateGroup line { var c10, d10, e11, f, g10; for (f = new Anb(b10.a); f.a < f.c.c.length; ) { e11 = RD(ynb(f), 10); - for (d10 = new is2(Mr(Z2b(e11).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(Z2b(e11).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); g10 = c10.c.i.p; a10.n[g10] = a10.n[g10] - 1; @@ -224046,7 +225087,7 @@ g.stateGroup line { function kec(a10) { var b10, c10, d10, e11; jec(a10); - for (c10 = new is2(Mr(W2b(a10).a.Kc(), new ir())); gs(c10); ) { + for (c10 = new is3(Mr(W2b(a10).a.Kc(), new ir())); gs(c10); ) { b10 = RD(hs(c10), 18); d10 = b10.c.i == a10; e11 = d10 ? b10.d : b10.c; @@ -224082,7 +225123,7 @@ g.stateGroup line { for (c10 = new dMd((!a10.a && (a10.a = new C5d(J4, a10, 10, 11)), a10.a)); c10.e != c10.i.gc(); ) { b10 = RD(bMd(c10), 27); d10 = yGd(b10); - if (!gs(new is2(Mr(d10.a.Kc(), new ir())))) { + if (!gs(new is3(Mr(d10.a.Kc(), new ir())))) { return b10; } } @@ -224283,7 +225324,7 @@ g.stateGroup line { function a5b(a10) { var b10, c10; if (Heb(TD(Gxd(a10, (yCc(), NAc))))) { - for (c10 = new is2(Mr(zGd(a10).a.Kc(), new ir())); gs(c10); ) { + for (c10 = new is3(Mr(zGd(a10).a.Kc(), new ir())); gs(c10); ) { b10 = RD(hs(c10), 74); if (ozd(b10)) { if (Heb(TD(Gxd(b10, OAc)))) { @@ -224838,10 +225879,10 @@ g.stateGroup line { } function edc(a10) { var b10; - b10 = (Zcc(), RD(hs(new is2(Mr(Z2b(a10).a.Kc(), new ir()))), 18).c.i); + b10 = (Zcc(), RD(hs(new is3(Mr(Z2b(a10).a.Kc(), new ir()))), 18).c.i); while (b10.k == (r3b(), o3b)) { pQb(b10, (Ywc(), twc), (Geb(), true)); - b10 = RD(hs(new is2(Mr(Z2b(b10).a.Kc(), new ir()))), 18).c.i; + b10 = RD(hs(new is3(Mr(Z2b(b10).a.Kc(), new ir()))), 18).c.i; } } function BMc(a10, b10, c10, d10) { @@ -226027,7 +227068,7 @@ g.stateGroup line { } function oOc(a10, b10, c10) { var d10, e11, f; - for (e11 = new is2(Mr(W2b(c10).a.Kc(), new ir())); gs(e11); ) { + for (e11 = new is3(Mr(W2b(c10).a.Kc(), new ir())); gs(e11); ) { d10 = RD(hs(e11), 18); if (!(!W0b(d10) && !(!W0b(d10) && d10.c.i.c == d10.d.i.c))) { continue; @@ -226078,7 +227119,7 @@ g.stateGroup line { function ZQc(a10, b10, c10, d10) { var e11, f, g10; if (b10.k == (r3b(), o3b)) { - for (f = new is2(Mr(Z2b(b10).a.Kc(), new ir())); gs(f); ) { + for (f = new is3(Mr(Z2b(b10).a.Kc(), new ir())); gs(f); ) { e11 = RD(hs(f), 18); g10 = e11.c.i.k; if (g10 == o3b && a10.c.a[e11.c.i.c.p] == d10 && a10.c.a[b10.c.p] == c10) { @@ -226774,7 +227815,7 @@ g.stateGroup line { } a10.d[b10.p] = true; a10.a[b10.p] = true; - for (d10 = new is2(Mr(a3b(b10).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(a3b(b10).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); if (W0b(c10)) { continue; @@ -227088,11 +228129,11 @@ g.stateGroup line { } function eIc(a10) { var b10, c10, d10, e11, f; - b10 = Kr(new is2(Mr(a3b(a10).a.Kc(), new ir()))); - for (e11 = new is2(Mr(Z2b(a10).a.Kc(), new ir())); gs(e11); ) { + b10 = Kr(new is3(Mr(a3b(a10).a.Kc(), new ir()))); + for (e11 = new is3(Mr(Z2b(a10).a.Kc(), new ir())); gs(e11); ) { d10 = RD(hs(e11), 18); c10 = d10.c.i; - f = Kr(new is2(Mr(a3b(c10).a.Kc(), new ir()))); + f = Kr(new is3(Mr(a3b(c10).a.Kc(), new ir()))); b10 = $wnd.Math.max(b10, f); } return sgb(b10); @@ -227270,7 +228311,7 @@ g.stateGroup line { var b10, c10, d10; if (Heb(TD(Gxd(a10, (umd(), $kd))))) { d10 = new bnb(); - for (c10 = new is2(Mr(zGd(a10).a.Kc(), new ir())); gs(c10); ) { + for (c10 = new is3(Mr(zGd(a10).a.Kc(), new ir())); gs(c10); ) { b10 = RD(hs(c10), 74); ozd(b10) && Heb(TD(Gxd(b10, _kd))) && (ZEb(d10.c, b10), true); } @@ -228383,7 +229424,7 @@ g.stateGroup line { d10 = RD(ynb(e11), 10); g10 = new _sb(); f = a3b(d10); - for (c10 = new is2(Mr(f.a.Kc(), new ir())); gs(c10); ) { + for (c10 = new is3(Mr(f.a.Kc(), new ir())); gs(c10); ) { b10 = RD(hs(c10), 18); b10.c.i == b10.d.i || Ysb(g10, b10.d.i); } @@ -229397,10 +230438,10 @@ g.stateGroup line { if (a10.d[c10.p]) { return; } - for (e11 = new is2(Mr(a3b(c10).a.Kc(), new ir())); gs(e11); ) { + for (e11 = new is3(Mr(a3b(c10).a.Kc(), new ir())); gs(e11); ) { d10 = RD(hs(e11), 18); h10 = d10.d.i; - for (g10 = new is2(Mr(Z2b(h10).a.Kc(), new ir())); gs(g10); ) { + for (g10 = new is3(Mr(Z2b(h10).a.Kc(), new ir())); gs(g10); ) { f = RD(hs(g10), 18); f.c.i == b10 && (a10.a[f.p] = true); } @@ -229639,7 +230680,7 @@ g.stateGroup line { } c10 = wec(RD(mQb(b10, hec), 371), RD(mQb(a10, UAc), 171)); pQb(b10, hec, c10); - if (gs(new is2(Mr(W2b(b10).a.Kc(), new ir())))) { + if (gs(new is3(Mr(W2b(b10).a.Kc(), new ir())))) { return; } switch (c10.g) { @@ -229944,7 +230985,7 @@ g.stateGroup line { for (h10 = new Anb(e11.a); h10.a < h10.c.c.length; ) { g10 = RD(ynb(h10), 10); g10.k == (r3b(), n3b) && Qdc(g10, b10); - for (d10 = new is2(Mr(a3b(g10).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(a3b(g10).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); Pdc(c10, b10); } @@ -229973,8 +231014,8 @@ g.stateGroup line { a10.k = $C(kE, Pwe, 28, a10.p.c.length, 15, 1); for (c10 = new Anb(a10.p); c10.a < c10.c.c.length; ) { b10 = RD(ynb(c10), 10); - a10.e[b10.p] = Kr(new is2(Mr(Z2b(b10).a.Kc(), new ir()))); - a10.k[b10.p] = Kr(new is2(Mr(a3b(b10).a.Kc(), new ir()))); + a10.e[b10.p] = Kr(new is3(Mr(Z2b(b10).a.Kc(), new ir()))); + a10.k[b10.p] = Kr(new is3(Mr(a3b(b10).a.Kc(), new ir()))); } } function bIc(a10) { @@ -229985,7 +231026,7 @@ g.stateGroup line { for (g10 = new Anb(a10.p); g10.a < g10.c.c.length; ) { f = RD(ynb(g10), 10); f.p = e11; - for (d10 = new is2(Mr(a3b(f).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(a3b(f).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); Ysb(b10, c10.d.i); } @@ -231256,7 +232297,7 @@ g.stateGroup line { f = null; j: for (i10 = new Anb(a10.a); i10.a < i10.c.c.length; ) { h10 = RD(ynb(i10), 10); - for (d10 = new is2(Mr(Z2b(h10).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(Z2b(h10).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); if (!!e11 && e11 != h10) { b10 = false; @@ -231488,7 +232529,7 @@ g.stateGroup line { b10 = 0; for (d10 = new Anb(a10.a); d10.a < d10.c.c.length; ) { c10 = RD(ynb(d10), 10); - for (f = new is2(Mr(a3b(c10).a.Kc(), new ir())); gs(f); ) { + for (f = new is3(Mr(a3b(c10).a.Kc(), new ir())); gs(f); ) { e11 = RD(hs(f), 18); if (a10 == e11.d.i.c && e11.c.j == (qpd(), ppd)) { g10 = K3b(e11.c).b; @@ -231617,7 +232658,7 @@ g.stateGroup line { return d10; } a10.j[g10.p] = -1; - for (f = new is2(Mr(W2b(g10).a.Kc(), new ir())); gs(f); ) { + for (f = new is3(Mr(W2b(g10).a.Kc(), new ir())); gs(f); ) { e11 = RD(hs(f), 18); if (!(!W0b(e11) && !(!W0b(e11) && e11.c.i.c == e11.d.i.c)) || e11 == b10) { continue; @@ -231976,7 +233017,7 @@ g.stateGroup line { i10 = RD($5b(a10.a, b10), 17).a; c10 ? c6b(a10.a, sgb(i10 + 1), b10) : c6b(a10.a, sgb(i10 - 1), b10); g10 = new Iub(); - for (e11 = new is2(Mr((c10 ? a3b(b10) : Z2b(b10)).a.Kc(), new ir())); gs(e11); ) { + for (e11 = new is3(Mr((c10 ? a3b(b10) : Z2b(b10)).a.Kc(), new ir())); gs(e11); ) { d10 = RD(hs(e11), 18); c10 ? f = d10.d.i : f = d10.c.i; dE($5b(a10.a, f)) === dE($5b(a10.a, b10)) && (h10 = g10.a.zc(f, g10), h10 == null); @@ -232174,7 +233215,7 @@ g.stateGroup line { for (g10 = new Anb(b10.a); g10.a < g10.c.c.length; ) { f = RD(ynb(g10), 10); e11 += f.o.b + f.d.a + f.d.d + a10.e; - for (d10 = new is2(Mr(Z2b(f).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(Z2b(f).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); if (c10.c.i.k == (r3b(), q3b)) { i10 = c10.c.i; @@ -233010,8 +234051,8 @@ g.stateGroup line { if (nQb(c10, (Ywc(), wwc))) { return RD(mQb(c10, wwc), 12).i; } - if (c10.k != (r3b(), p3b) && gs(new is2(Mr(a3b(c10).a.Kc(), new ir())))) { - b10 = RD(hs(new is2(Mr(a3b(c10).a.Kc(), new ir()))), 18); + if (c10.k != (r3b(), p3b) && gs(new is3(Mr(a3b(c10).a.Kc(), new ir())))) { + b10 = RD(hs(new is3(Mr(a3b(c10).a.Kc(), new ir()))), 18); } else if (c10.k != p3b) { return null; } @@ -233136,7 +234177,7 @@ g.stateGroup line { } function eec(a10) { var b10, c10; - for (c10 = new is2(Mr(a3b(a10).a.Kc(), new ir())); gs(c10); ) { + for (c10 = new is3(Mr(a3b(a10).a.Kc(), new ir())); gs(c10); ) { b10 = RD(hs(c10), 18); if (b10.d.i.k != (r3b(), n3b)) { throw Adb(new Jed(nBe + X2b(a10) + "' has its layer constraint set to LAST, but has at least one outgoing edge that does not go to a LAST_SEPARATE node. That must not happen.")); @@ -233171,7 +234212,7 @@ g.stateGroup line { for (k10 = new Anb(a10.a); k10.a < k10.c.c.length; ) { j10 = RD(ynb(k10), 10); h10 = 0; - for (f = new is2(Mr(Z2b(j10).a.Kc(), new ir())); gs(f); ) { + for (f = new is3(Mr(Z2b(j10).a.Kc(), new ir())); gs(f); ) { e11 = RD(hs(f), 18); l10 = K3b(e11.c).b; m10 = K3b(e11.d).b; @@ -233525,7 +234566,7 @@ g.stateGroup line { } function dec(a10) { var b10, c10; - for (c10 = new is2(Mr(Z2b(a10).a.Kc(), new ir())); gs(c10); ) { + for (c10 = new is3(Mr(Z2b(a10).a.Kc(), new ir())); gs(c10); ) { b10 = RD(hs(c10), 18); if (b10.c.i.k != (r3b(), n3b)) { throw Adb(new Jed(nBe + X2b(a10) + "' has its layer constraint set to FIRST, but has at least one incoming edge that does not come from a FIRST_SEPARATE node. That must not happen.")); @@ -234216,7 +235257,7 @@ g.stateGroup line { var b10, c10, d10, e11, f; e11 = new bnb(); b10 = new btb((!a10.a && (a10.a = new C5d(J4, a10, 10, 11)), a10.a)); - for (d10 = new is2(Mr(zGd(a10).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(zGd(a10).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 74); if (!ZD(QHd((!c10.b && (c10.b = new Yie(E4, c10, 4, 7)), c10.b), 0), 193)) { f = AGd(RD(QHd((!c10.c && (c10.c = new Yie(E4, c10, 5, 8)), c10.c), 0), 84)); @@ -234608,7 +235649,7 @@ g.stateGroup line { case 4: g3b(f, c10); } - for (e11 = new is2(Mr(W2b(f).a.Kc(), new ir())); gs(e11); ) { + for (e11 = new is3(Mr(W2b(f).a.Kc(), new ir())); gs(e11); ) { d10 = RD(hs(e11), 18); if (!!d10.c && !!d10.d) { continue; @@ -234634,7 +235675,7 @@ g.stateGroup line { var b10, c10, d10, e11, f, g10; f = new _sb(); b10 = new btb((!a10.a && (a10.a = new C5d(J4, a10, 10, 11)), a10.a)); - for (e11 = new is2(Mr(zGd(a10).a.Kc(), new ir())); gs(e11); ) { + for (e11 = new is3(Mr(zGd(a10).a.Kc(), new ir())); gs(e11); ) { d10 = RD(hs(e11), 74); if (!ZD(QHd((!d10.b && (d10.b = new Yie(E4, d10, 4, 7)), d10.b), 0), 193)) { g10 = AGd(RD(QHd((!d10.c && (d10.c = new Yie(E4, d10, 5, 8)), d10.c), 0), 84)); @@ -235016,7 +236057,7 @@ g.stateGroup line { a10.c = b10; } g3b(c10, a10.b); - for (e11 = new is2(Mr(Z2b(c10).a.Kc(), new ir())); gs(e11); ) { + for (e11 = new is3(Mr(Z2b(c10).a.Kc(), new ir())); gs(e11); ) { d10 = RD(hs(e11), 18); !d10.c.i.c && d10.c.i.k == (r3b(), n3b) && g3b(d10.c.i, a10.a); } @@ -235268,7 +236309,7 @@ g.stateGroup line { } function X9b(a10, b10, c10, d10) { var e11, f, g10, h10, i10; - if (Kr((U9b(), new is2(Mr(W2b(b10).a.Kc(), new ir())))) >= a10.a) { + if (Kr((U9b(), new is3(Mr(W2b(b10).a.Kc(), new ir())))) >= a10.a) { return -1; } if (!W9b(b10, c10)) { @@ -235692,7 +236733,7 @@ g.stateGroup line { continue; } $$b(i10, g10, new pjd()); - for (f = new is2(Mr(a3b(g10).a.Kc(), new ir())); gs(f); ) { + for (f = new is3(Mr(a3b(g10).a.Kc(), new ir())); gs(f); ) { e11 = RD(hs(f), 18); if (e11.c.i.k == m3b || e11.d.i.k == m3b) { continue; @@ -238274,7 +239315,7 @@ g.stateGroup line { } for (f = a10.Kc(); f.Ob(); ) { e11 = RD(f.Pb(), 10); - for (d10 = new is2(Mr(a3b(e11).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(a3b(e11).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); if (W0b(c10)) { continue; @@ -238558,7 +239599,7 @@ g.stateGroup line { function lnc(a10) { var b10, c10, d10, e11, f, g10, h10, i10, j10; g10 = new bnb(); - for (d10 = new is2(Mr(a3b(a10.b).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(a3b(a10.b).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); W0b(c10) && Rmb(g10, new knc(c10, nnc(a10, c10.c), nnc(a10, c10.d))); } @@ -238598,7 +239639,7 @@ g.stateGroup line { i10 = RD(ynb(j10), 10); k10 = new bnb(); h10 = 0; - for (d10 = new is2(Mr(Z2b(i10).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(Z2b(i10).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); if (W0b(c10) || !W0b(c10) && c10.c.i.c == c10.d.i.c) { continue; @@ -238624,7 +239665,7 @@ g.stateGroup line { i10 = RD(ynb(j10), 10); k10 = new bnb(); h10 = 0; - for (d10 = new is2(Mr(a3b(i10).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(a3b(i10).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); if (W0b(c10) || !W0b(c10) && c10.c.i.c == c10.d.i.c) { continue; @@ -239310,7 +240351,7 @@ g.stateGroup line { var d10, e11, f, g10, h10, i10, j10; for (g10 = new dMd((!a10.a && (a10.a = new C5d(J4, a10, 10, 11)), a10.a)); g10.e != g10.i.gc(); ) { f = RD(bMd(g10), 27); - for (e11 = new is2(Mr(zGd(f).a.Kc(), new ir())); gs(e11); ) { + for (e11 = new is3(Mr(zGd(f).a.Kc(), new ir())); gs(e11); ) { d10 = RD(hs(e11), 74); if (!nzd(d10) && !nzd(d10) && !ozd(d10)) { i10 = RD(Wd(qtb(c10.f, f)), 40); @@ -239579,7 +240620,7 @@ g.stateGroup line { var c10, d10, e11, f, g10; b10.d ? e11 = a10.a.c == (wQc(), vQc) ? Z2b(b10.b) : a3b(b10.b) : e11 = a10.a.c == (wQc(), uQc) ? Z2b(b10.b) : a3b(b10.b); f = false; - for (d10 = new is2(Mr(e11.a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(e11.a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); g10 = Heb(a10.a.f[a10.a.g[b10.b.p].p]); if (!g10 && !W0b(c10) && c10.c.i.c == c10.d.i.c) { @@ -240845,14 +241886,14 @@ g.stateGroup line { k10[d10++] = j10.a.gc(); for (i10 = new Anb(e11.a); i10.a < i10.c.c.length; ) { g10 = RD(ynb(i10), 10); - for (c10 = new is2(Mr(a3b(g10).a.Kc(), new ir())); gs(c10); ) { + for (c10 = new is3(Mr(a3b(g10).a.Kc(), new ir())); gs(c10); ) { b10 = RD(hs(c10), 18); j10.a.zc(b10, j10); } } for (h10 = new Anb(e11.a); h10.a < h10.c.c.length; ) { g10 = RD(ynb(h10), 10); - for (c10 = new is2(Mr(Z2b(g10).a.Kc(), new ir())); gs(c10); ) { + for (c10 = new is3(Mr(Z2b(g10).a.Kc(), new ir())); gs(c10); ) { b10 = RD(hs(c10), 18); j10.a.Bc(b10) != null; } @@ -241328,10 +242369,10 @@ g.stateGroup line { for (h10 = new Anb(e11.a); h10.a < h10.c.c.length; ) { g10 = RD(ynb(h10), 10); if (g10.k == (r3b(), n3b)) { - i10 = (j10 = RD(hs(new is2(Mr(Z2b(g10).a.Kc(), new ir()))), 18), k10 = RD(hs(new is2(Mr(a3b(g10).a.Kc(), new ir()))), 18), !Heb(TD(mQb(j10, (Ywc(), Nwc)))) || !Heb(TD(mQb(k10, Nwc)))) ? b10 : Qnd(b10); + i10 = (j10 = RD(hs(new is3(Mr(Z2b(g10).a.Kc(), new ir()))), 18), k10 = RD(hs(new is3(Mr(a3b(g10).a.Kc(), new ir()))), 18), !Heb(TD(mQb(j10, (Ywc(), Nwc)))) || !Heb(TD(mQb(k10, Nwc)))) ? b10 : Qnd(b10); Qdc(g10, i10); } - for (d10 = new is2(Mr(a3b(g10).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(a3b(g10).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); i10 = Heb(TD(mQb(c10, (Ywc(), Nwc)))) ? Qnd(b10) : b10; Pdc(c10, i10); @@ -241513,19 +242554,19 @@ g.stateGroup line { } function VGc(a10, b10) { var c10, d10, e11, f, g10; - for (g10 = new is2(Mr(Z2b(b10).a.Kc(), new ir())); gs(g10); ) { + for (g10 = new is3(Mr(Z2b(b10).a.Kc(), new ir())); gs(g10); ) { f = RD(hs(g10), 18); if (a10.f.b == 0) { e11 = f.c.i.k == (r3b(), p3b) && !!f.c.i.c && f.c.i.c.p == a10.c; - if (gs(new is2(Mr(Z2b(f.c.i).a.Kc(), new ir())))) { - c10 = RD(hs(new is2(Mr(Z2b(f.c.i).a.Kc(), new ir()))), 18).c.i.c; + if (gs(new is3(Mr(Z2b(f.c.i).a.Kc(), new ir())))) { + c10 = RD(hs(new is3(Mr(Z2b(f.c.i).a.Kc(), new ir()))), 18).c.i.c; d10 = f.c.i.k == n3b && !!c10 && c10.p == a10.c; } else { d10 = false; } } else { e11 = f.c.i.k == (r3b(), p3b) && f.c.i.p == a10.c; - d10 = f.c.i.k == n3b && RD(hs(new is2(Mr(Z2b(f.c.i).a.Kc(), new ir()))), 18).c.i.p == a10.c; + d10 = f.c.i.k == n3b && RD(hs(new is3(Mr(Z2b(f.c.i).a.Kc(), new ir()))), 18).c.i.p == a10.c; } if (e11 || d10) { return true; @@ -241704,7 +242745,7 @@ g.stateGroup line { function V9b(a10, b10) { var c10, d10, e11, f, g10, h10, i10, j10; c10 = new aac(); - for (e11 = new is2(Mr(Z2b(b10).a.Kc(), new ir())); gs(e11); ) { + for (e11 = new is3(Mr(Z2b(b10).a.Kc(), new ir())); gs(e11); ) { d10 = RD(hs(e11), 18); if (W0b(d10)) { continue; @@ -241720,7 +242761,7 @@ g.stateGroup line { Rmb(c10.a, h10); } } - for (g10 = new is2(Mr(a3b(b10).a.Kc(), new ir())); gs(g10); ) { + for (g10 = new is3(Mr(a3b(b10).a.Kc(), new ir())); gs(g10); ) { f = RD(hs(g10), 18); if (W0b(f)) { continue; @@ -241850,7 +242891,7 @@ g.stateGroup line { } e11 = RD(mQb(h10, (Ywc(), hwc)), 64); if (e11 == (qpd(), Xod) || e11 == ppd) { - for (d10 = new is2(Mr(W2b(h10).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(W2b(h10).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); b10 = c10.a; if (b10.b == 0) { @@ -243249,7 +244290,7 @@ g.stateGroup line { } function M5c(a10, b10) { var c10, d10, e11, f, g10, h10, i10, j10, k10, l10, m10; - for (d10 = new is2(Mr(zGd(b10).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(zGd(b10).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 74); if (!ZD(QHd((!c10.b && (c10.b = new Yie(E4, c10, 4, 7)), c10.b), 0), 193)) { i10 = AGd(RD(QHd((!c10.c && (c10.c = new Yie(E4, c10, 5, 8)), c10.c), 0), 84)); @@ -244762,7 +245803,7 @@ g.stateGroup line { for (i10 = new Anb(f.a); i10.a < i10.c.c.length; ) { h10 = RD(ynb(i10), 10); h10.p = j10++; - for (d10 = new is2(Mr(a3b(h10).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(a3b(h10).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 18); c10.p = e11++; } @@ -245562,14 +246603,14 @@ g.stateGroup line { var b10, c10, d10, e11, f; d10 = RD(mQb(a10, (yCc(), UAc)), 171); if (d10 == (cxc(), $wc)) { - for (c10 = new is2(Mr(Z2b(a10).a.Kc(), new ir())); gs(c10); ) { + for (c10 = new is3(Mr(Z2b(a10).a.Kc(), new ir())); gs(c10); ) { b10 = RD(hs(c10), 18); if (!lec(b10)) { throw Adb(new Jed(nBe + X2b(a10) + "' has its layer constraint set to FIRST_SEPARATE, but has at least one incoming edge. FIRST_SEPARATE nodes must not have incoming edges.")); } } } else if (d10 == axc) { - for (f = new is2(Mr(a3b(a10).a.Kc(), new ir())); gs(f); ) { + for (f = new is3(Mr(a3b(a10).a.Kc(), new ir())); gs(f); ) { e11 = RD(hs(f), 18); if (!lec(e11)) { throw Adb(new Jed(nBe + X2b(a10) + "' has its layer constraint set to LAST_SEPARATE, but has at least one outgoing edge. LAST_SEPARATE nodes must not have outgoing edges.")); @@ -246352,13 +247393,13 @@ g.stateGroup line { l10 = RD(mQb(g10, (Ywc(), hwc)), 64); if (l10 == (qpd(), Yod)) { k10.a.zc(g10, k10); - for (e11 = new is2(Mr(Z2b(g10).a.Kc(), new ir())); gs(e11); ) { + for (e11 = new is3(Mr(Z2b(g10).a.Kc(), new ir())); gs(e11); ) { d10 = RD(hs(e11), 18); Ysb(j10, d10.c.i); } } else if (l10 == npd) { p10.a.zc(g10, p10); - for (e11 = new is2(Mr(Z2b(g10).a.Kc(), new ir())); gs(e11); ) { + for (e11 = new is3(Mr(Z2b(g10).a.Kc(), new ir())); gs(e11); ) { d10 = RD(hs(e11), 18); Ysb(o10, d10.c.i); } @@ -247640,7 +248681,7 @@ g.stateGroup line { gGb(hGb(iGb(new jGb(), cD(WC(hN, 1), rve, 60, 0, [b10])), b10), a10.a); j10 = new cHb(); Zjb(a10.e, b10, j10); - c10 = Kr(new is2(Mr(Z2b(h10).a.Kc(), new ir()))) - Kr(new is2(Mr(a3b(h10).a.Kc(), new ir()))); + c10 = Kr(new is3(Mr(Z2b(h10).a.Kc(), new ir()))) - Kr(new is3(Mr(a3b(h10).a.Kc(), new ir()))); c10 < 0 ? aHb(j10, true, (Cmd(), ymd)) : c10 > 0 && aHb(j10, true, (Cmd(), zmd)); h10.k == (r3b(), m3b) && bHb(j10); Zjb(a10.f, h10, b10); @@ -247708,7 +248749,7 @@ g.stateGroup line { $mb(a10.c, j10, Kfb(UD(Vmb(a10.c, j10))) + k10 - d10 * a10.f); } (a10.r == (aEc(), VDc) && (RD(Vmb(a10.b, j10), 17).a > a10.k || RD(Vmb(a10.b, j10 - 1), 17).a > a10.k) || a10.r == YDc && (Kfb(UD(Vmb(a10.c, j10))) > a10.n || Kfb(UD(Vmb(a10.c, j10 - 1))) > a10.n)) && (i10 = false); - for (g10 = new is2(Mr(Z2b(b10).a.Kc(), new ir())); gs(g10); ) { + for (g10 = new is3(Mr(Z2b(b10).a.Kc(), new ir())); gs(g10); ) { f = RD(hs(g10), 18); h10 = f.c.i; if (a10.g[h10.p] == j10) { @@ -248774,7 +249815,7 @@ g.stateGroup line { k10 = RD(mQb(a10, rAc), 88); for (n10 = new Anb(a10.a); n10.a < n10.c.c.length; ) { m10 = RD(ynb(n10), 10); - for (f = new is2(Mr(a3b(m10).a.Kc(), new ir())); gs(f); ) { + for (f = new is3(Mr(a3b(m10).a.Kc(), new ir())); gs(f); ) { e11 = RD(hs(f), 18); if (e11.c.i != e11.d.i && br(e11.b, Gcc)) { p10 = Kcc(e11); @@ -249824,7 +250865,7 @@ g.stateGroup line { var d10, e11, f, g10, h10, i10, j10, k10; for (i10 = new dMd((!a10.a && (a10.a = new C5d(J4, a10, 10, 11)), a10.a)); i10.e != i10.i.gc(); ) { h10 = RD(bMd(i10), 27); - for (e11 = new is2(Mr(zGd(h10).a.Kc(), new ir())); gs(e11); ) { + for (e11 = new is3(Mr(zGd(h10).a.Kc(), new ir())); gs(e11); ) { d10 = RD(hs(e11), 74); !d10.b && (d10.b = new Yie(E4, d10, 4, 7)); if (!(d10.b.i <= 1 && (!d10.c && (d10.c = new Yie(E4, d10, 5, 8)), d10.c.i <= 1))) { @@ -251097,7 +252138,7 @@ g.stateGroup line { m10 = 1; for (s10 = new dMd((!a10.a && (a10.a = new C5d(J4, a10, 10, 11)), a10.a)); s10.e != s10.i.gc(); ) { q = RD(bMd(s10), 27); - m10 += Kr(new is2(Mr(zGd(q).a.Kc(), new ir()))); + m10 += Kr(new is3(Mr(zGd(q).a.Kc(), new ir()))); B10 = q.g; o10 = $wnd.Math.max(o10, B10); l10 = q.f; @@ -251120,7 +252161,7 @@ g.stateGroup line { w10 = h10 + (e11.d + e11.a); for (v = new dMd((!a10.a && (a10.a = new C5d(J4, a10, 10, 11)), a10.a)); v.e != v.i.gc(); ) { u10 = RD(bMd(v), 27); - for (k10 = new is2(Mr(zGd(u10).a.Kc(), new ir())); gs(k10); ) { + for (k10 = new is3(Mr(zGd(u10).a.Kc(), new ir())); gs(k10); ) { j10 = RD(hs(k10), 74); nzd(j10) || cud(j10, b10, A10, w10); } @@ -252008,8 +253049,8 @@ g.stateGroup line { m10 = k10.p; a10.g[m10] = k10.c.p; j10 += k10.o.b + a10.o; - c10 = Kr(new is2(Mr(Z2b(k10).a.Kc(), new ir()))); - o10 = Kr(new is2(Mr(a3b(k10).a.Kc(), new ir()))); + c10 = Kr(new is3(Mr(Z2b(k10).a.Kc(), new ir()))); + o10 = Kr(new is3(Mr(a3b(k10).a.Kc(), new ir()))); a10.d[m10][0] = o10 - c10; a10.d[m10][1] = c10; a10.d[m10][2] = o10; @@ -252211,16 +253252,16 @@ g.stateGroup line { g3b(n10, e11); i10 = false; } else { - for (h10 = new is2(Mr(Z2b(n10).a.Kc(), new ir())); gs(h10); ) { + for (h10 = new is3(Mr(Z2b(n10).a.Kc(), new ir())); gs(h10); ) { f = RD(hs(h10), 18); - if (f.c.i.k == (r3b(), p3b) && f.c.i.c == e11 || f.c.i.k == n3b && RD(hs(new is2(Mr(Z2b(f.c.i).a.Kc(), new ir()))), 18).c.i.c == e11) { + if (f.c.i.k == (r3b(), p3b) && f.c.i.c == e11 || f.c.i.k == n3b && RD(hs(new is3(Mr(Z2b(f.c.i).a.Kc(), new ir()))), 18).c.i.c == e11) { d10 = new R4b(a10.a); Rmb(a10.a.b, d10); e11 = new R4b(a10.a); Rmb(a10.a.b, e11); } } - for (g10 = new is2(Mr(Z2b(n10).a.Kc(), new ir())); gs(g10); ) { + for (g10 = new is3(Mr(Z2b(n10).a.Kc(), new ir())); gs(g10); ) { f = RD(hs(g10), 18); f.c.i.k == (r3b(), n3b) && !f.c.i.c && g3b(f.c.i, d10); } @@ -252429,7 +253470,7 @@ g.stateGroup line { for (m10 = new Anb(g10.a); m10.a < m10.c.c.length; ) { l10 = RD(ynb(m10), 10); j10 = 0; - for (p10 = new is2(Mr(a3b(l10).a.Kc(), new ir())); gs(p10); ) { + for (p10 = new is3(Mr(a3b(l10).a.Kc(), new ir())); gs(p10); ) { o10 = RD(hs(p10), 18); r10 = K3b(o10.c).b; s10 = K3b(o10.d).b; @@ -252592,7 +253633,7 @@ g.stateGroup line { b10 = RD(ynb(c10), 60); j10 = Zjc(b10); if (j10) { - for (h10 = new is2(Mr(a3b(j10).a.Kc(), new ir())); gs(h10); ) { + for (h10 = new is3(Mr(a3b(j10).a.Kc(), new ir())); gs(h10); ) { g10 = RD(hs(h10), 18); if (W0b(g10)) { continue; @@ -252691,7 +253732,7 @@ g.stateGroup line { c10 = new _sb(); Zjb(FSb, h10, c10); n10 = new TSb(); - e11 = RD(zDb(new SDb(null, new Twb(new is2(Mr(yGd(h10).a.Kc(), new ir())))), OBb(n10, tBb(new ZBb(), new XBb(), new wCb(), cD(WC(QL, 1), jwe, 108, 0, [(xBb(), vBb)])))), 85); + e11 = RD(zDb(new SDb(null, new Twb(new is3(Mr(yGd(h10).a.Kc(), new ir())))), OBb(n10, tBb(new ZBb(), new XBb(), new wCb(), cD(WC(QL, 1), jwe, 108, 0, [(xBb(), vBb)])))), 85); ISb(c10, RD(e11.xc((Geb(), true)), 16), new VSb()); d10 = RD(zDb(CDb(RD(e11.xc(false), 15).Lc(), new XSb()), tBb(new ZBb(), new XBb(), new wCb(), cD(WC(QL, 1), jwe, 108, 0, [vBb]))), 15); for (g10 = d10.Kc(); g10.Ob(); ) { @@ -252706,7 +253747,7 @@ g.stateGroup line { ye2(c10, j10); } } - e11 = RD(zDb(new SDb(null, new Twb(new is2(Mr(zGd(h10).a.Kc(), new ir())))), OBb(n10, tBb(new ZBb(), new XBb(), new wCb(), cD(WC(QL, 1), jwe, 108, 0, [vBb])))), 85); + e11 = RD(zDb(new SDb(null, new Twb(new is3(Mr(zGd(h10).a.Kc(), new ir())))), OBb(n10, tBb(new ZBb(), new XBb(), new wCb(), cD(WC(QL, 1), jwe, 108, 0, [vBb])))), 85); ISb(c10, RD(e11.xc(true), 16), new ZSb()); d10 = RD(zDb(CDb(RD(e11.xc(false), 15).Lc(), new _Sb()), tBb(new ZBb(), new XBb(), new wCb(), cD(WC(QL, 1), jwe, 108, 0, [vBb]))), 15); for (l10 = d10.Kc(); l10.Ob(); ) { @@ -254341,7 +255382,7 @@ g.stateGroup line { u10 = -1; for (t10 = new Anb(p10.a); t10.a < t10.c.c.length; ) { s10 = RD(ynb(t10), 10); - if (Kr((U9b(), new is2(Mr(W2b(s10).a.Kc(), new ir())))) >= a10.a) { + if (Kr((U9b(), new is3(Mr(W2b(s10).a.Kc(), new ir())))) >= a10.a) { d10 = V9b(a10, s10); k10 = $wnd.Math.max(k10, d10.b); u10 = $wnd.Math.max(u10, d10.d); @@ -254495,7 +255536,7 @@ g.stateGroup line { q = new D_b(); for (p10 = new Anb(b10.a); p10.a < p10.c.c.length; ) { o10 = RD(ynb(p10), 10); - for (e11 = new is2(Mr(a3b(o10).a.Kc(), new ir())); gs(e11); ) { + for (e11 = new is3(Mr(a3b(o10).a.Kc(), new ir())); gs(e11); ) { d10 = RD(hs(e11), 18); if (d10.c.i.k == (r3b(), m3b) || d10.d.i.k == m3b) { k10 = h_b(a10, d10, j10, q); @@ -254637,7 +255678,7 @@ g.stateGroup line { C10 = b3b(l10, (qpd(), ppd)); C10.dc() || !br(C10, new lLc()) ? d10.c = 1 : (e11 = b3b(l10, Xod), (e11.dc() || !br(e11, new hLc())) && (v += d10.a)); } - for (g10 = new is2(Mr(a3b(l10).a.Kc(), new ir())); gs(g10); ) { + for (g10 = new is3(Mr(a3b(l10).a.Kc(), new ir())); gs(g10); ) { f = RD(hs(g10), 18); v += d10.c; u10 += d10.b; @@ -254645,7 +255686,7 @@ g.stateGroup line { ZKc(a10, d10, B10); } r10 = Al(cD(WC(cJ, 1), rve, 20, 0, [b3b(l10, (qpd(), Yod)), b3b(l10, npd)])); - for (A10 = new is2(new Il(r10.a.length, r10.a)); gs(A10); ) { + for (A10 = new is3(new Il(r10.a.length, r10.a)); gs(A10); ) { w10 = RD(hs(A10), 12); s10 = RD(mQb(w10, (Ywc(), Iwc)), 10); if (s10) { @@ -254658,7 +255699,7 @@ g.stateGroup line { for (o10 = new Anb(t10); o10.a < o10.c.c.length; ) { l10 = RD(ynb(o10), 10); d10 = a10.b[l10.c.p][l10.p]; - for (g10 = new is2(Mr(a3b(l10).a.Kc(), new ir())); gs(g10); ) { + for (g10 = new is3(Mr(a3b(l10).a.Kc(), new ir())); gs(g10); ) { f = RD(hs(g10), 18); v += d10.c; u10 += d10.b; @@ -255395,11 +256436,11 @@ g.stateGroup line { r10 = (sFb(s10.b < s10.d.gc()), RD(s10.d.Xb(s10.c = s10.b++), 30)); for (u10 = new Anb(r10.a); u10.a < u10.c.c.length; ) { t10 = RD(ynb(u10), 10); - for (n10 = new is2(Mr(a3b(t10).a.Kc(), new ir())); gs(n10); ) { + for (n10 = new is3(Mr(a3b(t10).a.Kc(), new ir())); gs(n10); ) { l10 = RD(hs(n10), 18); A10.a.zc(l10, A10); } - for (m10 = new is2(Mr(Z2b(t10).a.Kc(), new ir())); gs(m10); ) { + for (m10 = new is3(Mr(Z2b(t10).a.Kc(), new ir())); gs(m10); ) { l10 = RD(hs(m10), 18); A10.a.Bc(l10) != null; } @@ -255472,7 +256513,7 @@ g.stateGroup line { for (o10 = new Anb(l10.a); o10.a < o10.c.c.length; ) { n10 = RD(ynb(o10), 10); e11 = RD(Wjb(a10.f, n10), 60); - for (i10 = new is2(Mr(a3b(n10).a.Kc(), new ir())); gs(i10); ) { + for (i10 = new is3(Mr(a3b(n10).a.Kc(), new ir())); gs(i10); ) { g10 = RD(hs(i10), 18); d10 = Sub(g10.a, 0); j10 = true; @@ -255524,7 +256565,7 @@ g.stateGroup line { } } } - for (h10 = new is2(Mr(Z2b(n10).a.Kc(), new ir())); gs(h10); ) { + for (h10 = new is3(Mr(Z2b(n10).a.Kc(), new ir())); gs(h10); ) { g10 = RD(hs(h10), 18); if (g10.a.b != 0) { b10 = RD(Rub(g10.a), 8); @@ -256029,7 +257070,7 @@ g.stateGroup line { Mub(a10.f, n10); n10.p = d10; a10.e = $wnd.Math.max(a10.e, d10); - for (f = new is2(Mr(Z2b(n10).a.Kc(), new ir())); gs(f); ) { + for (f = new is3(Mr(Z2b(n10).a.Kc(), new ir())); gs(f); ) { e11 = RD(hs(f), 18); if (!e11.c.i.c && e11.c.i.k == (r3b(), n3b)) { Mub(a10.f, e11.c.i); @@ -256043,7 +257084,7 @@ g.stateGroup line { WGc(a10); Xub(a10.f); d10 = 0; - if (gs(new is2(Mr(Z2b(n10).a.Kc(), new ir())))) { + if (gs(new is3(Mr(Z2b(n10).a.Kc(), new ir())))) { m10 = 0; m10 = UGc(m10, n10); d10 = m10 + 2; @@ -256912,7 +257953,7 @@ g.stateGroup line { ye2(h10.a, sUc(n10)); } function cud(a10, b10, c10, d10) { - var e11, f, g10, h10, i10, j10, k10, l10, m10, n10, o10, p10, q, r10, s10, t10, u10, v, w10, A10, B10, C10, D10, F10, G, H10, I10, J, K10, L, M10, N, O, P10; + var e11, f, g10, h10, i10, j10, k10, l10, m10, n10, o10, p10, q, r10, s10, t10, u10, v, w10, A10, B10, C10, D10, F10, G, H10, I10, J, K10, L, M10, N, O10, P10; t10 = RD(QHd((!a10.b && (a10.b = new Yie(E4, a10, 4, 7)), a10.b), 0), 84); v = t10.nh(); w10 = t10.oh(); @@ -256965,11 +258006,11 @@ g.stateGroup line { f = Jwb(b10, 5); t10 == F10 && ++f; L = B10 - q; - O = C10 - r10; - J = $wnd.Math.sqrt(L * L + O * O); + O10 = C10 - r10; + J = $wnd.Math.sqrt(L * L + O10 * O10); l10 = J * 0.20000000298023224; M10 = L / (f + 1); - P10 = O / (f + 1); + P10 = O10 / (f + 1); K10 = q; N = r10; for (k10 = 0; k10 < f; k10++) { @@ -257614,7 +258655,7 @@ g.stateGroup line { ZEb(w10.c, d10); continue; } - for (j10 = new is2(Mr(Z2b(d10).a.Kc(), new ir())); gs(j10); ) { + for (j10 = new is3(Mr(Z2b(d10).a.Kc(), new ir())); gs(j10); ) { h10 = RD(hs(j10), 18); F10 = h10.c.i; if (!a9b(F10)) { @@ -257628,7 +258669,7 @@ g.stateGroup line { } Y0b(h10, RD(Vmb(C10.j, 1), 12)); } - for (i10 = new is2(Mr(a3b(d10).a.Kc(), new ir())); gs(i10); ) { + for (i10 = new is3(Mr(a3b(d10).a.Kc(), new ir())); gs(i10); ) { h10 = RD(hs(i10), 18); G = h10.d.i; if (!a9b(G)) { @@ -258322,7 +259363,7 @@ g.stateGroup line { for (m10 = new Anb(b10.a); m10.a < m10.c.c.length; ) { l10 = RD(ynb(m10), 10); l10.p = i10++; - for (f = new is2(Mr(a3b(l10).a.Kc(), new ir())); gs(f); ) { + for (f = new is3(Mr(a3b(l10).a.Kc(), new ir())); gs(f); ) { e11 = RD(hs(f), 18); e11.p = g10++; } @@ -258337,7 +259378,7 @@ g.stateGroup line { o10 = new pwb(new JGc(a10)); for (u10 = new Anb(b10.a); u10.a < u10.c.c.length; ) { s10 = RD(ynb(u10), 10); - for (f = new is2(Mr(Z2b(s10).a.Kc(), new ir())); gs(f); ) { + for (f = new is3(Mr(Z2b(s10).a.Kc(), new ir())); gs(f); ) { e11 = RD(hs(f), 18); a10.a[e11.p] || ++a10.b[s10.p]; } @@ -258347,7 +259388,7 @@ g.stateGroup line { while (o10.b.c.length != 0) { s10 = RD(mwb(o10), 10); a10.f[s10.p] = h10++; - for (f = new is2(Mr(a3b(s10).a.Kc(), new ir())); gs(f); ) { + for (f = new is3(Mr(a3b(s10).a.Kc(), new ir())); gs(f); ) { e11 = RD(hs(f), 18); if (a10.a[e11.p]) { continue; @@ -258361,7 +259402,7 @@ g.stateGroup line { n10 = new pwb(new NGc(a10)); for (t10 = new Anb(b10.a); t10.a < t10.c.c.length; ) { s10 = RD(ynb(t10), 10); - for (f = new is2(Mr(a3b(s10).a.Kc(), new ir())); gs(f); ) { + for (f = new is3(Mr(a3b(s10).a.Kc(), new ir())); gs(f); ) { e11 = RD(hs(f), 18); a10.a[e11.p] || ++a10.e[s10.p]; } @@ -258373,7 +259414,7 @@ g.stateGroup line { r10 = RD(mwb(n10), 10); (d10.a.c.length >= v || !zGc(r10, d10)) && (d10 = BGc(b10, k10)); g3b(r10, d10); - for (f = new is2(Mr(Z2b(r10).a.Kc(), new ir())); gs(f); ) { + for (f = new is3(Mr(Z2b(r10).a.Kc(), new ir())); gs(f); ) { e11 = RD(hs(f), 18); if (a10.a[e11.p]) { continue; @@ -258427,16 +259468,16 @@ g.stateGroup line { } else if (!g10 && s10) { if (j10.k == (r3b(), n3b)) { d10 = true; - b10 ? m10 = RD(hs(new is2(Mr(Z2b(j10).a.Kc(), new ir()))), 18).c.i : m10 = RD(hs(new is2(Mr(a3b(j10).a.Kc(), new ir()))), 18).d.i; + b10 ? m10 = RD(hs(new is3(Mr(Z2b(j10).a.Kc(), new ir()))), 18).c.i : m10 = RD(hs(new is3(Mr(a3b(j10).a.Kc(), new ir()))), 18).d.i; if (m10 == l10) { - b10 ? c10 = RD(hs(new is2(Mr(a3b(j10).a.Kc(), new ir()))), 18).d.i : c10 = RD(hs(new is2(Mr(Z2b(j10).a.Kc(), new ir()))), 18).c.i; + b10 ? c10 = RD(hs(new is3(Mr(a3b(j10).a.Kc(), new ir()))), 18).d.i : c10 = RD(hs(new is3(Mr(Z2b(j10).a.Kc(), new ir()))), 18).c.i; (b10 ? RD($5b(a10.a, c10), 17).a - RD($5b(a10.a, m10), 17).a : RD($5b(a10.a, m10), 17).a - RD($5b(a10.a, c10), 17).a) <= 2 && (s10 = false); } } } } if (d10 && s10) { - b10 ? c10 = RD(hs(new is2(Mr(a3b(l10).a.Kc(), new ir()))), 18).d.i : c10 = RD(hs(new is2(Mr(Z2b(l10).a.Kc(), new ir()))), 18).c.i; + b10 ? c10 = RD(hs(new is3(Mr(a3b(l10).a.Kc(), new ir()))), 18).d.i : c10 = RD(hs(new is3(Mr(Z2b(l10).a.Kc(), new ir()))), 18).c.i; (b10 ? RD($5b(a10.a, c10), 17).a - RD($5b(a10.a, l10), 17).a : RD($5b(a10.a, l10), 17).a - RD($5b(a10.a, c10), 17).a) <= 2 && c10.k == (r3b(), p3b) && (s10 = false); } if (g10 || s10) { @@ -260153,7 +261194,7 @@ g.stateGroup line { Ezc = AFc; } function iNc(a10, b10, c10) { - var d10, e11, f, g10, h10, i10, j10, k10, l10, m10, n10, o10, p10, q, r10, s10, t10, u10, v, w10, A10, B10, C10, D10, F10, G, H10, I10, J, K10, L, M10, N, O, P10, Q10, R10, S10, T10, U, V10, W, X10, Y10, Z10, $10, ab, bb, cb, db17, eb, fb, gb, hb, ib, jb, kb, lb; + var d10, e11, f, g10, h10, i10, j10, k10, l10, m10, n10, o10, p10, q, r10, s10, t10, u10, v, w10, A10, B10, C10, D10, F10, G, H10, I10, J, K10, L, M10, N, O10, P10, Q10, R10, S10, T10, U, V10, W, X10, Y10, Z10, $10, ab, bb, cb, db17, eb, fb, gb, hb, ib, jb, kb, lb; cb = 0; for (H10 = b10, K10 = 0, N = H10.length; K10 < N; ++K10) { F10 = H10[K10]; @@ -260168,7 +261209,7 @@ g.stateGroup line { } } hb = 0; - for (I10 = c10, L = 0, O = I10.length; L < O; ++L) { + for (I10 = c10, L = 0, O10 = I10.length; L < O10; ++L) { F10 = I10[L]; P10 = 0; for (V10 = new Anb(F10.j); V10.a < V10.c.c.length; ) { @@ -260635,7 +261676,7 @@ g.stateGroup line { yne(a10); } function Fed(a10, b10, c10, d10) { - var e11, f, g10, h10, i10, j10, k10, l10, m10, n10, o10, p10, q, r10, s10, t10, u10, v, w10, A10, B10, C10, D10, F10, G, H10, I10, J, K10, L, M10, N, O, P10, Q10, R10, S10, T10, U, V10, W, X10, Y10, Z10, $10, ab; + var e11, f, g10, h10, i10, j10, k10, l10, m10, n10, o10, p10, q, r10, s10, t10, u10, v, w10, A10, B10, C10, D10, F10, G, H10, I10, J, K10, L, M10, N, O10, P10, Q10, R10, S10, T10, U, V10, W, X10, Y10, Z10, $10, ab; if (d10.$g()) { return yob(), yob(), vob; } @@ -260702,15 +261743,15 @@ g.stateGroup line { } } } - O = RD(Gxd(b10, tld), 107); - n10 = b10.g - (O.b + O.c); - m10 = b10.f - (O.d + O.a); + O10 = RD(Gxd(b10, tld), 107); + n10 = b10.g - (O10.b + O10.c); + m10 = b10.f - (O10.d + O10.a); Z10.bh("Available Child Area: (" + n10 + "|" + m10 + ")"); Ixd(b10, Dkd, n10 / m10); Ced(b10, e11, d10.eh(M10)); if (RD(Gxd(b10, nmd), 280) == lqd) { psd(b10); - zyd(b10, O.b + Kfb(UD(Gxd(b10, Ikd))) + O.c, O.d + Kfb(UD(Gxd(b10, Hkd))) + O.a); + zyd(b10, O10.b + Kfb(UD(Gxd(b10, Ikd))) + O10.c, O10.d + Kfb(UD(Gxd(b10, Hkd))) + O10.a); } Z10.bh("Executed layout algorithm: " + WD(Gxd(b10, Akd)) + " on node " + b10.k); if (RD(Gxd(b10, nmd), 280) == jqd) { @@ -260731,8 +261772,8 @@ g.stateGroup line { g10 = 0; P10 < Q10 && (u10.Hc((ukd(), okd)) ? f = (n10 / 2 - p10 * P10 / 2) / P10 : u10.Hc(qkd) && (f = (n10 - p10 * P10) / P10)); P10 < R10 && (u10.Hc((ukd(), skd)) ? g10 = (m10 / 2 - o10 * P10 / 2) / P10 : u10.Hc(rkd) && (g10 = (m10 - o10 * P10) / P10)); - $10 = f + (O.b / P10 - O.b); - ab = g10 + (O.d / P10 - O.d); + $10 = f + (O10.b / P10 - O10.b); + ab = g10 + (O10.d / P10 - O10.d); Z10.bh("Shift: (" + $10 + "|" + ab + ")"); for (L = new dMd((!b10.a && (b10.a = new C5d(J4, b10, 10, 11)), b10.a)); L.e != L.i.gc(); ) { K10 = RD(bMd(L), 27); @@ -263675,7 +264716,7 @@ g.stateGroup line { var LF = sfb(xve, "FluentIterable", 547); feb(442, 547, Vve, Dl); _.Kc = function El() { - return new is2(Mr(this.a.Kc(), new ir())); + return new is3(Mr(this.a.Kc(), new ir())); }; var IF = sfb(xve, "FluentIterable/2", 442); feb(1059, 547, Vve, Gl); @@ -264011,7 +265052,7 @@ g.stateGroup line { _.Ld = function Tn2() { return this.Wd(); }; - _.Nc = function Wn() { + _.Nc = function Wn2() { return new Swb(this, 1); }; _.Fb = function Un2(a10) { @@ -264627,7 +265668,7 @@ g.stateGroup line { _.Ob = function _r() { return !this.a; }; - _.Pb = function as() { + _.Pb = function as2() { if (this.a) { throw Adb(new Dvb()); } @@ -264637,13 +265678,13 @@ g.stateGroup line { _.a = false; var OG = sfb(xve, "Iterators/9", 732); feb(1086, 399, yve, ds); - _.Xb = function es(a10) { + _.Xb = function es2(a10) { return this.a[this.b + a10]; }; _.b = 0; var bs; var PG = sfb(xve, "Iterators/ArrayItr", 1086); - feb(38, 1, { 38: 1, 51: 1 }, is2); + feb(38, 1, { 38: 1, 51: 1 }, is3); _.Nb = function js(a10) { Ztb(this, a10); }; @@ -264662,10 +265703,10 @@ g.stateGroup line { }; var QG = sfb(xve, "Iterators/ConcatenatedIterator", 38); feb(22, 1, { 3: 1, 34: 1, 22: 1 }); - _.Fd = function rs(a10) { + _.Fd = function rs2(a10) { return ns(this, RD(a10, 22)); }; - _.Fb = function ts(a10) { + _.Fb = function ts2(a10) { return this === a10; }; _.Hb = function us() { @@ -270622,7 +271663,7 @@ g.stateGroup line { if (this.d) { d10 = RD(mQb(RD(this.e, 12), (Ywc(), Iwc)), 10); if (d10) { - for (b10 = new is2(Mr(Z2b(d10).a.Kc(), new ir())); gs(b10); ) { + for (b10 = new is3(Mr(Z2b(d10).a.Kc(), new ir())); gs(b10); ) { a10 = RD(hs(b10), 18); Rmb(this.a, new r1b(a10)); } @@ -270665,7 +271706,7 @@ g.stateGroup line { if (this.d) { d10 = RD(mQb(RD(this.e, 12), (Ywc(), Iwc)), 10); if (d10) { - for (b10 = new is2(Mr(a3b(d10).a.Kc(), new ir())); gs(b10); ) { + for (b10 = new is3(Mr(a3b(d10).a.Kc(), new ir())); gs(b10); ) { a10 = RD(hs(b10), 18); Rmb(this.c, new r1b(a10)); } @@ -271194,7 +272235,7 @@ g.stateGroup line { var oS = sfb(hBe, "FinalSplineBendpointsCalculator/lambda$0$Type", 1569); feb(1570, 1, {}, e8b); _.Kb = function f8b(a10) { - return new SDb(null, new Twb(new is2(Mr(a3b(RD(a10, 10)).a.Kc(), new ir())))); + return new SDb(null, new Twb(new is3(Mr(a3b(RD(a10, 10)).a.Kc(), new ir())))); }; var pS = sfb(hBe, "FinalSplineBendpointsCalculator/lambda$1$Type", 1570); feb(1571, 1, nwe, g8b); @@ -271783,7 +272824,7 @@ g.stateGroup line { var IT = sfb(hBe, "PartitionPreprocessor/lambda$0$Type", 1641); feb(1642, 1, {}, ggc); _.Kb = function hgc(a10) { - return new SDb(null, new Twb(new is2(Mr(a3b(RD(a10, 10)).a.Kc(), new ir())))); + return new SDb(null, new Twb(new is3(Mr(a3b(RD(a10, 10)).a.Kc(), new ir())))); }; var JT = sfb(hBe, "PartitionPreprocessor/lambda$1$Type", 1642); feb(1643, 1, nwe, igc); @@ -272322,7 +273363,7 @@ g.stateGroup line { var lV = sfb(rBe, "LGraphToCGraphTransformer/lambda$16$Type", 1746); feb(1748, 1, {}, clc); _.Kb = function dlc(a10) { - return lkc(), new SDb(null, new Twb(new is2(Mr(a3b(RD(a10, 10)).a.Kc(), new ir())))); + return lkc(), new SDb(null, new Twb(new is3(Mr(a3b(RD(a10, 10)).a.Kc(), new ir())))); }; var mV = sfb(rBe, "LGraphToCGraphTransformer/lambda$17$Type", 1748); feb(1749, 1, nwe, elc); @@ -272347,7 +273388,7 @@ g.stateGroup line { var qV = sfb(rBe, "LGraphToCGraphTransformer/lambda$20$Type", 1751); feb(1752, 1, {}, mlc); _.Kb = function nlc(a10) { - return lkc(), new SDb(null, new Twb(new is2(Mr(a3b(RD(a10, 10)).a.Kc(), new ir())))); + return lkc(), new SDb(null, new Twb(new is3(Mr(a3b(RD(a10, 10)).a.Kc(), new ir())))); }; var rV = sfb(rBe, "LGraphToCGraphTransformer/lambda$21$Type", 1752); feb(1753, 1, {}, olc); @@ -272377,7 +273418,7 @@ g.stateGroup line { var wV = sfb(rBe, "LGraphToCGraphTransformer/lambda$4$Type", 1735); feb(1736, 1, {}, ylc); _.Kb = function zlc(a10) { - return lkc(), new SDb(null, new Twb(new is2(Mr(a3b(RD(a10, 10)).a.Kc(), new ir())))); + return lkc(), new SDb(null, new Twb(new is3(Mr(a3b(RD(a10, 10)).a.Kc(), new ir())))); }; var xV = sfb(rBe, "LGraphToCGraphTransformer/lambda$5$Type", 1736); feb(1737, 1, {}, Alc); @@ -274261,7 +275302,7 @@ g.stateGroup line { var vZ = sfb(tEe, "NetworkSimplexPlacer/lambda$29$Type", 1462); feb(1436, 1, {}, TPc); _.Kb = function UPc(a10) { - return dOc(), new SDb(null, new Twb(new is2(Mr(a3b(RD(a10, 10)).a.Kc(), new ir())))); + return dOc(), new SDb(null, new Twb(new is3(Mr(a3b(RD(a10, 10)).a.Kc(), new ir())))); }; var wZ = sfb(tEe, "NetworkSimplexPlacer/lambda$3$Type", 1436); feb(1437, 1, nwe, VPc); @@ -274286,7 +275327,7 @@ g.stateGroup line { var AZ = sfb(tEe, "NetworkSimplexPlacer/lambda$7$Type", 1440); feb(1441, 1, {}, bQc); _.Kb = function cQc(a10) { - return dOc(), new SDb(null, new Twb(new is2(Mr(W2b(RD(a10, 10)).a.Kc(), new ir())))); + return dOc(), new SDb(null, new Twb(new is3(Mr(W2b(RD(a10, 10)).a.Kc(), new ir())))); }; var BZ = sfb(tEe, "NetworkSimplexPlacer/lambda$8$Type", 1441); feb(1442, 1, nwe, dQc); @@ -274515,7 +275556,7 @@ g.stateGroup line { var l$ = sfb(yEe, "HyperEdgeSegment", 118); feb(132, 1, { 132: 1 }, bTc); _.Ib = function cTc() { - return this.a + "->" + this.b + " (" + os(this.c) + ")"; + return this.a + "->" + this.b + " (" + os2(this.c) + ")"; }; _.d = 0; var c$ = sfb(yEe, "HyperEdgeSegmentDependency", 132); @@ -275704,7 +276745,7 @@ g.stateGroup line { _.Dg = function L3c(a10) { var b10, c10, d10, e11, f, g10, h10, i10, j10, k10, l10, m10, n10; d10 = 0; - for (c10 = new is2(Mr(zGd(a10).a.Kc(), new ir())); gs(c10); ) { + for (c10 = new is3(Mr(zGd(a10).a.Kc(), new ir())); gs(c10); ) { b10 = RD(hs(c10), 74); h10 = AGd(RD(QHd((!b10.c && (b10.c = new Yie(E4, b10, 5, 8)), b10.c), 0), 84)); j10 = h10.i + h10.g / 2; @@ -275737,7 +276778,7 @@ g.stateGroup line { _.Dg = function N3c(a10) { var b10, c10, d10, e11, f, g10, h10, i10, j10, k10, l10; d10 = 0; - for (c10 = new is2(Mr(zGd(a10).a.Kc(), new ir())); gs(c10); ) { + for (c10 = new is3(Mr(zGd(a10).a.Kc(), new ir())); gs(c10); ) { b10 = RD(hs(c10), 74); h10 = AGd(RD(QHd((!b10.c && (b10.c = new Yie(E4, b10, 5, 8)), b10.c), 0), 84)); i10 = h10.i + h10.g / 2; @@ -276729,7 +277770,7 @@ g.stateGroup line { _.Qg = function bhd() { return new xAb(); }; - var T22 = sfb(zye, "LayoutMetaDataService/lambda$18$Type", 899); + var T2 = sfb(zye, "LayoutMetaDataService/lambda$18$Type", 899); feb(900, 1, CGe, chd); _.Rg = function dhd(a10) { return Yx(RD(a10, 157)); @@ -277461,13 +278502,13 @@ g.stateGroup line { m10 = $wnd.Math.max(m10, A10 + h10.j + h10.f); } } - for (e11 = new is2(Mr(zGd(q).a.Kc(), new ir())); gs(e11); ) { + for (e11 = new is3(Mr(zGd(q).a.Kc(), new ir())); gs(e11); ) { c10 = RD(hs(e11), 74); k10 = atd(c10); l10 = $wnd.Math.max(l10, k10.a); m10 = $wnd.Math.max(m10, k10.b); } - for (d10 = new is2(Mr(yGd(q).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(yGd(q).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 74); if (vCd(JGd(c10)) != a10) { k10 = atd(c10); @@ -277479,7 +278520,7 @@ g.stateGroup line { if (f == (Ymd(), Umd)) { for (r10 = new dMd((!a10.a && (a10.a = new C5d(J4, a10, 10, 11)), a10.a)); r10.e != r10.i.gc(); ) { q = RD(bMd(r10), 27); - for (d10 = new is2(Mr(zGd(q).a.Kc(), new ir())); gs(d10); ) { + for (d10 = new is3(Mr(zGd(q).a.Kc(), new ir())); gs(d10); ) { c10 = RD(hs(d10), 74); g10 = tsd(c10); g10.b == 0 ? Ixd(c10, cld, null) : Ixd(c10, cld, g10); @@ -277758,7 +278799,7 @@ g.stateGroup line { var a10, b10; if (!this.a) { this.a = new bnb(); - for (b10 = new is2(Mr(yGd(RD(this.f, 27)).a.Kc(), new ir())); gs(b10); ) { + for (b10 = new is3(Mr(yGd(RD(this.f, 27)).a.Kc(), new ir())); gs(b10); ) { a10 = RD(hs(b10), 74); Rmb(this.a, new wud(a10)); } @@ -277769,7 +278810,7 @@ g.stateGroup line { var a10, b10; if (!this.c) { this.c = new bnb(); - for (b10 = new is2(Mr(zGd(RD(this.f, 27)).a.Kc(), new ir())); gs(b10); ) { + for (b10 = new is3(Mr(zGd(RD(this.f, 27)).a.Kc(), new ir())); gs(b10); ) { a10 = RD(hs(b10), 74); Rmb(this.c, new wud(a10)); } @@ -290497,19 +291538,19 @@ g.stateGroup line { } }); - // node_modules/mermaid/dist/flowchart-elk-definition-ae0efee6.js - var flowchart_elk_definition_ae0efee6_exports = {}; - __export(flowchart_elk_definition_ae0efee6_exports, { + // node_modules/mermaid/dist/flowchart-elk-definition-930acc39.js + var flowchart_elk_definition_930acc39_exports = {}; + __export(flowchart_elk_definition_930acc39_exports, { diagram: () => diagram18 }); var import_elk_bundled, import_ts_dedent19, import_dayjs18, import_sanitize_url19, import_dompurify18, findCommonAncestor, elk, portPos, conf10, nodeDb2, addVertices3, getNextPosition, getNextPort, getEdgeStartEndPoint, addEdges3, addMarkersToEdge, getClasses7, addSubGraphs, calcOffset, insertEdge2, insertChildren, draw18, drawNodes, renderer13, genSections, getStyles12, styles9, diagram18; - var init_flowchart_elk_definition_ae0efee6 = __esm({ - "node_modules/mermaid/dist/flowchart-elk-definition-ae0efee6.js"() { + var init_flowchart_elk_definition_930acc39 = __esm({ + "node_modules/mermaid/dist/flowchart-elk-definition-930acc39.js"() { init_polyfillShim(); - init_flowDb_c1833063(); + init_flowDb_0da60e67(); init_src32(); - init_edges_066a5561(); - init_mermaid_6dc72991(); + init_edges_5962ec63(); + init_mermaid_2490e8f2(); import_elk_bundled = __toESM(require_elk_bundled(), 1); import_ts_dedent19 = __toESM(require_dist4(), 1); import_dayjs18 = __toESM(require_dayjs_min(), 1); @@ -291313,9 +292354,9 @@ g.stateGroup line { } }); - // node_modules/mermaid/dist/timeline-definition-bf702344.js - var timeline_definition_bf702344_exports = {}; - __export(timeline_definition_bf702344_exports, { + // node_modules/mermaid/dist/timeline-definition-6eaa3543.js + var timeline_definition_6eaa3543_exports = {}; + __export(timeline_definition_6eaa3543_exports, { diagram: () => diagram19 }); function wrap(text4, width3) { @@ -291339,10 +292380,10 @@ g.stateGroup line { }); } var import_ts_dedent20, import_dayjs19, import_sanitize_url20, import_dompurify19, parser16, parser$112, currentSection3, currentTaskId, sections4, tasks3, rawTasks3, getCommonDb, clear18, addSection4, getSections4, getTasks3, addTask3, addEvent, addTaskOrg3, compileTasks3, timelineDb, db13, MAX_SECTIONS, drawRect5, drawFace2, drawCircle2, drawText5, drawLabel3, drawSection2, taskCount2, drawTask2, drawBackgroundRect4, getTextObj3, getNoteRect3, _drawTextCandidateFunc4, initGraphics2, drawNode, getVirtualNodeHeight, defaultBkg, svgDraw5, draw19, drawTasks2, drawEvents, renderer14, genSections2, getStyles13, styles10, diagram19; - var init_timeline_definition_bf702344 = __esm({ - "node_modules/mermaid/dist/timeline-definition-bf702344.js"() { + var init_timeline_definition_6eaa3543 = __esm({ + "node_modules/mermaid/dist/timeline-definition-6eaa3543.js"() { init_polyfillShim(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); init_src32(); init_dist(); import_ts_dedent20 = __toESM(require_dist4(), 1); @@ -294069,6 +295110,8 @@ g.stateGroup line { } function CanvasRenderer(options4) { var r2 = this; + var containerWindow = r2.cy.window(); + var document5 = containerWindow.document; r2.data = { canvases: new Array(CRp.CANVAS_LAYERS), contexts: new Array(CRp.CANVAS_LAYERS), @@ -294078,7 +295121,7 @@ g.stateGroup line { }; var tapHlOffAttr = "-webkit-tap-highlight-color"; var tapHlOffStyle = "rgba(0,0,0,0)"; - r2.data.canvasContainer = document.createElement("div"); + r2.data.canvasContainer = document5.createElement("div"); var containerStyle = r2.data.canvasContainer.style; r2.data.canvasContainer.style[tapHlOffAttr] = tapHlOffStyle; containerStyle.position = "relative"; @@ -294099,7 +295142,7 @@ g.stateGroup line { styleMap2["touch-action"] = "none"; } for (var i2 = 0; i2 < CRp.CANVAS_LAYERS; i2++) { - var canvas = r2.data.canvases[i2] = document.createElement("canvas"); + var canvas = r2.data.canvases[i2] = document5.createElement("canvas"); r2.data.contexts[i2] = canvas.getContext("2d"); Object.keys(styleMap2).forEach(function(k3) { canvas.style[k3] = styleMap2[k3]; @@ -294115,7 +295158,7 @@ g.stateGroup line { r2.data.canvases[CRp.SELECT_BOX].setAttribute("data-id", "layer" + CRp.SELECT_BOX + "-selectbox"); r2.data.canvases[CRp.DRAG].setAttribute("data-id", "layer" + CRp.DRAG + "-drag"); for (var i2 = 0; i2 < CRp.BUFFER_COUNT; i2++) { - r2.data.bufferCanvases[i2] = document.createElement("canvas"); + r2.data.bufferCanvases[i2] = document5.createElement("canvas"); r2.data.bufferContexts[i2] = r2.data.bufferCanvases[i2].getContext("2d"); r2.data.bufferCanvases[i2].style.position = "absolute"; r2.data.bufferCanvases[i2].setAttribute("data-id", "buffer" + i2); @@ -294195,10 +295238,10 @@ g.stateGroup line { }; }; var getRsPt = function getRsPt2(ele, x4, y4) { - var rs = ele[0]._private.rscratch; + var rs2 = ele[0]._private.rscratch; return { - x: rs[x4], - y: rs[y4] + x: rs2[x4], + y: rs2[y4] }; }; var getLabelRotationPoint = function getLabelRotationPoint2(ele) { @@ -296184,11 +297227,11 @@ g.stateGroup line { edgeNext[st2] = edge; } if (!directed) { - var ts = t4 * N + s3; - if (!directed && dist3[ts] > _weight) { - dist3[ts] = _weight; - next3[ts] = s3; - edgeNext[ts] = edge; + var ts2 = t4 * N + s3; + if (!directed && dist3[ts2] > _weight) { + dist3[ts2] = _weight; + next3[ts2] = s3; + edgeNext[ts2] = edge; } } } @@ -307380,6 +308423,12 @@ g.stateGroup line { }, { name: "line-dash-offset", type: t4.number + }, { + name: "line-outline-width", + type: t4.size + }, { + name: "line-outline-color", + type: t4.color }, { name: "line-gradient-stop-colors", type: t4.colors @@ -307822,6 +308871,8 @@ g.stateGroup line { "line-fill": "solid", "line-cap": "butt", "line-opacity": 1, + "line-outline-width": 0, + "line-outline-color": "#000", "line-gradient-stop-colors": "#999", "line-gradient-stop-positions": "0%", "control-point-step-size": 40, @@ -311329,10 +312380,10 @@ g.stateGroup line { var hh = height2 / 2; var pos = node3.position(); var cornerRadius = node3.pstyle("corner-radius").value === "auto" ? "auto" : node3.pstyle("corner-radius").pfValue; - var rs = node3._private.rscratch; + var rs2 = node3._private.rscratch; if (pos.x - hw <= x4 && x4 <= pos.x + hw && pos.y - hh <= y4 && y4 <= pos.y + hh) { var shape = r2.nodeShapes[self2.getNodeShape(node3)]; - if (shape.checkPoint(x4, y4, 0, width3, height2, pos.x, pos.y, cornerRadius, rs)) { + if (shape.checkPoint(x4, y4, 0, width3, height2, pos.x, pos.y, cornerRadius, rs2)) { addEle(node3, 0); return true; } @@ -311340,7 +312391,7 @@ g.stateGroup line { } function checkEdge(edge) { var _p = edge._private; - var rs = _p.rscratch; + var rs2 = _p.rscratch; var styleWidth = edge.pstyle("width").pfValue; var scale = edge.pstyle("arrow-scale").value; var width3 = styleWidth / 2 + edgeThreshold; @@ -311349,17 +312400,17 @@ g.stateGroup line { var src = _p.source; var tgt = _p.target; var sqDist; - if (rs.edgeType === "segments" || rs.edgeType === "straight" || rs.edgeType === "haystack") { - var pts2 = rs.allpts; + if (rs2.edgeType === "segments" || rs2.edgeType === "straight" || rs2.edgeType === "haystack") { + var pts2 = rs2.allpts; for (var i3 = 0; i3 + 3 < pts2.length; i3 += 2) { if (inLineVicinity(x4, y4, pts2[i3], pts2[i3 + 1], pts2[i3 + 2], pts2[i3 + 3], width22) && widthSq > (sqDist = sqdistToFiniteLine(x4, y4, pts2[i3], pts2[i3 + 1], pts2[i3 + 2], pts2[i3 + 3]))) { addEle(edge, sqDist); return true; } } - } else if (rs.edgeType === "bezier" || rs.edgeType === "multibezier" || rs.edgeType === "self" || rs.edgeType === "compound") { - var pts2 = rs.allpts; - for (var i3 = 0; i3 + 5 < rs.allpts.length; i3 += 4) { + } else if (rs2.edgeType === "bezier" || rs2.edgeType === "multibezier" || rs2.edgeType === "self" || rs2.edgeType === "compound") { + var pts2 = rs2.allpts; + for (var i3 = 0; i3 + 5 < rs2.allpts.length; i3 += 4) { if (inBezierVicinity(x4, y4, pts2[i3], pts2[i3 + 1], pts2[i3 + 2], pts2[i3 + 3], pts2[i3 + 4], pts2[i3 + 5], width22) && widthSq > (sqDist = sqdistToQuadraticBezier(x4, y4, pts2[i3], pts2[i3 + 1], pts2[i3 + 2], pts2[i3 + 3], pts2[i3 + 4], pts2[i3 + 5]))) { addEle(edge, sqDist); return true; @@ -311371,24 +312422,24 @@ g.stateGroup line { var arSize = self2.getArrowWidth(styleWidth, scale); var arrows2 = [{ name: "source", - x: rs.arrowStartX, - y: rs.arrowStartY, - angle: rs.srcArrowAngle + x: rs2.arrowStartX, + y: rs2.arrowStartY, + angle: rs2.srcArrowAngle }, { name: "target", - x: rs.arrowEndX, - y: rs.arrowEndY, - angle: rs.tgtArrowAngle + x: rs2.arrowEndX, + y: rs2.arrowEndY, + angle: rs2.tgtArrowAngle }, { name: "mid-source", - x: rs.midX, - y: rs.midY, - angle: rs.midsrcArrowAngle + x: rs2.midX, + y: rs2.midY, + angle: rs2.midsrcArrowAngle }, { name: "mid-target", - x: rs.midX, - y: rs.midY, - angle: rs.midtgtArrowAngle + x: rs2.midX, + y: rs2.midY, + angle: rs2.midtgtArrowAngle }]; for (var i3 = 0; i3 < arrows2.length; i3++) { var ar = arrows2[i3]; @@ -311517,14 +312568,14 @@ g.stateGroup line { } else { var edge = ele; var _p = edge._private; - var rs = _p.rscratch; - if (rs.startX != null && rs.startY != null && !inBoundingBox(boxBb, rs.startX, rs.startY)) { + var rs2 = _p.rscratch; + if (rs2.startX != null && rs2.startY != null && !inBoundingBox(boxBb, rs2.startX, rs2.startY)) { continue; } - if (rs.endX != null && rs.endY != null && !inBoundingBox(boxBb, rs.endX, rs.endY)) { + if (rs2.endX != null && rs2.endY != null && !inBoundingBox(boxBb, rs2.endX, rs2.endY)) { continue; } - if (rs.edgeType === "bezier" || rs.edgeType === "multibezier" || rs.edgeType === "self" || rs.edgeType === "compound" || rs.edgeType === "segments" || rs.edgeType === "haystack") { + if (rs2.edgeType === "bezier" || rs2.edgeType === "multibezier" || rs2.edgeType === "self" || rs2.edgeType === "compound" || rs2.edgeType === "segments" || rs2.edgeType === "haystack") { var pts2 = _p.rstyle.bezierPts || _p.rstyle.linePts || _p.rstyle.haystackPts; var allInside = true; for (var i2 = 0; i2 < pts2.length; i2++) { @@ -311536,7 +312587,7 @@ g.stateGroup line { if (allInside) { box.push(edge); } - } else if (rs.edgeType === "haystack" || rs.edgeType === "straight") { + } else if (rs2.edgeType === "haystack" || rs2.edgeType === "straight") { box.push(edge); } } @@ -311545,33 +312596,33 @@ g.stateGroup line { }; BRp$d = {}; BRp$d.calculateArrowAngles = function(edge) { - var rs = edge._private.rscratch; - var isHaystack = rs.edgeType === "haystack"; - var isBezier = rs.edgeType === "bezier"; - var isMultibezier = rs.edgeType === "multibezier"; - var isSegments = rs.edgeType === "segments"; - var isCompound = rs.edgeType === "compound"; - var isSelf = rs.edgeType === "self"; + var rs2 = edge._private.rscratch; + var isHaystack = rs2.edgeType === "haystack"; + var isBezier = rs2.edgeType === "bezier"; + var isMultibezier = rs2.edgeType === "multibezier"; + var isSegments = rs2.edgeType === "segments"; + var isCompound = rs2.edgeType === "compound"; + var isSelf = rs2.edgeType === "self"; var dispX, dispY; var startX2, startY2, endX, endY, midX, midY; if (isHaystack) { - startX2 = rs.haystackPts[0]; - startY2 = rs.haystackPts[1]; - endX = rs.haystackPts[2]; - endY = rs.haystackPts[3]; + startX2 = rs2.haystackPts[0]; + startY2 = rs2.haystackPts[1]; + endX = rs2.haystackPts[2]; + endY = rs2.haystackPts[3]; } else { - startX2 = rs.arrowStartX; - startY2 = rs.arrowStartY; - endX = rs.arrowEndX; - endY = rs.arrowEndY; + startX2 = rs2.arrowStartX; + startY2 = rs2.arrowStartY; + endX = rs2.arrowEndX; + endY = rs2.arrowEndY; } - midX = rs.midX; - midY = rs.midY; + midX = rs2.midX; + midY = rs2.midY; if (isSegments) { - dispX = startX2 - rs.segpts[0]; - dispY = startY2 - rs.segpts[1]; + dispX = startX2 - rs2.segpts[0]; + dispY = startY2 - rs2.segpts[1]; } else if (isMultibezier || isCompound || isSelf || isBezier) { - var pts2 = rs.allpts; + var pts2 = rs2.allpts; var bX = qbezierAt(pts2[0], pts2[2], pts2[4], 0.1); var bY = qbezierAt(pts2[1], pts2[3], pts2[5], 0.1); dispX = startX2 - bX; @@ -311580,9 +312631,9 @@ g.stateGroup line { dispX = startX2 - midX; dispY = startY2 - midY; } - rs.srcArrowAngle = getAngleFromDisp(dispX, dispY); - var midX = rs.midX; - var midY = rs.midY; + rs2.srcArrowAngle = getAngleFromDisp(dispX, dispY); + var midX = rs2.midX; + var midY = rs2.midY; if (isHaystack) { midX = (startX2 + endX) / 2; midY = (startY2 + endY) / 2; @@ -311590,15 +312641,15 @@ g.stateGroup line { dispX = endX - startX2; dispY = endY - startY2; if (isSegments) { - var pts2 = rs.allpts; + var pts2 = rs2.allpts; if (pts2.length / 2 % 2 === 0) { var i2 = pts2.length / 2; var i1 = i2 - 2; dispX = pts2[i2] - pts2[i1]; dispY = pts2[i2 + 1] - pts2[i1 + 1]; - } else if (rs.isRound) { - dispX = rs.midVector[1]; - dispY = -rs.midVector[0]; + } else if (rs2.isRound) { + dispX = rs2.midVector[1]; + dispY = -rs2.midVector[0]; } else { var i2 = pts2.length / 2 - 1; var i1 = i2 - 2; @@ -311606,8 +312657,8 @@ g.stateGroup line { dispY = pts2[i2 + 1] - pts2[i1 + 1]; } } else if (isMultibezier || isCompound || isSelf) { - var pts2 = rs.allpts; - var cpts = rs.ctrlpts; + var pts2 = rs2.allpts; + var cpts = rs2.ctrlpts; var bp0x, bp0y; var bp1x, bp1y; if (cpts.length / 2 % 2 === 0) { @@ -311630,27 +312681,27 @@ g.stateGroup line { dispX = bp1x - bp0x; dispY = bp1y - bp0y; } - rs.midtgtArrowAngle = getAngleFromDisp(dispX, dispY); - rs.midDispX = dispX; - rs.midDispY = dispY; + rs2.midtgtArrowAngle = getAngleFromDisp(dispX, dispY); + rs2.midDispX = dispX; + rs2.midDispY = dispY; dispX *= -1; dispY *= -1; if (isSegments) { - var pts2 = rs.allpts; + var pts2 = rs2.allpts; if (pts2.length / 2 % 2 === 0) ; - else if (!rs.isRound) { + else if (!rs2.isRound) { var i2 = pts2.length / 2 - 1; var i3 = i2 + 2; dispX = -(pts2[i3] - pts2[i2]); dispY = -(pts2[i3 + 1] - pts2[i2 + 1]); } } - rs.midsrcArrowAngle = getAngleFromDisp(dispX, dispY); + rs2.midsrcArrowAngle = getAngleFromDisp(dispX, dispY); if (isSegments) { - dispX = endX - rs.segpts[rs.segpts.length - 2]; - dispY = endY - rs.segpts[rs.segpts.length - 1]; + dispX = endX - rs2.segpts[rs2.segpts.length - 2]; + dispY = endY - rs2.segpts[rs2.segpts.length - 1]; } else if (isMultibezier || isCompound || isSelf || isBezier) { - var pts2 = rs.allpts; + var pts2 = rs2.allpts; var l2 = pts2.length; var bX = qbezierAt(pts2[l2 - 6], pts2[l2 - 4], pts2[l2 - 2], 0.9); var bY = qbezierAt(pts2[l2 - 5], pts2[l2 - 3], pts2[l2 - 1], 0.9); @@ -311660,7 +312711,7 @@ g.stateGroup line { dispX = endX - midX; dispY = endY - midY; } - rs.tgtArrowAngle = getAngleFromDisp(dispX, dispY); + rs2.tgtArrowAngle = getAngleFromDisp(dispX, dispY); }; BRp$d.getArrowWidth = BRp$d.getArrowHeight = function(edgeWidth, scale) { var cache3 = this.arrowWidthCache = this.arrowWidthCache || {}; @@ -311796,15 +312847,15 @@ g.stateGroup line { for (var i2 = 0; i2 < edges4.length; i2++) { var edge = edges4[i2]; var _p = edge._private; - var rs = _p.rscratch; - if (!rs.haystack) { + var rs2 = _p.rscratch; + if (!rs2.haystack) { var angle2 = Math.random() * 2 * Math.PI; - rs.source = { + rs2.source = { x: Math.cos(angle2), y: Math.sin(angle2) }; angle2 = Math.random() * 2 * Math.PI; - rs.target = { + rs2.target = { x: Math.cos(angle2), y: Math.sin(angle2) }; @@ -311819,11 +312870,11 @@ g.stateGroup line { var tgtH = tgt.height(); var radius2 = edge.pstyle("haystack-radius").value; var halfRadius = radius2 / 2; - rs.haystackPts = rs.allpts = [rs.source.x * srcW * halfRadius + srcPos.x, rs.source.y * srcH * halfRadius + srcPos.y, rs.target.x * tgtW * halfRadius + tgtPos.x, rs.target.y * tgtH * halfRadius + tgtPos.y]; - rs.midX = (rs.allpts[0] + rs.allpts[2]) / 2; - rs.midY = (rs.allpts[1] + rs.allpts[3]) / 2; - rs.edgeType = "haystack"; - rs.haystack = true; + rs2.haystackPts = rs2.allpts = [rs2.source.x * srcW * halfRadius + srcPos.x, rs2.source.y * srcH * halfRadius + srcPos.y, rs2.target.x * tgtW * halfRadius + tgtPos.x, rs2.target.y * tgtH * halfRadius + tgtPos.y]; + rs2.midX = (rs2.allpts[0] + rs2.allpts[2]) / 2; + rs2.midY = (rs2.allpts[1] + rs2.allpts[3]) / 2; + rs2.edgeType = "haystack"; + rs2.haystack = true; this.storeEdgeProjections(edge); this.calculateArrowAngles(edge); this.recalculateEdgeLabelProjections(edge); @@ -311831,7 +312882,7 @@ g.stateGroup line { } }; BRp$c.findSegmentsPoints = function(edge, pairInfo) { - var rs = edge._private.rscratch; + var rs2 = edge._private.rscratch; var segmentWs = edge.pstyle("segment-weights"); var segmentDs = edge.pstyle("segment-distances"); var segmentRs = edge.pstyle("segment-radii"); @@ -311839,10 +312890,10 @@ g.stateGroup line { var segmentsN = Math.min(segmentWs.pfValue.length, segmentDs.pfValue.length); var lastRadius = segmentRs.pfValue[segmentRs.pfValue.length - 1]; var lastRadiusType = segmentTs.pfValue[segmentTs.pfValue.length - 1]; - rs.edgeType = "segments"; - rs.segpts = []; - rs.radii = []; - rs.isArcRadius = []; + rs2.edgeType = "segments"; + rs2.segpts = []; + rs2.radii = []; + rs2.isArcRadius = []; for (var s3 = 0; s3 < segmentsN; s3++) { var w2 = segmentWs.pfValue[s3]; var d2 = segmentDs.pfValue[s3]; @@ -311853,20 +312904,20 @@ g.stateGroup line { x: midptPts.x1 * w1 + midptPts.x2 * w22, y: midptPts.y1 * w1 + midptPts.y2 * w22 }; - rs.segpts.push(adjustedMidpt.x + vectorNormInverse.x * d2, adjustedMidpt.y + vectorNormInverse.y * d2); - rs.radii.push(segmentRs.pfValue[s3] !== void 0 ? segmentRs.pfValue[s3] : lastRadius); - rs.isArcRadius.push((segmentTs.pfValue[s3] !== void 0 ? segmentTs.pfValue[s3] : lastRadiusType) === "arc-radius"); + rs2.segpts.push(adjustedMidpt.x + vectorNormInverse.x * d2, adjustedMidpt.y + vectorNormInverse.y * d2); + rs2.radii.push(segmentRs.pfValue[s3] !== void 0 ? segmentRs.pfValue[s3] : lastRadius); + rs2.isArcRadius.push((segmentTs.pfValue[s3] !== void 0 ? segmentTs.pfValue[s3] : lastRadiusType) === "arc-radius"); } }; BRp$c.findLoopPoints = function(edge, pairInfo, i2, edgeIsUnbundled) { - var rs = edge._private.rscratch; + var rs2 = edge._private.rscratch; var dirCounts = pairInfo.dirCounts, srcPos = pairInfo.srcPos; var ctrlptDists = edge.pstyle("control-point-distances"); var ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[0] : void 0; var loopDir = edge.pstyle("loop-direction").pfValue; var loopSwp = edge.pstyle("loop-sweep").pfValue; var stepSize = edge.pstyle("control-point-step-size").pfValue; - rs.edgeType = "self"; + rs2.edgeType = "self"; var j2 = i2; var loopDist = stepSize; if (edgeIsUnbundled) { @@ -311878,11 +312929,11 @@ g.stateGroup line { var inAngle = loopAngle + loopSwp / 2; var dc = String(loopDir + "_" + loopSwp); j2 = dirCounts[dc] === void 0 ? dirCounts[dc] = 0 : ++dirCounts[dc]; - rs.ctrlpts = [srcPos.x + Math.cos(outAngle) * 1.4 * loopDist * (j2 / 3 + 1), srcPos.y + Math.sin(outAngle) * 1.4 * loopDist * (j2 / 3 + 1), srcPos.x + Math.cos(inAngle) * 1.4 * loopDist * (j2 / 3 + 1), srcPos.y + Math.sin(inAngle) * 1.4 * loopDist * (j2 / 3 + 1)]; + rs2.ctrlpts = [srcPos.x + Math.cos(outAngle) * 1.4 * loopDist * (j2 / 3 + 1), srcPos.y + Math.sin(outAngle) * 1.4 * loopDist * (j2 / 3 + 1), srcPos.x + Math.cos(inAngle) * 1.4 * loopDist * (j2 / 3 + 1), srcPos.y + Math.sin(inAngle) * 1.4 * loopDist * (j2 / 3 + 1)]; }; BRp$c.findCompoundLoopPoints = function(edge, pairInfo, i2, edgeIsUnbundled) { - var rs = edge._private.rscratch; - rs.edgeType = "compound"; + var rs2 = edge._private.rscratch; + rs2.edgeType = "compound"; var srcPos = pairInfo.srcPos, tgtPos = pairInfo.tgtPos, srcW = pairInfo.srcW, srcH = pairInfo.srcH, tgtW = pairInfo.tgtW, tgtH = pairInfo.tgtH; var stepSize = edge.pstyle("control-point-step-size").pfValue; var ctrlptDists = edge.pstyle("control-point-distances"); @@ -311909,13 +312960,13 @@ g.stateGroup line { var minCompoundStretch = 0.5; var compoundStretchA = Math.max(minCompoundStretch, Math.log(srcW * 0.01)); var compoundStretchB = Math.max(minCompoundStretch, Math.log(tgtW * 0.01)); - rs.ctrlpts = [loopPos.x, loopPos.y - (1 + Math.pow(loopW, 1.12) / 100) * loopDist * (j2 / 3 + 1) * compoundStretchA, loopPos.x - (1 + Math.pow(loopW, 1.12) / 100) * loopDist * (j2 / 3 + 1) * compoundStretchB, loopPos.y]; + rs2.ctrlpts = [loopPos.x, loopPos.y - (1 + Math.pow(loopW, 1.12) / 100) * loopDist * (j2 / 3 + 1) * compoundStretchA, loopPos.x - (1 + Math.pow(loopW, 1.12) / 100) * loopDist * (j2 / 3 + 1) * compoundStretchB, loopPos.y]; }; BRp$c.findStraightEdgePoints = function(edge) { edge._private.rscratch.edgeType = "straight"; }; BRp$c.findBezierPoints = function(edge, pairInfo, i2, edgeIsUnbundled, edgeIsSwapped) { - var rs = edge._private.rscratch; + var rs2 = edge._private.rscratch; var stepSize = edge.pstyle("control-point-step-size").pfValue; var ctrlptDists = edge.pstyle("control-point-distances"); var ctrlptWs = edge.pstyle("control-point-weights"); @@ -311923,8 +312974,8 @@ g.stateGroup line { var ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[0] : void 0; var ctrlptWeight = ctrlptWs.value[0]; var multi = edgeIsUnbundled; - rs.edgeType = multi ? "multibezier" : "bezier"; - rs.ctrlpts = []; + rs2.edgeType = multi ? "multibezier" : "bezier"; + rs2.ctrlpts = []; for (var b2 = 0; b2 < bezierN; b2++) { var normctrlptDist = (0.5 - pairInfo.eles.length / 2 + i2) * stepSize * (edgeIsSwapped ? -1 : 1); var manctrlptDist = void 0; @@ -311946,12 +312997,12 @@ g.stateGroup line { x: midptPts.x1 * w1 + midptPts.x2 * w2, y: midptPts.y1 * w1 + midptPts.y2 * w2 }; - rs.ctrlpts.push(adjustedMidpt.x + vectorNormInverse.x * distanceFromMidpoint, adjustedMidpt.y + vectorNormInverse.y * distanceFromMidpoint); + rs2.ctrlpts.push(adjustedMidpt.x + vectorNormInverse.x * distanceFromMidpoint, adjustedMidpt.y + vectorNormInverse.y * distanceFromMidpoint); } }; BRp$c.findTaxiPoints = function(edge, pairInfo) { - var rs = edge._private.rscratch; - rs.edgeType = "segments"; + var rs2 = edge._private.rscratch; + rs2.edgeType = "segments"; var VERTICAL = "vertical"; var HORIZONTAL = "horizontal"; var LEFTWARD = "leftward"; @@ -312023,13 +313074,13 @@ g.stateGroup line { if (lShapeInsideSrc) { var x4 = (posPts.x1 + posPts.x2) / 2; var y1 = posPts.y1, y22 = posPts.y2; - rs.segpts = [x4, y1, x4, y22]; + rs2.segpts = [x4, y1, x4, y22]; } else if (lShapeInsideTgt) { var y4 = (posPts.y1 + posPts.y2) / 2; var x1 = posPts.x1, x22 = posPts.x2; - rs.segpts = [x1, y4, x22, y4]; + rs2.segpts = [x1, y4, x22, y4]; } else { - rs.segpts = [posPts.x1, posPts.y2]; + rs2.segpts = [posPts.x1, posPts.y2]; } } else { var _lShapeInsideSrc = Math.abs(pl) <= srcW / 2; @@ -312037,58 +313088,58 @@ g.stateGroup line { if (_lShapeInsideSrc) { var _y = (posPts.y1 + posPts.y2) / 2; var _x = posPts.x1, _x2 = posPts.x2; - rs.segpts = [_x, _y, _x2, _y]; + rs2.segpts = [_x, _y, _x2, _y]; } else if (_lShapeInsideTgt) { var _x3 = (posPts.x1 + posPts.x2) / 2; var _y2 = posPts.y1, _y3 = posPts.y2; - rs.segpts = [_x3, _y2, _x3, _y3]; + rs2.segpts = [_x3, _y2, _x3, _y3]; } else { - rs.segpts = [posPts.x2, posPts.y1]; + rs2.segpts = [posPts.x2, posPts.y1]; } } } else { if (isVert) { var _y4 = posPts.y1 + d2 + (dIncludesNodeBody ? srcH / 2 * sgnL : 0); var _x4 = posPts.x1, _x5 = posPts.x2; - rs.segpts = [_x4, _y4, _x5, _y4]; + rs2.segpts = [_x4, _y4, _x5, _y4]; } else { var _x6 = posPts.x1 + d2 + (dIncludesNodeBody ? srcW / 2 * sgnL : 0); var _y5 = posPts.y1, _y6 = posPts.y2; - rs.segpts = [_x6, _y5, _x6, _y6]; + rs2.segpts = [_x6, _y5, _x6, _y6]; } } - if (rs.isRound) { + if (rs2.isRound) { var radius2 = edge.pstyle("taxi-radius").value; var isArcRadius = edge.pstyle("radius-type").value[0] === "arc-radius"; - rs.radii = new Array(rs.segpts.length / 2).fill(radius2); - rs.isArcRadius = new Array(rs.segpts.length / 2).fill(isArcRadius); + rs2.radii = new Array(rs2.segpts.length / 2).fill(radius2); + rs2.isArcRadius = new Array(rs2.segpts.length / 2).fill(isArcRadius); } }; BRp$c.tryToCorrectInvalidPoints = function(edge, pairInfo) { - var rs = edge._private.rscratch; - if (rs.edgeType === "bezier") { + var rs2 = edge._private.rscratch; + if (rs2.edgeType === "bezier") { var srcPos = pairInfo.srcPos, tgtPos = pairInfo.tgtPos, srcW = pairInfo.srcW, srcH = pairInfo.srcH, tgtW = pairInfo.tgtW, tgtH = pairInfo.tgtH, srcShape = pairInfo.srcShape, tgtShape = pairInfo.tgtShape, srcCornerRadius = pairInfo.srcCornerRadius, tgtCornerRadius = pairInfo.tgtCornerRadius, srcRs = pairInfo.srcRs, tgtRs = pairInfo.tgtRs; - var badStart = !number$1(rs.startX) || !number$1(rs.startY); - var badAStart = !number$1(rs.arrowStartX) || !number$1(rs.arrowStartY); - var badEnd = !number$1(rs.endX) || !number$1(rs.endY); - var badAEnd = !number$1(rs.arrowEndX) || !number$1(rs.arrowEndY); + var badStart = !number$1(rs2.startX) || !number$1(rs2.startY); + var badAStart = !number$1(rs2.arrowStartX) || !number$1(rs2.arrowStartY); + var badEnd = !number$1(rs2.endX) || !number$1(rs2.endY); + var badAEnd = !number$1(rs2.arrowEndX) || !number$1(rs2.arrowEndY); var minCpADistFactor = 3; var arrowW = this.getArrowWidth(edge.pstyle("width").pfValue, edge.pstyle("arrow-scale").value) * this.arrowShapeWidth; var minCpADist = minCpADistFactor * arrowW; var startACpDist = dist({ - x: rs.ctrlpts[0], - y: rs.ctrlpts[1] + x: rs2.ctrlpts[0], + y: rs2.ctrlpts[1] }, { - x: rs.startX, - y: rs.startY + x: rs2.startX, + y: rs2.startY }); var closeStartACp = startACpDist < minCpADist; var endACpDist = dist({ - x: rs.ctrlpts[0], - y: rs.ctrlpts[1] + x: rs2.ctrlpts[0], + y: rs2.ctrlpts[1] }, { - x: rs.endX, - y: rs.endY + x: rs2.endX, + y: rs2.endY }); var closeEndACp = endACpDist < minCpADist; var overlapping = false; @@ -312096,8 +313147,8 @@ g.stateGroup line { overlapping = true; var cpD = { // delta - x: rs.ctrlpts[0] - srcPos.x, - y: rs.ctrlpts[1] - srcPos.y + x: rs2.ctrlpts[0] - srcPos.x, + y: rs2.ctrlpts[1] - srcPos.y }; var cpL = Math.sqrt(cpD.x * cpD.x + cpD.y * cpD.y); var cpM = { @@ -312108,24 +313159,24 @@ g.stateGroup line { var radius2 = Math.max(srcW, srcH); var cpProj = { // *2 radius guarantees outside shape - x: rs.ctrlpts[0] + cpM.x * 2 * radius2, - y: rs.ctrlpts[1] + cpM.y * 2 * radius2 + x: rs2.ctrlpts[0] + cpM.x * 2 * radius2, + y: rs2.ctrlpts[1] + cpM.y * 2 * radius2 }; var srcCtrlPtIntn = srcShape.intersectLine(srcPos.x, srcPos.y, srcW, srcH, cpProj.x, cpProj.y, 0, srcCornerRadius, srcRs); if (closeStartACp) { - rs.ctrlpts[0] = rs.ctrlpts[0] + cpM.x * (minCpADist - startACpDist); - rs.ctrlpts[1] = rs.ctrlpts[1] + cpM.y * (minCpADist - startACpDist); + rs2.ctrlpts[0] = rs2.ctrlpts[0] + cpM.x * (minCpADist - startACpDist); + rs2.ctrlpts[1] = rs2.ctrlpts[1] + cpM.y * (minCpADist - startACpDist); } else { - rs.ctrlpts[0] = srcCtrlPtIntn[0] + cpM.x * minCpADist; - rs.ctrlpts[1] = srcCtrlPtIntn[1] + cpM.y * minCpADist; + rs2.ctrlpts[0] = srcCtrlPtIntn[0] + cpM.x * minCpADist; + rs2.ctrlpts[1] = srcCtrlPtIntn[1] + cpM.y * minCpADist; } } if (badEnd || badAEnd || closeEndACp) { overlapping = true; var _cpD = { // delta - x: rs.ctrlpts[0] - tgtPos.x, - y: rs.ctrlpts[1] - tgtPos.y + x: rs2.ctrlpts[0] - tgtPos.x, + y: rs2.ctrlpts[1] - tgtPos.y }; var _cpL = Math.sqrt(_cpD.x * _cpD.x + _cpD.y * _cpD.y); var _cpM = { @@ -312136,16 +313187,16 @@ g.stateGroup line { var _radius = Math.max(srcW, srcH); var _cpProj = { // *2 radius guarantees outside shape - x: rs.ctrlpts[0] + _cpM.x * 2 * _radius, - y: rs.ctrlpts[1] + _cpM.y * 2 * _radius + x: rs2.ctrlpts[0] + _cpM.x * 2 * _radius, + y: rs2.ctrlpts[1] + _cpM.y * 2 * _radius }; var tgtCtrlPtIntn = tgtShape.intersectLine(tgtPos.x, tgtPos.y, tgtW, tgtH, _cpProj.x, _cpProj.y, 0, tgtCornerRadius, tgtRs); if (closeEndACp) { - rs.ctrlpts[0] = rs.ctrlpts[0] + _cpM.x * (minCpADist - endACpDist); - rs.ctrlpts[1] = rs.ctrlpts[1] + _cpM.y * (minCpADist - endACpDist); + rs2.ctrlpts[0] = rs2.ctrlpts[0] + _cpM.x * (minCpADist - endACpDist); + rs2.ctrlpts[1] = rs2.ctrlpts[1] + _cpM.y * (minCpADist - endACpDist); } else { - rs.ctrlpts[0] = tgtCtrlPtIntn[0] + _cpM.x * minCpADist; - rs.ctrlpts[1] = tgtCtrlPtIntn[1] + _cpM.y * minCpADist; + rs2.ctrlpts[0] = tgtCtrlPtIntn[0] + _cpM.x * minCpADist; + rs2.ctrlpts[1] = tgtCtrlPtIntn[1] + _cpM.y * minCpADist; } } if (overlapping) { @@ -312154,90 +313205,90 @@ g.stateGroup line { } }; BRp$c.storeAllpts = function(edge) { - var rs = edge._private.rscratch; - if (rs.edgeType === "multibezier" || rs.edgeType === "bezier" || rs.edgeType === "self" || rs.edgeType === "compound") { - rs.allpts = []; - rs.allpts.push(rs.startX, rs.startY); - for (var b2 = 0; b2 + 1 < rs.ctrlpts.length; b2 += 2) { - rs.allpts.push(rs.ctrlpts[b2], rs.ctrlpts[b2 + 1]); - if (b2 + 3 < rs.ctrlpts.length) { - rs.allpts.push((rs.ctrlpts[b2] + rs.ctrlpts[b2 + 2]) / 2, (rs.ctrlpts[b2 + 1] + rs.ctrlpts[b2 + 3]) / 2); + var rs2 = edge._private.rscratch; + if (rs2.edgeType === "multibezier" || rs2.edgeType === "bezier" || rs2.edgeType === "self" || rs2.edgeType === "compound") { + rs2.allpts = []; + rs2.allpts.push(rs2.startX, rs2.startY); + for (var b2 = 0; b2 + 1 < rs2.ctrlpts.length; b2 += 2) { + rs2.allpts.push(rs2.ctrlpts[b2], rs2.ctrlpts[b2 + 1]); + if (b2 + 3 < rs2.ctrlpts.length) { + rs2.allpts.push((rs2.ctrlpts[b2] + rs2.ctrlpts[b2 + 2]) / 2, (rs2.ctrlpts[b2 + 1] + rs2.ctrlpts[b2 + 3]) / 2); } } - rs.allpts.push(rs.endX, rs.endY); + rs2.allpts.push(rs2.endX, rs2.endY); var m2, mt2; - if (rs.ctrlpts.length / 2 % 2 === 0) { - m2 = rs.allpts.length / 2 - 1; - rs.midX = rs.allpts[m2]; - rs.midY = rs.allpts[m2 + 1]; + if (rs2.ctrlpts.length / 2 % 2 === 0) { + m2 = rs2.allpts.length / 2 - 1; + rs2.midX = rs2.allpts[m2]; + rs2.midY = rs2.allpts[m2 + 1]; } else { - m2 = rs.allpts.length / 2 - 3; + m2 = rs2.allpts.length / 2 - 3; mt2 = 0.5; - rs.midX = qbezierAt(rs.allpts[m2], rs.allpts[m2 + 2], rs.allpts[m2 + 4], mt2); - rs.midY = qbezierAt(rs.allpts[m2 + 1], rs.allpts[m2 + 3], rs.allpts[m2 + 5], mt2); - } - } else if (rs.edgeType === "straight") { - rs.allpts = [rs.startX, rs.startY, rs.endX, rs.endY]; - rs.midX = (rs.startX + rs.endX + rs.arrowStartX + rs.arrowEndX) / 4; - rs.midY = (rs.startY + rs.endY + rs.arrowStartY + rs.arrowEndY) / 4; - } else if (rs.edgeType === "segments") { - rs.allpts = []; - rs.allpts.push(rs.startX, rs.startY); - rs.allpts.push.apply(rs.allpts, rs.segpts); - rs.allpts.push(rs.endX, rs.endY); - if (rs.isRound) { - rs.roundCorners = []; - for (var i2 = 2; i2 + 3 < rs.allpts.length; i2 += 2) { - var radius2 = rs.radii[i2 / 2 - 1]; - var isArcRadius = rs.isArcRadius[i2 / 2 - 1]; - rs.roundCorners.push(getRoundCorner({ - x: rs.allpts[i2 - 2], - y: rs.allpts[i2 - 1] + rs2.midX = qbezierAt(rs2.allpts[m2], rs2.allpts[m2 + 2], rs2.allpts[m2 + 4], mt2); + rs2.midY = qbezierAt(rs2.allpts[m2 + 1], rs2.allpts[m2 + 3], rs2.allpts[m2 + 5], mt2); + } + } else if (rs2.edgeType === "straight") { + rs2.allpts = [rs2.startX, rs2.startY, rs2.endX, rs2.endY]; + rs2.midX = (rs2.startX + rs2.endX + rs2.arrowStartX + rs2.arrowEndX) / 4; + rs2.midY = (rs2.startY + rs2.endY + rs2.arrowStartY + rs2.arrowEndY) / 4; + } else if (rs2.edgeType === "segments") { + rs2.allpts = []; + rs2.allpts.push(rs2.startX, rs2.startY); + rs2.allpts.push.apply(rs2.allpts, rs2.segpts); + rs2.allpts.push(rs2.endX, rs2.endY); + if (rs2.isRound) { + rs2.roundCorners = []; + for (var i2 = 2; i2 + 3 < rs2.allpts.length; i2 += 2) { + var radius2 = rs2.radii[i2 / 2 - 1]; + var isArcRadius = rs2.isArcRadius[i2 / 2 - 1]; + rs2.roundCorners.push(getRoundCorner({ + x: rs2.allpts[i2 - 2], + y: rs2.allpts[i2 - 1] }, { - x: rs.allpts[i2], - y: rs.allpts[i2 + 1], + x: rs2.allpts[i2], + y: rs2.allpts[i2 + 1], radius: radius2 }, { - x: rs.allpts[i2 + 2], - y: rs.allpts[i2 + 3] + x: rs2.allpts[i2 + 2], + y: rs2.allpts[i2 + 3] }, radius2, isArcRadius)); } } - if (rs.segpts.length % 4 === 0) { - var i22 = rs.segpts.length / 2; + if (rs2.segpts.length % 4 === 0) { + var i22 = rs2.segpts.length / 2; var i1 = i22 - 2; - rs.midX = (rs.segpts[i1] + rs.segpts[i22]) / 2; - rs.midY = (rs.segpts[i1 + 1] + rs.segpts[i22 + 1]) / 2; + rs2.midX = (rs2.segpts[i1] + rs2.segpts[i22]) / 2; + rs2.midY = (rs2.segpts[i1 + 1] + rs2.segpts[i22 + 1]) / 2; } else { - var _i2 = rs.segpts.length / 2 - 1; - if (!rs.isRound) { - rs.midX = rs.segpts[_i2]; - rs.midY = rs.segpts[_i2 + 1]; + var _i2 = rs2.segpts.length / 2 - 1; + if (!rs2.isRound) { + rs2.midX = rs2.segpts[_i2]; + rs2.midY = rs2.segpts[_i2 + 1]; } else { var point9 = { - x: rs.segpts[_i2], - y: rs.segpts[_i2 + 1] + x: rs2.segpts[_i2], + y: rs2.segpts[_i2 + 1] }; - var corner = rs.roundCorners[_i2 / 2]; + var corner = rs2.roundCorners[_i2 / 2]; var v = [point9.x - corner.cx, point9.y - corner.cy]; var factor = corner.radius / Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2)); v = v.map(function(c5) { return c5 * factor; }); - rs.midX = corner.cx + v[0]; - rs.midY = corner.cy + v[1]; - rs.midVector = v; + rs2.midX = corner.cx + v[0]; + rs2.midY = corner.cy + v[1]; + rs2.midVector = v; } } } }; BRp$c.checkForInvalidEdgeWarning = function(edge) { - var rs = edge[0]._private.rscratch; - if (rs.nodesOverlap || number$1(rs.startX) && number$1(rs.startY) && number$1(rs.endX) && number$1(rs.endY)) { - rs.loggedErr = false; + var rs2 = edge[0]._private.rscratch; + if (rs2.nodesOverlap || number$1(rs2.startX) && number$1(rs2.startY) && number$1(rs2.endX) && number$1(rs2.endY)) { + rs2.loggedErr = false; } else { - if (!rs.loggedErr) { - rs.loggedErr = true; + if (!rs2.loggedErr) { + rs2.loggedErr = true; warn("Edge `" + edge.id() + "` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."); } } @@ -312353,7 +313404,7 @@ g.stateGroup line { }; for (var _i2 = 0; _i2 < pairInfo.eles.length; _i2++) { var _edge = pairInfo.eles[_i2]; - var rs = _edge[0]._private.rscratch; + var rs2 = _edge[0]._private.rscratch; var _curveStyle = _edge.pstyle("curve-style").value; var _edgeIsUnbundled = _curveStyle === "unbundled-bezier" || _curveStyle.endsWith("segments") || _curveStyle.endsWith("taxi"); var edgeIsSwapped = !src2.same(_edge.source()); @@ -312436,10 +313487,10 @@ g.stateGroup line { }; } var passedPairInfo = edgeIsSwapped ? swappedpairInfo : pairInfo; - rs.nodesOverlap = passedPairInfo.nodesOverlap; - rs.srcIntn = passedPairInfo.srcIntn; - rs.tgtIntn = passedPairInfo.tgtIntn; - rs.isRound = _curveStyle.startsWith("round"); + rs2.nodesOverlap = passedPairInfo.nodesOverlap; + rs2.srcIntn = passedPairInfo.srcIntn; + rs2.tgtIntn = passedPairInfo.tgtIntn; + rs2.isRound = _curveStyle.startsWith("round"); if (hasCompounds && (src2.isParent() || src2.isChild() || tgt2.isParent() || tgt2.isChild()) && (src2.parents().anySame(tgt2) || tgt2.parents().anySame(src2) || src2.same(tgt2) && src2.isParent())) { _this.findCompoundLoopPoints(_edge, passedPairInfo, _i2, _edgeIsUnbundled); } else if (src2 === tgt2) { @@ -312469,27 +313520,27 @@ g.stateGroup line { this.findHaystackPoints(haystackEdges); }; BRp$c.getSegmentPoints = function(edge) { - var rs = edge[0]._private.rscratch; - var type3 = rs.edgeType; + var rs2 = edge[0]._private.rscratch; + var type3 = rs2.edgeType; if (type3 === "segments") { this.recalculateRenderedStyle(edge); - return getPts(rs.segpts); + return getPts(rs2.segpts); } }; BRp$c.getControlPoints = function(edge) { - var rs = edge[0]._private.rscratch; - var type3 = rs.edgeType; + var rs2 = edge[0]._private.rscratch; + var type3 = rs2.edgeType; if (type3 === "bezier" || type3 === "multibezier" || type3 === "self" || type3 === "compound") { this.recalculateRenderedStyle(edge); - return getPts(rs.ctrlpts); + return getPts(rs2.ctrlpts); } }; BRp$c.getEdgeMidpoint = function(edge) { - var rs = edge[0]._private.rscratch; + var rs2 = edge[0]._private.rscratch; this.recalculateRenderedStyle(edge); return { - x: rs.midX, - y: rs.midY + x: rs2.midX, + y: rs2.midY }; }; BRp$b = {}; @@ -312498,7 +313549,7 @@ g.stateGroup line { var npos = node3.position(); var w2 = node3.outerWidth(); var h3 = node3.outerHeight(); - var rs = node3._private.rscratch; + var rs2 = node3._private.rscratch; if (prop.value.length === 2) { var p3 = [prop.pfValue[0], prop.pfValue[1]]; if (prop.units[0] === "%") { @@ -312515,7 +313566,7 @@ g.stateGroup line { angle2 = -Math.PI / 2 + angle2; var l2 = 2 * Math.max(w2, h3); var _p = [npos.x + Math.cos(angle2) * l2, npos.y + Math.sin(angle2) * l2]; - return r2.nodeShapes[this.getNodeShape(node3)].intersectLine(npos.x, npos.y, w2, h3, _p[0], _p[1], 0, node3.pstyle("corner-radius").value === "auto" ? "auto" : node3.pstyle("corner-radius").pfValue, rs); + return r2.nodeShapes[this.getNodeShape(node3)].intersectLine(npos.x, npos.y, w2, h3, _p[0], _p[1], 0, node3.pstyle("corner-radius").value === "auto" ? "auto" : node3.pstyle("corner-radius").pfValue, rs2); } }; BRp$b.findEndpoints = function(edge) { @@ -312532,8 +313583,8 @@ g.stateGroup line { var srcRs = source._private.rscratch; var tgtRs = target2._private.rscratch; var curveStyle = edge.pstyle("curve-style").value; - var rs = edge._private.rscratch; - var et2 = rs.edgeType; + var rs2 = edge._private.rscratch; + var et2 = rs2.edgeType; var taxi = curveStyle === "taxi"; var self2 = et2 === "self" || et2 === "compound"; var bezier = et2 === "bezier" || et2 === "multibezier" || self2; @@ -312548,20 +313599,20 @@ g.stateGroup line { var tgtManEndpt = edge.pstyle("target-endpoint"); var tgtManEndptVal = overrideEndpts ? "outside-to-node" : tgtManEndpt.value; var tgtCornerRadius = target2.pstyle("corner-radius").value === "auto" ? "auto" : target2.pstyle("corner-radius").pfValue; - rs.srcManEndpt = srcManEndpt; - rs.tgtManEndpt = tgtManEndpt; + rs2.srcManEndpt = srcManEndpt; + rs2.tgtManEndpt = tgtManEndpt; var p1; var p22; var p1_i; var p2_i; if (bezier) { - var cpStart = [rs.ctrlpts[0], rs.ctrlpts[1]]; - var cpEnd = multi ? [rs.ctrlpts[rs.ctrlpts.length - 2], rs.ctrlpts[rs.ctrlpts.length - 1]] : cpStart; + var cpStart = [rs2.ctrlpts[0], rs2.ctrlpts[1]]; + var cpEnd = multi ? [rs2.ctrlpts[rs2.ctrlpts.length - 2], rs2.ctrlpts[rs2.ctrlpts.length - 1]] : cpStart; p1 = cpEnd; p22 = cpStart; } else if (lines) { - var srcArrowFromPt = !segments ? [tgtPos.x, tgtPos.y] : rs.segpts.slice(0, 2); - var tgtArrowFromPt = !segments ? [srcPos.x, srcPos.y] : rs.segpts.slice(rs.segpts.length - 2); + var srcArrowFromPt = !segments ? [tgtPos.x, tgtPos.y] : rs2.segpts.slice(0, 2); + var tgtArrowFromPt = !segments ? [srcPos.x, srcPos.y] : rs2.segpts.slice(rs2.segpts.length - 2); p1 = tgtArrowFromPt; p22 = srcArrowFromPt; } @@ -312570,7 +313621,7 @@ g.stateGroup line { } else if (tgtManEndpt.units) { intersect4 = this.manualEndptToPx(target2, tgtManEndpt); } else if (tgtManEndptVal === "outside-to-line") { - intersect4 = rs.tgtIntn; + intersect4 = rs2.tgtIntn; } else { if (tgtManEndptVal === "outside-to-node" || tgtManEndptVal === "outside-to-node-or-label") { p1_i = p1; @@ -312622,16 +313673,16 @@ g.stateGroup line { } var arrowEnd = shortenIntersection(intersect4, p1, r2.arrowShapes[tgtArShape].spacing(edge) + tgtDist); var edgeEnd = shortenIntersection(intersect4, p1, r2.arrowShapes[tgtArShape].gap(edge) + tgtDist); - rs.endX = edgeEnd[0]; - rs.endY = edgeEnd[1]; - rs.arrowEndX = arrowEnd[0]; - rs.arrowEndY = arrowEnd[1]; + rs2.endX = edgeEnd[0]; + rs2.endY = edgeEnd[1]; + rs2.arrowEndX = arrowEnd[0]; + rs2.arrowEndY = arrowEnd[1]; if (srcManEndptVal === "inside-to-node") { intersect4 = [srcPos.x, srcPos.y]; } else if (srcManEndpt.units) { intersect4 = this.manualEndptToPx(source, srcManEndpt); } else if (srcManEndptVal === "outside-to-line") { - intersect4 = rs.srcIntn; + intersect4 = rs2.srcIntn; } else { if (srcManEndptVal === "outside-to-node" || srcManEndptVal === "outside-to-node-or-label") { p2_i = p22; @@ -312683,73 +313734,73 @@ g.stateGroup line { } var arrowStart = shortenIntersection(intersect4, p22, r2.arrowShapes[srcArShape].spacing(edge) + srcDist); var edgeStart = shortenIntersection(intersect4, p22, r2.arrowShapes[srcArShape].gap(edge) + srcDist); - rs.startX = edgeStart[0]; - rs.startY = edgeStart[1]; - rs.arrowStartX = arrowStart[0]; - rs.arrowStartY = arrowStart[1]; + rs2.startX = edgeStart[0]; + rs2.startY = edgeStart[1]; + rs2.arrowStartX = arrowStart[0]; + rs2.arrowStartY = arrowStart[1]; if (hasEndpts) { - if (!number$1(rs.startX) || !number$1(rs.startY) || !number$1(rs.endX) || !number$1(rs.endY)) { - rs.badLine = true; + if (!number$1(rs2.startX) || !number$1(rs2.startY) || !number$1(rs2.endX) || !number$1(rs2.endY)) { + rs2.badLine = true; } else { - rs.badLine = false; + rs2.badLine = false; } } }; BRp$b.getSourceEndpoint = function(edge) { - var rs = edge[0]._private.rscratch; + var rs2 = edge[0]._private.rscratch; this.recalculateRenderedStyle(edge); - switch (rs.edgeType) { + switch (rs2.edgeType) { case "haystack": return { - x: rs.haystackPts[0], - y: rs.haystackPts[1] + x: rs2.haystackPts[0], + y: rs2.haystackPts[1] }; default: return { - x: rs.arrowStartX, - y: rs.arrowStartY + x: rs2.arrowStartX, + y: rs2.arrowStartY }; } }; BRp$b.getTargetEndpoint = function(edge) { - var rs = edge[0]._private.rscratch; + var rs2 = edge[0]._private.rscratch; this.recalculateRenderedStyle(edge); - switch (rs.edgeType) { + switch (rs2.edgeType) { case "haystack": return { - x: rs.haystackPts[2], - y: rs.haystackPts[3] + x: rs2.haystackPts[2], + y: rs2.haystackPts[3] }; default: return { - x: rs.arrowEndX, - y: rs.arrowEndY + x: rs2.arrowEndX, + y: rs2.arrowEndY }; } }; BRp$a = {}; BRp$a.storeEdgeProjections = function(edge) { var _p = edge._private; - var rs = _p.rscratch; - var et2 = rs.edgeType; + var rs2 = _p.rscratch; + var et2 = rs2.edgeType; _p.rstyle.bezierPts = null; _p.rstyle.linePts = null; _p.rstyle.haystackPts = null; if (et2 === "multibezier" || et2 === "bezier" || et2 === "self" || et2 === "compound") { _p.rstyle.bezierPts = []; - for (var i2 = 0; i2 + 5 < rs.allpts.length; i2 += 4) { - pushBezierPts(this, edge, rs.allpts.slice(i2, i2 + 6)); + for (var i2 = 0; i2 + 5 < rs2.allpts.length; i2 += 4) { + pushBezierPts(this, edge, rs2.allpts.slice(i2, i2 + 6)); } } else if (et2 === "segments") { var lpts = _p.rstyle.linePts = []; - for (var i2 = 0; i2 + 1 < rs.allpts.length; i2 += 2) { + for (var i2 = 0; i2 + 1 < rs2.allpts.length; i2 += 2) { lpts.push({ - x: rs.allpts[i2], - y: rs.allpts[i2 + 1] + x: rs2.allpts[i2], + y: rs2.allpts[i2 + 1] }); } } else if (et2 === "haystack") { - var hpts = rs.haystackPts; + var hpts = rs2.haystackPts; _p.rstyle.haystackPts = [{ x: hpts[0], y: hpts[1] @@ -312777,7 +313828,7 @@ g.stateGroup line { var nodePos = node3.position(); var textHalign = node3.pstyle("text-halign").strValue; var textValign = node3.pstyle("text-valign").strValue; - var rs = _p.rscratch; + var rs2 = _p.rscratch; var rstyle = _p.rstyle; switch (textHalign) { case "left": @@ -312799,8 +313850,8 @@ g.stateGroup line { default: textY = nodePos.y; } - rs.labelX = textX; - rs.labelY = textY; + rs2.labelX = textX; + rs2.labelY = textY; rstyle.labelX = textX; rstyle.labelY = textY; this.calculateLabelAngles(node3); @@ -312828,7 +313879,7 @@ g.stateGroup line { BRp$9.recalculateEdgeLabelProjections = function(edge) { var p3; var _p = edge._private; - var rs = _p.rscratch; + var rs2 = _p.rscratch; var r2 = this; var content3 = { mid: edge.pstyle("label").strValue, @@ -312840,8 +313891,8 @@ g.stateGroup line { return; } p3 = { - x: rs.midX, - y: rs.midY + x: rs2.midX, + y: rs2.midY }; var setRs = function setRs2(propName, prefix, value) { setPrefixedProperty(_p.rscratch, propName, prefix, value); @@ -312849,25 +313900,25 @@ g.stateGroup line { }; setRs("labelX", null, p3.x); setRs("labelY", null, p3.y); - var midAngle = lineAngleFromDelta(rs.midDispX, rs.midDispY); + var midAngle = lineAngleFromDelta(rs2.midDispX, rs2.midDispY); setRs("labelAutoAngle", null, midAngle); var createControlPointInfo = function createControlPointInfo2() { if (createControlPointInfo2.cache) { return createControlPointInfo2.cache; } var ctrlpts = []; - for (var i2 = 0; i2 + 5 < rs.allpts.length; i2 += 4) { + for (var i2 = 0; i2 + 5 < rs2.allpts.length; i2 += 4) { var p0 = { - x: rs.allpts[i2], - y: rs.allpts[i2 + 1] + x: rs2.allpts[i2], + y: rs2.allpts[i2 + 1] }; var p1 = { - x: rs.allpts[i2 + 2], - y: rs.allpts[i2 + 3] + x: rs2.allpts[i2 + 2], + y: rs2.allpts[i2 + 3] }; var p22 = { - x: rs.allpts[i2 + 4], - y: rs.allpts[i2 + 5] + x: rs2.allpts[i2 + 4], + y: rs2.allpts[i2 + 5] }; ctrlpts.push({ p0, @@ -312915,7 +313966,7 @@ g.stateGroup line { return; } var offset = edge.pstyle(prefix + "-text-offset").pfValue; - switch (rs.edgeType) { + switch (rs2.edgeType) { case "self": case "compound": case "bezier": @@ -312958,25 +314009,25 @@ g.stateGroup line { case "haystack": { var d2 = 0, di2, d0; var p0, p1; - var l2 = rs.allpts.length; + var l2 = rs2.allpts.length; for (var _i2 = 0; _i2 + 3 < l2; _i2 += 2) { if (isSrc) { p0 = { - x: rs.allpts[_i2], - y: rs.allpts[_i2 + 1] + x: rs2.allpts[_i2], + y: rs2.allpts[_i2 + 1] }; p1 = { - x: rs.allpts[_i2 + 2], - y: rs.allpts[_i2 + 3] + x: rs2.allpts[_i2 + 2], + y: rs2.allpts[_i2 + 3] }; } else { p0 = { - x: rs.allpts[l2 - 2 - _i2], - y: rs.allpts[l2 - 1 - _i2] + x: rs2.allpts[l2 - 2 - _i2], + y: rs2.allpts[l2 - 1 - _i2] }; p1 = { - x: rs.allpts[l2 - 4 - _i2], - y: rs.allpts[l2 - 3 - _i2] + x: rs2.allpts[l2 - 4 - _i2], + y: rs2.allpts[l2 - 3 - _i2] }; } di2 = dist(p0, p1); @@ -313061,8 +314112,7 @@ g.stateGroup line { var overflow = ele.pstyle("text-overflow-wrap").value; var overflowAny = overflow === "anywhere"; var wrappedLines = []; - var wordsRegex = /[\s\u200b]+/; - var wordSeparator = overflowAny ? "" : " "; + var separatorRegex = /[\s\u200b]+|$/g; for (var l2 = 0; l2 < lines.length; l2++) { var line2 = lines[l2]; var lineDims = this.calculateLabelDimensions(ele, line2); @@ -313072,21 +314122,32 @@ g.stateGroup line { line2 = processedLine; } if (lineW > maxW) { - var words = line2.split(wordsRegex); + var separatorMatches = line2.matchAll(separatorRegex); var subline = ""; - for (var w2 = 0; w2 < words.length; w2++) { - var word = words[w2]; - var testLine = subline.length === 0 ? word : subline + wordSeparator + word; - var testDims = this.calculateLabelDimensions(ele, testLine); - var testW = testDims.width; - if (testW <= maxW) { - subline += word + wordSeparator; - } else { - if (subline) { - wrappedLines.push(subline); + var previousIndex = 0; + var _iterator = _createForOfIteratorHelper(separatorMatches), _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done; ) { + var separatorMatch = _step.value; + var wordSeparator = separatorMatch[0]; + var word = line2.substring(previousIndex, separatorMatch.index); + previousIndex = separatorMatch.index + wordSeparator.length; + var testLine = subline.length === 0 ? word : subline + word + wordSeparator; + var testDims = this.calculateLabelDimensions(ele, testLine); + var testW = testDims.width; + if (testW <= maxW) { + subline += word + wordSeparator; + } else { + if (subline) { + wrappedLines.push(subline); + } + subline = word + wordSeparator; } - subline = word + wordSeparator; } + } catch (err2) { + _iterator.e(err2); + } finally { + _iterator.f(); } if (!subline.match(/^[\s\u200b]+$/)) { wrappedLines.push(subline); @@ -313145,6 +314206,8 @@ g.stateGroup line { }; BRp$9.calculateLabelDimensions = function(ele, text4) { var r2 = this; + var containerWindow = r2.cy.window(); + var document5 = containerWindow.document; var cacheKey = hashString(text4, ele._private.labelDimsKey); var cache3 = r2.labelDimCache || (r2.labelDimCache = []); var existingVal = cache3[cacheKey]; @@ -313159,7 +314222,7 @@ g.stateGroup line { var canvas = this.labelCalcCanvas; var c2d = this.labelCalcCanvasContext; if (!canvas) { - canvas = this.labelCalcCanvas = document.createElement("canvas"); + canvas = this.labelCalcCanvas = document5.createElement("canvas"); c2d = this.labelCalcCanvasContext = canvas.getContext("2d"); var ds = canvas.style; ds.position = "absolute"; @@ -313190,7 +314253,7 @@ g.stateGroup line { }; BRp$9.calculateLabelAngle = function(ele, prefix) { var _p = ele._private; - var rs = _p.rscratch; + var rs2 = _p.rscratch; var isEdge2 = ele.isEdge(); var prefixDash = prefix ? prefix + "-" : ""; var rot = ele.pstyle(prefixDash + "text-rotation"); @@ -313198,7 +314261,7 @@ g.stateGroup line { if (rotStr === "none") { return 0; } else if (isEdge2 && rotStr === "autorotate") { - return rs.labelAutoAngle; + return rs2.labelAutoAngle; } else if (rotStr === "autorotate") { return 0; } else { @@ -313209,11 +314272,11 @@ g.stateGroup line { var r2 = this; var isEdge2 = ele.isEdge(); var _p = ele._private; - var rs = _p.rscratch; - rs.labelAngle = r2.calculateLabelAngle(ele); + var rs2 = _p.rscratch; + rs2.labelAngle = r2.calculateLabelAngle(ele); if (isEdge2) { - rs.sourceLabelAngle = r2.calculateLabelAngle(ele, "source"); - rs.targetLabelAngle = r2.calculateLabelAngle(ele, "target"); + rs2.sourceLabelAngle = r2.calculateLabelAngle(ele, "source"); + rs2.targetLabelAngle = r2.calculateLabelAngle(ele, "target"); } }; BRp$8 = {}; @@ -313346,16 +314409,16 @@ g.stateGroup line { var _ele2 = edges4[_i3]; var _p3 = _ele2._private; var _rstyle2 = _p3.rstyle; - var rs = _p3.rscratch; - _rstyle2.srcX = rs.arrowStartX; - _rstyle2.srcY = rs.arrowStartY; - _rstyle2.tgtX = rs.arrowEndX; - _rstyle2.tgtY = rs.arrowEndY; - _rstyle2.midX = rs.midX; - _rstyle2.midY = rs.midY; - _rstyle2.labelAngle = rs.labelAngle; - _rstyle2.sourceLabelAngle = rs.sourceLabelAngle; - _rstyle2.targetLabelAngle = rs.targetLabelAngle; + var rs2 = _p3.rscratch; + _rstyle2.srcX = rs2.arrowStartX; + _rstyle2.srcY = rs2.arrowStartY; + _rstyle2.tgtX = rs2.arrowEndX; + _rstyle2.tgtY = rs2.arrowEndY; + _rstyle2.midX = rs2.midX; + _rstyle2.midY = rs2.midY; + _rstyle2.labelAngle = rs2.labelAngle; + _rstyle2.sourceLabelAngle = rs2.sourceLabelAngle; + _rstyle2.targetLabelAngle = rs2.targetLabelAngle; } }; BRp$6 = {}; @@ -313369,10 +314432,10 @@ g.stateGroup line { var grabTargets = []; for (var i2 = 0; i2 < eles.length; i2++) { var ele = eles[i2]; - var rs = ele._private.rscratch; + var rs2 = ele._private.rscratch; if (ele.grabbed() && !ele.isParent()) { grabTargets.push(ele); - } else if (rs.inDragLayer) { + } else if (rs2.inDragLayer) { eles.drag.push(ele); } else { eles.nondrag.push(ele); @@ -313723,6 +314786,9 @@ g.stateGroup line { if (!eventInContainer(e3)) { return; } + if (r2.hoverData.which === 1 && e3.which !== 1) { + return; + } e3.preventDefault(); blurActiveDomElement(); r2.hoverData.capture = true; @@ -314077,6 +315143,9 @@ g.stateGroup line { }, false); var clickTimeout, didDoubleClick, prevClickTimeStamp; r2.registerBinding(containerWindow, "mouseup", function mouseupHandler(e3) { + if (r2.hoverData.which === 1 && e3.which !== 1 && r2.hoverData.capture) { + return; + } var capture = r2.hoverData.capture; if (!capture) { return; @@ -314246,6 +315315,7 @@ g.stateGroup line { r2.hoverData.dragDelta = []; r2.hoverData.mdownPos = null; r2.hoverData.mdownGPos = null; + r2.hoverData.which = null; }, false); var wheelHandler = function wheelHandler2(e3) { if (r2.scrollingPage) { @@ -314524,7 +315594,7 @@ g.stateGroup line { } }, false); var touchmoveHandler; - r2.registerBinding(window, "touchmove", touchmoveHandler = function touchmoveHandler2(e3) { + r2.registerBinding(containerWindow, "touchmove", touchmoveHandler = function touchmoveHandler2(e3) { var capture = r2.touchData.capture; if (!capture && !eventInContainer(e3)) { return; @@ -315208,13 +316278,13 @@ g.stateGroup line { renderer: this, name, points, - getOrCreateCorners: function getOrCreateCorners(centerX, centerY, width3, height2, cornerRadius, rs, field) { - if (rs[field] !== void 0 && rs[field + "-cx"] === centerX && rs[field + "-cy"] === centerY) { - return rs[field]; + getOrCreateCorners: function getOrCreateCorners(centerX, centerY, width3, height2, cornerRadius, rs2, field) { + if (rs2[field] !== void 0 && rs2[field + "-cx"] === centerX && rs2[field + "-cy"] === centerY) { + return rs2[field]; } - rs[field] = new Array(points.length / 2); - rs[field + "-cx"] = centerX; - rs[field + "-cy"] = centerY; + rs2[field] = new Array(points.length / 2); + rs2[field + "-cx"] = centerX; + rs2[field + "-cy"] = centerY; var halfW = width3 / 2; var halfH = height2 / 2; cornerRadius = cornerRadius === "auto" ? getRoundPolygonRadius(width3, height2) : cornerRadius; @@ -315230,20 +316300,20 @@ g.stateGroup line { for (i2 = 0; i2 < len; i2++) { p22 = p3[i2 % len]; p32 = p3[(i2 + 1) % len]; - rs[field][i2] = getRoundCorner(p1, p22, p32, cornerRadius); + rs2[field][i2] = getRoundCorner(p1, p22, p32, cornerRadius); p1 = p22; p22 = p32; } - return rs[field]; + return rs2[field]; }, - draw: function draw24(context, centerX, centerY, width3, height2, cornerRadius, rs) { - this.renderer.nodeShapeImpl("round-polygon", context, centerX, centerY, width3, height2, this.points, this.getOrCreateCorners(centerX, centerY, width3, height2, cornerRadius, rs, "drawCorners")); + draw: function draw24(context, centerX, centerY, width3, height2, cornerRadius, rs2) { + this.renderer.nodeShapeImpl("round-polygon", context, centerX, centerY, width3, height2, this.points, this.getOrCreateCorners(centerX, centerY, width3, height2, cornerRadius, rs2, "drawCorners")); }, - intersectLine: function intersectLine3(nodeX, nodeY, width3, height2, x4, y4, padding3, cornerRadius, rs) { - return roundPolygonIntersectLine(x4, y4, this.points, nodeX, nodeY, width3, height2, padding3, this.getOrCreateCorners(nodeX, nodeY, width3, height2, cornerRadius, rs, "corners")); + intersectLine: function intersectLine3(nodeX, nodeY, width3, height2, x4, y4, padding3, cornerRadius, rs2) { + return roundPolygonIntersectLine(x4, y4, this.points, nodeX, nodeY, width3, height2, padding3, this.getOrCreateCorners(nodeX, nodeY, width3, height2, cornerRadius, rs2, "corners")); }, - checkPoint: function checkPoint(x4, y4, padding3, width3, height2, centerX, centerY, cornerRadius, rs) { - return pointInsideRoundPolygon(x4, y4, this.points, centerX, centerY, width3, height2, this.getOrCreateCorners(centerX, centerY, width3, height2, cornerRadius, rs, "corners")); + checkPoint: function checkPoint(x4, y4, padding3, width3, height2, centerX, centerY, cornerRadius, rs2) { + return pointInsideRoundPolygon(x4, y4, this.points, centerX, centerY, width3, height2, this.getOrCreateCorners(centerX, centerY, width3, height2, cornerRadius, rs2, "corners")); } }; }; @@ -316585,8 +317655,8 @@ g.stateGroup line { var allowLazyQueueing = !firstGet; for (var i2 = 0; i2 < eles.length; i2++) { var ele = eles[i2]; - var rs = ele._private.rscratch; - var caches = rs.imgLayerCaches = rs.imgLayerCaches || {}; + var rs2 = ele._private.rscratch; + var caches = rs2.imgLayerCaches = rs2.imgLayerCaches || {}; var existingLayer = caches[lvl]; if (existingLayer) { layer = existingLayer; @@ -316694,8 +317764,8 @@ g.stateGroup line { for (var i2 = 0; i2 < eles.length; i2++) { var req = isEles ? null : eles[i2]; var ele = isEles ? eles[i2] : eles[i2].ele; - var rs = ele._private.rscratch; - var caches = rs.imgLayerCaches = rs.imgLayerCaches || {}; + var rs2 = ele._private.rscratch; + var caches = rs2.imgLayerCaches = rs2.imgLayerCaches || {}; for (var l2 = minLvl; l2 <= maxLvl; l2++) { var layer = caches[l2]; if (!layer) { @@ -317052,11 +318122,11 @@ g.stateGroup line { var shouldDrawOverlay = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true; var shouldDrawOpacity = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : true; var r2 = this; - var rs = edge._private.rscratch; + var rs2 = edge._private.rscratch; if (shouldDrawOpacity && !edge.visible()) { return; } - if (rs.badLine || rs.allpts == null || isNaN(rs.allpts[0])) { + if (rs2.badLine || rs2.allpts == null || isNaN(rs2.allpts[0])) { return; } var bb; @@ -317070,18 +318140,37 @@ g.stateGroup line { var lineStyle = edge.pstyle("line-style").value; var edgeWidth = edge.pstyle("width").pfValue; var lineCap = edge.pstyle("line-cap").value; + var lineOutlineWidth = edge.pstyle("line-outline-width").value; + var lineOutlineColor = edge.pstyle("line-outline-color").value; var effectiveLineOpacity = opacity * lineOpacity; var effectiveArrowOpacity = opacity * lineOpacity; var drawLine = function drawLine2() { var strokeOpacity = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : effectiveLineOpacity; if (curveStyle === "straight-triangle") { r2.eleStrokeStyle(context, edge, strokeOpacity); - r2.drawEdgeTrianglePath(edge, context, rs.allpts); + r2.drawEdgeTrianglePath(edge, context, rs2.allpts); } else { context.lineWidth = edgeWidth; context.lineCap = lineCap; r2.eleStrokeStyle(context, edge, strokeOpacity); - r2.drawEdgePath(edge, context, rs.allpts, lineStyle); + r2.drawEdgePath(edge, context, rs2.allpts, lineStyle); + context.lineCap = "butt"; + } + }; + var drawLineOutline = function drawLineOutline2() { + var strokeOpacity = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : effectiveLineOpacity; + context.lineWidth = edgeWidth + lineOutlineWidth; + context.lineCap = lineCap; + if (lineOutlineWidth > 0) { + r2.colorStrokeStyle(context, lineOutlineColor[0], lineOutlineColor[1], lineOutlineColor[2], strokeOpacity); + } else { + context.lineCap = "butt"; + return; + } + if (curveStyle === "straight-triangle") { + r2.drawEdgeTrianglePath(edge, context, rs2.allpts); + } else { + r2.drawEdgePath(edge, context, rs2.allpts, lineStyle); context.lineCap = "butt"; } }; @@ -317115,6 +318204,8 @@ g.stateGroup line { drawLine(effectiveGhostOpacity); drawArrows2(effectiveGhostOpacity); context.translate(-gx, -gy); + } else { + drawLineOutline(); } drawUnderlay(); drawLine(); @@ -317139,24 +318230,24 @@ g.stateGroup line { } var r2 = this; var usePaths = r2.usePaths(); - var rs = edge._private.rscratch; + var rs2 = edge._private.rscratch; var padding3 = edge.pstyle("".concat(overlayOrUnderlay, "-padding")).pfValue; var width3 = 2 * padding3; var color2 = edge.pstyle("".concat(overlayOrUnderlay, "-color")).value; context.lineWidth = width3; - if (rs.edgeType === "self" && !usePaths) { + if (rs2.edgeType === "self" && !usePaths) { context.lineCap = "butt"; } else { context.lineCap = "round"; } r2.colorStrokeStyle(context, color2[0], color2[1], color2[2], opacity); - r2.drawEdgePath(edge, context, rs.allpts, "solid"); + r2.drawEdgePath(edge, context, rs2.allpts, "solid"); }; }; CRp$8.drawEdgeOverlay = drawEdgeOverlayUnderlay("overlay"); CRp$8.drawEdgeUnderlay = drawEdgeOverlayUnderlay("underlay"); CRp$8.drawEdgePath = function(edge, context, pts2, type3) { - var rs = edge._private.rscratch; + var rs2 = edge._private.rscratch; var canvasCxt = context; var path3; var pathCacheHit = false; @@ -317165,14 +318256,14 @@ g.stateGroup line { var lineDashOffset = edge.pstyle("line-dash-offset").pfValue; if (usePaths) { var pathCacheKey = pts2.join("$"); - var keyMatches = rs.pathCacheKey && rs.pathCacheKey === pathCacheKey; + var keyMatches = rs2.pathCacheKey && rs2.pathCacheKey === pathCacheKey; if (keyMatches) { - path3 = context = rs.pathCache; + path3 = context = rs2.pathCache; pathCacheHit = true; } else { path3 = context = new Path2D(); - rs.pathCacheKey = pathCacheKey; - rs.pathCache = path3; + rs2.pathCacheKey = pathCacheKey; + rs2.pathCache = path3; } } if (canvasCxt.setLineDash) { @@ -317189,12 +318280,12 @@ g.stateGroup line { break; } } - if (!pathCacheHit && !rs.badLine) { + if (!pathCacheHit && !rs2.badLine) { if (context.beginPath) { context.beginPath(); } context.moveTo(pts2[0], pts2[1]); - switch (rs.edgeType) { + switch (rs2.edgeType) { case "bezier": case "self": case "compound": @@ -317210,8 +318301,8 @@ g.stateGroup line { } break; case "segments": - if (rs.isRound) { - var _iterator = _createForOfIteratorHelper(rs.roundCorners), _step; + if (rs2.isRound) { + var _iterator = _createForOfIteratorHelper(rs2.roundCorners), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done; ) { var corner = _step.value; @@ -317258,15 +318349,15 @@ g.stateGroup line { } }; CRp$8.drawArrowheads = function(context, edge, opacity) { - var rs = edge._private.rscratch; - var isHaystack = rs.edgeType === "haystack"; + var rs2 = edge._private.rscratch; + var isHaystack = rs2.edgeType === "haystack"; if (!isHaystack) { - this.drawArrowhead(context, edge, "source", rs.arrowStartX, rs.arrowStartY, rs.srcArrowAngle, opacity); + this.drawArrowhead(context, edge, "source", rs2.arrowStartX, rs2.arrowStartY, rs2.srcArrowAngle, opacity); } - this.drawArrowhead(context, edge, "mid-target", rs.midX, rs.midY, rs.midtgtArrowAngle, opacity); - this.drawArrowhead(context, edge, "mid-source", rs.midX, rs.midY, rs.midsrcArrowAngle, opacity); + this.drawArrowhead(context, edge, "mid-target", rs2.midX, rs2.midY, rs2.midtgtArrowAngle, opacity); + this.drawArrowhead(context, edge, "mid-source", rs2.midX, rs2.midY, rs2.midsrcArrowAngle, opacity); if (!isHaystack) { - this.drawArrowhead(context, edge, "target", rs.arrowEndX, rs.arrowEndY, rs.tgtArrowAngle, opacity); + this.drawArrowhead(context, edge, "target", rs2.arrowEndX, rs2.arrowEndY, rs2.tgtArrowAngle, opacity); } }; CRp$8.drawArrowhead = function(context, edge, prefix, x4, y4, angle2, opacity) { @@ -317395,7 +318486,7 @@ g.stateGroup line { var paddingX2 = node3.padding() * 2; var nodeTW = nodeW + (getIndexedStyle(node3, "background-width-relative-to", "value", index3) === "inner" ? 0 : paddingX2); var nodeTH = nodeH + (getIndexedStyle(node3, "background-height-relative-to", "value", index3) === "inner" ? 0 : paddingX2); - var rs = node3._private.rscratch; + var rs2 = node3._private.rscratch; var clip = getIndexedStyle(node3, "background-clip", "value", index3); var shouldClip = clip === "node"; var imgOpacity = getIndexedStyle(node3, "background-image-opacity", "value", index3) * nodeOpacity; @@ -317468,7 +318559,7 @@ g.stateGroup line { } else { y4 += offYPfVal; } - if (rs.pathCache) { + if (rs2.pathCache) { x4 -= nodeX; y4 -= nodeY; nodeX = 0; @@ -317488,10 +318579,10 @@ g.stateGroup line { if (repeat3 === "no-repeat") { if (shouldClip) { context.save(); - if (rs.pathCache) { - context.clip(rs.pathCache); + if (rs2.pathCache) { + context.clip(rs2.pathCache); } else { - r2.nodeShapes[r2.getNodeShape(node3)].draw(context, nodeX, nodeY, nodeTW, nodeTH, cornerRadius, rs); + r2.nodeShapes[r2.getNodeShape(node3)].draw(context, nodeX, nodeY, nodeTW, nodeTH, cornerRadius, rs2); context.clip(); } } @@ -317502,7 +318593,7 @@ g.stateGroup line { } else { var pattern = context.createPattern(img, repeat3); context.fillStyle = pattern; - r2.nodeShapes[r2.getNodeShape(node3)].draw(context, nodeX, nodeY, nodeTW, nodeTH, cornerRadius, rs); + r2.nodeShapes[r2.getNodeShape(node3)].draw(context, nodeX, nodeY, nodeTW, nodeTH, cornerRadius, rs2); context.translate(x4, y4); context.fill(); context.translate(-x4, -y4); @@ -317817,7 +318908,7 @@ g.stateGroup line { var r2 = this; var nodeWidth, nodeHeight; var _p = node3._private; - var rs = _p.rscratch; + var rs2 = _p.rscratch; var pos = node3.position(); if (!number$1(pos.x) || !number$1(pos.y)) { return; @@ -317893,10 +318984,10 @@ g.stateGroup line { if (cachedPath != null) { path4 = cachedPath; cacheHit = true; - rs.pathCache = path4; + rs2.pathCache = path4; } else { path4 = new Path2D(); - pathCache[key] = rs.pathCache = path4; + pathCache[key] = rs2.pathCache = path4; } return { path: path4, @@ -317920,7 +319011,7 @@ g.stateGroup line { y: 0 }; } - r2.nodeShapes[r2.getNodeShape(node3)].draw(path3 || context, npos.x, npos.y, nodeWidth, nodeHeight, cornerRadius, rs); + r2.nodeShapes[r2.getNodeShape(node3)].draw(path3 || context, npos.x, npos.y, nodeWidth, nodeHeight, cornerRadius, rs2); } if (usePaths) { context.fill(path3); @@ -317956,7 +319047,7 @@ g.stateGroup line { r2.drawPie(context, node3, pieOpacity); if (redrawShape) { if (!usePaths) { - r2.nodeShapes[r2.getNodeShape(node3)].draw(context, pos.x, pos.y, nodeWidth, nodeHeight, cornerRadius, rs); + r2.nodeShapes[r2.getNodeShape(node3)].draw(context, pos.x, pos.y, nodeWidth, nodeHeight, cornerRadius, rs2); } } } @@ -318301,8 +319392,9 @@ g.stateGroup line { if (this.forcedPixelRatio != null) { return this.forcedPixelRatio; } + var containerWindow = this.cy.window(); var backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1; - return (window.devicePixelRatio || 1) / backingStore; + return (containerWindow.devicePixelRatio || 1) / backingStore; }; CRp$4.paintCache = function(context) { var caches = this.paintCaches = this.paintCaches || []; @@ -319075,7 +320167,9 @@ g.stateGroup line { if ((typeof OffscreenCanvas === "undefined" ? "undefined" : _typeof2(OffscreenCanvas)) !== "undefined") { canvas = new OffscreenCanvas(width3, height2); } else { - canvas = document.createElement("canvas"); + var containerWindow = this.cy.window(); + var document5 = containerWindow.document; + canvas = document5.createElement("canvas"); canvas.width = width3; canvas.height = height2; } @@ -319188,7 +320282,7 @@ g.stateGroup line { } return style3; }; - version3 = "3.29.1"; + version3 = "3.30.2"; cytoscape2 = function cytoscape3(options4) { if (options4 === void 0) { options4 = {}; @@ -323921,9 +325015,9 @@ g.stateGroup line { } }); - // node_modules/mermaid/dist/mindmap-definition-307c710a.js - var mindmap_definition_307c710a_exports = {}; - __export(mindmap_definition_307c710a_exports, { + // node_modules/mermaid/dist/mindmap-definition-b08d3ac4.js + var mindmap_definition_b08d3ac4_exports = {}; + __export(mindmap_definition_b08d3ac4_exports, { diagram: () => diagram20 }); function insertPolygonShape3(parent4, w2, h3, points, node3) { @@ -324041,14 +325135,14 @@ g.stateGroup line { }); } var import_cytoscape_cose_bilkent, import_ts_dedent21, import_dayjs20, import_sanitize_url21, import_dompurify20, parser17, parser$113, nodes3, cnt, elements2, clear19, getParent, getMindmap, addNode, nodeType, getType, setElementForId, decorateNode, type2Str, getLogger, getElementById2, db14, db$1, MAX_SECTIONS2, defaultBkg2, rectBkg, cloudBkg, bangBkg, circleBkg, hexagonBkg, roundedRectBkg, drawNode2, positionNode2, draw20, renderer17, genSections3, getStyles14, styles11, diagram20; - var init_mindmap_definition_307c710a = __esm({ - "node_modules/mermaid/dist/mindmap-definition-307c710a.js"() { + var init_mindmap_definition_b08d3ac4 = __esm({ + "node_modules/mermaid/dist/mindmap-definition-b08d3ac4.js"() { init_polyfillShim(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); init_cytoscape_esm(); import_cytoscape_cose_bilkent = __toESM(require_cytoscape_cose_bilkent(), 1); init_src32(); - init_createText_ca0c5216(); + init_createText_4a4f35c9(); init_dist(); import_ts_dedent21 = __toESM(require_dist4(), 1); import_dayjs20 = __toESM(require_dayjs_min(), 1); @@ -328132,16 +329226,16 @@ g.stateGroup line { } }); - // node_modules/mermaid/dist/sankeyDiagram-707fac0f.js - var sankeyDiagram_707fac0f_exports = {}; - __export(sankeyDiagram_707fac0f_exports, { + // node_modules/mermaid/dist/sankeyDiagram-c599f8ec.js + var sankeyDiagram_c599f8ec_exports = {}; + __export(sankeyDiagram_c599f8ec_exports, { diagram: () => diagram21 }); var import_d3_sankey, import_ts_dedent22, import_dayjs21, import_sanitize_url22, import_dompurify21, parser18, parser$114, links2, nodes4, nodesMap, clear20, SankeyLink, addLink2, SankeyNode, findOrCreateNode, getNodes, getLinks2, getGraph, db15, _Uid, Uid, alignmentsMap, draw21, renderer18, prepareTextForParsing, originalParse, diagram21; - var init_sankeyDiagram_707fac0f = __esm({ - "node_modules/mermaid/dist/sankeyDiagram-707fac0f.js"() { + var init_sankeyDiagram_c599f8ec = __esm({ + "node_modules/mermaid/dist/sankeyDiagram-c599f8ec.js"() { init_polyfillShim(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); init_src32(); import_d3_sankey = __toESM(require_d3_sankey(), 1); import_ts_dedent22 = __toESM(require_dist4(), 1); @@ -328796,9 +329890,9 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; } }); - // node_modules/mermaid/dist/blockDiagram-9f4a6865.js - var blockDiagram_9f4a6865_exports = {}; - __export(blockDiagram_9f4a6865_exports, { + // node_modules/mermaid/dist/blockDiagram-a8a0820c.js + var blockDiagram_a8a0820c_exports = {}; + __export(blockDiagram_a8a0820c_exports, { diagram: () => diagram22 }); function typeStr2Type(typeStr) { @@ -329280,13 +330374,13 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return { x: minX, y: minY, width: width3, height: height2 }; } var import_ts_dedent23, import_dayjs22, import_sanitize_url23, import_dompurify22, _a, _b, parser19, parser$115, blockDatabase, edgeList, edgeCount3, COLOR_KEYWORD2, FILL_KEYWORD2, BG_FILL2, STYLECLASS_SEP2, config4, classes5, sanitizeText4, addStyleClass2, addStyle2Node, setCssClass3, populateBlockDatabase, blocks, rootBlock, clear21, cnt2, generateId3, setHierarchy, getColumns, getBlocksFlat, getBlocks, getEdges2, getBlock, setBlock, getLogger2, getClasses$1, db16, db$12, fade2, getStyles15, flowStyles2, padding2, getMaxChildSize, getClasses8, draw22, renderer19, diagram22; - var init_blockDiagram_9f4a6865 = __esm({ - "node_modules/mermaid/dist/blockDiagram-9f4a6865.js"() { + var init_blockDiagram_a8a0820c = __esm({ + "node_modules/mermaid/dist/blockDiagram-a8a0820c.js"() { init_polyfillShim(); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); init_clone2(); init_dist(); - init_edges_066a5561(); + init_edges_5962ec63(); init_graphlib(); init_src32(); import_ts_dedent23 = __toESM(require_dist4(), 1); @@ -330620,7 +331714,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; } }); - // node_modules/mermaid/dist/mermaid-6dc72991.js + // node_modules/mermaid/dist/mermaid-2490e8f2.js function setupDompurifyHooks() { const TEMPORARY_ATTRIBUTE = "data-temp-href-target"; import_dompurify23.default.addHook("beforeSanitizeAttributes", (node3) => { @@ -332532,8 +333626,8 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; addSVGa11yTitleDescription(svgNode2, a11yTitle, a11yDescr, svgNode2.attr("id")); } var import_ts_dedent24, import_dayjs23, import_sanitize_url24, import_dompurify23, LEVELS, log$1, setLogLevel$1, format2, lineBreakRegex, getRows, setupDompurifyHooksIfNotSetup, removeScript, sanitizeMore, sanitizeText$2, sanitizeTextOrArray, hasBreaks, splitBreaks, placeholderToBreak, breakToPlaceholder, getUrl, evaluate, getMax, getMin, parseGenericTypes, countOccurrence, shouldCombineSets, processSet, isMathMLSupported, katexRegex, hasKatex, calculateMathMLDimensions, renderKatex, common$1, mkBorder, oldAttributeBackgroundColorOdd, oldAttributeBackgroundColorEven, Theme$4, getThemeVariables$4, Theme$3, getThemeVariables$3, Theme$2, getThemeVariables$2, Theme$1, getThemeVariables$1, Theme5, getThemeVariables, theme, defaultConfigJson, config5, keyify, configKeys, defaultConfig$2, sanitizeDirective, sanitizeCss, frontMatterRegex, directiveRegex, anyCommentRegex, UnknownDiagramError, detectors, detectType, registerLazyLoadedDiagrams, addDetector, getDiagramLoader, assignWithDepth, assignWithDepth$1, ZERO_WIDTH_SPACE, d3CurveTypes, directiveWithoutOpen, detectInit, detectDirective, removeDirectives, isSubstringInArray, runFunc, roundNumber, calculatePoint, calcCardinalityPosition, cnt3, generateId2, random, getTextObj4, drawSimpleText, wrapLabel, breakString, calculateTextDimensions, InitIDGenerator, decoder, entityDecode, insertTitle, parseFontSize, utils2, encodeEntities, decodeEntities, version4, defaultConfig$1, siteConfig, configFromInitialize, directives, currentConfig, updateCurrentConfig, setSiteConfig, saveConfigFromInitialize, updateSiteConfig, getSiteConfig, setConfig$1, getConfig$1, sanitize, addDirective, reset2, ConfigWarning, issuedWarnings, issueWarning, checkConfig, id$l, detector$l, loader$m, plugin$j, c4, id$k, detector$k, loader$l, plugin$i, flowchart, id$j, detector$j, loader$k, plugin$h, flowchartV2, id$i, detector$i, loader$j, plugin$g, er, id$h, detector$h, loader$i, plugin$f, git, id$g, detector$g, loader$h, plugin$e, gantt, id$f, detector$f, loader$g, info2, id$e, detector$e, loader$f, pie, id$d, detector$d, loader$e, plugin$d, quadrantChart, id$c, detector$c, loader$d, plugin$c, xychart, id$b, detector$b, loader$c, plugin$b, requirement, id$a, detector$a, loader$b, plugin$a, sequence, id$9, detector$9, loader$a, plugin$9, classDiagram, id$8, detector$8, loader$9, plugin$8, classDiagramV2, id$7, detector$7, loader$8, plugin$7, state2, id$6, detector$6, loader$7, plugin$6, stateV2, id$5, detector$5, loader$6, plugin$5, journey, d3Attrs, calculateSvgSizeAttrs, configureSvgSize, setupGraphViewbox$1, themes, getStyles16, addStylesForDiagram, getStyles$1, accTitle, diagramTitle, accDescription, sanitizeText$1, clear2, setAccTitle, getAccTitle, setAccDescription, getAccDescription, setDiagramTitle, getDiagramTitle, commonDb, log, setLogLevel, getConfig, setConfig, defaultConfig, sanitizeText5, setupGraphViewbox, getCommonDb2, diagrams, registerDiagram, getDiagram, DiagramNotFoundError, selectSvgElement, draw23, renderer20, errorRenderer, diagram23, errorDiagram, id$4, detector$4, loader$5, plugin$4, flowchartElk, id$3, detector$3, loader$4, plugin$3, timeline, id$2, detector$2, loader$3, plugin$2, mindmap, id$1, detector$1, loader$2, plugin$1, sankey2, id3, detector, loader$1, plugin2, block, hasLoadedDiagrams, addDiagrams, Diagram, getDiagramFromText$1, interactionFunctions, attachFunctions, SVG_ROLE, cleanupComments, isNothing_1, isObject_12, toArray_1, repeat_1, isNegativeZero_1, extend_1, common, exception, snippet, TYPE_CONSTRUCTOR_OPTIONS, YAML_NODE_KINDS, type2, schema, str, seq2, map4, failsafe, _null, bool, int, YAML_FLOAT_PATTERN, SCIENTIFIC_WITHOUT_DOT, float, json2, core3, YAML_DATE_REGEXP, YAML_TIMESTAMP_REGEXP, timestamp, merge4, BASE64_MAP, binary, _hasOwnProperty$3, _toString$2, omap, _toString$1, pairs, _hasOwnProperty$2, set6, _default, _hasOwnProperty$1, CONTEXT_FLOW_IN, CONTEXT_FLOW_OUT, CONTEXT_BLOCK_IN, CONTEXT_BLOCK_OUT, CHOMPING_CLIP, CHOMPING_STRIP, CHOMPING_KEEP, PATTERN_NON_PRINTABLE, PATTERN_NON_ASCII_LINE_BREAKS, PATTERN_FLOW_INDICATORS, PATTERN_TAG_HANDLE, PATTERN_TAG_URI, simpleEscapeCheck, simpleEscapeMap, i2, directiveHandlers, loadAll_1, load_1, loader, JSON_SCHEMA, load, cleanupText, processFrontmatter, processDirectives, MAX_TEXTLENGTH, MAX_TEXTLENGTH_EXCEEDED_MSG, SECURITY_LVL_SANDBOX, SECURITY_LVL_LOOSE, XMLNS_SVG_STD, XMLNS_XLINK_STD, XMLNS_XHTML_STD, IFRAME_WIDTH, IFRAME_HEIGHT, IFRAME_STYLES, IFRAME_BODY_STYLE, IFRAME_SANDBOX_OPTS, IFRAME_NOT_SUPPORTED_MSG, DOMPURIFY_TAGS, DOMPURIFY_ATTR, cssImportantStyles, createCssStyles, createUserStyles, cleanUpSvgCode, putIntoIFrame, appendDivSvgG, removeExistingElements, render$1, getDiagramFromText, mermaidAPI, loadRegisteredDiagrams, handleError, run4, runThrowsErrors, initialize, init2, registerExternalDiagrams, contentLoaded, setParseErrorHandler, executionQueue, executionQueueRunning, executeQueue, parse8, render5, mermaid; - var init_mermaid_6dc72991 = __esm({ - "node_modules/mermaid/dist/mermaid-6dc72991.js"() { + var init_mermaid_2490e8f2 = __esm({ + "node_modules/mermaid/dist/mermaid-2490e8f2.js"() { init_polyfillShim(); import_ts_dedent24 = __toESM(require_dist4(), 1); import_dayjs23 = __toESM(require_dayjs_min(), 1); @@ -335405,7 +336499,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; decodeEntities = function(text4) { return text4.replace(/fl°°/g, "&#").replace(/fl°/g, "&").replace(/¶ß/g, ";"); }; - version4 = "10.9.1"; + version4 = "10.9.2"; defaultConfig$1 = Object.freeze(defaultConfig$2); siteConfig = assignWithDepth$1({}, defaultConfig$1); directives = []; @@ -335520,7 +336614,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(txt); }; loader$m = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_c4Diagram_ae766693(), c4Diagram_ae766693_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_c4Diagram_dc8f04df(), c4Diagram_dc8f04df_exports)); return { id: id$l, diagram: diagram24 }; }; plugin$j = { @@ -335538,7 +336632,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*graph/.test(txt); }; loader$l = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_flowDiagram_b222e15a(), flowDiagram_b222e15a_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_flowDiagram_622f9fc1(), flowDiagram_622f9fc1_exports)); return { id: id$k, diagram: diagram24 }; }; plugin$i = { @@ -335559,7 +336653,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*flowchart/.test(txt); }; loader$k = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_flowDiagram_v2_13329dc7(), flowDiagram_v2_13329dc7_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_flowDiagram_v2_a33b4996(), flowDiagram_v2_a33b4996_exports)); return { id: id$j, diagram: diagram24 }; }; plugin$h = { @@ -335573,7 +336667,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*erDiagram/.test(txt); }; loader$j = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_erDiagram_09d1c15f(), erDiagram_09d1c15f_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_erDiagram_51d2b61e(), erDiagram_51d2b61e_exports)); return { id: id$i, diagram: diagram24 }; }; plugin$g = { @@ -335587,7 +336681,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*gitGraph/.test(txt); }; loader$i = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_gitGraphDiagram_942e62fe(), gitGraphDiagram_942e62fe_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_gitGraphDiagram_23af1bdb(), gitGraphDiagram_23af1bdb_exports)); return { id: id$h, diagram: diagram24 }; }; plugin$f = { @@ -335601,7 +336695,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*gantt/.test(txt); }; loader$h = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_ganttDiagram_b62c793e(), ganttDiagram_b62c793e_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_ganttDiagram_a649f789(), ganttDiagram_a649f789_exports)); return { id: id$g, diagram: diagram24 }; }; plugin$e = { @@ -335615,7 +336709,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*info/.test(txt); }; loader$g = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_infoDiagram_94cd232f(), infoDiagram_94cd232f_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_infoDiagram_f86e0131(), infoDiagram_f86e0131_exports)); return { id: id$f, diagram: diagram24 }; }; info2 = { @@ -335628,7 +336722,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*pie/.test(txt); }; loader$f = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_pieDiagram_bb1d19e5(), pieDiagram_bb1d19e5_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_pieDiagram_31d824a1(), pieDiagram_31d824a1_exports)); return { id: id$e, diagram: diagram24 }; }; pie = { @@ -335641,7 +336735,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*quadrantChart/.test(txt); }; loader$e = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_quadrantDiagram_c759a472(), quadrantDiagram_c759a472_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_quadrantDiagram_a712a7d9(), quadrantDiagram_a712a7d9_exports)); return { id: id$d, diagram: diagram24 }; }; plugin$d = { @@ -335655,7 +336749,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*xychart-beta/.test(txt); }; loader$d = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_xychartDiagram_f11f50a6(), xychartDiagram_f11f50a6_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_xychartDiagram_4a8b8217(), xychartDiagram_4a8b8217_exports)); return { id: id$c, diagram: diagram24 }; }; plugin$c = { @@ -335669,7 +336763,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*requirement(Diagram)?/.test(txt); }; loader$c = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_requirementDiagram_87253d64(), requirementDiagram_87253d64_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_requirementDiagram_eb878fee(), requirementDiagram_eb878fee_exports)); return { id: id$b, diagram: diagram24 }; }; plugin$b = { @@ -335683,7 +336777,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*sequenceDiagram/.test(txt); }; loader$b = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_sequenceDiagram_6894f283(), sequenceDiagram_6894f283_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_sequenceDiagram_66748113(), sequenceDiagram_66748113_exports)); return { id: id$a, diagram: diagram24 }; }; plugin$a = { @@ -335701,7 +336795,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*classDiagram/.test(txt); }; loader$a = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_classDiagram_fb54d2a0(), classDiagram_fb54d2a0_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_classDiagram_8298e144(), classDiagram_8298e144_exports)); return { id: id$9, diagram: diagram24 }; }; plugin$9 = { @@ -335719,7 +336813,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*classDiagram-v2/.test(txt); }; loader$9 = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_classDiagram_v2_a2b738ad(), classDiagram_v2_a2b738ad_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_classDiagram_v2_296fb1cd(), classDiagram_v2_296fb1cd_exports)); return { id: id$8, diagram: diagram24 }; }; plugin$8 = { @@ -335737,7 +336831,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*stateDiagram/.test(txt); }; loader$8 = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_stateDiagram_5dee940d(), stateDiagram_5dee940d_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_stateDiagram_35d39939(), stateDiagram_35d39939_exports)); return { id: id$7, diagram: diagram24 }; }; plugin$7 = { @@ -335758,7 +336852,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return false; }; loader$7 = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_stateDiagram_v2_1992cada(), stateDiagram_v2_1992cada_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_stateDiagram_v2_6c43c13a(), stateDiagram_v2_6c43c13a_exports)); return { id: id$6, diagram: diagram24 }; }; plugin$6 = { @@ -335772,7 +336866,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*journey/.test(txt); }; loader$6 = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_journeyDiagram_6625b456(), journeyDiagram_6625b456_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_journeyDiagram_de0d04b7(), journeyDiagram_de0d04b7_exports)); return { id: id$5, diagram: diagram24 }; }; plugin$5 = { @@ -336027,7 +337121,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return false; }; loader$5 = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_flowchart_elk_definition_ae0efee6(), flowchart_elk_definition_ae0efee6_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_flowchart_elk_definition_930acc39(), flowchart_elk_definition_930acc39_exports)); return { id: id$4, diagram: diagram24 }; }; plugin$4 = { @@ -336041,7 +337135,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*timeline/.test(txt); }; loader$4 = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_timeline_definition_bf702344(), timeline_definition_bf702344_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_timeline_definition_6eaa3543(), timeline_definition_6eaa3543_exports)); return { id: id$3, diagram: diagram24 }; }; plugin$3 = { @@ -336055,7 +337149,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*mindmap/.test(txt); }; loader$3 = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_mindmap_definition_307c710a(), mindmap_definition_307c710a_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_mindmap_definition_b08d3ac4(), mindmap_definition_b08d3ac4_exports)); return { id: id$2, diagram: diagram24 }; }; plugin$2 = { @@ -336069,7 +337163,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*sankey-beta/.test(txt); }; loader$2 = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_sankeyDiagram_707fac0f(), sankeyDiagram_707fac0f_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_sankeyDiagram_c599f8ec(), sankeyDiagram_c599f8ec_exports)); return { id: id$1, diagram: diagram24 }; }; plugin$1 = { @@ -336083,7 +337177,7 @@ ${prefix}${Math.round(value * 100) / 100}${suffix}`; return /^\s*block-beta/.test(txt); }; loader$1 = async () => { - const { diagram: diagram24 } = await Promise.resolve().then(() => (init_blockDiagram_9f4a6865(), blockDiagram_9f4a6865_exports)); + const { diagram: diagram24 } = await Promise.resolve().then(() => (init_blockDiagram_a8a0820c(), blockDiagram_a8a0820c_exports)); return { id: id3, diagram: diagram24 }; }; plugin2 = { @@ -339164,7 +340258,6 @@ ${config22.themeCSS}`; const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty); const regExpTest = unapply(RegExp.prototype.test); const typeErrorCreate = unconstruct(TypeError); - const numberIsNaN = unapply(Number.isNaN); function unapply(func) { return function(thisArg) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { @@ -339252,8 +340345,8 @@ ${config22.themeCSS}`; const mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]); const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]); const text4 = freeze(["#text"]); - const html2 = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]); - const svg2 = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]); + const html2 = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]); + const svg2 = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]); const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]); const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]); const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); @@ -339332,7 +340425,7 @@ ${config22.themeCSS}`; function createDOMPurify() { let window3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal(); const DOMPurify2 = (root5) => createDOMPurify(root5); - DOMPurify2.version = "3.1.3"; + DOMPurify2.version = "3.1.7"; DOMPurify2.removed = []; if (!window3 || !window3.document || window3.document.nodeType !== NODE_TYPE.document) { DOMPurify2.isSupported = false; @@ -339356,6 +340449,7 @@ ${config22.themeCSS}`; } = window3; const ElementPrototype = Element4.prototype; const cloneNode = lookupGetter(ElementPrototype, "cloneNode"); + const remove3 = lookupGetter(ElementPrototype, "remove"); const getNextSibling = lookupGetter(ElementPrototype, "nextSibling"); const getChildNodes = lookupGetter(ElementPrototype, "childNodes"); const getParentNode = lookupGetter(ElementPrototype, "parentNode"); @@ -339453,7 +340547,6 @@ ${config22.themeCSS}`; const DEFAULT_PARSER_MEDIA_TYPE = "text/html"; let transformCaseFunc = null; let CONFIG = null; - const MAX_NESTING_DEPTH = 255; const formElement = document5.createElement("form"); const isRegexOrFunction = function isRegexOrFunction2(testValue) { return testValue instanceof RegExp || testValue instanceof Function; @@ -339603,7 +340696,7 @@ ${config22.themeCSS}`; CONFIG = cfg; }; const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]); - const HTML_INTEGRATION_POINTS = addToSet({}, ["foreignobject", "annotation-xml"]); + const HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]); const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]); const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]); const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]); @@ -339657,9 +340750,9 @@ ${config22.themeCSS}`; element: node3 }); try { - node3.parentNode.removeChild(node3); + getParentNode(node3).removeChild(node3); } catch (_) { - node3.remove(); + remove3(node3); } }; const _removeAttribute = function _removeAttribute2(name, node3) { @@ -339734,9 +340827,7 @@ ${config22.themeCSS}`; ); }; const _isClobbered = function _isClobbered2(elm) { - return elm instanceof HTMLFormElement && // eslint-disable-next-line unicorn/no-typeof-undefined - (typeof elm.__depth !== "undefined" && typeof elm.__depth !== "number" || // eslint-disable-next-line unicorn/no-typeof-undefined - typeof elm.__removalCount !== "undefined" && typeof elm.__removalCount !== "number" || typeof elm.nodeName !== "string" || typeof elm.textContent !== "string" || typeof elm.removeChild !== "function" || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== "function" || typeof elm.setAttribute !== "function" || typeof elm.namespaceURI !== "string" || typeof elm.insertBefore !== "function" || typeof elm.hasChildNodes !== "function"); + return elm instanceof HTMLFormElement && (typeof elm.nodeName !== "string" || typeof elm.textContent !== "string" || typeof elm.removeChild !== "function" || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== "function" || typeof elm.setAttribute !== "function" || typeof elm.namespaceURI !== "string" || typeof elm.insertBefore !== "function" || typeof elm.hasChildNodes !== "function"); }; const _isNode = function _isNode2(object3) { return typeof Node3 === "function" && object3 instanceof Node3; @@ -339821,7 +340912,7 @@ ${config22.themeCSS}`; return false; }; const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) { - if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document5 || value in formElement || value === "__depth" || value === "__removalCount")) { + if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document5 || value in formElement)) { return false; } if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ; @@ -339891,10 +340982,6 @@ ${config22.themeCSS}`; _removeAttribute(name, currentNode); continue; } - if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) { - _removeAttribute(name, currentNode); - continue; - } if (SAFE_FOR_TEMPLATES) { arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => { value = stringReplace(value, expr, " "); @@ -339908,6 +340995,10 @@ ${config22.themeCSS}`; _removeAttribute(name, currentNode); value = SANITIZE_NAMED_PROPS_PREFIX + value; } + if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) { + _removeAttribute(name, currentNode); + continue; + } if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") { if (namespaceURI) ; else { @@ -339948,19 +341039,7 @@ ${config22.themeCSS}`; if (_sanitizeElements(shadowNode)) { continue; } - const parentNode = getParentNode(shadowNode); - if (shadowNode.nodeType === NODE_TYPE.element) { - if (parentNode && parentNode.__depth) { - shadowNode.__depth = (shadowNode.__removalCount || 0) + parentNode.__depth + 1; - } else { - shadowNode.__depth = 1; - } - } - if (shadowNode.__depth >= MAX_NESTING_DEPTH || shadowNode.__depth < 0 || numberIsNaN(shadowNode.__depth)) { - _forceRemove(shadowNode); - } if (shadowNode.content instanceof DocumentFragment2) { - shadowNode.content.__depth = shadowNode.__depth; _sanitizeShadowDOM2(shadowNode.content); } _sanitizeAttributes(shadowNode); @@ -340032,19 +341111,7 @@ ${config22.themeCSS}`; if (_sanitizeElements(currentNode)) { continue; } - const parentNode = getParentNode(currentNode); - if (currentNode.nodeType === NODE_TYPE.element) { - if (parentNode && parentNode.__depth) { - currentNode.__depth = (currentNode.__removalCount || 0) + parentNode.__depth + 1; - } else { - currentNode.__depth = 1; - } - } - if (currentNode.__depth >= MAX_NESTING_DEPTH || currentNode.__depth < 0 || numberIsNaN(currentNode.__depth)) { - _forceRemove(currentNode); - } if (currentNode.content instanceof DocumentFragment2) { - currentNode.content.__depth = currentNode.__depth; _sanitizeShadowDOM(currentNode.content); } _sanitizeAttributes(currentNode); @@ -341272,209 +342339,6 @@ ${config22.themeCSS}`; } }); - // node_modules/@appland/client/dist/src/mapset.js - var require_mapset = __commonJS({ - "node_modules/@appland/client/dist/src/mapset.js"(exports2) { - "use strict"; - init_polyfillShim(); - var __importDefault = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - var reportJson_1 = __importDefault(require_reportJson()); - var get_12 = __importDefault(require_get2()); - var verbose_1 = __importDefault(require_verbose()); - var retry_1 = __importDefault(require_retry()); - var buildRequest_1 = __importDefault(require_buildRequest()); - var retryOnError_1 = __importDefault(require_retryOnError()); - var retryOn503_1 = __importDefault(require_retryOn503()); - var handleError_1 = __importDefault(require_handleError()); - var Mapset = class { - constructor(app, id4) { - this.app = app; - this.id = id4; - } - async listAppMaps() { - const requestPath = `api/mapsets?app=${this.app.fqname}&mapset=${this.id}`; - return (0, get_12.default)(requestPath).then((response) => (0, reportJson_1.default)(response)); - } - static async create(appId, appMapIds, options4, retryOptions = {}) { - if ((0, verbose_1.default)()) - console.log(`Creating mapset in app ${appId} with ${appMapIds.length} AppMaps`); - const payload = JSON.stringify(Object.assign({ app: appId, appmaps: appMapIds }, options4)); - async function makeRequest() { - const retrier = (0, retry_1.default)(`Create Mapset`, retryOptions, makeRequest); - const request = (0, buildRequest_1.default)("api/mapsets"); - return new Promise((resolve3, reject2) => { - const interaction = request.requestFunction(request.url, { - method: "POST", - headers: Object.assign({ "Content-Type": "application/json", "Content-Length": import_buffer.Buffer.byteLength(payload) }, request.headers) - }, resolve3); - interaction.on("error", (0, retryOnError_1.default)(retrier, resolve3, reject2)); - interaction.write(payload); - interaction.end(); - }).then((0, retryOn503_1.default)(retrier)); - } - return makeRequest().then(handleError_1.default).then((response) => (0, reportJson_1.default)(response)); - } - }; - exports2.default = Mapset; - } - }); - - // node_modules/@appland/client/dist/src/app.js - var require_app = __commonJS({ - "node_modules/@appland/client/dist/src/app.js"(exports2) { - "use strict"; - init_polyfillShim(); - var __importDefault = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - var mapset_1 = __importDefault(require_mapset()); - var reportJson_1 = __importDefault(require_reportJson()); - var get_12 = __importDefault(require_get2()); - var verbose_1 = __importDefault(require_verbose()); - var retry_1 = __importDefault(require_retry()); - var buildRequest_1 = __importDefault(require_buildRequest()); - var retryOnError_1 = __importDefault(require_retryOnError()); - var _1 = require_src(); - var default_1 = class { - constructor(fqname) { - this.fqname = fqname; - } - mapset(mapsetId) { - return new mapset_1.default(this, mapsetId); - } - async listFindingStatus() { - const requestPath = ["api", this.fqname, "finding_status"].join("/"); - return (0, get_12.default)(requestPath).then((response) => (0, reportJson_1.default)(response)); - } - async exists(retryOptions = {}) { - const commandDescription = `Checking if app ${this.fqname} exists`; - if ((0, verbose_1.default)()) - console.log(commandDescription); - const makeRequest = async () => { - const retrier = (0, retry_1.default)(commandDescription, retryOptions, makeRequest); - const requestPath = ["api", this.fqname].join("/"); - const request = (0, buildRequest_1.default)(requestPath); - return new Promise((resolve3, reject2) => { - const interaction = request.requestFunction(request.url, { - method: "HEAD", - headers: request.headers - }, resolve3); - interaction.on("error", (0, retryOnError_1.default)(retrier, resolve3, reject2)); - interaction.end(); - }).then((0, _1.retryOn503)(retrier)); - }; - return makeRequest().then((response) => { - if ((0, verbose_1.default)()) - console.log(`${commandDescription}: statusCode=${response.statusCode || ""}`); - if (!response.statusCode) { - throw new Error("No status code was provided by the server"); - } - if (response.statusCode === 404) { - return false; - } - if (response.statusCode < 300) { - return true; - } - throw new Error(`Unexpected status code: ${response.statusCode}`); - }); - } - }; - exports2.default = default_1; - } - }); - - // node_modules/form-data/lib/browser.js - var require_browser14 = __commonJS({ - "node_modules/form-data/lib/browser.js"(exports2, module2) { - init_polyfillShim(); - module2.exports = typeof self == "object" ? self.FormData : window.FormData; - } - }); - - // node_modules/@appland/client/dist/src/appMap.js - var require_appMap = __commonJS({ - "node_modules/@appland/client/dist/src/appMap.js"(exports2) { - "use strict"; - init_polyfillShim(); - var __importDefault = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - var form_data_1 = __importDefault(require_browser14()); - var assert_1 = __importDefault(require_assert()); - var reportJson_1 = __importDefault(require_reportJson()); - var get_12 = __importDefault(require_get2()); - var retry_1 = __importDefault(require_retry()); - var buildRequest_1 = __importDefault(require_buildRequest()); - var retryOnError_1 = __importDefault(require_retryOnError()); - var retryOn503_1 = __importDefault(require_retryOn503()); - var handleError_1 = __importDefault(require_handleError()); - var AppMap2 = class _AppMap { - constructor(uuid3) { - this.uuid = uuid3; - } - async get() { - const requestPath = ["api/appmaps", this.uuid].join("/"); - return (0, get_12.default)(requestPath).then((response) => (0, reportJson_1.default)(response)); - } - static async create(data4, options4, retryOptions = {}) { - const response = await _AppMap.performCreate({ path: "api/appmaps", requireApiKey: true }, data4, options4, retryOptions); - (0, assert_1.default)(response.completed, "AppMap.create.completed is undefined"); - return response.completed; - } - static async createUpload(data4, options4, retryOptions = {}) { - return _AppMap.performCreate({ path: "api/appmaps/create_upload", requireApiKey: false }, data4, options4, retryOptions); - } - static async performCreate(performOptions, data4, options4, retryOptions = {}) { - const makeRequest = async () => { - const retrier = (0, retry_1.default)(`Upload AppMap`, retryOptions, makeRequest); - const form = new form_data_1.default(); - form.append("data", data4.toString()); - if (options4.metadata) { - form.append("metadata", JSON.stringify(options4.metadata)); - } - if (options4.app) { - form.append("app", options4.app); - } - if (options4.public) { - form.append("link_sharing", "true"); - } - const request = (0, buildRequest_1.default)(performOptions.path, { - requireApiKey: performOptions.requireApiKey - }); - return new Promise((resolve3, reject2) => { - const interaction = request.requestFunction(request.url, { - method: "POST", - headers: Object.assign(Object.assign({}, request.headers), form.getHeaders()) - }, resolve3); - interaction.on("error", (0, retryOnError_1.default)(retrier, resolve3, reject2)); - form.pipe(interaction); - }).then((0, retryOn503_1.default)(retrier)); - }; - const handleUpload = async (response) => { - const appmap = await (0, reportJson_1.default)(response); - if (appmap.uuid) { - return { - completed: { uuid: appmap.uuid } - }; - } - (0, assert_1.default)(appmap.id, "Expecting appmap.id"); - (0, assert_1.default)(appmap.token, "Expecting appmap.token"); - return { - pending: { upload_id: appmap.id, token: appmap.token } - }; - }; - return makeRequest().then(handleError_1.default).then(handleUpload); - } - }; - exports2.default = AppMap2; - } - }); - // node_modules/@appland/client/dist/src/makeRequest.js var require_makeRequest = __commonJS({ "node_modules/@appland/client/dist/src/makeRequest.js"(exports2) { @@ -341625,13 +342489,19 @@ ${config22.themeCSS}`; static async update(dto) { if (!dto.events && !dto.appmaps) return; - await (0, makeRequest_1.default)({ + const serializeDto = Object.assign({}, dto); + if (serializeDto.metadata) + serializeDto.metadata = JSON.stringify(serializeDto.metadata); + const response = await (0, makeRequest_1.default)({ service: configuration_1.ServiceEndpoint.ServiceApi, path: this.usagePath, method: "POST", - body: JSON.stringify(dto), + body: JSON.stringify(serializeDto), retry: false }); + if (!response.ok) { + throw new Error(`Failed to update usage: ${response.body.toString("utf-8")}`); + } } }; exports2.default = Usage; @@ -341647,261 +342517,176 @@ ${config22.themeCSS}`; typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, global2.io = factory()); })(exports2, function() { "use strict"; - function _typeof3(obj) { - "@babel/helpers - typeof"; - return _typeof3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { - return typeof obj2; - } : function(obj2) { - return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }, _typeof3(obj); + function _arrayLikeToArray2(r2, a3) { + (null == a3 || a3 > r2.length) && (a3 = r2.length); + for (var e3 = 0, n2 = Array(a3); e3 < a3; e3++) n2[e3] = r2[e3]; + return n2; } - function _classCallCheck2(instance2, Constructor) { - if (!(instance2 instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - function _defineProperties2(target2, props) { - for (var i3 = 0; i3 < props.length; i3++) { - var descriptor = props[i3]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target2, _toPropertyKey(descriptor.key), descriptor); - } - } - function _createClass2(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties2(Constructor.prototype, protoProps); - if (staticProps) _defineProperties2(Constructor, staticProps); - Object.defineProperty(Constructor, "prototype", { - writable: false - }); - return Constructor; + function _arrayWithoutHoles(r2) { + if (Array.isArray(r2)) return _arrayLikeToArray2(r2); } - function _extends() { - _extends = Object.assign ? Object.assign.bind() : function(target2) { - for (var i3 = 1; i3 < arguments.length; i3++) { - var source = arguments[i3]; - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target2[key] = source[key]; - } - } - } - return target2; - }; - return _extends.apply(this, arguments); + function _construct(t4, e3, r2) { + if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); + var o2 = [null]; + o2.push.apply(o2, e3); + var p3 = new (t4.bind.apply(t4, o2))(); + return r2 && _setPrototypeOf(p3, r2.prototype), p3; } - function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); + function _defineProperties2(e3, r2) { + for (var t4 = 0; t4 < r2.length; t4++) { + var o2 = r2[t4]; + o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e3, _toPropertyKey(o2.key), o2); } - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - Object.defineProperty(subClass, "prototype", { - writable: false - }); - if (superClass) _setPrototypeOf(subClass, superClass); - } - function _getPrototypeOf(o2) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o3) { - return o3.__proto__ || Object.getPrototypeOf(o3); - }; - return _getPrototypeOf(o2); } - function _setPrototypeOf(o2, p3) { - _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p4) { - o3.__proto__ = p4; - return o3; - }; - return _setPrototypeOf(o2, p3); - } - function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { - })); - return true; - } catch (e3) { - return false; - } - } - function _construct(Parent, args, Class) { - if (_isNativeReflectConstruct()) { - _construct = Reflect.construct.bind(); - } else { - _construct = function _construct2(Parent2, args2, Class2) { - var a3 = [null]; - a3.push.apply(a3, args2); - var Constructor = Function.bind.apply(Parent2, a3); - var instance2 = new Constructor(); - if (Class2) _setPrototypeOf(instance2, Class2.prototype); - return instance2; - }; - } - return _construct.apply(null, arguments); - } - function _isNativeFunction(fn4) { - return Function.toString.call(fn4).indexOf("[native code]") !== -1; - } - function _wrapNativeSuper(Class) { - var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0; - _wrapNativeSuper = function _wrapNativeSuper2(Class2) { - if (Class2 === null || !_isNativeFunction(Class2)) return Class2; - if (typeof Class2 !== "function") { - throw new TypeError("Super expression must either be null or a function"); - } - if (typeof _cache !== "undefined") { - if (_cache.has(Class2)) return _cache.get(Class2); - _cache.set(Class2, Wrapper); - } - function Wrapper() { - return _construct(Class2, arguments, _getPrototypeOf(this).constructor); - } - Wrapper.prototype = Object.create(Class2.prototype, { - constructor: { - value: Wrapper, - enumerable: false, - writable: true, - configurable: true - } - }); - return _setPrototypeOf(Wrapper, Class2); - }; - return _wrapNativeSuper(Class); - } - function _assertThisInitialized(self2) { - if (self2 === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - return self2; - } - function _possibleConstructorReturn(self2, call) { - if (call && (typeof call === "object" || typeof call === "function")) { - return call; - } else if (call !== void 0) { - throw new TypeError("Derived constructors may only return object or undefined"); - } - return _assertThisInitialized(self2); - } - function _createSuper(Derived) { - var hasNativeReflectConstruct = _isNativeReflectConstruct(); - return function _createSuperInternal() { - var Super = _getPrototypeOf(Derived), result; - if (hasNativeReflectConstruct) { - var NewTarget = _getPrototypeOf(this).constructor; - result = Reflect.construct(Super, arguments, NewTarget); - } else { - result = Super.apply(this, arguments); - } - return _possibleConstructorReturn(this, result); - }; - } - function _superPropBase(object3, property2) { - while (!Object.prototype.hasOwnProperty.call(object3, property2)) { - object3 = _getPrototypeOf(object3); - if (object3 === null) break; - } - return object3; + function _createClass2(e3, r2, t4) { + return r2 && _defineProperties2(e3.prototype, r2), t4 && _defineProperties2(e3, t4), Object.defineProperty(e3, "prototype", { + writable: false + }), e3; } - function _get() { - if (typeof Reflect !== "undefined" && Reflect.get) { - _get = Reflect.get.bind(); - } else { - _get = function _get2(target2, property2, receiver) { - var base = _superPropBase(target2, property2); - if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property2); - if (desc.get) { - return desc.get.call(arguments.length < 3 ? target2 : receiver); - } - return desc.value; - }; - } - return _get.apply(this, arguments); - } - function _unsupportedIterableToArray2(o2, minLen) { - if (!o2) return; - if (typeof o2 === "string") return _arrayLikeToArray2(o2, minLen); - var n2 = Object.prototype.toString.call(o2).slice(8, -1); - if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; - if (n2 === "Map" || n2 === "Set") return Array.from(o2); - if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray2(o2, minLen); - } - function _arrayLikeToArray2(arr, len) { - if (len == null || len > arr.length) len = arr.length; - for (var i3 = 0, arr2 = new Array(len); i3 < len; i3++) arr2[i3] = arr[i3]; - return arr2; - } - function _createForOfIteratorHelper2(o2, allowArrayLike) { - var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"]; - if (!it2) { - if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray2(o2)) || allowArrayLike && o2 && typeof o2.length === "number") { - if (it2) o2 = it2; - var i3 = 0; - var F2 = function() { + function _createForOfIteratorHelper2(r2, e3) { + var t4 = "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; + if (!t4) { + if (Array.isArray(r2) || (t4 = _unsupportedIterableToArray2(r2)) || e3 && r2 && "number" == typeof r2.length) { + t4 && (r2 = t4); + var n2 = 0, F2 = function() { }; return { s: F2, n: function() { - if (i3 >= o2.length) return { + return n2 >= r2.length ? { done: true - }; - return { + } : { done: false, - value: o2[i3++] + value: r2[n2++] }; }, - e: function(e3) { - throw e3; + e: function(r3) { + throw r3; }, f: F2 }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - var normalCompletion = true, didErr = false, err2; + var o2, a3 = true, u2 = false; return { s: function() { - it2 = it2.call(o2); + t4 = t4.call(r2); }, n: function() { - var step3 = it2.next(); - normalCompletion = step3.done; - return step3; + var r3 = t4.next(); + return a3 = r3.done, r3; }, - e: function(e3) { - didErr = true; - err2 = e3; + e: function(r3) { + u2 = true, o2 = r3; }, f: function() { try { - if (!normalCompletion && it2.return != null) it2.return(); + a3 || null == t4.return || t4.return(); } finally { - if (didErr) throw err2; + if (u2) throw o2; } } }; } - function _toPrimitive(input2, hint) { - if (typeof input2 !== "object" || input2 === null) return input2; - var prim2 = input2[Symbol.toPrimitive]; - if (prim2 !== void 0) { - var res = prim2.call(input2, hint || "default"); - if (typeof res !== "object") return res; + function _extends() { + return _extends = Object.assign ? Object.assign.bind() : function(n2) { + for (var e3 = 1; e3 < arguments.length; e3++) { + var t4 = arguments[e3]; + for (var r2 in t4) ({}).hasOwnProperty.call(t4, r2) && (n2[r2] = t4[r2]); + } + return n2; + }, _extends.apply(null, arguments); + } + function _getPrototypeOf(t4) { + return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t5) { + return t5.__proto__ || Object.getPrototypeOf(t5); + }, _getPrototypeOf(t4); + } + function _inheritsLoose(t4, o2) { + t4.prototype = Object.create(o2.prototype), t4.prototype.constructor = t4, _setPrototypeOf(t4, o2); + } + function _isNativeFunction(t4) { + try { + return -1 !== Function.toString.call(t4).indexOf("[native code]"); + } catch (n2) { + return "function" == typeof t4; + } + } + function _isNativeReflectConstruct() { + try { + var t4 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { + })); + } catch (t5) { + } + return (_isNativeReflectConstruct = function() { + return !!t4; + })(); + } + function _iterableToArray(r2) { + if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); + } + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _setPrototypeOf(t4, e3) { + return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t5, e4) { + return t5.__proto__ = e4, t5; + }, _setPrototypeOf(t4, e3); + } + function _toConsumableArray(r2) { + return _arrayWithoutHoles(r2) || _iterableToArray(r2) || _unsupportedIterableToArray2(r2) || _nonIterableSpread(); + } + function _toPrimitive(t4, r2) { + if ("object" != typeof t4 || !t4) return t4; + var e3 = t4[Symbol.toPrimitive]; + if (void 0 !== e3) { + var i3 = e3.call(t4, r2 || "default"); + if ("object" != typeof i3) return i3; throw new TypeError("@@toPrimitive must return a primitive value."); } - return (hint === "string" ? String : Number)(input2); + return ("string" === r2 ? String : Number)(t4); } - function _toPropertyKey(arg) { - var key = _toPrimitive(arg, "string"); - return typeof key === "symbol" ? key : String(key); + function _toPropertyKey(t4) { + var i3 = _toPrimitive(t4, "string"); + return "symbol" == typeof i3 ? i3 : i3 + ""; + } + function _typeof3(o2) { + "@babel/helpers - typeof"; + return _typeof3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof3(o2); + } + function _unsupportedIterableToArray2(r2, a3) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray2(r2, a3); + var t4 = {}.toString.call(r2).slice(8, -1); + return "Object" === t4 && r2.constructor && (t4 = r2.constructor.name), "Map" === t4 || "Set" === t4 ? Array.from(r2) : "Arguments" === t4 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t4) ? _arrayLikeToArray2(r2, a3) : void 0; + } + } + function _wrapNativeSuper(t4) { + var r2 = "function" == typeof Map ? /* @__PURE__ */ new Map() : void 0; + return _wrapNativeSuper = function(t5) { + if (null === t5 || !_isNativeFunction(t5)) return t5; + if ("function" != typeof t5) throw new TypeError("Super expression must either be null or a function"); + if (void 0 !== r2) { + if (r2.has(t5)) return r2.get(t5); + r2.set(t5, Wrapper); + } + function Wrapper() { + return _construct(t5, arguments, _getPrototypeOf(this).constructor); + } + return Wrapper.prototype = Object.create(t5.prototype, { + constructor: { + value: Wrapper, + enumerable: false, + writable: true, + configurable: true + } + }), _setPrototypeOf(Wrapper, t5); + }, _wrapNativeSuper(t4); } var PACKET_TYPES = /* @__PURE__ */ Object.create(null); PACKET_TYPES["open"] = "0"; @@ -341974,8 +342759,8 @@ ${config22.themeCSS}`; } var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var lookup$1 = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256); - for (var i$1 = 0; i$1 < chars.length; i$1++) { - lookup$1[chars.charCodeAt(i$1)] = i$1; + for (var i2 = 0; i2 < chars.length; i2++) { + lookup$1[chars.charCodeAt(i2)] = i2; } var decode$1 = function decode3(base64) { var bufferLength = base64.length * 0.75, len = base64.length, i3, p3 = 0, encoded1, encoded2, encoded3, encoded4; @@ -342053,13 +342838,13 @@ ${config22.themeCSS}`; }; var SEPARATOR = String.fromCharCode(30); var encodePayload = function encodePayload2(packets, callback) { - var length3 = packets.length; - var encodedPackets = new Array(length3); + var length2 = packets.length; + var encodedPackets = new Array(length2); var count = 0; packets.forEach(function(packet, i3) { encodePacket(packet, false, function(encodedPacket) { encodedPackets[i3] = encodedPacket; - if (++count === length3) { + if (++count === length2) { callback(encodedPackets.join(SEPARATOR)); } }); @@ -342263,6 +343048,18 @@ ${config22.themeCSS}`; Emitter2.prototype.hasListeners = function(event3) { return !!this.listeners(event3).length; }; + var nextTick2 = function() { + var isPromiseAvailable = typeof Promise === "function" && typeof Promise.resolve === "function"; + if (isPromiseAvailable) { + return function(cb) { + return Promise.resolve().then(cb); + }; + } else { + return function(cb, setTimeoutFn) { + return setTimeoutFn(cb, 0); + }; + } + }(); var globalThisShim = function() { if (typeof self !== "undefined") { return self; @@ -342272,6 +343069,9 @@ ${config22.themeCSS}`; return Function("return this")(); } }(); + var defaultBinaryType = "arraybuffer"; + function createCookieJar() { + } function pick2(obj) { for (var _len = arguments.length, attr = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { attr[_key - 1] = arguments[_key]; @@ -342302,23 +343102,26 @@ ${config22.themeCSS}`; return Math.ceil((obj.byteLength || obj.size) * BASE64_OVERHEAD); } function utf8Length(str2) { - var c5 = 0, length3 = 0; + var c5 = 0, length2 = 0; for (var i3 = 0, l2 = str2.length; i3 < l2; i3++) { c5 = str2.charCodeAt(i3); if (c5 < 128) { - length3 += 1; + length2 += 1; } else if (c5 < 2048) { - length3 += 2; + length2 += 2; } else if (c5 < 55296 || c5 >= 57344) { - length3 += 3; + length2 += 3; } else { i3++; - length3 += 4; + length2 += 4; } } - return length3; + return length2; + } + function randomString() { + return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5); } - function encode$1(obj) { + function encode(obj) { var str2 = ""; for (var i3 in obj) { if (obj.hasOwnProperty(i3)) { @@ -342338,212 +343141,209 @@ ${config22.themeCSS}`; return qry; } var TransportError = /* @__PURE__ */ function(_Error) { - _inherits(TransportError2, _Error); - var _super = _createSuper(TransportError2); function TransportError2(reason, description, context) { var _this; - _classCallCheck2(this, TransportError2); - _this = _super.call(this, reason); + _this = _Error.call(this, reason) || this; _this.description = description; _this.context = context; _this.type = "TransportError"; return _this; } - return _createClass2(TransportError2); + _inheritsLoose(TransportError2, _Error); + return TransportError2; }(/* @__PURE__ */ _wrapNativeSuper(Error)); var Transport = /* @__PURE__ */ function(_Emitter) { - _inherits(Transport2, _Emitter); - var _super2 = _createSuper(Transport2); function Transport2(opts) { var _this2; - _classCallCheck2(this, Transport2); - _this2 = _super2.call(this); + _this2 = _Emitter.call(this) || this; _this2.writable = false; - installTimerFunctions(_assertThisInitialized(_this2), opts); + installTimerFunctions(_this2, opts); _this2.opts = opts; _this2.query = opts.query; _this2.socket = opts.socket; + _this2.supportsBinary = !opts.forceBase64; return _this2; } - _createClass2(Transport2, [{ - key: "onError", - value: function onError(reason, description, context) { - _get(_getPrototypeOf(Transport2.prototype), "emitReserved", this).call(this, "error", new TransportError(reason, description, context)); - return this; + _inheritsLoose(Transport2, _Emitter); + var _proto = Transport2.prototype; + _proto.onError = function onError(reason, description, context) { + _Emitter.prototype.emitReserved.call(this, "error", new TransportError(reason, description, context)); + return this; + }; + _proto.open = function open2() { + this.readyState = "opening"; + this.doOpen(); + return this; + }; + _proto.close = function close2() { + if (this.readyState === "opening" || this.readyState === "open") { + this.doClose(); + this.onClose(); } - /** - * Opens the transport. - */ - }, { - key: "open", - value: function open2() { - this.readyState = "opening"; - this.doOpen(); - return this; + return this; + }; + _proto.send = function send(packets) { + if (this.readyState === "open") { + this.write(packets); } - /** - * Closes the transport. - */ - }, { - key: "close", - value: function close2() { - if (this.readyState === "opening" || this.readyState === "open") { - this.doClose(); - this.onClose(); - } - return this; + }; + _proto.onOpen = function onOpen() { + this.readyState = "open"; + this.writable = true; + _Emitter.prototype.emitReserved.call(this, "open"); + }; + _proto.onData = function onData(data4) { + var packet = decodePacket(data4, this.socket.binaryType); + this.onPacket(packet); + }; + _proto.onPacket = function onPacket(packet) { + _Emitter.prototype.emitReserved.call(this, "packet", packet); + }; + _proto.onClose = function onClose(details) { + this.readyState = "closed"; + _Emitter.prototype.emitReserved.call(this, "close", details); + }; + _proto.pause = function pause2(onPause) { + }; + _proto.createUri = function createUri(schema2) { + var query = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + return schema2 + "://" + this._hostname() + this._port() + this.opts.path + this._query(query); + }; + _proto._hostname = function _hostname() { + var hostname = this.opts.hostname; + return hostname.indexOf(":") === -1 ? hostname : "[" + hostname + "]"; + }; + _proto._port = function _port() { + if (this.opts.port && (this.opts.secure && Number(this.opts.port !== 443) || !this.opts.secure && Number(this.opts.port) !== 80)) { + return ":" + this.opts.port; + } else { + return ""; } - /** - * Sends multiple packets. - * - * @param {Array} packets - */ - }, { - key: "send", - value: function send(packets) { - if (this.readyState === "open") { - this.write(packets); + }; + _proto._query = function _query(query) { + var encodedQuery = encode(query); + return encodedQuery.length ? "?" + encodedQuery : ""; + }; + return Transport2; + }(Emitter2); + var Polling = /* @__PURE__ */ function(_Transport) { + function Polling2() { + var _this; + _this = _Transport.apply(this, arguments) || this; + _this._polling = false; + return _this; + } + _inheritsLoose(Polling2, _Transport); + var _proto = Polling2.prototype; + _proto.doOpen = function doOpen() { + this._poll(); + }; + _proto.pause = function pause2(onPause) { + var _this2 = this; + this.readyState = "pausing"; + var pause3 = function pause4() { + _this2.readyState = "paused"; + onPause(); + }; + if (this._polling || !this.writable) { + var total = 0; + if (this._polling) { + total++; + this.once("pollComplete", function() { + --total || pause3(); + }); } + if (!this.writable) { + total++; + this.once("drain", function() { + --total || pause3(); + }); + } + } else { + pause3(); } - /** - * Called upon open - * - * @protected - */ - }, { - key: "onOpen", - value: function onOpen() { - this.readyState = "open"; - this.writable = true; - _get(_getPrototypeOf(Transport2.prototype), "emitReserved", this).call(this, "open"); - } - /** - * Called with data. - * - * @param {String} data - * @protected - */ - }, { - key: "onData", - value: function onData(data4) { - var packet = decodePacket(data4, this.socket.binaryType); - this.onPacket(packet); - } - /** - * Called with a decoded packet. - * - * @protected - */ - }, { - key: "onPacket", - value: function onPacket(packet) { - _get(_getPrototypeOf(Transport2.prototype), "emitReserved", this).call(this, "packet", packet); - } - /** - * Called upon close. - * - * @protected - */ - }, { - key: "onClose", - value: function onClose(details) { - this.readyState = "closed"; - _get(_getPrototypeOf(Transport2.prototype), "emitReserved", this).call(this, "close", details); - } - /** - * Pauses the transport, in order not to lose packets during an upgrade. - * - * @param onPause - */ - }, { - key: "pause", - value: function pause2(onPause) { + }; + _proto._poll = function _poll() { + this._polling = true; + this.doPoll(); + this.emitReserved("poll"); + }; + _proto.onData = function onData(data4) { + var _this3 = this; + var callback = function callback2(packet) { + if ("opening" === _this3.readyState && packet.type === "open") { + _this3.onOpen(); + } + if ("close" === packet.type) { + _this3.onClose({ + description: "transport closed by the server" + }); + return false; + } + _this3.onPacket(packet); + }; + decodePayload(data4, this.socket.binaryType).forEach(callback); + if ("closed" !== this.readyState) { + this._polling = false; + this.emitReserved("pollComplete"); + if ("open" === this.readyState) { + this._poll(); + } } - }, { - key: "createUri", - value: function createUri(schema2) { - var query = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - return schema2 + "://" + this._hostname() + this._port() + this.opts.path + this._query(query); + }; + _proto.doClose = function doClose() { + var _this4 = this; + var close2 = function close3() { + _this4.write([{ + type: "close" + }]); + }; + if ("open" === this.readyState) { + close2(); + } else { + this.once("open", close2); } - }, { - key: "_hostname", - value: function _hostname() { - var hostname = this.opts.hostname; - return hostname.indexOf(":") === -1 ? hostname : "[" + hostname + "]"; + }; + _proto.write = function write2(packets) { + var _this5 = this; + this.writable = false; + encodePayload(packets, function(data4) { + _this5.doWrite(data4, function() { + _this5.writable = true; + _this5.emitReserved("drain"); + }); + }); + }; + _proto.uri = function uri() { + var schema2 = this.opts.secure ? "https" : "http"; + var query = this.query || {}; + if (false !== this.opts.timestampRequests) { + query[this.opts.timestampParam] = randomString(); } - }, { - key: "_port", - value: function _port() { - if (this.opts.port && (this.opts.secure && Number(this.opts.port !== 443) || !this.opts.secure && Number(this.opts.port) !== 80)) { - return ":" + this.opts.port; - } else { - return ""; - } + if (!this.supportsBinary && !query.sid) { + query.b64 = 1; } - }, { - key: "_query", - value: function _query(query) { - var encodedQuery = encode$1(query); - return encodedQuery.length ? "?" + encodedQuery : ""; + return this.createUri(schema2, query); + }; + return _createClass2(Polling2, [{ + key: "name", + get: function get7() { + return "polling"; } }]); - return Transport2; - }(Emitter2); - var alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""), length2 = 64, map5 = {}; - var seed = 0, i2 = 0, prev2; - function encode(num) { - var encoded = ""; - do { - encoded = alphabet[num % length2] + encoded; - num = Math.floor(num / length2); - } while (num > 0); - return encoded; - } - function yeast() { - var now4 = encode(+/* @__PURE__ */ new Date()); - if (now4 !== prev2) return seed = 0, prev2 = now4; - return now4 + "." + encode(seed++); - } - for (; i2 < length2; i2++) map5[alphabet[i2]] = i2; + }(Transport); var value = false; try { value = typeof XMLHttpRequest !== "undefined" && "withCredentials" in new XMLHttpRequest(); } catch (err2) { } var hasCORS = value; - function XHR(opts) { - var xdomain = opts.xdomain; - try { - if ("undefined" !== typeof XMLHttpRequest && (!xdomain || hasCORS)) { - return new XMLHttpRequest(); - } - } catch (e3) { - } - if (!xdomain) { - try { - return new globalThisShim[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP"); - } catch (e3) { - } - } - } - function createCookieJar() { - } function empty3() { } - var hasXHR2 = function() { - var xhr = new XHR({ - xdomain: false - }); - return null != xhr.responseType; - }(); - var Polling = /* @__PURE__ */ function(_Transport) { - _inherits(Polling2, _Transport); - var _super = _createSuper(Polling2); - function Polling2(opts) { + var BaseXHR = /* @__PURE__ */ function(_Polling) { + function BaseXHR2(opts) { var _this; - _classCallCheck2(this, Polling2); - _this = _super.call(this, opts); - _this.polling = false; + _this = _Polling.call(this, opts) || this; if (typeof location !== "undefined") { var isSSL = "https:" === location.protocol; var port = location.port; @@ -342552,354 +343352,143 @@ ${config22.themeCSS}`; } _this.xd = typeof location !== "undefined" && opts.hostname !== location.hostname || port !== opts.port; } - var forceBase64 = opts && opts.forceBase64; - _this.supportsBinary = hasXHR2 && !forceBase64; - if (_this.opts.withCredentials) { - _this.cookieJar = createCookieJar(); - } return _this; } - _createClass2(Polling2, [{ - key: "name", - get: function get7() { - return "polling"; - } - /** - * Opens the socket (triggers polling). We write a PING message to determine - * when the transport is open. - * - * @protected - */ - }, { - key: "doOpen", - value: function doOpen() { - this.poll(); - } - /** - * Pauses polling. - * - * @param {Function} onPause - callback upon buffers are flushed and transport is paused - * @package - */ - }, { - key: "pause", - value: function pause2(onPause) { - var _this2 = this; - this.readyState = "pausing"; - var pause3 = function pause4() { - _this2.readyState = "paused"; - onPause(); - }; - if (this.polling || !this.writable) { - var total = 0; - if (this.polling) { - total++; - this.once("pollComplete", function() { - --total || pause3(); - }); - } - if (!this.writable) { - total++; - this.once("drain", function() { - --total || pause3(); - }); - } - } else { - pause3(); - } - } - /** - * Starts polling cycle. - * - * @private - */ - }, { - key: "poll", - value: function poll() { - this.polling = true; - this.doPoll(); - this.emitReserved("poll"); - } - /** - * Overloads onData to detect payloads. - * - * @protected - */ - }, { - key: "onData", - value: function onData(data4) { - var _this3 = this; - var callback = function callback2(packet) { - if ("opening" === _this3.readyState && packet.type === "open") { - _this3.onOpen(); - } - if ("close" === packet.type) { - _this3.onClose({ - description: "transport closed by the server" - }); - return false; - } - _this3.onPacket(packet); - }; - decodePayload(data4, this.socket.binaryType).forEach(callback); - if ("closed" !== this.readyState) { - this.polling = false; - this.emitReserved("pollComplete"); - if ("open" === this.readyState) { - this.poll(); - } - } - } - /** - * For polling, send a close packet. - * - * @protected - */ - }, { - key: "doClose", - value: function doClose() { - var _this4 = this; - var close2 = function close3() { - _this4.write([{ - type: "close" - }]); - }; - if ("open" === this.readyState) { - close2(); - } else { - this.once("open", close2); - } - } - /** - * Writes a packets payload. - * - * @param {Array} packets - data packets - * @protected - */ - }, { - key: "write", - value: function write2(packets) { - var _this5 = this; - this.writable = false; - encodePayload(packets, function(data4) { - _this5.doWrite(data4, function() { - _this5.writable = true; - _this5.emitReserved("drain"); - }); - }); - } - /** - * Generates uri for connection. - * - * @private - */ - }, { - key: "uri", - value: function uri() { - var schema2 = this.opts.secure ? "https" : "http"; - var query = this.query || {}; - if (false !== this.opts.timestampRequests) { - query[this.opts.timestampParam] = yeast(); - } - if (!this.supportsBinary && !query.sid) { - query.b64 = 1; - } - return this.createUri(schema2, query); - } - /** - * Creates a request. - * - * @param {String} method - * @private - */ - }, { - key: "request", - value: function request() { - var opts = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; - _extends(opts, { - xd: this.xd, - cookieJar: this.cookieJar - }, this.opts); - return new Request(this.uri(), opts); - } - /** - * Sends data. - * - * @param {String} data to send. - * @param {Function} called upon flush. - * @private - */ - }, { - key: "doWrite", - value: function doWrite(data4, fn4) { - var _this6 = this; - var req = this.request({ - method: "POST", - data: data4 - }); - req.on("success", fn4); - req.on("error", function(xhrStatus, context) { - _this6.onError("xhr post error", xhrStatus, context); - }); - } - /** - * Starts a poll cycle. - * - * @private - */ - }, { - key: "doPoll", - value: function doPoll() { - var _this7 = this; - var req = this.request(); - req.on("data", this.onData.bind(this)); - req.on("error", function(xhrStatus, context) { - _this7.onError("xhr poll error", xhrStatus, context); - }); - this.pollXhr = req; - } - }]); - return Polling2; - }(Transport); + _inheritsLoose(BaseXHR2, _Polling); + var _proto = BaseXHR2.prototype; + _proto.doWrite = function doWrite(data4, fn4) { + var _this2 = this; + var req = this.request({ + method: "POST", + data: data4 + }); + req.on("success", fn4); + req.on("error", function(xhrStatus, context) { + _this2.onError("xhr post error", xhrStatus, context); + }); + }; + _proto.doPoll = function doPoll() { + var _this3 = this; + var req = this.request(); + req.on("data", this.onData.bind(this)); + req.on("error", function(xhrStatus, context) { + _this3.onError("xhr poll error", xhrStatus, context); + }); + this.pollXhr = req; + }; + return BaseXHR2; + }(Polling); var Request = /* @__PURE__ */ function(_Emitter) { - _inherits(Request2, _Emitter); - var _super2 = _createSuper(Request2); - function Request2(uri, opts) { - var _this8; - _classCallCheck2(this, Request2); - _this8 = _super2.call(this); - installTimerFunctions(_assertThisInitialized(_this8), opts); - _this8.opts = opts; - _this8.method = opts.method || "GET"; - _this8.uri = uri; - _this8.data = void 0 !== opts.data ? opts.data : null; - _this8.create(); - return _this8; - } - _createClass2(Request2, [{ - key: "create", - value: function create2() { - var _this9 = this; - var _a3; - var opts = pick2(this.opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref"); - opts.xdomain = !!this.opts.xd; - var xhr = this.xhr = new XHR(opts); + function Request2(createRequest, uri, opts) { + var _this4; + _this4 = _Emitter.call(this) || this; + _this4.createRequest = createRequest; + installTimerFunctions(_this4, opts); + _this4._opts = opts; + _this4._method = opts.method || "GET"; + _this4._uri = uri; + _this4._data = void 0 !== opts.data ? opts.data : null; + _this4._create(); + return _this4; + } + _inheritsLoose(Request2, _Emitter); + var _proto2 = Request2.prototype; + _proto2._create = function _create() { + var _this5 = this; + var _a3; + var opts = pick2(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref"); + opts.xdomain = !!this._opts.xd; + var xhr = this._xhr = this.createRequest(opts); + try { + xhr.open(this._method, this._uri, true); try { - xhr.open(this.method, this.uri, true); - try { - if (this.opts.extraHeaders) { - xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true); - for (var i3 in this.opts.extraHeaders) { - if (this.opts.extraHeaders.hasOwnProperty(i3)) { - xhr.setRequestHeader(i3, this.opts.extraHeaders[i3]); - } + if (this._opts.extraHeaders) { + xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true); + for (var i3 in this._opts.extraHeaders) { + if (this._opts.extraHeaders.hasOwnProperty(i3)) { + xhr.setRequestHeader(i3, this._opts.extraHeaders[i3]); } } - } catch (e3) { - } - if ("POST" === this.method) { - try { - xhr.setRequestHeader("Content-type", "text/plain;charset=UTF-8"); - } catch (e3) { - } } + } catch (e3) { + } + if ("POST" === this._method) { try { - xhr.setRequestHeader("Accept", "*/*"); + xhr.setRequestHeader("Content-type", "text/plain;charset=UTF-8"); } catch (e3) { } - (_a3 = this.opts.cookieJar) === null || _a3 === void 0 ? void 0 : _a3.addCookies(xhr); - if ("withCredentials" in xhr) { - xhr.withCredentials = this.opts.withCredentials; - } - if (this.opts.requestTimeout) { - xhr.timeout = this.opts.requestTimeout; - } - xhr.onreadystatechange = function() { - var _a4; - if (xhr.readyState === 3) { - (_a4 = _this9.opts.cookieJar) === null || _a4 === void 0 ? void 0 : _a4.parseCookies(xhr); - } - if (4 !== xhr.readyState) return; - if (200 === xhr.status || 1223 === xhr.status) { - _this9.onLoad(); - } else { - _this9.setTimeoutFn(function() { - _this9.onError(typeof xhr.status === "number" ? xhr.status : 0); - }, 0); - } - }; - xhr.send(this.data); + } + try { + xhr.setRequestHeader("Accept", "*/*"); } catch (e3) { - this.setTimeoutFn(function() { - _this9.onError(e3); - }, 0); - return; } - if (typeof document !== "undefined") { - this.index = Request2.requestsCount++; - Request2.requests[this.index] = this; + (_a3 = this._opts.cookieJar) === null || _a3 === void 0 ? void 0 : _a3.addCookies(xhr); + if ("withCredentials" in xhr) { + xhr.withCredentials = this._opts.withCredentials; } - } - /** - * Called upon error. - * - * @private - */ - }, { - key: "onError", - value: function onError(err2) { - this.emitReserved("error", err2, this.xhr); - this.cleanup(true); - } - /** - * Cleans up house. - * - * @private - */ - }, { - key: "cleanup", - value: function cleanup2(fromError) { - if ("undefined" === typeof this.xhr || null === this.xhr) { - return; + if (this._opts.requestTimeout) { + xhr.timeout = this._opts.requestTimeout; } - this.xhr.onreadystatechange = empty3; - if (fromError) { - try { - this.xhr.abort(); - } catch (e3) { + xhr.onreadystatechange = function() { + var _a4; + if (xhr.readyState === 3) { + (_a4 = _this5._opts.cookieJar) === null || _a4 === void 0 ? void 0 : _a4.parseCookies( + // @ts-ignore + xhr.getResponseHeader("set-cookie") + ); } - } - if (typeof document !== "undefined") { - delete Request2.requests[this.index]; - } - this.xhr = null; + if (4 !== xhr.readyState) return; + if (200 === xhr.status || 1223 === xhr.status) { + _this5._onLoad(); + } else { + _this5.setTimeoutFn(function() { + _this5._onError(typeof xhr.status === "number" ? xhr.status : 0); + }, 0); + } + }; + xhr.send(this._data); + } catch (e3) { + this.setTimeoutFn(function() { + _this5._onError(e3); + }, 0); + return; } - /** - * Called upon load. - * - * @private - */ - }, { - key: "onLoad", - value: function onLoad() { - var data4 = this.xhr.responseText; - if (data4 !== null) { - this.emitReserved("data", data4); - this.emitReserved("success"); - this.cleanup(); + if (typeof document !== "undefined") { + this._index = Request2.requestsCount++; + Request2.requests[this._index] = this; + } + }; + _proto2._onError = function _onError(err2) { + this.emitReserved("error", err2, this._xhr); + this._cleanup(true); + }; + _proto2._cleanup = function _cleanup(fromError) { + if ("undefined" === typeof this._xhr || null === this._xhr) { + return; + } + this._xhr.onreadystatechange = empty3; + if (fromError) { + try { + this._xhr.abort(); + } catch (e3) { } } - /** - * Aborts the request. - * - * @package - */ - }, { - key: "abort", - value: function abort() { - this.cleanup(); + if (typeof document !== "undefined") { + delete Request2.requests[this._index]; } - }]); + this._xhr = null; + }; + _proto2._onLoad = function _onLoad() { + var data4 = this._xhr.responseText; + if (data4 !== null) { + this.emitReserved("data", data4); + this.emitReserved("success"); + this._cleanup(); + } + }; + _proto2.abort = function abort() { + this._cleanup(); + }; return Request2; }(Emitter2); Request.requestsCount = 0; @@ -342919,247 +343508,241 @@ ${config22.themeCSS}`; } } } - var nextTick2 = function() { - var isPromiseAvailable = typeof Promise === "function" && typeof Promise.resolve === "function"; - if (isPromiseAvailable) { - return function(cb) { - return Promise.resolve().then(cb); - }; - } else { - return function(cb, setTimeoutFn) { - return setTimeoutFn(cb, 0); - }; - } + var hasXHR2 = function() { + var xhr = newRequest({ + xdomain: false + }); + return xhr && xhr.responseType !== null; }(); - var WebSocket = globalThisShim.WebSocket || globalThisShim.MozWebSocket; - var usingBrowserWebSocket = true; - var defaultBinaryType = "arraybuffer"; - var isReactNative = typeof navigator !== "undefined" && typeof navigator.product === "string" && navigator.product.toLowerCase() === "reactnative"; - var WS = /* @__PURE__ */ function(_Transport) { - _inherits(WS2, _Transport); - var _super = _createSuper(WS2); - function WS2(opts) { - var _this; - _classCallCheck2(this, WS2); - _this = _super.call(this, opts); - _this.supportsBinary = !opts.forceBase64; - return _this; + var XHR = /* @__PURE__ */ function(_BaseXHR) { + function XHR2(opts) { + var _this6; + _this6 = _BaseXHR.call(this, opts) || this; + var forceBase64 = opts && opts.forceBase64; + _this6.supportsBinary = hasXHR2 && !forceBase64; + return _this6; + } + _inheritsLoose(XHR2, _BaseXHR); + var _proto3 = XHR2.prototype; + _proto3.request = function request() { + var opts = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + _extends(opts, { + xd: this.xd + }, this.opts); + return new Request(newRequest, this.uri(), opts); + }; + return XHR2; + }(BaseXHR); + function newRequest(opts) { + var xdomain = opts.xdomain; + try { + if ("undefined" !== typeof XMLHttpRequest && (!xdomain || hasCORS)) { + return new XMLHttpRequest(); + } + } catch (e3) { } - _createClass2(WS2, [{ - key: "name", - get: function get7() { - return "websocket"; + if (!xdomain) { + try { + return new globalThisShim[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP"); + } catch (e3) { } - }, { - key: "doOpen", - value: function doOpen() { - if (!this.check()) { - return; - } - var uri = this.uri(); - var protocols = this.opts.protocols; - var opts = isReactNative ? {} : pick2(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity"); - if (this.opts.extraHeaders) { - opts.headers = this.opts.extraHeaders; - } - try { - this.ws = usingBrowserWebSocket && !isReactNative ? protocols ? new WebSocket(uri, protocols) : new WebSocket(uri) : new WebSocket(uri, protocols, opts); - } catch (err2) { - return this.emitReserved("error", err2); - } - this.ws.binaryType = this.socket.binaryType; - this.addEventListeners(); + } + } + var isReactNative = typeof navigator !== "undefined" && typeof navigator.product === "string" && navigator.product.toLowerCase() === "reactnative"; + var BaseWS = /* @__PURE__ */ function(_Transport) { + function BaseWS2() { + return _Transport.apply(this, arguments) || this; + } + _inheritsLoose(BaseWS2, _Transport); + var _proto = BaseWS2.prototype; + _proto.doOpen = function doOpen() { + var uri = this.uri(); + var protocols = this.opts.protocols; + var opts = isReactNative ? {} : pick2(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity"); + if (this.opts.extraHeaders) { + opts.headers = this.opts.extraHeaders; } - /** - * Adds event listeners to the socket - * - * @private - */ - }, { - key: "addEventListeners", - value: function addEventListeners() { - var _this2 = this; - this.ws.onopen = function() { - if (_this2.opts.autoUnref) { - _this2.ws._socket.unref(); - } - _this2.onOpen(); - }; - this.ws.onclose = function(closeEvent) { - return _this2.onClose({ - description: "websocket connection closed", - context: closeEvent - }); - }; - this.ws.onmessage = function(ev) { - return _this2.onData(ev.data); - }; - this.ws.onerror = function(e3) { - return _this2.onError("websocket error", e3); - }; + try { + this.ws = this.createSocket(uri, protocols, opts); + } catch (err2) { + return this.emitReserved("error", err2); } - }, { - key: "write", - value: function write2(packets) { - var _this3 = this; - this.writable = false; - var _loop = function _loop2() { - var packet = packets[i3]; - var lastPacket = i3 === packets.length - 1; - encodePacket(packet, _this3.supportsBinary, function(data4) { - var opts = {}; - try { - if (usingBrowserWebSocket) { - _this3.ws.send(data4); - } - } catch (e3) { - } - if (lastPacket) { - nextTick2(function() { - _this3.writable = true; - _this3.emitReserved("drain"); - }, _this3.setTimeoutFn); - } - }); - }; - for (var i3 = 0; i3 < packets.length; i3++) { - _loop(); + this.ws.binaryType = this.socket.binaryType; + this.addEventListeners(); + }; + _proto.addEventListeners = function addEventListeners() { + var _this = this; + this.ws.onopen = function() { + if (_this.opts.autoUnref) { + _this.ws._socket.unref(); } + _this.onOpen(); + }; + this.ws.onclose = function(closeEvent) { + return _this.onClose({ + description: "websocket connection closed", + context: closeEvent + }); + }; + this.ws.onmessage = function(ev) { + return _this.onData(ev.data); + }; + this.ws.onerror = function(e3) { + return _this.onError("websocket error", e3); + }; + }; + _proto.write = function write2(packets) { + var _this2 = this; + this.writable = false; + var _loop = function _loop2() { + var packet = packets[i3]; + var lastPacket = i3 === packets.length - 1; + encodePacket(packet, _this2.supportsBinary, function(data4) { + try { + _this2.doWrite(packet, data4); + } catch (e3) { + } + if (lastPacket) { + nextTick2(function() { + _this2.writable = true; + _this2.emitReserved("drain"); + }, _this2.setTimeoutFn); + } + }); + }; + for (var i3 = 0; i3 < packets.length; i3++) { + _loop(); } - }, { - key: "doClose", - value: function doClose() { - if (typeof this.ws !== "undefined") { - this.ws.close(); - this.ws = null; - } + }; + _proto.doClose = function doClose() { + if (typeof this.ws !== "undefined") { + this.ws.close(); + this.ws = null; } - /** - * Generates uri for connection. - * - * @private - */ - }, { - key: "uri", - value: function uri() { - var schema2 = this.opts.secure ? "wss" : "ws"; - var query = this.query || {}; - if (this.opts.timestampRequests) { - query[this.opts.timestampParam] = yeast(); - } - if (!this.supportsBinary) { - query.b64 = 1; - } - return this.createUri(schema2, query); + }; + _proto.uri = function uri() { + var schema2 = this.opts.secure ? "wss" : "ws"; + var query = this.query || {}; + if (this.opts.timestampRequests) { + query[this.opts.timestampParam] = randomString(); } - /** - * Feature detection for WebSocket. - * - * @return {Boolean} whether this transport is available. - * @private - */ - }, { - key: "check", - value: function check() { - return !!WebSocket; + if (!this.supportsBinary) { + query.b64 = 1; + } + return this.createUri(schema2, query); + }; + return _createClass2(BaseWS2, [{ + key: "name", + get: function get7() { + return "websocket"; } }]); - return WS2; }(Transport); + var WebSocketCtor = globalThisShim.WebSocket || globalThisShim.MozWebSocket; + var WS = /* @__PURE__ */ function(_BaseWS) { + function WS2() { + return _BaseWS.apply(this, arguments) || this; + } + _inheritsLoose(WS2, _BaseWS); + var _proto2 = WS2.prototype; + _proto2.createSocket = function createSocket(uri, protocols, opts) { + return !isReactNative ? protocols ? new WebSocketCtor(uri, protocols) : new WebSocketCtor(uri) : new WebSocketCtor(uri, protocols, opts); + }; + _proto2.doWrite = function doWrite(_packet, data4) { + this.ws.send(data4); + }; + return WS2; + }(BaseWS); var WT = /* @__PURE__ */ function(_Transport) { - _inherits(WT2, _Transport); - var _super = _createSuper(WT2); function WT2() { - _classCallCheck2(this, WT2); - return _super.apply(this, arguments); + return _Transport.apply(this, arguments) || this; } - _createClass2(WT2, [{ - key: "name", - get: function get7() { - return "webtransport"; + _inheritsLoose(WT2, _Transport); + var _proto = WT2.prototype; + _proto.doOpen = function doOpen() { + var _this = this; + try { + this._transport = new WebTransport(this.createUri("https"), this.opts.transportOptions[this.name]); + } catch (err2) { + return this.emitReserved("error", err2); } - }, { - key: "doOpen", - value: function doOpen() { - var _this = this; - if (typeof WebTransport !== "function") { - return; - } - this.transport = new WebTransport(this.createUri("https"), this.opts.transportOptions[this.name]); - this.transport.closed.then(function() { - _this.onClose(); - })["catch"](function(err2) { - _this.onError("webtransport error", err2); - }); - this.transport.ready.then(function() { - _this.transport.createBidirectionalStream().then(function(stream) { - var decoderStream = createPacketDecoderStream(Number.MAX_SAFE_INTEGER, _this.socket.binaryType); - var reader = stream.readable.pipeThrough(decoderStream).getReader(); - var encoderStream = createPacketEncoderStream(); - encoderStream.readable.pipeTo(stream.writable); - _this.writer = encoderStream.writable.getWriter(); - var read = function read2() { - reader.read().then(function(_ref) { - var done = _ref.done, value2 = _ref.value; - if (done) { - return; - } - _this.onPacket(value2); - read2(); - })["catch"](function(err2) { - }); - }; - read(); - var packet = { - type: "open" - }; - if (_this.query.sid) { - packet.data = '{"sid":"'.concat(_this.query.sid, '"}'); - } - _this.writer.write(packet).then(function() { - return _this.onOpen(); + this._transport.closed.then(function() { + _this.onClose(); + })["catch"](function(err2) { + _this.onError("webtransport error", err2); + }); + this._transport.ready.then(function() { + _this._transport.createBidirectionalStream().then(function(stream) { + var decoderStream = createPacketDecoderStream(Number.MAX_SAFE_INTEGER, _this.socket.binaryType); + var reader = stream.readable.pipeThrough(decoderStream).getReader(); + var encoderStream = createPacketEncoderStream(); + encoderStream.readable.pipeTo(stream.writable); + _this._writer = encoderStream.writable.getWriter(); + var read = function read2() { + reader.read().then(function(_ref) { + var done = _ref.done, value2 = _ref.value; + if (done) { + return; + } + _this.onPacket(value2); + read2(); + })["catch"](function(err2) { }); + }; + read(); + var packet = { + type: "open" + }; + if (_this.query.sid) { + packet.data = '{"sid":"'.concat(_this.query.sid, '"}'); + } + _this._writer.write(packet).then(function() { + return _this.onOpen(); }); }); + }); + }; + _proto.write = function write2(packets) { + var _this2 = this; + this.writable = false; + var _loop = function _loop2() { + var packet = packets[i3]; + var lastPacket = i3 === packets.length - 1; + _this2._writer.write(packet).then(function() { + if (lastPacket) { + nextTick2(function() { + _this2.writable = true; + _this2.emitReserved("drain"); + }, _this2.setTimeoutFn); + } + }); + }; + for (var i3 = 0; i3 < packets.length; i3++) { + _loop(); } - }, { - key: "write", - value: function write2(packets) { - var _this2 = this; - this.writable = false; - var _loop = function _loop2() { - var packet = packets[i3]; - var lastPacket = i3 === packets.length - 1; - _this2.writer.write(packet).then(function() { - if (lastPacket) { - nextTick2(function() { - _this2.writable = true; - _this2.emitReserved("drain"); - }, _this2.setTimeoutFn); - } - }); - }; - for (var i3 = 0; i3 < packets.length; i3++) { - _loop(); - } - } - }, { - key: "doClose", - value: function doClose() { - var _a3; - (_a3 = this.transport) === null || _a3 === void 0 ? void 0 : _a3.close(); + }; + _proto.doClose = function doClose() { + var _a3; + (_a3 = this._transport) === null || _a3 === void 0 ? void 0 : _a3.close(); + }; + return _createClass2(WT2, [{ + key: "name", + get: function get7() { + return "webtransport"; } }]); - return WT2; }(Transport); var transports = { websocket: WS, webtransport: WT, - polling: Polling + polling: XHR }; var re3 = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/; var parts = ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"]; function parse10(str2) { + if (str2.length > 8e3) { + throw "URI too long"; + } var src = str2, b2 = str2.indexOf("["), e3 = str2.indexOf("]"); if (b2 != -1 && e3 != -1) { str2 = str2.substring(0, b2) + str2.substring(b2, e3).replace(/:/g, ";") + str2.substring(e3, str2.length); @@ -343197,39 +343780,53 @@ ${config22.themeCSS}`; }); return data4; } - var Socket$1 = /* @__PURE__ */ function(_Emitter) { - _inherits(Socket2, _Emitter); - var _super = _createSuper(Socket2); - function Socket2(uri) { + var withEventListeners = typeof addEventListener === "function" && typeof removeEventListener === "function"; + var OFFLINE_EVENT_LISTENERS = []; + if (withEventListeners) { + addEventListener("offline", function() { + OFFLINE_EVENT_LISTENERS.forEach(function(listener) { + return listener(); + }); + }, false); + } + var SocketWithoutUpgrade = /* @__PURE__ */ function(_Emitter) { + function SocketWithoutUpgrade2(uri, opts) { var _this; - var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - _classCallCheck2(this, Socket2); - _this = _super.call(this); + _this = _Emitter.call(this) || this; _this.binaryType = defaultBinaryType; _this.writeBuffer = []; + _this._prevBufferLen = 0; + _this._pingInterval = -1; + _this._pingTimeout = -1; + _this._maxPayload = -1; + _this._pingTimeoutTime = Infinity; if (uri && "object" === _typeof3(uri)) { opts = uri; uri = null; } if (uri) { - uri = parse10(uri); - opts.hostname = uri.host; - opts.secure = uri.protocol === "https" || uri.protocol === "wss"; - opts.port = uri.port; - if (uri.query) opts.query = uri.query; + var parsedUri = parse10(uri); + opts.hostname = parsedUri.host; + opts.secure = parsedUri.protocol === "https" || parsedUri.protocol === "wss"; + opts.port = parsedUri.port; + if (parsedUri.query) opts.query = parsedUri.query; } else if (opts.host) { opts.hostname = parse10(opts.host).host; } - installTimerFunctions(_assertThisInitialized(_this), opts); + installTimerFunctions(_this, opts); _this.secure = null != opts.secure ? opts.secure : typeof location !== "undefined" && "https:" === location.protocol; if (opts.hostname && !opts.port) { opts.port = _this.secure ? "443" : "80"; } _this.hostname = opts.hostname || (typeof location !== "undefined" ? location.hostname : "localhost"); _this.port = opts.port || (typeof location !== "undefined" && location.port ? location.port : _this.secure ? "443" : "80"); - _this.transports = opts.transports || ["polling", "websocket", "webtransport"]; - _this.writeBuffer = []; - _this.prevBufferLen = 0; + _this.transports = []; + _this._transportsByName = {}; + opts.transports.forEach(function(t4) { + var transportName = t4.prototype.name; + _this.transports.push(transportName); + _this._transportsByName[transportName] = t4; + }); _this.opts = _extends({ path: "/engine.io", agent: false, @@ -343249,487 +343846,773 @@ ${config22.themeCSS}`; if (typeof _this.opts.query === "string") { _this.opts.query = decode2(_this.opts.query); } - _this.id = null; - _this.upgrades = null; - _this.pingInterval = null; - _this.pingTimeout = null; - _this.pingTimeoutTimer = null; - if (typeof addEventListener === "function") { + if (withEventListeners) { if (_this.opts.closeOnBeforeunload) { - _this.beforeunloadEventListener = function() { + _this._beforeunloadEventListener = function() { if (_this.transport) { _this.transport.removeAllListeners(); _this.transport.close(); } }; - addEventListener("beforeunload", _this.beforeunloadEventListener, false); + addEventListener("beforeunload", _this._beforeunloadEventListener, false); } if (_this.hostname !== "localhost") { - _this.offlineEventListener = function() { - _this.onClose("transport close", { + _this._offlineEventListener = function() { + _this._onClose("transport close", { description: "network connection lost" }); }; - addEventListener("offline", _this.offlineEventListener, false); + OFFLINE_EVENT_LISTENERS.push(_this._offlineEventListener); } } - _this.open(); + if (_this.opts.withCredentials) { + _this._cookieJar = createCookieJar(); + } + _this._open(); return _this; } - _createClass2(Socket2, [{ - key: "createTransport", - value: function createTransport(name) { - var query = _extends({}, this.opts.query); - query.EIO = protocol$1; - query.transport = name; - if (this.id) query.sid = this.id; - var opts = _extends({}, this.opts, { - query, - socket: this, - hostname: this.hostname, - secure: this.secure, - port: this.port - }, this.opts.transportOptions[name]); - return new transports[name](opts); + _inheritsLoose(SocketWithoutUpgrade2, _Emitter); + var _proto = SocketWithoutUpgrade2.prototype; + _proto.createTransport = function createTransport(name) { + var query = _extends({}, this.opts.query); + query.EIO = protocol$1; + query.transport = name; + if (this.id) query.sid = this.id; + var opts = _extends({}, this.opts, { + query, + socket: this, + hostname: this.hostname, + secure: this.secure, + port: this.port + }, this.opts.transportOptions[name]); + return new this._transportsByName[name](opts); + }; + _proto._open = function _open() { + var _this2 = this; + if (this.transports.length === 0) { + this.setTimeoutFn(function() { + _this2.emitReserved("error", "No transports available"); + }, 0); + return; } - /** - * Initializes transport to use and starts probe. - * - * @private - */ - }, { - key: "open", - value: function open2() { - var _this2 = this; - var transport; - if (this.opts.rememberUpgrade && Socket2.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1) { - transport = "websocket"; - } else if (0 === this.transports.length) { - this.setTimeoutFn(function() { - _this2.emitReserved("error", "No transports available"); - }, 0); - return; - } else { - transport = this.transports[0]; + var transportName = this.opts.rememberUpgrade && SocketWithoutUpgrade2.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1 ? "websocket" : this.transports[0]; + this.readyState = "opening"; + var transport = this.createTransport(transportName); + transport.open(); + this.setTransport(transport); + }; + _proto.setTransport = function setTransport(transport) { + var _this3 = this; + if (this.transport) { + this.transport.removeAllListeners(); + } + this.transport = transport; + transport.on("drain", this._onDrain.bind(this)).on("packet", this._onPacket.bind(this)).on("error", this._onError.bind(this)).on("close", function(reason) { + return _this3._onClose("transport close", reason); + }); + }; + _proto.onOpen = function onOpen() { + this.readyState = "open"; + SocketWithoutUpgrade2.priorWebsocketSuccess = "websocket" === this.transport.name; + this.emitReserved("open"); + this.flush(); + }; + _proto._onPacket = function _onPacket(packet) { + if ("opening" === this.readyState || "open" === this.readyState || "closing" === this.readyState) { + this.emitReserved("packet", packet); + this.emitReserved("heartbeat"); + switch (packet.type) { + case "open": + this.onHandshake(JSON.parse(packet.data)); + break; + case "ping": + this._sendPacket("pong"); + this.emitReserved("ping"); + this.emitReserved("pong"); + this._resetPingTimeout(); + break; + case "error": + var err2 = new Error("server error"); + err2.code = packet.data; + this._onError(err2); + break; + case "message": + this.emitReserved("data", packet.data); + this.emitReserved("message", packet.data); + break; } - this.readyState = "opening"; - try { - transport = this.createTransport(transport); - } catch (e3) { - this.transports.shift(); - this.open(); - return; + } + }; + _proto.onHandshake = function onHandshake(data4) { + this.emitReserved("handshake", data4); + this.id = data4.sid; + this.transport.query.sid = data4.sid; + this._pingInterval = data4.pingInterval; + this._pingTimeout = data4.pingTimeout; + this._maxPayload = data4.maxPayload; + this.onOpen(); + if ("closed" === this.readyState) return; + this._resetPingTimeout(); + }; + _proto._resetPingTimeout = function _resetPingTimeout() { + var _this4 = this; + this.clearTimeoutFn(this._pingTimeoutTimer); + var delay2 = this._pingInterval + this._pingTimeout; + this._pingTimeoutTime = Date.now() + delay2; + this._pingTimeoutTimer = this.setTimeoutFn(function() { + _this4._onClose("ping timeout"); + }, delay2); + if (this.opts.autoUnref) { + this._pingTimeoutTimer.unref(); + } + }; + _proto._onDrain = function _onDrain() { + this.writeBuffer.splice(0, this._prevBufferLen); + this._prevBufferLen = 0; + if (0 === this.writeBuffer.length) { + this.emitReserved("drain"); + } else { + this.flush(); + } + }; + _proto.flush = function flush() { + if ("closed" !== this.readyState && this.transport.writable && !this.upgrading && this.writeBuffer.length) { + var packets = this._getWritablePackets(); + this.transport.send(packets); + this._prevBufferLen = packets.length; + this.emitReserved("flush"); + } + }; + _proto._getWritablePackets = function _getWritablePackets() { + var shouldCheckPayloadSize = this._maxPayload && this.transport.name === "polling" && this.writeBuffer.length > 1; + if (!shouldCheckPayloadSize) { + return this.writeBuffer; + } + var payloadSize = 1; + for (var i3 = 0; i3 < this.writeBuffer.length; i3++) { + var data4 = this.writeBuffer[i3].data; + if (data4) { + payloadSize += byteLength(data4); } - transport.open(); - this.setTransport(transport); + if (i3 > 0 && payloadSize > this._maxPayload) { + return this.writeBuffer.slice(0, i3); + } + payloadSize += 2; } - /** - * Sets the current transport. Disables the existing one (if any). - * - * @private - */ - }, { - key: "setTransport", - value: function setTransport(transport) { - var _this3 = this; - if (this.transport) { - this.transport.removeAllListeners(); - } - this.transport = transport; - transport.on("drain", this.onDrain.bind(this)).on("packet", this.onPacket.bind(this)).on("error", this.onError.bind(this)).on("close", function(reason) { - return _this3.onClose("transport close", reason); - }); + return this.writeBuffer; + }; + _proto._hasPingExpired = function _hasPingExpired() { + var _this5 = this; + if (!this._pingTimeoutTime) return true; + var hasExpired = Date.now() > this._pingTimeoutTime; + if (hasExpired) { + this._pingTimeoutTime = 0; + nextTick2(function() { + _this5._onClose("ping timeout"); + }, this.setTimeoutFn); } - /** - * Probes a transport. - * - * @param {String} name - transport name - * @private - */ - }, { - key: "probe", - value: function probe(name) { - var _this4 = this; - var transport = this.createTransport(name); - var failed = false; - Socket2.priorWebsocketSuccess = false; - var onTransportOpen = function onTransportOpen2() { - if (failed) return; - transport.send([{ - type: "ping", - data: "probe" - }]); - transport.once("packet", function(msg) { - if (failed) return; - if ("pong" === msg.type && "probe" === msg.data) { - _this4.upgrading = true; - _this4.emitReserved("upgrading", transport); - if (!transport) return; - Socket2.priorWebsocketSuccess = "websocket" === transport.name; - _this4.transport.pause(function() { - if (failed) return; - if ("closed" === _this4.readyState) return; - cleanup2(); - _this4.setTransport(transport); - transport.send([{ - type: "upgrade" - }]); - _this4.emitReserved("upgrade", transport); - transport = null; - _this4.upgrading = false; - _this4.flush(); - }); + return hasExpired; + }; + _proto.write = function write2(msg, options4, fn4) { + this._sendPacket("message", msg, options4, fn4); + return this; + }; + _proto.send = function send(msg, options4, fn4) { + this._sendPacket("message", msg, options4, fn4); + return this; + }; + _proto._sendPacket = function _sendPacket(type3, data4, options4, fn4) { + if ("function" === typeof data4) { + fn4 = data4; + data4 = void 0; + } + if ("function" === typeof options4) { + fn4 = options4; + options4 = null; + } + if ("closing" === this.readyState || "closed" === this.readyState) { + return; + } + options4 = options4 || {}; + options4.compress = false !== options4.compress; + var packet = { + type: type3, + data: data4, + options: options4 + }; + this.emitReserved("packetCreate", packet); + this.writeBuffer.push(packet); + if (fn4) this.once("flush", fn4); + this.flush(); + }; + _proto.close = function close2() { + var _this6 = this; + var close3 = function close4() { + _this6._onClose("forced close"); + _this6.transport.close(); + }; + var cleanupAndClose = function cleanupAndClose2() { + _this6.off("upgrade", cleanupAndClose2); + _this6.off("upgradeError", cleanupAndClose2); + close3(); + }; + var waitForUpgrade = function waitForUpgrade2() { + _this6.once("upgrade", cleanupAndClose); + _this6.once("upgradeError", cleanupAndClose); + }; + if ("opening" === this.readyState || "open" === this.readyState) { + this.readyState = "closing"; + if (this.writeBuffer.length) { + this.once("drain", function() { + if (_this6.upgrading) { + waitForUpgrade(); } else { - var err2 = new Error("probe error"); - err2.transport = transport.name; - _this4.emitReserved("upgradeError", err2); + close3(); } }); - }; - function freezeTransport() { - if (failed) return; - failed = true; - cleanup2(); - transport.close(); - transport = null; - } - var onerror = function onerror2(err2) { - var error3 = new Error("probe error: " + err2); - error3.transport = transport.name; - freezeTransport(); - _this4.emitReserved("upgradeError", error3); - }; - function onTransportClose() { - onerror("transport closed"); - } - function onclose() { - onerror("socket closed"); + } else if (this.upgrading) { + waitForUpgrade(); + } else { + close3(); } - function onupgrade(to) { - if (transport && to.name !== transport.name) { - freezeTransport(); + } + return this; + }; + _proto._onError = function _onError(err2) { + SocketWithoutUpgrade2.priorWebsocketSuccess = false; + if (this.opts.tryAllTransports && this.transports.length > 1 && this.readyState === "opening") { + this.transports.shift(); + return this._open(); + } + this.emitReserved("error", err2); + this._onClose("transport error", err2); + }; + _proto._onClose = function _onClose(reason, description) { + if ("opening" === this.readyState || "open" === this.readyState || "closing" === this.readyState) { + this.clearTimeoutFn(this._pingTimeoutTimer); + this.transport.removeAllListeners("close"); + this.transport.close(); + this.transport.removeAllListeners(); + if (withEventListeners) { + if (this._beforeunloadEventListener) { + removeEventListener("beforeunload", this._beforeunloadEventListener, false); } - } - var cleanup2 = function cleanup3() { - transport.removeListener("open", onTransportOpen); - transport.removeListener("error", onerror); - transport.removeListener("close", onTransportClose); - _this4.off("close", onclose); - _this4.off("upgrading", onupgrade); - }; - transport.once("open", onTransportOpen); - transport.once("error", onerror); - transport.once("close", onTransportClose); - this.once("close", onclose); - this.once("upgrading", onupgrade); - if (this.upgrades.indexOf("webtransport") !== -1 && name !== "webtransport") { - this.setTimeoutFn(function() { - if (!failed) { - transport.open(); + if (this._offlineEventListener) { + var i3 = OFFLINE_EVENT_LISTENERS.indexOf(this._offlineEventListener); + if (i3 !== -1) { + OFFLINE_EVENT_LISTENERS.splice(i3, 1); } - }, 200); - } else { - transport.open(); + } } + this.readyState = "closed"; + this.id = null; + this.emitReserved("close", reason, description); + this.writeBuffer = []; + this._prevBufferLen = 0; } - /** - * Called when connection is deemed open. - * - * @private - */ - }, { - key: "onOpen", - value: function onOpen() { - this.readyState = "open"; - Socket2.priorWebsocketSuccess = "websocket" === this.transport.name; - this.emitReserved("open"); - this.flush(); - if ("open" === this.readyState && this.opts.upgrade) { - var i3 = 0; - var l2 = this.upgrades.length; - for (; i3 < l2; i3++) { - this.probe(this.upgrades[i3]); - } + }; + return SocketWithoutUpgrade2; + }(Emitter2); + SocketWithoutUpgrade.protocol = protocol$1; + var SocketWithUpgrade = /* @__PURE__ */ function(_SocketWithoutUpgrade) { + function SocketWithUpgrade2() { + var _this7; + _this7 = _SocketWithoutUpgrade.apply(this, arguments) || this; + _this7._upgrades = []; + return _this7; + } + _inheritsLoose(SocketWithUpgrade2, _SocketWithoutUpgrade); + var _proto2 = SocketWithUpgrade2.prototype; + _proto2.onOpen = function onOpen() { + _SocketWithoutUpgrade.prototype.onOpen.call(this); + if ("open" === this.readyState && this.opts.upgrade) { + for (var i3 = 0; i3 < this._upgrades.length; i3++) { + this._probe(this._upgrades[i3]); } } - /** - * Handles a packet. - * - * @private - */ - }, { - key: "onPacket", - value: function onPacket(packet) { - if ("opening" === this.readyState || "open" === this.readyState || "closing" === this.readyState) { - this.emitReserved("packet", packet); - this.emitReserved("heartbeat"); - this.resetPingTimeout(); - switch (packet.type) { - case "open": - this.onHandshake(JSON.parse(packet.data)); - break; - case "ping": - this.sendPacket("pong"); - this.emitReserved("ping"); - this.emitReserved("pong"); - break; - case "error": - var err2 = new Error("server error"); - err2.code = packet.data; - this.onError(err2); - break; - case "message": - this.emitReserved("data", packet.data); - this.emitReserved("message", packet.data); - break; + }; + _proto2._probe = function _probe(name) { + var _this8 = this; + var transport = this.createTransport(name); + var failed = false; + SocketWithoutUpgrade.priorWebsocketSuccess = false; + var onTransportOpen = function onTransportOpen2() { + if (failed) return; + transport.send([{ + type: "ping", + data: "probe" + }]); + transport.once("packet", function(msg) { + if (failed) return; + if ("pong" === msg.type && "probe" === msg.data) { + _this8.upgrading = true; + _this8.emitReserved("upgrading", transport); + if (!transport) return; + SocketWithoutUpgrade.priorWebsocketSuccess = "websocket" === transport.name; + _this8.transport.pause(function() { + if (failed) return; + if ("closed" === _this8.readyState) return; + cleanup2(); + _this8.setTransport(transport); + transport.send([{ + type: "upgrade" + }]); + _this8.emitReserved("upgrade", transport); + transport = null; + _this8.upgrading = false; + _this8.flush(); + }); + } else { + var err2 = new Error("probe error"); + err2.transport = transport.name; + _this8.emitReserved("upgradeError", err2); } - } + }); + }; + function freezeTransport() { + if (failed) return; + failed = true; + cleanup2(); + transport.close(); + transport = null; + } + var onerror = function onerror2(err2) { + var error3 = new Error("probe error: " + err2); + error3.transport = transport.name; + freezeTransport(); + _this8.emitReserved("upgradeError", error3); + }; + function onTransportClose() { + onerror("transport closed"); } - /** - * Called upon handshake completion. - * - * @param {Object} data - handshake obj - * @private - */ - }, { - key: "onHandshake", - value: function onHandshake(data4) { - this.emitReserved("handshake", data4); - this.id = data4.sid; - this.transport.query.sid = data4.sid; - this.upgrades = this.filterUpgrades(data4.upgrades); - this.pingInterval = data4.pingInterval; - this.pingTimeout = data4.pingTimeout; - this.maxPayload = data4.maxPayload; - this.onOpen(); - if ("closed" === this.readyState) return; - this.resetPingTimeout(); + function onclose() { + onerror("socket closed"); } - /** - * Sets and resets ping timeout timer based on server pings. - * - * @private - */ - }, { - key: "resetPingTimeout", - value: function resetPingTimeout() { - var _this5 = this; - this.clearTimeoutFn(this.pingTimeoutTimer); - this.pingTimeoutTimer = this.setTimeoutFn(function() { - _this5.onClose("ping timeout"); - }, this.pingInterval + this.pingTimeout); - if (this.opts.autoUnref) { - this.pingTimeoutTimer.unref(); + function onupgrade(to) { + if (transport && to.name !== transport.name) { + freezeTransport(); } } - /** - * Called on `drain` event - * - * @private - */ - }, { - key: "onDrain", - value: function onDrain() { - this.writeBuffer.splice(0, this.prevBufferLen); - this.prevBufferLen = 0; - if (0 === this.writeBuffer.length) { - this.emitReserved("drain"); - } else { - this.flush(); - } + var cleanup2 = function cleanup3() { + transport.removeListener("open", onTransportOpen); + transport.removeListener("error", onerror); + transport.removeListener("close", onTransportClose); + _this8.off("close", onclose); + _this8.off("upgrading", onupgrade); + }; + transport.once("open", onTransportOpen); + transport.once("error", onerror); + transport.once("close", onTransportClose); + this.once("close", onclose); + this.once("upgrading", onupgrade); + if (this._upgrades.indexOf("webtransport") !== -1 && name !== "webtransport") { + this.setTimeoutFn(function() { + if (!failed) { + transport.open(); + } + }, 200); + } else { + transport.open(); } - /** - * Flush write buffers. - * - * @private - */ - }, { - key: "flush", - value: function flush() { - if ("closed" !== this.readyState && this.transport.writable && !this.upgrading && this.writeBuffer.length) { - var packets = this.getWritablePackets(); - this.transport.send(packets); - this.prevBufferLen = packets.length; - this.emitReserved("flush"); - } + }; + _proto2.onHandshake = function onHandshake(data4) { + this._upgrades = this._filterUpgrades(data4.upgrades); + _SocketWithoutUpgrade.prototype.onHandshake.call(this, data4); + }; + _proto2._filterUpgrades = function _filterUpgrades(upgrades) { + var filteredUpgrades = []; + for (var i3 = 0; i3 < upgrades.length; i3++) { + if (~this.transports.indexOf(upgrades[i3])) filteredUpgrades.push(upgrades[i3]); } - /** - * Ensure the encoded size of the writeBuffer is below the maxPayload value sent by the server (only for HTTP - * long-polling) - * - * @private - */ - }, { - key: "getWritablePackets", - value: function getWritablePackets() { - var shouldCheckPayloadSize = this.maxPayload && this.transport.name === "polling" && this.writeBuffer.length > 1; - if (!shouldCheckPayloadSize) { - return this.writeBuffer; + return filteredUpgrades; + }; + return SocketWithUpgrade2; + }(SocketWithoutUpgrade); + var Socket$1 = /* @__PURE__ */ function(_SocketWithUpgrade) { + function Socket2(uri) { + var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + var o2 = _typeof3(uri) === "object" ? uri : opts; + if (!o2.transports || o2.transports && typeof o2.transports[0] === "string") { + o2.transports = (o2.transports || ["polling", "websocket", "webtransport"]).map(function(transportName) { + return transports[transportName]; + }).filter(function(t4) { + return !!t4; + }); + } + return _SocketWithUpgrade.call(this, uri, o2) || this; + } + _inheritsLoose(Socket2, _SocketWithUpgrade); + return Socket2; + }(SocketWithUpgrade); + Socket$1.protocol; + function getDefaultExportFromCjs(x4) { + return x4 && x4.__esModule && Object.prototype.hasOwnProperty.call(x4, "default") ? x4["default"] : x4; + } + var browser = { exports: {} }; + var ms3; + var hasRequiredMs; + function requireMs() { + if (hasRequiredMs) return ms3; + hasRequiredMs = 1; + var s3 = 1e3; + var m2 = s3 * 60; + var h3 = m2 * 60; + var d2 = h3 * 24; + var w2 = d2 * 7; + var y4 = d2 * 365.25; + ms3 = function ms4(val, options4) { + options4 = options4 || {}; + var type3 = _typeof3(val); + if (type3 === "string" && val.length > 0) { + return parse11(val); + } else if (type3 === "number" && isFinite(val)) { + return options4["long"] ? fmtLong(val) : fmtShort(val); + } + throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val)); + }; + function parse11(str2) { + str2 = String(str2); + if (str2.length > 100) { + return; + } + var match2 = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str2); + if (!match2) { + return; + } + var n2 = parseFloat(match2[1]); + var type3 = (match2[2] || "ms").toLowerCase(); + switch (type3) { + case "years": + case "year": + case "yrs": + case "yr": + case "y": + return n2 * y4; + case "weeks": + case "week": + case "w": + return n2 * w2; + case "days": + case "day": + case "d": + return n2 * d2; + case "hours": + case "hour": + case "hrs": + case "hr": + case "h": + return n2 * h3; + case "minutes": + case "minute": + case "mins": + case "min": + case "m": + return n2 * m2; + case "seconds": + case "second": + case "secs": + case "sec": + case "s": + return n2 * s3; + case "milliseconds": + case "millisecond": + case "msecs": + case "msec": + case "ms": + return n2; + default: + return void 0; + } + } + function fmtShort(ms4) { + var msAbs = Math.abs(ms4); + if (msAbs >= d2) { + return Math.round(ms4 / d2) + "d"; + } + if (msAbs >= h3) { + return Math.round(ms4 / h3) + "h"; + } + if (msAbs >= m2) { + return Math.round(ms4 / m2) + "m"; + } + if (msAbs >= s3) { + return Math.round(ms4 / s3) + "s"; + } + return ms4 + "ms"; + } + function fmtLong(ms4) { + var msAbs = Math.abs(ms4); + if (msAbs >= d2) { + return plural(ms4, msAbs, d2, "day"); + } + if (msAbs >= h3) { + return plural(ms4, msAbs, h3, "hour"); + } + if (msAbs >= m2) { + return plural(ms4, msAbs, m2, "minute"); + } + if (msAbs >= s3) { + return plural(ms4, msAbs, s3, "second"); + } + return ms4 + " ms"; + } + function plural(ms4, msAbs, n2, name) { + var isPlural = msAbs >= n2 * 1.5; + return Math.round(ms4 / n2) + " " + name + (isPlural ? "s" : ""); + } + return ms3; + } + function setup(env) { + createDebug.debug = createDebug; + createDebug["default"] = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable2; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = requireMs(); + createDebug.destroy = destroy2; + Object.keys(env).forEach(function(key) { + createDebug[key] = env[key]; + }); + createDebug.names = []; + createDebug.skips = []; + createDebug.formatters = {}; + function selectColor(namespace) { + var hash = 0; + for (var i3 = 0; i3 < namespace.length; i3++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i3); + hash |= 0; + } + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + function createDebug(namespace) { + var prevTime; + var enableOverride = null; + var namespacesCache; + var enabledCache; + function debug2() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + if (!debug2.enabled) { + return; } - var payloadSize = 1; - for (var i3 = 0; i3 < this.writeBuffer.length; i3++) { - var data4 = this.writeBuffer[i3].data; - if (data4) { - payloadSize += byteLength(data4); + var self2 = debug2; + var curr = Number(/* @__PURE__ */ new Date()); + var ms4 = curr - (prevTime || curr); + self2.diff = ms4; + self2.prev = prevTime; + self2.curr = curr; + prevTime = curr; + args[0] = createDebug.coerce(args[0]); + if (typeof args[0] !== "string") { + args.unshift("%O"); + } + var index3 = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match2, format3) { + if (match2 === "%%") { + return "%"; + } + index3++; + var formatter = createDebug.formatters[format3]; + if (typeof formatter === "function") { + var val = args[index3]; + match2 = formatter.call(self2, val); + args.splice(index3, 1); + index3--; + } + return match2; + }); + createDebug.formatArgs.call(self2, args); + var logFn = self2.log || createDebug.log; + logFn.apply(self2, args); + } + debug2.namespace = namespace; + debug2.useColors = createDebug.useColors(); + debug2.color = createDebug.selectColor(namespace); + debug2.extend = extend4; + debug2.destroy = createDebug.destroy; + Object.defineProperty(debug2, "enabled", { + enumerable: true, + configurable: false, + get: function get7() { + if (enableOverride !== null) { + return enableOverride; } - if (i3 > 0 && payloadSize > this.maxPayload) { - return this.writeBuffer.slice(0, i3); + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); } - payloadSize += 2; + return enabledCache; + }, + set: function set7(v) { + enableOverride = v; + } + }); + if (typeof createDebug.init === "function") { + createDebug.init(debug2); + } + return debug2; + } + function extend4(namespace, delimiter3) { + var newDebug = createDebug(this.namespace + (typeof delimiter3 === "undefined" ? ":" : delimiter3) + namespace); + newDebug.log = this.log; + return newDebug; + } + function enable(namespaces2) { + createDebug.save(namespaces2); + createDebug.namespaces = namespaces2; + createDebug.names = []; + createDebug.skips = []; + var i3; + var split = (typeof namespaces2 === "string" ? namespaces2 : "").split(/[\s,]+/); + var len = split.length; + for (i3 = 0; i3 < len; i3++) { + if (!split[i3]) { + continue; + } + namespaces2 = split[i3].replace(/\*/g, ".*?"); + if (namespaces2[0] === "-") { + createDebug.skips.push(new RegExp("^" + namespaces2.slice(1) + "$")); + } else { + createDebug.names.push(new RegExp("^" + namespaces2 + "$")); } - return this.writeBuffer; } - /** - * Sends a message. - * - * @param {String} msg - message. - * @param {Object} options. - * @param {Function} callback function. - * @return {Socket} for chaining. - */ - }, { - key: "write", - value: function write2(msg, options4, fn4) { - this.sendPacket("message", msg, options4, fn4); - return this; + } + function disable2() { + var namespaces2 = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function(namespace) { + return "-" + namespace; + }))).join(","); + createDebug.enable(""); + return namespaces2; + } + function enabled(name) { + if (name[name.length - 1] === "*") { + return true; } - }, { - key: "send", - value: function send(msg, options4, fn4) { - this.sendPacket("message", msg, options4, fn4); - return this; + var i3; + var len; + for (i3 = 0, len = createDebug.skips.length; i3 < len; i3++) { + if (createDebug.skips[i3].test(name)) { + return false; + } } - /** - * Sends a packet. - * - * @param {String} type: packet type. - * @param {String} data. - * @param {Object} options. - * @param {Function} fn - callback function. - * @private - */ - }, { - key: "sendPacket", - value: function sendPacket(type3, data4, options4, fn4) { - if ("function" === typeof data4) { - fn4 = data4; - data4 = void 0; + for (i3 = 0, len = createDebug.names.length; i3 < len; i3++) { + if (createDebug.names[i3].test(name)) { + return true; } - if ("function" === typeof options4) { - fn4 = options4; - options4 = null; + } + return false; + } + function toNamespace(regexp) { + return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*"); + } + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + function destroy2() { + console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); + } + createDebug.enable(createDebug.load()); + return createDebug; + } + var common3 = setup; + browser.exports; + (function(module3, exports3) { + exports3.formatArgs = formatArgs; + exports3.save = save; + exports3.load = load2; + exports3.useColors = useColors; + exports3.storage = localstorage(); + exports3.destroy = /* @__PURE__ */ function() { + var warned = false; + return function() { + if (!warned) { + warned = true; + console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); } - if ("closing" === this.readyState || "closed" === this.readyState) { + }; + }(); + exports3.colors = ["#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33"]; + function useColors() { + if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) { + return true; + } + if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker + typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); + } + function formatArgs(args) { + args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module3.exports.humanize(this.diff); + if (!this.useColors) { + return; + } + var c5 = "color: " + this.color; + args.splice(1, 0, c5, "color: inherit"); + var index3 = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function(match2) { + if (match2 === "%%") { return; } - options4 = options4 || {}; - options4.compress = false !== options4.compress; - var packet = { - type: type3, - data: data4, - options: options4 - }; - this.emitReserved("packetCreate", packet); - this.writeBuffer.push(packet); - if (fn4) this.once("flush", fn4); - this.flush(); - } - /** - * Closes the connection. - */ - }, { - key: "close", - value: function close2() { - var _this6 = this; - var close3 = function close4() { - _this6.onClose("forced close"); - _this6.transport.close(); - }; - var cleanupAndClose = function cleanupAndClose2() { - _this6.off("upgrade", cleanupAndClose2); - _this6.off("upgradeError", cleanupAndClose2); - close3(); - }; - var waitForUpgrade = function waitForUpgrade2() { - _this6.once("upgrade", cleanupAndClose); - _this6.once("upgradeError", cleanupAndClose); - }; - if ("opening" === this.readyState || "open" === this.readyState) { - this.readyState = "closing"; - if (this.writeBuffer.length) { - this.once("drain", function() { - if (_this6.upgrading) { - waitForUpgrade(); - } else { - close3(); - } - }); - } else if (this.upgrading) { - waitForUpgrade(); - } else { - close3(); - } + index3++; + if (match2 === "%c") { + lastC = index3; } - return this; + }); + args.splice(lastC, 0, c5); + } + exports3.log = console.debug || console.log || function() { + }; + function save(namespaces2) { + try { + if (namespaces2) { + exports3.storage.setItem("debug", namespaces2); + } else { + exports3.storage.removeItem("debug"); + } + } catch (error3) { } - /** - * Called upon transport error - * - * @private - */ - }, { - key: "onError", - value: function onError(err2) { - Socket2.priorWebsocketSuccess = false; - this.emitReserved("error", err2); - this.onClose("transport error", err2); + } + function load2() { + var r2; + try { + r2 = exports3.storage.getItem("debug"); + } catch (error3) { } - /** - * Called upon transport close. - * - * @private - */ - }, { - key: "onClose", - value: function onClose(reason, description) { - if ("opening" === this.readyState || "open" === this.readyState || "closing" === this.readyState) { - this.clearTimeoutFn(this.pingTimeoutTimer); - this.transport.removeAllListeners("close"); - this.transport.close(); - this.transport.removeAllListeners(); - if (typeof removeEventListener === "function") { - removeEventListener("beforeunload", this.beforeunloadEventListener, false); - removeEventListener("offline", this.offlineEventListener, false); - } - this.readyState = "closed"; - this.id = null; - this.emitReserved("close", reason, description); - this.writeBuffer = []; - this.prevBufferLen = 0; - } + if (!r2 && typeof import_process.default !== "undefined" && "env" in import_process.default) { + r2 = import_process.default.env.DEBUG; } - /** - * Filters upgrades, returning only those matching client transports. - * - * @param {Array} upgrades - server upgrades - * @private - */ - }, { - key: "filterUpgrades", - value: function filterUpgrades(upgrades) { - var filteredUpgrades = []; - var i3 = 0; - var j2 = upgrades.length; - for (; i3 < j2; i3++) { - if (~this.transports.indexOf(upgrades[i3])) filteredUpgrades.push(upgrades[i3]); - } - return filteredUpgrades; + return r2; + } + function localstorage() { + try { + return localStorage; + } catch (error3) { } - }]); - return Socket2; - }(Emitter2); - Socket$1.protocol = protocol$1; - Socket$1.protocol; + } + module3.exports = common3(exports3); + var formatters = module3.exports.formatters; + formatters.j = function(v) { + try { + return JSON.stringify(v); + } catch (error3) { + return "[UnexpectedJSONParseError]: " + error3.message; + } + }; + })(browser, browser.exports); + var browserExports = browser.exports; + var debugModule = /* @__PURE__ */ getDefaultExportFromCjs(browserExports); + var debug$3 = debugModule("socket.io-client:url"); function url(uri) { var path3 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""; var loc = arguments.length > 2 ? arguments[2] : void 0; @@ -343745,12 +344628,14 @@ ${config22.themeCSS}`; } } if (!/^(https?|wss?):\/\//.test(uri)) { + debug$3("protocol-less url %s", uri); if ("undefined" !== typeof loc) { uri = loc.protocol + "//" + uri; } else { uri = "https://" + uri; } } + debug$3("parse %s", uri); obj = parse10(uri); } if (!obj.port) { @@ -343868,10 +344753,15 @@ ${config22.themeCSS}`; } var RESERVED_EVENTS$1 = [ "connect", + // used on the client side "connect_error", + // used on the client side "disconnect", + // used on both sides "disconnecting", + // used on the server side "newListener", + // used by the Node.js EventEmitter "removeListener" // used by the Node.js EventEmitter ]; @@ -343888,241 +344778,223 @@ ${config22.themeCSS}`; })(PacketType || (PacketType = {})); var Encoder = /* @__PURE__ */ function() { function Encoder2(replacer) { - _classCallCheck2(this, Encoder2); this.replacer = replacer; } - _createClass2(Encoder2, [{ - key: "encode", - value: function encode2(obj) { - if (obj.type === PacketType.EVENT || obj.type === PacketType.ACK) { - if (hasBinary(obj)) { - return this.encodeAsBinary({ - type: obj.type === PacketType.EVENT ? PacketType.BINARY_EVENT : PacketType.BINARY_ACK, - nsp: obj.nsp, - data: obj.data, - id: obj.id - }); - } + var _proto = Encoder2.prototype; + _proto.encode = function encode2(obj) { + if (obj.type === PacketType.EVENT || obj.type === PacketType.ACK) { + if (hasBinary(obj)) { + return this.encodeAsBinary({ + type: obj.type === PacketType.EVENT ? PacketType.BINARY_EVENT : PacketType.BINARY_ACK, + nsp: obj.nsp, + data: obj.data, + id: obj.id + }); } - return [this.encodeAsString(obj)]; } - /** - * Encode packet as string. - */ - }, { - key: "encodeAsString", - value: function encodeAsString(obj) { - var str2 = "" + obj.type; - if (obj.type === PacketType.BINARY_EVENT || obj.type === PacketType.BINARY_ACK) { - str2 += obj.attachments + "-"; - } - if (obj.nsp && "/" !== obj.nsp) { - str2 += obj.nsp + ","; - } - if (null != obj.id) { - str2 += obj.id; - } - if (null != obj.data) { - str2 += JSON.stringify(obj.data, this.replacer); - } - return str2; + return [this.encodeAsString(obj)]; + }; + _proto.encodeAsString = function encodeAsString(obj) { + var str2 = "" + obj.type; + if (obj.type === PacketType.BINARY_EVENT || obj.type === PacketType.BINARY_ACK) { + str2 += obj.attachments + "-"; } - /** - * Encode packet as 'buffer sequence' by removing blobs, and - * deconstructing packet into object with placeholders and - * a list of buffers. - */ - }, { - key: "encodeAsBinary", - value: function encodeAsBinary(obj) { - var deconstruction = deconstructPacket(obj); - var pack = this.encodeAsString(deconstruction.packet); - var buffers = deconstruction.buffers; - buffers.unshift(pack); - return buffers; + if (obj.nsp && "/" !== obj.nsp) { + str2 += obj.nsp + ","; } - }]); + if (null != obj.id) { + str2 += obj.id; + } + if (null != obj.data) { + str2 += JSON.stringify(obj.data, this.replacer); + } + return str2; + }; + _proto.encodeAsBinary = function encodeAsBinary(obj) { + var deconstruction = deconstructPacket(obj); + var pack = this.encodeAsString(deconstruction.packet); + var buffers = deconstruction.buffers; + buffers.unshift(pack); + return buffers; + }; return Encoder2; }(); - function isObject5(value2) { - return Object.prototype.toString.call(value2) === "[object Object]"; - } var Decoder = /* @__PURE__ */ function(_Emitter) { - _inherits(Decoder2, _Emitter); - var _super = _createSuper(Decoder2); function Decoder2(reviver) { var _this; - _classCallCheck2(this, Decoder2); - _this = _super.call(this); + _this = _Emitter.call(this) || this; _this.reviver = reviver; return _this; } - _createClass2(Decoder2, [{ - key: "add", - value: function add3(obj) { - var packet; - if (typeof obj === "string") { - if (this.reconstructor) { - throw new Error("got plaintext data when reconstructing a packet"); - } - packet = this.decodeString(obj); - var isBinaryEvent = packet.type === PacketType.BINARY_EVENT; - if (isBinaryEvent || packet.type === PacketType.BINARY_ACK) { - packet.type = isBinaryEvent ? PacketType.EVENT : PacketType.ACK; - this.reconstructor = new BinaryReconstructor(packet); - if (packet.attachments === 0) { - _get(_getPrototypeOf(Decoder2.prototype), "emitReserved", this).call(this, "decoded", packet); - } - } else { - _get(_getPrototypeOf(Decoder2.prototype), "emitReserved", this).call(this, "decoded", packet); - } - } else if (isBinary2(obj) || obj.base64) { - if (!this.reconstructor) { - throw new Error("got binary data when not reconstructing a packet"); - } else { - packet = this.reconstructor.takeBinaryData(obj); - if (packet) { - this.reconstructor = null; - _get(_getPrototypeOf(Decoder2.prototype), "emitReserved", this).call(this, "decoded", packet); - } + _inheritsLoose(Decoder2, _Emitter); + var _proto2 = Decoder2.prototype; + _proto2.add = function add3(obj) { + var packet; + if (typeof obj === "string") { + if (this.reconstructor) { + throw new Error("got plaintext data when reconstructing a packet"); + } + packet = this.decodeString(obj); + var isBinaryEvent = packet.type === PacketType.BINARY_EVENT; + if (isBinaryEvent || packet.type === PacketType.BINARY_ACK) { + packet.type = isBinaryEvent ? PacketType.EVENT : PacketType.ACK; + this.reconstructor = new BinaryReconstructor(packet); + if (packet.attachments === 0) { + _Emitter.prototype.emitReserved.call(this, "decoded", packet); } } else { - throw new Error("Unknown type: " + obj); - } - } - /** - * Decode a packet String (JSON data) - * - * @param {String} str - * @return {Object} packet - */ - }, { - key: "decodeString", - value: function decodeString2(str2) { - var i3 = 0; - var p3 = { - type: Number(str2.charAt(0)) - }; - if (PacketType[p3.type] === void 0) { - throw new Error("unknown packet type " + p3.type); - } - if (p3.type === PacketType.BINARY_EVENT || p3.type === PacketType.BINARY_ACK) { - var start3 = i3 + 1; - while (str2.charAt(++i3) !== "-" && i3 != str2.length) { - } - var buf = str2.substring(start3, i3); - if (buf != Number(buf) || str2.charAt(i3) !== "-") { - throw new Error("Illegal attachments"); - } - p3.attachments = Number(buf); + _Emitter.prototype.emitReserved.call(this, "decoded", packet); } - if ("/" === str2.charAt(i3 + 1)) { - var _start = i3 + 1; - while (++i3) { - var c5 = str2.charAt(i3); - if ("," === c5) break; - if (i3 === str2.length) break; - } - p3.nsp = str2.substring(_start, i3); + } else if (isBinary2(obj) || obj.base64) { + if (!this.reconstructor) { + throw new Error("got binary data when not reconstructing a packet"); } else { - p3.nsp = "/"; - } - var next3 = str2.charAt(i3 + 1); - if ("" !== next3 && Number(next3) == next3) { - var _start2 = i3 + 1; - while (++i3) { - var _c = str2.charAt(i3); - if (null == _c || Number(_c) != _c) { - --i3; - break; - } - if (i3 === str2.length) break; - } - p3.id = Number(str2.substring(_start2, i3 + 1)); - } - if (str2.charAt(++i3)) { - var payload = this.tryParse(str2.substr(i3)); - if (Decoder2.isPayloadValid(p3.type, payload)) { - p3.data = payload; - } else { - throw new Error("invalid payload"); + packet = this.reconstructor.takeBinaryData(obj); + if (packet) { + this.reconstructor = null; + _Emitter.prototype.emitReserved.call(this, "decoded", packet); } } - return p3; + } else { + throw new Error("Unknown type: " + obj); } - }, { - key: "tryParse", - value: function tryParse(str2) { - try { - return JSON.parse(str2, this.reviver); - } catch (e3) { - return false; + }; + _proto2.decodeString = function decodeString2(str2) { + var i3 = 0; + var p3 = { + type: Number(str2.charAt(0)) + }; + if (PacketType[p3.type] === void 0) { + throw new Error("unknown packet type " + p3.type); + } + if (p3.type === PacketType.BINARY_EVENT || p3.type === PacketType.BINARY_ACK) { + var start3 = i3 + 1; + while (str2.charAt(++i3) !== "-" && i3 != str2.length) { + } + var buf = str2.substring(start3, i3); + if (buf != Number(buf) || str2.charAt(i3) !== "-") { + throw new Error("Illegal attachments"); } + p3.attachments = Number(buf); } - }, { - key: "destroy", - value: ( - /** - * Deallocates a parser's resources - */ - function destroy2() { - if (this.reconstructor) { - this.reconstructor.finishedReconstruction(); - this.reconstructor = null; + if ("/" === str2.charAt(i3 + 1)) { + var _start = i3 + 1; + while (++i3) { + var c5 = str2.charAt(i3); + if ("," === c5) break; + if (i3 === str2.length) break; + } + p3.nsp = str2.substring(_start, i3); + } else { + p3.nsp = "/"; + } + var next3 = str2.charAt(i3 + 1); + if ("" !== next3 && Number(next3) == next3) { + var _start2 = i3 + 1; + while (++i3) { + var _c = str2.charAt(i3); + if (null == _c || Number(_c) != _c) { + --i3; + break; } + if (i3 === str2.length) break; } - ) - }], [{ - key: "isPayloadValid", - value: function isPayloadValid(type3, payload) { - switch (type3) { - case PacketType.CONNECT: - return isObject5(payload); - case PacketType.DISCONNECT: - return payload === void 0; - case PacketType.CONNECT_ERROR: - return typeof payload === "string" || isObject5(payload); - case PacketType.EVENT: - case PacketType.BINARY_EVENT: - return Array.isArray(payload) && (typeof payload[0] === "number" || typeof payload[0] === "string" && RESERVED_EVENTS$1.indexOf(payload[0]) === -1); - case PacketType.ACK: - case PacketType.BINARY_ACK: - return Array.isArray(payload); + p3.id = Number(str2.substring(_start2, i3 + 1)); + } + if (str2.charAt(++i3)) { + var payload = this.tryParse(str2.substr(i3)); + if (Decoder2.isPayloadValid(p3.type, payload)) { + p3.data = payload; + } else { + throw new Error("invalid payload"); } } - }]); + return p3; + }; + _proto2.tryParse = function tryParse(str2) { + try { + return JSON.parse(str2, this.reviver); + } catch (e3) { + return false; + } + }; + Decoder2.isPayloadValid = function isPayloadValid(type3, payload) { + switch (type3) { + case PacketType.CONNECT: + return isObject5(payload); + case PacketType.DISCONNECT: + return payload === void 0; + case PacketType.CONNECT_ERROR: + return typeof payload === "string" || isObject5(payload); + case PacketType.EVENT: + case PacketType.BINARY_EVENT: + return Array.isArray(payload) && (typeof payload[0] === "number" || typeof payload[0] === "string" && RESERVED_EVENTS$1.indexOf(payload[0]) === -1); + case PacketType.ACK: + case PacketType.BINARY_ACK: + return Array.isArray(payload); + } + }; + _proto2.destroy = function destroy2() { + if (this.reconstructor) { + this.reconstructor.finishedReconstruction(); + this.reconstructor = null; + } + }; return Decoder2; }(Emitter2); var BinaryReconstructor = /* @__PURE__ */ function() { function BinaryReconstructor2(packet) { - _classCallCheck2(this, BinaryReconstructor2); this.packet = packet; this.buffers = []; this.reconPack = packet; } - _createClass2(BinaryReconstructor2, [{ - key: "takeBinaryData", - value: function takeBinaryData(binData) { - this.buffers.push(binData); - if (this.buffers.length === this.reconPack.attachments) { - var packet = reconstructPacket(this.reconPack, this.buffers); - this.finishedReconstruction(); - return packet; - } - return null; - } - /** - * Cleans up binary packet reconstruction variables. - */ - }, { - key: "finishedReconstruction", - value: function finishedReconstruction() { - this.reconPack = null; - this.buffers = []; + var _proto3 = BinaryReconstructor2.prototype; + _proto3.takeBinaryData = function takeBinaryData(binData) { + this.buffers.push(binData); + if (this.buffers.length === this.reconPack.attachments) { + var packet = reconstructPacket(this.reconPack, this.buffers); + this.finishedReconstruction(); + return packet; } - }]); + return null; + }; + _proto3.finishedReconstruction = function finishedReconstruction() { + this.reconPack = null; + this.buffers = []; + }; return BinaryReconstructor2; }(); + function isNamespaceValid(nsp) { + return typeof nsp === "string"; + } + var isInteger2 = Number.isInteger || function(value2) { + return typeof value2 === "number" && isFinite(value2) && Math.floor(value2) === value2; + }; + function isAckIdValid(id4) { + return id4 === void 0 || isInteger2(id4); + } + function isObject5(value2) { + return Object.prototype.toString.call(value2) === "[object Object]"; + } + function isDataValid(type3, payload) { + switch (type3) { + case PacketType.CONNECT: + return payload === void 0 || isObject5(payload); + case PacketType.DISCONNECT: + return payload === void 0; + case PacketType.EVENT: + return Array.isArray(payload) && (typeof payload[0] === "number" || typeof payload[0] === "string" && RESERVED_EVENTS$1.indexOf(payload[0]) === -1); + case PacketType.ACK: + return Array.isArray(payload); + case PacketType.CONNECT_ERROR: + return typeof payload === "string" || isObject5(payload); + default: + return false; + } + } + function isPacketValid(packet) { + return isNamespaceValid(packet.nsp) && isAckIdValid(packet.id) && isDataValid(packet.type, packet.data); + } var parser21 = /* @__PURE__ */ Object.freeze({ __proto__: null, protocol, @@ -344130,7 +345002,8 @@ ${config22.themeCSS}`; return PacketType; }, Encoder, - Decoder + Decoder, + isPacketValid }); function on4(obj, ev, fn4) { obj.on(ev, fn4); @@ -344138,6 +345011,7 @@ ${config22.themeCSS}`; obj.off(ev, fn4); }; } + var debug$2 = debugModule("socket.io-client:socket"); var RESERVED_EVENTS = Object.freeze({ connect: 1, connect_error: 1, @@ -344148,12 +345022,9 @@ ${config22.themeCSS}`; removeListener: 1 }); var Socket = /* @__PURE__ */ function(_Emitter) { - _inherits(Socket2, _Emitter); - var _super = _createSuper(Socket2); function Socket2(io, nsp, opts) { var _this; - _classCallCheck2(this, Socket2); - _this = _super.call(this); + _this = _Emitter.call(this) || this; _this.connected = false; _this.recovered = false; _this.receiveBuffer = []; @@ -344172,853 +345043,472 @@ ${config22.themeCSS}`; if (_this.io._autoConnect) _this.open(); return _this; } - _createClass2(Socket2, [{ - key: "disconnected", - get: function get7() { - return !this.connected; + _inheritsLoose(Socket2, _Emitter); + var _proto = Socket2.prototype; + _proto.subEvents = function subEvents() { + if (this.subs) return; + var io = this.io; + this.subs = [on4(io, "open", this.onopen.bind(this)), on4(io, "packet", this.onpacket.bind(this)), on4(io, "error", this.onerror.bind(this)), on4(io, "close", this.onclose.bind(this))]; + }; + _proto.connect = function connect() { + if (this.connected) return this; + this.subEvents(); + if (!this.io["_reconnecting"]) this.io.open(); + if ("open" === this.io._readyState) this.onopen(); + return this; + }; + _proto.open = function open2() { + return this.connect(); + }; + _proto.send = function send() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; } - /** - * Subscribe to open, close and packet events - * - * @private - */ - }, { - key: "subEvents", - value: function subEvents() { - if (this.subs) return; - var io = this.io; - this.subs = [on4(io, "open", this.onopen.bind(this)), on4(io, "packet", this.onpacket.bind(this)), on4(io, "error", this.onerror.bind(this)), on4(io, "close", this.onclose.bind(this))]; + args.unshift("message"); + this.emit.apply(this, args); + return this; + }; + _proto.emit = function emit3(ev) { + var _a3, _b2, _c; + if (RESERVED_EVENTS.hasOwnProperty(ev)) { + throw new Error('"' + ev.toString() + '" is a reserved event name'); } - /** - * Whether the Socket will try to reconnect when its Manager connects or reconnects. - * - * @example - * const socket = io(); - * - * console.log(socket.active); // true - * - * socket.on("disconnect", (reason) => { - * if (reason === "io server disconnect") { - * // the disconnection was initiated by the server, you need to manually reconnect - * console.log(socket.active); // false - * } - * // else the socket will automatically try to reconnect - * console.log(socket.active); // true - * }); - */ - }, { - key: "active", - get: function get7() { - return !!this.subs; + for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + args[_key2 - 1] = arguments[_key2]; } - /** - * "Opens" the socket. - * - * @example - * const socket = io({ - * autoConnect: false - * }); - * - * socket.connect(); - */ - }, { - key: "connect", - value: function connect() { - if (this.connected) return this; - this.subEvents(); - if (!this.io["_reconnecting"]) this.io.open(); - if ("open" === this.io._readyState) this.onopen(); + args.unshift(ev); + if (this._opts.retries && !this.flags.fromQueue && !this.flags["volatile"]) { + this._addToQueue(args); return this; } - /** - * Alias for {@link connect()}. - */ - }, { - key: "open", - value: function open2() { - return this.connect(); + var packet = { + type: PacketType.EVENT, + data: args + }; + packet.options = {}; + packet.options.compress = this.flags.compress !== false; + if ("function" === typeof args[args.length - 1]) { + var id4 = this.ids++; + debug$2("emitting packet with ack id %d", id4); + var ack = args.pop(); + this._registerAckCallback(id4, ack); + packet.id = id4; + } + var isTransportWritable = (_b2 = (_a3 = this.io.engine) === null || _a3 === void 0 ? void 0 : _a3.transport) === null || _b2 === void 0 ? void 0 : _b2.writable; + var isConnected = this.connected && !((_c = this.io.engine) === null || _c === void 0 ? void 0 : _c._hasPingExpired()); + var discardPacket = this.flags["volatile"] && !isTransportWritable; + if (discardPacket) { + debug$2("discard packet as the transport is not currently writable"); + } else if (isConnected) { + this.notifyOutgoingListeners(packet); + this.packet(packet); + } else { + this.sendBuffer.push(packet); } - /** - * Sends a `message` event. - * - * This method mimics the WebSocket.send() method. - * - * @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send - * - * @example - * socket.send("hello"); - * - * // this is equivalent to - * socket.emit("message", "hello"); - * - * @return self - */ - }, { - key: "send", - value: function send() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - args.unshift("message"); - this.emit.apply(this, args); - return this; + this.flags = {}; + return this; + }; + _proto._registerAckCallback = function _registerAckCallback(id4, ack) { + var _this2 = this; + var _a3; + var timeout2 = (_a3 = this.flags.timeout) !== null && _a3 !== void 0 ? _a3 : this._opts.ackTimeout; + if (timeout2 === void 0) { + this.acks[id4] = ack; + return; } - /** - * Override `emit`. - * If the event is in `events`, it's emitted normally. - * - * @example - * socket.emit("hello", "world"); - * - * // all serializable datastructures are supported (no need to call JSON.stringify) - * socket.emit("hello", 1, "2", { 3: ["4"], 5: Uint8Array.from([6]) }); - * - * // with an acknowledgement from the server - * socket.emit("hello", "world", (val) => { - * // ... - * }); - * - * @return self - */ - }, { - key: "emit", - value: function emit3(ev) { - if (RESERVED_EVENTS.hasOwnProperty(ev)) { - throw new Error('"' + ev.toString() + '" is a reserved event name'); - } - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - args.unshift(ev); - if (this._opts.retries && !this.flags.fromQueue && !this.flags["volatile"]) { - this._addToQueue(args); - return this; + var timer2 = this.io.setTimeoutFn(function() { + delete _this2.acks[id4]; + for (var i3 = 0; i3 < _this2.sendBuffer.length; i3++) { + if (_this2.sendBuffer[i3].id === id4) { + debug$2("removing packet with ack id %d from the buffer", id4); + _this2.sendBuffer.splice(i3, 1); + } } - var packet = { - type: PacketType.EVENT, - data: args - }; - packet.options = {}; - packet.options.compress = this.flags.compress !== false; - if ("function" === typeof args[args.length - 1]) { - var id4 = this.ids++; - var ack = args.pop(); - this._registerAckCallback(id4, ack); - packet.id = id4; - } - var isTransportWritable = this.io.engine && this.io.engine.transport && this.io.engine.transport.writable; - var discardPacket = this.flags["volatile"] && (!isTransportWritable || !this.connected); - if (discardPacket) ; - else if (this.connected) { - this.notifyOutgoingListeners(packet); - this.packet(packet); - } else { - this.sendBuffer.push(packet); + debug$2("event with ack id %d has timed out after %d ms", id4, timeout2); + ack.call(_this2, new Error("operation has timed out")); + }, timeout2); + var fn4 = function fn5() { + _this2.io.clearTimeoutFn(timer2); + for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + args[_key3] = arguments[_key3]; } - this.flags = {}; - return this; + ack.apply(_this2, args); + }; + fn4.withError = true; + this.acks[id4] = fn4; + }; + _proto.emitWithAck = function emitWithAck(ev) { + var _this3 = this; + for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { + args[_key4 - 1] = arguments[_key4]; } - /** - * @private - */ - }, { - key: "_registerAckCallback", - value: function _registerAckCallback(id4, ack) { - var _this2 = this; - var _a3; - var timeout2 = (_a3 = this.flags.timeout) !== null && _a3 !== void 0 ? _a3 : this._opts.ackTimeout; - if (timeout2 === void 0) { - this.acks[id4] = ack; - return; - } - var timer2 = this.io.setTimeoutFn(function() { - delete _this2.acks[id4]; - for (var i3 = 0; i3 < _this2.sendBuffer.length; i3++) { - if (_this2.sendBuffer[i3].id === id4) { - _this2.sendBuffer.splice(i3, 1); - } - } - ack.call(_this2, new Error("operation has timed out")); - }, timeout2); - var fn4 = function fn5() { - _this2.io.clearTimeoutFn(timer2); - for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - args[_key3] = arguments[_key3]; - } - ack.apply(_this2, args); + return new Promise(function(resolve3, reject2) { + var fn4 = function fn5(arg1, arg2) { + return arg1 ? reject2(arg1) : resolve3(arg2); }; fn4.withError = true; - this.acks[id4] = fn4; - } - /** - * Emits an event and waits for an acknowledgement - * - * @example - * // without timeout - * const response = await socket.emitWithAck("hello", "world"); - * - * // with a specific timeout - * try { - * const response = await socket.timeout(1000).emitWithAck("hello", "world"); - * } catch (err) { - * // the server did not acknowledge the event in the given delay - * } - * - * @return a Promise that will be fulfilled when the server acknowledges the event - */ - }, { - key: "emitWithAck", - value: function emitWithAck(ev) { - var _this3 = this; - for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { - args[_key4 - 1] = arguments[_key4]; - } - return new Promise(function(resolve3, reject2) { - var fn4 = function fn5(arg1, arg2) { - return arg1 ? reject2(arg1) : resolve3(arg2); - }; - fn4.withError = true; - args.push(fn4); - _this3.emit.apply(_this3, [ev].concat(args)); - }); - } - /** - * Add the packet to the queue. - * @param args - * @private - */ - }, { - key: "_addToQueue", - value: function _addToQueue(args) { - var _this4 = this; - var ack; - if (typeof args[args.length - 1] === "function") { - ack = args.pop(); - } - var packet = { - id: this._queueSeq++, - tryCount: 0, - pending: false, - args, - flags: _extends({ - fromQueue: true - }, this.flags) - }; - args.push(function(err2) { - if (packet !== _this4._queue[0]) { - return; - } - var hasError = err2 !== null; - if (hasError) { - if (packet.tryCount > _this4._opts.retries) { - _this4._queue.shift(); - if (ack) { - ack(err2); - } - } - } else { + args.push(fn4); + _this3.emit.apply(_this3, [ev].concat(args)); + }); + }; + _proto._addToQueue = function _addToQueue(args) { + var _this4 = this; + var ack; + if (typeof args[args.length - 1] === "function") { + ack = args.pop(); + } + var packet = { + id: this._queueSeq++, + tryCount: 0, + pending: false, + args, + flags: _extends({ + fromQueue: true + }, this.flags) + }; + args.push(function(err2) { + if (packet !== _this4._queue[0]) { + return; + } + var hasError = err2 !== null; + if (hasError) { + if (packet.tryCount > _this4._opts.retries) { + debug$2("packet [%d] is discarded after %d tries", packet.id, packet.tryCount); _this4._queue.shift(); if (ack) { - for (var _len5 = arguments.length, responseArgs = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { - responseArgs[_key5 - 1] = arguments[_key5]; - } - ack.apply(void 0, [null].concat(responseArgs)); + ack(err2); } } - packet.pending = false; - return _this4._drainQueue(); - }); - this._queue.push(packet); - this._drainQueue(); - } - /** - * Send the first packet of the queue, and wait for an acknowledgement from the server. - * @param force - whether to resend a packet that has not been acknowledged yet - * - * @private - */ - }, { - key: "_drainQueue", - value: function _drainQueue() { - var force = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false; - if (!this.connected || this._queue.length === 0) { - return; - } - var packet = this._queue[0]; - if (packet.pending && !force) { - return; - } - packet.pending = true; - packet.tryCount++; - this.flags = packet.flags; - this.emit.apply(this, packet.args); - } - /** - * Sends a packet. - * - * @param packet - * @private - */ - }, { - key: "packet", - value: function packet(_packet) { - _packet.nsp = this.nsp; - this.io._packet(_packet); - } - /** - * Called upon engine `open`. - * - * @private - */ - }, { - key: "onopen", - value: function onopen() { - var _this5 = this; - if (typeof this.auth == "function") { - this.auth(function(data4) { - _this5._sendConnectPacket(data4); - }); } else { - this._sendConnectPacket(this.auth); - } - } - /** - * Sends a CONNECT packet to initiate the Socket.IO session. - * - * @param data - * @private - */ - }, { - key: "_sendConnectPacket", - value: function _sendConnectPacket(data4) { - this.packet({ - type: PacketType.CONNECT, - data: this._pid ? _extends({ - pid: this._pid, - offset: this._lastOffset - }, data4) : data4 - }); - } - /** - * Called upon engine or manager `error`. - * - * @param err - * @private - */ - }, { - key: "onerror", - value: function onerror(err2) { - if (!this.connected) { - this.emitReserved("connect_error", err2); + debug$2("packet [%d] was successfully sent", packet.id); + _this4._queue.shift(); + if (ack) { + for (var _len5 = arguments.length, responseArgs = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { + responseArgs[_key5 - 1] = arguments[_key5]; + } + ack.apply(void 0, [null].concat(responseArgs)); + } } + packet.pending = false; + return _this4._drainQueue(); + }); + this._queue.push(packet); + this._drainQueue(); + }; + _proto._drainQueue = function _drainQueue() { + var force = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false; + debug$2("draining queue"); + if (!this.connected || this._queue.length === 0) { + return; } - /** - * Called upon engine `close`. - * - * @param reason - * @param description - * @private - */ - }, { - key: "onclose", - value: function onclose(reason, description) { - this.connected = false; - delete this.id; - this.emitReserved("disconnect", reason, description); - this._clearAcks(); + var packet = this._queue[0]; + if (packet.pending && !force) { + debug$2("packet [%d] has already been sent and is waiting for an ack", packet.id); + return; } - /** - * Clears the acknowledgement handlers upon disconnection, since the client will never receive an acknowledgement from - * the server. - * - * @private - */ - }, { - key: "_clearAcks", - value: function _clearAcks() { - var _this6 = this; - Object.keys(this.acks).forEach(function(id4) { - var isBuffered = _this6.sendBuffer.some(function(packet) { - return String(packet.id) === id4; - }); - if (!isBuffered) { - var ack = _this6.acks[id4]; - delete _this6.acks[id4]; - if (ack.withError) { - ack.call(_this6, new Error("socket has been disconnected")); - } - } + packet.pending = true; + packet.tryCount++; + debug$2("sending packet [%d] (try n\xB0%d)", packet.id, packet.tryCount); + this.flags = packet.flags; + this.emit.apply(this, packet.args); + }; + _proto.packet = function packet(_packet) { + _packet.nsp = this.nsp; + this.io._packet(_packet); + }; + _proto.onopen = function onopen() { + var _this5 = this; + debug$2("transport is open - connecting"); + if (typeof this.auth == "function") { + this.auth(function(data4) { + _this5._sendConnectPacket(data4); }); + } else { + this._sendConnectPacket(this.auth); } - /** - * Called with socket packet. - * - * @param packet - * @private - */ - }, { - key: "onpacket", - value: function onpacket(packet) { - var sameNamespace = packet.nsp === this.nsp; - if (!sameNamespace) return; - switch (packet.type) { - case PacketType.CONNECT: - if (packet.data && packet.data.sid) { - this.onconnect(packet.data.sid, packet.data.pid); - } else { - this.emitReserved("connect_error", new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)")); - } - break; - case PacketType.EVENT: - case PacketType.BINARY_EVENT: - this.onevent(packet); - break; - case PacketType.ACK: - case PacketType.BINARY_ACK: - this.onack(packet); - break; - case PacketType.DISCONNECT: - this.ondisconnect(); - break; - case PacketType.CONNECT_ERROR: - this.destroy(); - var err2 = new Error(packet.data.message); - err2.data = packet.data.data; - this.emitReserved("connect_error", err2); - break; - } - } - /** - * Called upon a server event. - * - * @param packet - * @private - */ - }, { - key: "onevent", - value: function onevent(packet) { - var args = packet.data || []; - if (null != packet.id) { - args.push(this.ack(packet.id)); - } - if (this.connected) { - this.emitEvent(args); - } else { - this.receiveBuffer.push(Object.freeze(args)); - } + }; + _proto._sendConnectPacket = function _sendConnectPacket(data4) { + this.packet({ + type: PacketType.CONNECT, + data: this._pid ? _extends({ + pid: this._pid, + offset: this._lastOffset + }, data4) : data4 + }); + }; + _proto.onerror = function onerror(err2) { + if (!this.connected) { + this.emitReserved("connect_error", err2); } - }, { - key: "emitEvent", - value: function emitEvent(args) { - if (this._anyListeners && this._anyListeners.length) { - var listeners = this._anyListeners.slice(); - var _iterator = _createForOfIteratorHelper2(listeners), _step; - try { - for (_iterator.s(); !(_step = _iterator.n()).done; ) { - var listener = _step.value; - listener.apply(this, args); - } - } catch (err2) { - _iterator.e(err2); - } finally { - _iterator.f(); + }; + _proto.onclose = function onclose(reason, description) { + debug$2("close (%s)", reason); + this.connected = false; + delete this.id; + this.emitReserved("disconnect", reason, description); + this._clearAcks(); + }; + _proto._clearAcks = function _clearAcks() { + var _this6 = this; + Object.keys(this.acks).forEach(function(id4) { + var isBuffered = _this6.sendBuffer.some(function(packet) { + return String(packet.id) === id4; + }); + if (!isBuffered) { + var ack = _this6.acks[id4]; + delete _this6.acks[id4]; + if (ack.withError) { + ack.call(_this6, new Error("socket has been disconnected")); } } - _get(_getPrototypeOf(Socket2.prototype), "emit", this).apply(this, args); - if (this._pid && args.length && typeof args[args.length - 1] === "string") { - this._lastOffset = args[args.length - 1]; - } + }); + }; + _proto.onpacket = function onpacket(packet) { + var sameNamespace = packet.nsp === this.nsp; + if (!sameNamespace) return; + switch (packet.type) { + case PacketType.CONNECT: + if (packet.data && packet.data.sid) { + this.onconnect(packet.data.sid, packet.data.pid); + } else { + this.emitReserved("connect_error", new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)")); + } + break; + case PacketType.EVENT: + case PacketType.BINARY_EVENT: + this.onevent(packet); + break; + case PacketType.ACK: + case PacketType.BINARY_ACK: + this.onack(packet); + break; + case PacketType.DISCONNECT: + this.ondisconnect(); + break; + case PacketType.CONNECT_ERROR: + this.destroy(); + var err2 = new Error(packet.data.message); + err2.data = packet.data.data; + this.emitReserved("connect_error", err2); + break; } - /** - * Produces an ack callback to emit with an event. - * - * @private - */ - }, { - key: "ack", - value: function ack(id4) { - var self2 = this; - var sent = false; - return function() { - if (sent) return; - sent = true; - for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { - args[_key6] = arguments[_key6]; - } - self2.packet({ - type: PacketType.ACK, - id: id4, - data: args - }); - }; + }; + _proto.onevent = function onevent(packet) { + var args = packet.data || []; + debug$2("emitting event %j", args); + if (null != packet.id) { + debug$2("attaching ack callback to event"); + args.push(this.ack(packet.id)); + } + if (this.connected) { + this.emitEvent(args); + } else { + this.receiveBuffer.push(Object.freeze(args)); } - /** - * Called upon a server acknowledgement. - * - * @param packet - * @private - */ - }, { - key: "onack", - value: function onack(packet) { - var ack = this.acks[packet.id]; - if (typeof ack !== "function") { - return; - } - delete this.acks[packet.id]; - if (ack.withError) { - packet.data.unshift(null); + }; + _proto.emitEvent = function emitEvent(args) { + if (this._anyListeners && this._anyListeners.length) { + var listeners = this._anyListeners.slice(); + var _iterator = _createForOfIteratorHelper2(listeners), _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done; ) { + var listener = _step.value; + listener.apply(this, args); + } + } catch (err2) { + _iterator.e(err2); + } finally { + _iterator.f(); } - ack.apply(this, packet.data); } - /** - * Called upon server connect. - * - * @private - */ - }, { - key: "onconnect", - value: function onconnect(id4, pid) { - this.id = id4; - this.recovered = pid && this._pid === pid; - this._pid = pid; - this.connected = true; - this.emitBuffered(); - this.emitReserved("connect"); - this._drainQueue(true); + _Emitter.prototype.emit.apply(this, args); + if (this._pid && args.length && typeof args[args.length - 1] === "string") { + this._lastOffset = args[args.length - 1]; } - /** - * Emit buffered events (received and emitted). - * - * @private - */ - }, { - key: "emitBuffered", - value: function emitBuffered() { - var _this7 = this; - this.receiveBuffer.forEach(function(args) { - return _this7.emitEvent(args); - }); - this.receiveBuffer = []; - this.sendBuffer.forEach(function(packet) { - _this7.notifyOutgoingListeners(packet); - _this7.packet(packet); + }; + _proto.ack = function ack(id4) { + var self2 = this; + var sent = false; + return function() { + if (sent) return; + sent = true; + for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { + args[_key6] = arguments[_key6]; + } + debug$2("sending ack %j", args); + self2.packet({ + type: PacketType.ACK, + id: id4, + data: args }); - this.sendBuffer = []; - } - /** - * Called upon server disconnect. - * - * @private - */ - }, { - key: "ondisconnect", - value: function ondisconnect() { - this.destroy(); - this.onclose("io server disconnect"); - } - /** - * Called upon forced client/server side disconnections, - * this method ensures the manager stops tracking us and - * that reconnections don't get triggered for this. - * - * @private - */ - }, { - key: "destroy", - value: function destroy2() { - if (this.subs) { - this.subs.forEach(function(subDestroy) { - return subDestroy(); - }); - this.subs = void 0; - } - this.io["_destroy"](this); - } - /** - * Disconnects the socket manually. In that case, the socket will not try to reconnect. - * - * If this is the last active Socket instance of the {@link Manager}, the low-level connection will be closed. - * - * @example - * const socket = io(); - * - * socket.on("disconnect", (reason) => { - * // console.log(reason); prints "io client disconnect" - * }); - * - * socket.disconnect(); - * - * @return self - */ - }, { - key: "disconnect", - value: function disconnect() { - if (this.connected) { - this.packet({ - type: PacketType.DISCONNECT - }); - } - this.destroy(); - if (this.connected) { - this.onclose("io client disconnect"); - } - return this; - } - /** - * Alias for {@link disconnect()}. - * - * @return self - */ - }, { - key: "close", - value: function close2() { - return this.disconnect(); + }; + }; + _proto.onack = function onack(packet) { + var ack = this.acks[packet.id]; + if (typeof ack !== "function") { + debug$2("bad ack %s", packet.id); + return; } - /** - * Sets the compress flag. - * - * @example - * socket.compress(false).emit("hello"); - * - * @param compress - if `true`, compresses the sending data - * @return self - */ - }, { - key: "compress", - value: function compress(_compress) { - this.flags.compress = _compress; - return this; + delete this.acks[packet.id]; + debug$2("calling ack %s with %j", packet.id, packet.data); + if (ack.withError) { + packet.data.unshift(null); } - /** - * Sets a modifier for a subsequent event emission that the event message will be dropped when this socket is not - * ready to send messages. - * - * @example - * socket.volatile.emit("hello"); // the server may or may not receive it - * - * @returns self - */ - }, { - key: "volatile", - get: function get7() { - this.flags["volatile"] = true; - return this; + ack.apply(this, packet.data); + }; + _proto.onconnect = function onconnect(id4, pid) { + debug$2("socket connected with id %s", id4); + this.id = id4; + this.recovered = pid && this._pid === pid; + this._pid = pid; + this.connected = true; + this.emitBuffered(); + this.emitReserved("connect"); + this._drainQueue(true); + }; + _proto.emitBuffered = function emitBuffered() { + var _this7 = this; + this.receiveBuffer.forEach(function(args) { + return _this7.emitEvent(args); + }); + this.receiveBuffer = []; + this.sendBuffer.forEach(function(packet) { + _this7.notifyOutgoingListeners(packet); + _this7.packet(packet); + }); + this.sendBuffer = []; + }; + _proto.ondisconnect = function ondisconnect() { + debug$2("server disconnect (%s)", this.nsp); + this.destroy(); + this.onclose("io server disconnect"); + }; + _proto.destroy = function destroy2() { + if (this.subs) { + this.subs.forEach(function(subDestroy) { + return subDestroy(); + }); + this.subs = void 0; } - /** - * Sets a modifier for a subsequent event emission that the callback will be called with an error when the - * given number of milliseconds have elapsed without an acknowledgement from the server: - * - * @example - * socket.timeout(5000).emit("my-event", (err) => { - * if (err) { - * // the server did not acknowledge the event in the given delay - * } - * }); - * - * @returns self - */ - }, { - key: "timeout", - value: function timeout2(_timeout) { - this.flags.timeout = _timeout; - return this; + this.io["_destroy"](this); + }; + _proto.disconnect = function disconnect() { + if (this.connected) { + debug$2("performing disconnect (%s)", this.nsp); + this.packet({ + type: PacketType.DISCONNECT + }); } - /** - * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the - * callback. - * - * @example - * socket.onAny((event, ...args) => { - * console.log(`got ${event}`); - * }); - * - * @param listener - */ - }, { - key: "onAny", - value: function onAny(listener) { - this._anyListeners = this._anyListeners || []; - this._anyListeners.push(listener); - return this; + this.destroy(); + if (this.connected) { + this.onclose("io client disconnect"); } - /** - * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the - * callback. The listener is added to the beginning of the listeners array. - * - * @example - * socket.prependAny((event, ...args) => { - * console.log(`got event ${event}`); - * }); - * - * @param listener - */ - }, { - key: "prependAny", - value: function prependAny(listener) { - this._anyListeners = this._anyListeners || []; - this._anyListeners.unshift(listener); + return this; + }; + _proto.close = function close2() { + return this.disconnect(); + }; + _proto.compress = function compress(_compress) { + this.flags.compress = _compress; + return this; + }; + _proto.timeout = function timeout2(_timeout) { + this.flags.timeout = _timeout; + return this; + }; + _proto.onAny = function onAny(listener) { + this._anyListeners = this._anyListeners || []; + this._anyListeners.push(listener); + return this; + }; + _proto.prependAny = function prependAny(listener) { + this._anyListeners = this._anyListeners || []; + this._anyListeners.unshift(listener); + return this; + }; + _proto.offAny = function offAny(listener) { + if (!this._anyListeners) { return this; } - /** - * Removes the listener that will be fired when any event is emitted. - * - * @example - * const catchAllListener = (event, ...args) => { - * console.log(`got event ${event}`); - * } - * - * socket.onAny(catchAllListener); - * - * // remove a specific listener - * socket.offAny(catchAllListener); - * - * // or remove all listeners - * socket.offAny(); - * - * @param listener - */ - }, { - key: "offAny", - value: function offAny(listener) { - if (!this._anyListeners) { - return this; - } - if (listener) { - var listeners = this._anyListeners; - for (var i3 = 0; i3 < listeners.length; i3++) { - if (listener === listeners[i3]) { - listeners.splice(i3, 1); - return this; - } + if (listener) { + var listeners = this._anyListeners; + for (var i3 = 0; i3 < listeners.length; i3++) { + if (listener === listeners[i3]) { + listeners.splice(i3, 1); + return this; } - } else { - this._anyListeners = []; } - return this; - } - /** - * Returns an array of listeners that are listening for any event that is specified. This array can be manipulated, - * e.g. to remove listeners. - */ - }, { - key: "listenersAny", - value: function listenersAny() { - return this._anyListeners || []; - } - /** - * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the - * callback. - * - * Note: acknowledgements sent to the server are not included. - * - * @example - * socket.onAnyOutgoing((event, ...args) => { - * console.log(`sent event ${event}`); - * }); - * - * @param listener - */ - }, { - key: "onAnyOutgoing", - value: function onAnyOutgoing(listener) { - this._anyOutgoingListeners = this._anyOutgoingListeners || []; - this._anyOutgoingListeners.push(listener); - return this; + } else { + this._anyListeners = []; } - /** - * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the - * callback. The listener is added to the beginning of the listeners array. - * - * Note: acknowledgements sent to the server are not included. - * - * @example - * socket.prependAnyOutgoing((event, ...args) => { - * console.log(`sent event ${event}`); - * }); - * - * @param listener - */ - }, { - key: "prependAnyOutgoing", - value: function prependAnyOutgoing(listener) { - this._anyOutgoingListeners = this._anyOutgoingListeners || []; - this._anyOutgoingListeners.unshift(listener); + return this; + }; + _proto.listenersAny = function listenersAny() { + return this._anyListeners || []; + }; + _proto.onAnyOutgoing = function onAnyOutgoing(listener) { + this._anyOutgoingListeners = this._anyOutgoingListeners || []; + this._anyOutgoingListeners.push(listener); + return this; + }; + _proto.prependAnyOutgoing = function prependAnyOutgoing(listener) { + this._anyOutgoingListeners = this._anyOutgoingListeners || []; + this._anyOutgoingListeners.unshift(listener); + return this; + }; + _proto.offAnyOutgoing = function offAnyOutgoing(listener) { + if (!this._anyOutgoingListeners) { return this; } - /** - * Removes the listener that will be fired when any event is emitted. - * - * @example - * const catchAllListener = (event, ...args) => { - * console.log(`sent event ${event}`); - * } - * - * socket.onAnyOutgoing(catchAllListener); - * - * // remove a specific listener - * socket.offAnyOutgoing(catchAllListener); - * - * // or remove all listeners - * socket.offAnyOutgoing(); - * - * @param [listener] - the catch-all listener (optional) - */ - }, { - key: "offAnyOutgoing", - value: function offAnyOutgoing(listener) { - if (!this._anyOutgoingListeners) { - return this; + if (listener) { + var listeners = this._anyOutgoingListeners; + for (var i3 = 0; i3 < listeners.length; i3++) { + if (listener === listeners[i3]) { + listeners.splice(i3, 1); + return this; + } } - if (listener) { - var listeners = this._anyOutgoingListeners; - for (var i3 = 0; i3 < listeners.length; i3++) { - if (listener === listeners[i3]) { - listeners.splice(i3, 1); - return this; - } + } else { + this._anyOutgoingListeners = []; + } + return this; + }; + _proto.listenersAnyOutgoing = function listenersAnyOutgoing() { + return this._anyOutgoingListeners || []; + }; + _proto.notifyOutgoingListeners = function notifyOutgoingListeners(packet) { + if (this._anyOutgoingListeners && this._anyOutgoingListeners.length) { + var listeners = this._anyOutgoingListeners.slice(); + var _iterator2 = _createForOfIteratorHelper2(listeners), _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { + var listener = _step2.value; + listener.apply(this, packet.data); } - } else { - this._anyOutgoingListeners = []; + } catch (err2) { + _iterator2.e(err2); + } finally { + _iterator2.f(); } - return this; } - /** - * Returns an array of listeners that are listening for any event that is specified. This array can be manipulated, - * e.g. to remove listeners. - */ + }; + return _createClass2(Socket2, [{ + key: "disconnected", + get: function get7() { + return !this.connected; + } }, { - key: "listenersAnyOutgoing", - value: function listenersAnyOutgoing() { - return this._anyOutgoingListeners || []; + key: "active", + get: function get7() { + return !!this.subs; } - /** - * Notify the listeners for each packet sent - * - * @param packet - * - * @private - */ }, { - key: "notifyOutgoingListeners", - value: function notifyOutgoingListeners(packet) { - if (this._anyOutgoingListeners && this._anyOutgoingListeners.length) { - var listeners = this._anyOutgoingListeners.slice(); - var _iterator2 = _createForOfIteratorHelper2(listeners), _step2; - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { - var listener = _step2.value; - listener.apply(this, packet.data); - } - } catch (err2) { - _iterator2.e(err2); - } finally { - _iterator2.f(); - } - } + key: "volatile", + get: function get7() { + this.flags["volatile"] = true; + return this; } }]); - return Socket2; }(Emitter2); function Backoff(opts) { opts = opts || {}; @@ -345029,13 +345519,13 @@ ${config22.themeCSS}`; this.attempts = 0; } Backoff.prototype.duration = function() { - var ms3 = this.ms * Math.pow(this.factor, this.attempts++); + var ms4 = this.ms * Math.pow(this.factor, this.attempts++); if (this.jitter) { var rand = Math.random(); - var deviation = Math.floor(rand * this.jitter * ms3); - ms3 = (Math.floor(rand * 10) & 1) == 0 ? ms3 - deviation : ms3 + deviation; + var deviation = Math.floor(rand * this.jitter * ms4); + ms4 = (Math.floor(rand * 10) & 1) == 0 ? ms4 - deviation : ms4 + deviation; } - return Math.min(ms3, this.max) | 0; + return Math.min(ms4, this.max) | 0; }; Backoff.prototype.reset = function() { this.attempts = 0; @@ -345049,14 +345539,12 @@ ${config22.themeCSS}`; Backoff.prototype.setJitter = function(jitter) { this.jitter = jitter; }; + var debug$1 = debugModule("socket.io-client:manager"); var Manager = /* @__PURE__ */ function(_Emitter) { - _inherits(Manager2, _Emitter); - var _super = _createSuper(Manager2); function Manager2(uri, opts) { var _this; - _classCallCheck2(this, Manager2); var _a3; - _this = _super.call(this); + _this = _Emitter.call(this) || this; _this.nsps = {}; _this.subs = []; if (uri && "object" === _typeof3(uri)) { @@ -345066,7 +345554,7 @@ ${config22.themeCSS}`; opts = opts || {}; opts.path = opts.path || "/socket.io"; _this.opts = opts; - installTimerFunctions(_assertThisInitialized(_this), opts); + installTimerFunctions(_this, opts); _this.reconnection(opts.reconnection !== false); _this.reconnectionAttempts(opts.reconnectionAttempts || Infinity); _this.reconnectionDelay(opts.reconnectionDelay || 1e3); @@ -345087,349 +345575,241 @@ ${config22.themeCSS}`; if (_this._autoConnect) _this.open(); return _this; } - _createClass2(Manager2, [{ - key: "reconnection", - value: function reconnection(v) { - if (!arguments.length) return this._reconnection; - this._reconnection = !!v; - return this; - } - }, { - key: "reconnectionAttempts", - value: function reconnectionAttempts(v) { - if (v === void 0) return this._reconnectionAttempts; - this._reconnectionAttempts = v; - return this; - } - }, { - key: "reconnectionDelay", - value: function reconnectionDelay(v) { - var _a3; - if (v === void 0) return this._reconnectionDelay; - this._reconnectionDelay = v; - (_a3 = this.backoff) === null || _a3 === void 0 ? void 0 : _a3.setMin(v); - return this; - } - }, { - key: "randomizationFactor", - value: function randomizationFactor(v) { - var _a3; - if (v === void 0) return this._randomizationFactor; - this._randomizationFactor = v; - (_a3 = this.backoff) === null || _a3 === void 0 ? void 0 : _a3.setJitter(v); - return this; - } - }, { - key: "reconnectionDelayMax", - value: function reconnectionDelayMax(v) { - var _a3; - if (v === void 0) return this._reconnectionDelayMax; - this._reconnectionDelayMax = v; - (_a3 = this.backoff) === null || _a3 === void 0 ? void 0 : _a3.setMax(v); - return this; - } - }, { - key: "timeout", - value: function timeout2(v) { - if (!arguments.length) return this._timeout; - this._timeout = v; - return this; - } - /** - * Starts trying to reconnect if reconnection is enabled and we have not - * started reconnecting yet - * - * @private - */ - }, { - key: "maybeReconnectOnOpen", - value: function maybeReconnectOnOpen() { - if (!this._reconnecting && this._reconnection && this.backoff.attempts === 0) { - this.reconnect(); - } - } - /** - * Sets the current transport `socket`. - * - * @param {Function} fn - optional, callback - * @return self - * @public - */ - }, { - key: "open", - value: function open2(fn4) { - var _this2 = this; - if (~this._readyState.indexOf("open")) return this; - this.engine = new Socket$1(this.uri, this.opts); - var socket = this.engine; - var self2 = this; - this._readyState = "opening"; - this.skipReconnect = false; - var openSubDestroy = on4(socket, "open", function() { - self2.onopen(); - fn4 && fn4(); - }); - var onError = function onError2(err2) { - _this2.cleanup(); - _this2._readyState = "closed"; - _this2.emitReserved("error", err2); - if (fn4) { - fn4(err2); - } else { - _this2.maybeReconnectOnOpen(); - } - }; - var errorSub = on4(socket, "error", onError); - if (false !== this._timeout) { - var timeout2 = this._timeout; - var timer2 = this.setTimeoutFn(function() { - openSubDestroy(); - onError(new Error("timeout")); - socket.close(); - }, timeout2); - if (this.opts.autoUnref) { - timer2.unref(); - } - this.subs.push(function() { - _this2.clearTimeoutFn(timer2); - }); - } - this.subs.push(openSubDestroy); - this.subs.push(errorSub); - return this; - } - /** - * Alias for open() - * - * @return self - * @public - */ - }, { - key: "connect", - value: function connect(fn4) { - return this.open(fn4); - } - /** - * Called upon transport open. - * - * @private - */ - }, { - key: "onopen", - value: function onopen() { - this.cleanup(); - this._readyState = "open"; - this.emitReserved("open"); - var socket = this.engine; - this.subs.push(on4(socket, "ping", this.onping.bind(this)), on4(socket, "data", this.ondata.bind(this)), on4(socket, "error", this.onerror.bind(this)), on4(socket, "close", this.onclose.bind(this)), on4(this.decoder, "decoded", this.ondecoded.bind(this))); + _inheritsLoose(Manager2, _Emitter); + var _proto = Manager2.prototype; + _proto.reconnection = function reconnection(v) { + if (!arguments.length) return this._reconnection; + this._reconnection = !!v; + if (!v) { + this.skipReconnect = true; } - /** - * Called upon a ping. - * - * @private - */ - }, { - key: "onping", - value: function onping() { - this.emitReserved("ping"); + return this; + }; + _proto.reconnectionAttempts = function reconnectionAttempts(v) { + if (v === void 0) return this._reconnectionAttempts; + this._reconnectionAttempts = v; + return this; + }; + _proto.reconnectionDelay = function reconnectionDelay(v) { + var _a3; + if (v === void 0) return this._reconnectionDelay; + this._reconnectionDelay = v; + (_a3 = this.backoff) === null || _a3 === void 0 ? void 0 : _a3.setMin(v); + return this; + }; + _proto.randomizationFactor = function randomizationFactor(v) { + var _a3; + if (v === void 0) return this._randomizationFactor; + this._randomizationFactor = v; + (_a3 = this.backoff) === null || _a3 === void 0 ? void 0 : _a3.setJitter(v); + return this; + }; + _proto.reconnectionDelayMax = function reconnectionDelayMax(v) { + var _a3; + if (v === void 0) return this._reconnectionDelayMax; + this._reconnectionDelayMax = v; + (_a3 = this.backoff) === null || _a3 === void 0 ? void 0 : _a3.setMax(v); + return this; + }; + _proto.timeout = function timeout2(v) { + if (!arguments.length) return this._timeout; + this._timeout = v; + return this; + }; + _proto.maybeReconnectOnOpen = function maybeReconnectOnOpen() { + if (!this._reconnecting && this._reconnection && this.backoff.attempts === 0) { + this.reconnect(); } - /** - * Called with data. - * - * @private - */ - }, { - key: "ondata", - value: function ondata(data4) { - try { - this.decoder.add(data4); - } catch (e3) { - this.onclose("parse error", e3); + }; + _proto.open = function open2(fn4) { + var _this2 = this; + debug$1("readyState %s", this._readyState); + if (~this._readyState.indexOf("open")) return this; + debug$1("opening %s", this.uri); + this.engine = new Socket$1(this.uri, this.opts); + var socket = this.engine; + var self2 = this; + this._readyState = "opening"; + this.skipReconnect = false; + var openSubDestroy = on4(socket, "open", function() { + self2.onopen(); + fn4 && fn4(); + }); + var onError = function onError2(err2) { + debug$1("error"); + _this2.cleanup(); + _this2._readyState = "closed"; + _this2.emitReserved("error", err2); + if (fn4) { + fn4(err2); + } else { + _this2.maybeReconnectOnOpen(); } - } - /** - * Called when parser fully decodes a packet. - * - * @private - */ - }, { - key: "ondecoded", - value: function ondecoded(packet) { - var _this3 = this; - nextTick2(function() { - _this3.emitReserved("packet", packet); - }, this.setTimeoutFn); - } - /** - * Called upon socket error. - * - * @private - */ - }, { - key: "onerror", - value: function onerror(err2) { - this.emitReserved("error", err2); - } - /** - * Creates a new socket for the given `nsp`. - * - * @return {Socket} - * @public - */ - }, { - key: "socket", - value: function socket(nsp, opts) { - var socket2 = this.nsps[nsp]; - if (!socket2) { - socket2 = new Socket(this, nsp, opts); - this.nsps[nsp] = socket2; - } else if (this._autoConnect && !socket2.active) { - socket2.connect(); + }; + var errorSub = on4(socket, "error", onError); + if (false !== this._timeout) { + var timeout2 = this._timeout; + debug$1("connect attempt will timeout after %d", timeout2); + var timer2 = this.setTimeoutFn(function() { + debug$1("connect attempt timed out after %d", timeout2); + openSubDestroy(); + onError(new Error("timeout")); + socket.close(); + }, timeout2); + if (this.opts.autoUnref) { + timer2.unref(); } - return socket2; + this.subs.push(function() { + _this2.clearTimeoutFn(timer2); + }); } - /** - * Called upon a socket close. - * - * @param socket - * @private - */ - }, { - key: "_destroy", - value: function _destroy(socket) { - var nsps = Object.keys(this.nsps); - for (var _i2 = 0, _nsps = nsps; _i2 < _nsps.length; _i2++) { - var nsp = _nsps[_i2]; - var _socket = this.nsps[nsp]; - if (_socket.active) { - return; - } - } - this._close(); + this.subs.push(openSubDestroy); + this.subs.push(errorSub); + return this; + }; + _proto.connect = function connect(fn4) { + return this.open(fn4); + }; + _proto.onopen = function onopen() { + debug$1("open"); + this.cleanup(); + this._readyState = "open"; + this.emitReserved("open"); + var socket = this.engine; + this.subs.push( + on4(socket, "ping", this.onping.bind(this)), + on4(socket, "data", this.ondata.bind(this)), + on4(socket, "error", this.onerror.bind(this)), + on4(socket, "close", this.onclose.bind(this)), + // @ts-ignore + on4(this.decoder, "decoded", this.ondecoded.bind(this)) + ); + }; + _proto.onping = function onping() { + this.emitReserved("ping"); + }; + _proto.ondata = function ondata(data4) { + try { + this.decoder.add(data4); + } catch (e3) { + this.onclose("parse error", e3); } - /** - * Writes a packet. - * - * @param packet - * @private - */ - }, { - key: "_packet", - value: function _packet(packet) { - var encodedPackets = this.encoder.encode(packet); - for (var i3 = 0; i3 < encodedPackets.length; i3++) { - this.engine.write(encodedPackets[i3], packet.options); + }; + _proto.ondecoded = function ondecoded(packet) { + var _this3 = this; + nextTick2(function() { + _this3.emitReserved("packet", packet); + }, this.setTimeoutFn); + }; + _proto.onerror = function onerror(err2) { + debug$1("error", err2); + this.emitReserved("error", err2); + }; + _proto.socket = function socket(nsp, opts) { + var socket2 = this.nsps[nsp]; + if (!socket2) { + socket2 = new Socket(this, nsp, opts); + this.nsps[nsp] = socket2; + } else if (this._autoConnect && !socket2.active) { + socket2.connect(); + } + return socket2; + }; + _proto._destroy = function _destroy(socket) { + var nsps = Object.keys(this.nsps); + for (var _i2 = 0, _nsps = nsps; _i2 < _nsps.length; _i2++) { + var nsp = _nsps[_i2]; + var _socket = this.nsps[nsp]; + if (_socket.active) { + debug$1("socket %s is still active, skipping close", nsp); + return; } } - /** - * Clean up transport subscriptions and packet buffer. - * - * @private - */ - }, { - key: "cleanup", - value: function cleanup2() { - this.subs.forEach(function(subDestroy) { - return subDestroy(); - }); - this.subs.length = 0; - this.decoder.destroy(); - } - /** - * Close the current socket. - * - * @private - */ - }, { - key: "_close", - value: function _close() { - this.skipReconnect = true; - this._reconnecting = false; - this.onclose("forced close"); - if (this.engine) this.engine.close(); + this._close(); + }; + _proto._packet = function _packet(packet) { + debug$1("writing packet %j", packet); + var encodedPackets = this.encoder.encode(packet); + for (var i3 = 0; i3 < encodedPackets.length; i3++) { + this.engine.write(encodedPackets[i3], packet.options); } - /** - * Alias for close() - * - * @private - */ - }, { - key: "disconnect", - value: function disconnect() { - return this._close(); + }; + _proto.cleanup = function cleanup2() { + debug$1("cleanup"); + this.subs.forEach(function(subDestroy) { + return subDestroy(); + }); + this.subs.length = 0; + this.decoder.destroy(); + }; + _proto._close = function _close() { + debug$1("disconnect"); + this.skipReconnect = true; + this._reconnecting = false; + this.onclose("forced close"); + }; + _proto.disconnect = function disconnect() { + return this._close(); + }; + _proto.onclose = function onclose(reason, description) { + var _a3; + debug$1("closed due to %s", reason); + this.cleanup(); + (_a3 = this.engine) === null || _a3 === void 0 ? void 0 : _a3.close(); + this.backoff.reset(); + this._readyState = "closed"; + this.emitReserved("close", reason, description); + if (this._reconnection && !this.skipReconnect) { + this.reconnect(); } - /** - * Called upon engine close. - * - * @private - */ - }, { - key: "onclose", - value: function onclose(reason, description) { - this.cleanup(); + }; + _proto.reconnect = function reconnect() { + var _this4 = this; + if (this._reconnecting || this.skipReconnect) return this; + var self2 = this; + if (this.backoff.attempts >= this._reconnectionAttempts) { + debug$1("reconnect failed"); this.backoff.reset(); - this._readyState = "closed"; - this.emitReserved("close", reason, description); - if (this._reconnection && !this.skipReconnect) { - this.reconnect(); - } - } - /** - * Attempt a reconnection. - * - * @private - */ - }, { - key: "reconnect", - value: function reconnect() { - var _this4 = this; - if (this._reconnecting || this.skipReconnect) return this; - var self2 = this; - if (this.backoff.attempts >= this._reconnectionAttempts) { - this.backoff.reset(); - this.emitReserved("reconnect_failed"); - this._reconnecting = false; - } else { - var delay2 = this.backoff.duration(); - this._reconnecting = true; - var timer2 = this.setTimeoutFn(function() { - if (self2.skipReconnect) return; - _this4.emitReserved("reconnect_attempt", self2.backoff.attempts); - if (self2.skipReconnect) return; - self2.open(function(err2) { - if (err2) { - self2._reconnecting = false; - self2.reconnect(); - _this4.emitReserved("reconnect_error", err2); - } else { - self2.onreconnect(); - } - }); - }, delay2); - if (this.opts.autoUnref) { - timer2.unref(); - } - this.subs.push(function() { - _this4.clearTimeoutFn(timer2); + this.emitReserved("reconnect_failed"); + this._reconnecting = false; + } else { + var delay2 = this.backoff.duration(); + debug$1("will wait %dms before reconnect attempt", delay2); + this._reconnecting = true; + var timer2 = this.setTimeoutFn(function() { + if (self2.skipReconnect) return; + debug$1("attempting reconnect"); + _this4.emitReserved("reconnect_attempt", self2.backoff.attempts); + if (self2.skipReconnect) return; + self2.open(function(err2) { + if (err2) { + debug$1("reconnect attempt error"); + self2._reconnecting = false; + self2.reconnect(); + _this4.emitReserved("reconnect_error", err2); + } else { + debug$1("reconnect success"); + self2.onreconnect(); + } }); + }, delay2); + if (this.opts.autoUnref) { + timer2.unref(); } + this.subs.push(function() { + _this4.clearTimeoutFn(timer2); + }); } - /** - * Called upon successful reconnect. - * - * @private - */ - }, { - key: "onreconnect", - value: function onreconnect() { - var attempt = this.backoff.attempts; - this._reconnecting = false; - this.backoff.reset(); - this.emitReserved("reconnect", attempt); - } - }]); + }; + _proto.onreconnect = function onreconnect() { + var attempt = this.backoff.attempts; + this._reconnecting = false; + this.backoff.reset(); + this.emitReserved("reconnect", attempt); + }; return Manager2; }(Emitter2); + var debug = debugModule("socket.io-client"); var cache3 = {}; function lookup2(uri, opts) { if (_typeof3(uri) === "object") { @@ -345445,9 +345825,11 @@ ${config22.themeCSS}`; var newConnection = opts.forceNew || opts["force new connection"] || false === opts.multiplex || sameNamespace; var io; if (newConnection) { + debug("ignoring socket cache for %s", source); io = new Manager(source, opts); } else { if (!cache3[id4]) { + debug("new io instance for %s", source); cache3[id4] = new Manager(source, opts); } io = cache3[id4]; @@ -345517,14 +345899,14 @@ ${config22.themeCSS}`; this.panic(new Error("Unexpected ack message: no userMessageId")); if (!("threadId" in message)) this.panic(new Error("Unexpected ack message: no threadId")); - (_b2 = (_a3 = this.callbacks).onAck) === null || _b2 === void 0 ? void 0 : _b2.call(_a3, message.userMessageId, message.threadId); + await ((_b2 = (_a3 = this.callbacks).onAck) === null || _b2 === void 0 ? void 0 : _b2.call(_a3, message.userMessageId, message.threadId)); break; case "token": if (!("token" in message)) this.panic(new Error("Unexpected token message: no token")); if (!("messageId" in message)) this.panic(new Error("Unexpected token message: no messageId")); - this.callbacks.onToken(message.token, message.messageId); + await this.callbacks.onToken(message.token, message.messageId); break; case "request-context": { if (!this.callbacks.onRequestContext) { @@ -345538,7 +345920,7 @@ ${config22.themeCSS}`; break; } case "end": - this.callbacks.onComplete(); + await this.callbacks.onComplete(); this.disconnect(); break; default: @@ -345674,7 +346056,7 @@ ${config22.themeCSS}`; return mod && mod.__esModule ? mod : { "default": mod }; }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.AIClient = exports2.AI = exports2.Usage = exports2.Mapset = exports2.AppMap = exports2.App = exports2.LicenseKey = exports2.buildRequest = exports2.reportJSON = exports2.retryOnError = exports2.retryOn503 = exports2.handleError = exports2.get = exports2.DefaultApiURL = exports2.setConfiguration = exports2.loadConfiguration = void 0; + exports2.AIClient = exports2.AI = exports2.Usage = exports2.LicenseKey = exports2.buildRequest = exports2.reportJSON = exports2.retryOnError = exports2.retryOn503 = exports2.handleError = exports2.get = exports2.DefaultApiURL = exports2.setConfiguration = exports2.loadConfiguration = void 0; var loadConfiguration_1 = require_loadConfiguration(); Object.defineProperty(exports2, "loadConfiguration", { enumerable: true, get: function() { return __importDefault(loadConfiguration_1).default; @@ -345713,18 +346095,6 @@ ${config22.themeCSS}`; Object.defineProperty(exports2, "LicenseKey", { enumerable: true, get: function() { return __importDefault(licenseKey_1).default; } }); - var app_1 = require_app(); - Object.defineProperty(exports2, "App", { enumerable: true, get: function() { - return __importDefault(app_1).default; - } }); - var appMap_1 = require_appMap(); - Object.defineProperty(exports2, "AppMap", { enumerable: true, get: function() { - return __importDefault(appMap_1).default; - } }); - var mapset_1 = require_mapset(); - Object.defineProperty(exports2, "Mapset", { enumerable: true, get: function() { - return __importDefault(mapset_1).default; - } }); var usage_1 = require_usage(); Object.defineProperty(exports2, "Usage", { enumerable: true, get: function() { return __importDefault(usage_1).default; @@ -346311,7 +346681,7 @@ ${config22.themeCSS}`; }); // node_modules/jayson/lib/client/browser/index.js - var require_browser15 = __commonJS({ + var require_browser14 = __commonJS({ "node_modules/jayson/lib/client/browser/index.js"(exports2, module2) { "use strict"; init_polyfillShim(); @@ -349784,7 +350154,7 @@ ${config22.themeCSS}`; // node_modules/mermaid/dist/mermaid.core.mjs init_polyfillShim(); var import_ts_dedent25 = __toESM(require_dist4(), 1); - init_mermaid_6dc72991(); + init_mermaid_2490e8f2(); var import_dayjs24 = __toESM(require_dayjs_min(), 1); var import_sanitize_url25 = __toESM(require_dist5(), 1); init_src32(); @@ -356083,11 +356453,11 @@ ${content3} const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ width: "106", height: "25", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("circle", { attrs: { cx: "12.5", cy: "12.5", r: "12.5", fill: "#FF07AA" } }), a3("path", { attrs: { d: "M16.931 14.303l-3.779-7.986-.655-1.296-.623 1.296L6.28 18.078h1.446l.697-1.549.707-1.538 1.858-4.211 1.51-3.147 3.325 7.358.347.75 1.089 2.337h1.456l-1.784-3.775z", fill: "#fff" } }), a3("path", { attrs: { d: "M16.931 14.303l-3.779-7.986-.655-1.296-.623 1.296L6.28 18.078h1.446l.697-1.549.707-1.538 1.858-4.211 1.51-3.147 3.325 7.358.347.75 1.089 2.337h1.456l-1.784-3.775z", stroke: "#fff" } }), a3("path", { attrs: { d: "M36.724 5.256h1.422L43.564 18H41.8l-1.296-3.132h-6.372L32.818 18h-1.71l5.616-12.744zm.684 1.944h-.036l-2.646 6.264h5.202L37.408 7.2zm7.526 2.376h1.404V10.8h.036c.384-.456.828-.81 1.332-1.062a3.803 3.803 0 011.692-.378c.66 0 1.26.114 1.8.342a3.91 3.91 0 011.404.918c.384.396.684.864.9 1.404.216.54.324 1.128.324 1.764 0 .636-.108 1.224-.324 1.764a4.27 4.27 0 01-.9 1.404 4.052 4.052 0 01-1.332.936 4.245 4.245 0 01-1.656.324c-.756 0-1.422-.162-1.998-.486-.564-.336-.978-.744-1.242-1.224h-.036v5.598h-1.404V9.576zm1.404 4.212c0 .444.066.858.198 1.242.144.372.348.702.612.99.264.276.576.498.936.666.372.156.786.234 1.242.234a3.05 3.05 0 001.224-.234c.372-.168.69-.39.954-.666a2.87 2.87 0 00.594-.99c.144-.384.216-.798.216-1.242 0-.444-.072-.852-.216-1.224a2.664 2.664 0 00-.594-.99 2.685 2.685 0 00-.954-.666 2.861 2.861 0 00-1.224-.252c-.456 0-.87.084-1.242.252-.36.156-.672.378-.936.666a2.871 2.871 0 00-.612.99c-.132.372-.198.78-.198 1.224zm9.6-4.212h1.404V10.8h.036c.384-.456.828-.81 1.332-1.062a3.803 3.803 0 011.692-.378c.66 0 1.26.114 1.8.342a3.91 3.91 0 011.404.918c.384.396.684.864.9 1.404.216.54.324 1.128.324 1.764 0 .636-.108 1.224-.324 1.764a4.27 4.27 0 01-.9 1.404 4.052 4.052 0 01-1.332.936 4.245 4.245 0 01-1.656.324c-.756 0-1.422-.162-1.998-.486-.564-.336-.978-.744-1.242-1.224h-.036v5.598h-1.404V9.576zm1.404 4.212c0 .444.066.858.198 1.242.144.372.348.702.612.99.264.276.576.498.936.666.372.156.786.234 1.242.234a3.05 3.05 0 001.224-.234c.372-.168.69-.39.954-.666a2.87 2.87 0 00.594-.99c.144-.384.216-.798.216-1.242 0-.444-.072-.852-.216-1.224a2.664 2.664 0 00-.594-.99 2.685 2.685 0 00-.954-.666 2.861 2.861 0 00-1.224-.252c-.456 0-.87.084-1.242.252-.36.156-.672.378-.936.666a2.871 2.871 0 00-.612.99c-.132.372-.198.78-.198 1.224zm9.924-8.532h2.25l4.32 9.99h.036l4.356-9.99h2.196V18h-1.512V7.308h-.036L74.304 18h-.918L68.814 7.308h-.036V18h-1.512V5.256zm15.97 5.4a3.88 3.88 0 011.53-.972 5.333 5.333 0 011.818-.324c1.248 0 2.148.294 2.7.882.552.588.828 1.482.828 2.682v3.618c0 .24.012.492.036.756.024.252.054.486.09.702h-1.35a3.318 3.318 0 01-.09-.63v-.63h-.036a3.27 3.27 0 01-1.116 1.062c-.456.276-1.008.414-1.656.414-.432 0-.84-.054-1.224-.162a3.279 3.279 0 01-.99-.468 2.498 2.498 0 01-.666-.792 2.243 2.243 0 01-.252-1.08c0-.696.18-1.242.54-1.638.36-.396.804-.69 1.332-.882a6.699 6.699 0 011.728-.36 22.447 22.447 0 011.71-.072h.54v-.252c0-.612-.186-1.074-.558-1.386-.36-.312-.87-.468-1.53-.468-.456 0-.906.078-1.35.234a3.129 3.129 0 00-1.152.684l-.882-.918zm4.068 3.294c-.9 0-1.614.126-2.142.378-.528.252-.792.666-.792 1.242 0 .528.174.906.522 1.134.36.216.804.324 1.332.324.408 0 .762-.066 1.062-.198.312-.144.57-.33.774-.558.204-.228.36-.492.468-.792.108-.312.168-.642.18-.99v-.54h-1.404zm5.302-4.374h1.404V10.8h.036c.384-.456.828-.81 1.332-1.062a3.803 3.803 0 011.692-.378c.66 0 1.26.114 1.8.342.552.216 1.02.522 1.404.918.384.396.684.864.9 1.404.216.54.324 1.128.324 1.764 0 .636-.108 1.224-.324 1.764a4.27 4.27 0 01-.9 1.404 4.056 4.056 0 01-1.332.936 4.245 4.245 0 01-1.656.324c-.756 0-1.422-.162-1.998-.486-.564-.336-.978-.744-1.242-1.224h-.036v5.598h-1.404V9.576zm1.404 4.212c0 .444.066.858.198 1.242.144.372.348.702.612.99.264.276.576.498.936.666.372.156.786.234 1.242.234a3.05 3.05 0 001.224-.234c.372-.168.69-.39.954-.666a2.87 2.87 0 00.594-.99c.144-.384.216-.798.216-1.242 0-.444-.072-.852-.216-1.224a2.664 2.664 0 00-.594-.99 2.685 2.685 0 00-.954-.666 2.861 2.861 0 00-1.224-.252c-.456 0-.87.084-1.242.252-.36.156-.672.378-.936.666a2.871 2.871 0 00-.612.99c-.132.372-.198.78-.198 1.224z", fill: "#fff" } })])); } }; - var Ae = { functional: true, render(e3, t4) { + var fe = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 461.312 461.312" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M230.656 156.416c-40.96 0-74.24 33.28-74.24 74.24s33.28 74.24 74.24 74.24 74.24-33.28 74.24-74.24-33.28-74.24-74.24-74.24zm-5.632 52.224c-9.216 0-16.896 7.68-16.896 16.896h-24.576c.512-23.04 18.944-41.472 41.472-41.472v24.576z" } }), a3("path", { attrs: { d: "M455.936 215.296c-25.088-31.232-114.688-133.12-225.28-133.12S30.464 184.064 5.376 215.296c-7.168 8.704-7.168 21.504 0 30.72 25.088 31.232 114.688 133.12 225.28 133.12s200.192-101.888 225.28-133.12c7.168-8.704 7.168-21.504 0-30.72zm-225.28 122.88c-59.392 0-107.52-48.128-107.52-107.52s48.128-107.52 107.52-107.52 107.52 48.128 107.52 107.52-48.128 107.52-107.52 107.52z" } })])); } }; - var fe = de({ render: function(e3, t4) { + var Ae = de({ render: function(e3, t4) { return (0, t4._c)("h5", { staticClass: "details-panel-list-header" }, [t4._t("default")], 2); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-601d767e_0", { source: "h5.details-panel-list-header{border-bottom:1px solid #242c41;color:#808b98;font-size:.9rem;font-weight:800;line-height:1.4;margin:0 0 8px 0;padding-bottom:8px;text-transform:uppercase}", map: void 0, media: void 0 }); @@ -356109,12 +356479,12 @@ ${content3} var je = "setExpandedPackage"; var De = "clearExpandedPackage"; var Re = "setFilter"; - var Ye = "setFilterBoolean"; - var Pe = "setElapsedTime"; + var Pe = "setFilterBoolean"; + var Ye = "setElapsedTime"; var Fe = "resetFilters"; var He = "addRootObject"; - var Te = "removeRootObject"; - var Oe = "addHiddenName"; + var Oe = "removeRootObject"; + var Te = "addHiddenName"; var Le = "removeHiddenName"; var Ue = "setSavedFilters"; var qe = "setselectedSavedFilter"; @@ -356160,9 +356530,9 @@ ${content3} e3.expandedPackages = []; }, [Re](e3, t4) { e3.filters = t4; - }, [Ye](e3, { declutterProperty: t4, value: a3 }) { + }, [Pe](e3, { declutterProperty: t4, value: a3 }) { e3.filters.declutter[t4].on = a3; - }, [Pe](e3, t4) { + }, [Ye](e3, t4) { e3.filters.declutter.hideElapsedTimeUnder.time = t4; }, [Fe](e3) { let a3; @@ -356175,9 +356545,9 @@ ${content3} }, [He](e3, t4) { const a3 = t4.trim(); a3 && !e3.filters.rootObjects.includes(a3) && e3.filters.rootObjects.push(a3); - }, [Te](e3, t4) { - e3.filters.rootObjects.splice(t4, 1); }, [Oe](e3, t4) { + e3.filters.rootObjects.splice(t4, 1); + }, [Te](e3, t4) { const a3 = t4.trim(); a3 && !e3.filters.declutter.hideName.names.includes(a3) && (e3.filters.declutter.hideName.names.push(a3), e3.filters.declutter.hideName.on = true); }, [Le](e3, t4) { @@ -356207,7 +356577,7 @@ ${content3} }), 0)], 1) : e3._e(); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-8ef6c86a_0", { source: ".v-details-panel-list[data-v-8ef6c86a]{list-style-type:none;padding:0;margin:0}.v-details-panel-list ul[data-v-8ef6c86a]{list-style-type:none;padding:0;margin-bottom:1.5rem;margin-top:0}.v-details-panel-list ul .list-item[data-v-8ef6c86a]{position:relative;border-bottom:1px solid #242c41;display:flex;justify-content:space-between;align-items:center;padding:8px .5rem;font-size:.9em;cursor:pointer;overflow:hidden;z-index:0}.v-details-panel-list ul .list-item[data-v-8ef6c86a]:first-child{padding-top:0}.v-details-panel-list ul .list-item[data-v-8ef6c86a]:active,.v-details-panel-list ul .list-item[data-v-8ef6c86a]:hover{color:#4362b1;text-decoration:underline}.v-details-panel-list ul .list-item__count[data-v-8ef6c86a]{margin-left:1rem;border-radius:.5rem;display:inline-block;padding:.25rem .5rem;font-size:.8rem;line-height:1;color:currentColor;background-color:rgba(0,0,0,.2);white-space:nowrap}.v-details-panel-list ul .list-item__event-quickview[data-v-8ef6c86a]{margin-left:1rem;padding:.25rem;color:#808b98;line-height:0;cursor:pointer}.v-details-panel-list ul .list-item__event-quickview[data-v-8ef6c86a]:active,.v-details-panel-list ul .list-item__event-quickview[data-v-8ef6c86a]:hover{color:#e1e2e2}.v-details-panel-list ul .list-item__event-quickview svg[data-v-8ef6c86a]{width:1rem;height:1rem;fill:currentColor}.v-details-panel-list ul li[data-v-8ef6c86a]{border-bottom:1px solid #424750;transition:all .3s ease}.v-details-panel-list ul li[data-v-8ef6c86a]:active,.v-details-panel-list ul li[data-v-8ef6c86a]:hover{color:#ccc}.v-details-panel-list ul li[data-v-8ef6c86a]:last-of-type{border-bottom:0}", map: void 0, media: void 0 }); - }, { name: "v-details-panel-list", components: { EyeIcon: Ae, VDetailsPanelListHeader: fe }, props: { title: String, items: { type: Array, default: () => [] }, uniqueItems: { type: Boolean, default: true }, nameKey: { type: String }, eventQuickview: { type: Boolean, default: false } }, methods: { nameOf(e3) { + }, { name: "v-details-panel-list", components: { EyeIcon: fe, VDetailsPanelListHeader: Ae }, props: { title: String, items: { type: Array, default: () => [] }, uniqueItems: { type: Boolean, default: true }, nameKey: { type: String }, eventQuickview: { type: Boolean, default: false } }, methods: { nameOf(e3) { return this.nameKey ? e3[this.nameKey] : e3.prettyName || e3.name || e3.toString(); }, selectCodeObject(e3) { this.$store && this.$store.commit(be, e3.object); @@ -356348,7 +356718,7 @@ ${content3} })], 2)], 1), e3._v(" "), a3("v-details-panel-text", { attrs: { title: "Event summary" } }, [e3._v("\n " + e3._s(e3.finding.message || e3.finding.groupMessage) + "\n ")]), e3._v(" "), a3("v-details-panel-stack-trace", { attrs: { "stack-locations": e3.resolvedFinding.stackLocations } }), e3._v(" "), a3("v-details-panel-list", { attrs: { title: "Related events", items: e3.relatedEvents, "event-quickview": true } })], 1); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-037d937e_0", { source: ".details-panel-analysis-finding h3[data-v-037d937e]{padding:0}.details-panel-analysis-finding ul[data-v-037d937e]{list-style-type:none;margin-top:0;padding:.25rem .5rem}.details-panel-analysis-finding ul li[data-v-037d937e]{border-bottom:1px solid #242c41a3;padding:.5rem 0}.details-panel-analysis-finding ul li[data-v-037d937e]:last-of-type{border:0;padding:.5rem 0 0 0}.details-panel-analysis-finding ul li[data-v-037d937e]:first-of-type{padding-top:0}.details-panel-analysis-finding a[data-v-037d937e]{color:#4362b1;text-decoration:none;line-height:1.5rem;width:100%;word-break:break-all;transition:all .3s ease}.details-panel-analysis-finding a[data-v-037d937e]:hover{text-decoration:underline;color:#889dd2}.details-panel-analysis-finding section[data-v-037d937e]{margin-bottom:16px}", map: void 0, media: void 0 }); - }, { name: "v-details-panel-analysis-finding", components: { VDetailsPanelList: We, VDetailsPanelListHeader: fe, VDetailsPanelHeader: ct, VDetailsPanelStackTrace: de({ render: function() { + }, { name: "v-details-panel-analysis-finding", components: { VDetailsPanelList: We, VDetailsPanelListHeader: Ae, VDetailsPanelHeader: ct, VDetailsPanelStackTrace: de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("section", { staticClass: "stack-trace" }, [a3("v-details-panel-list-header", [e3._v("Stack trace")]), e3._v(" "), a3("ul", e3._l(e3.stackLocations, function(t5) { return a3("li", { key: t5.uri.path, attrs: { "data-cy": "stack-trace" } }, [a3("v-popper", { staticClass: "hover-text-popper", attrs: { "data-cy": "popper", text: t5.uri.path, placement: "top", "text-align": "left" } }, [a3("a", { attrs: { href: "#" }, on: { click: function(a4) { @@ -356357,7 +356727,7 @@ ${content3} }), 0)], 1); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-7585ac2b_0", { source: ".stack-trace__header h3{margin:.75rem 0;font-size:.9rem;color:#808b98;font-weight:800;text-transform:uppercase}.stack-trace ul{list-style-type:none;padding:.25rem .5rem;margin-top:0}.stack-trace ul li{border-bottom:1px solid #242c41a3;padding:.5rem 0}.stack-trace ul li:last-of-type{border:0}.stack-trace ul li:first-of-type{padding-top:0}.stack-trace ul a{color:#2a84ef;text-decoration:none;line-height:1.5rem;width:100%;word-break:break-all;transition:all .3s ease}.stack-trace ul a:hover{color:#e3e5e8}", map: void 0, media: void 0 }); - }, { name: "v-details-panel-stack-trace", components: { VPopper: lt, VDetailsPanelListHeader: fe }, props: { stackLocations: { type: Array, required: true } }, methods: { displayLocation(e3) { + }, { name: "v-details-panel-stack-trace", components: { VPopper: lt, VDetailsPanelListHeader: Ae }, props: { stackLocations: { type: Array, required: true } }, methods: { displayLocation(e3) { const t4 = e3.range[0] && e3.range[0].line + 1, { truncatedPath: a3 } = e3; return t4 && t4 > 1 ? `${a3}:${t4}` : `${a3}`; }, openInSourceCode(e3) { @@ -356369,7 +356739,7 @@ ${content3} return a3("div", { staticClass: "details-panel-text" }, [a3("v-details-panel-list-header", [e3._v(e3._s(e3.title))]), e3._v(" "), a3("p", [e3._t("default")], 2)], 1); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-04e72acc_0", { source: ".details-panel-text p{padding:0 .5rem}", map: void 0, media: void 0 }); - }, { name: "v-details-panel-text", components: { VDetailsPanelListHeader: fe }, props: { title: String } }, void 0, false, void 0, false, he, void 0, void 0) }, props: { object: { type: Object, required: true }, appMap: { type: Object } }, computed: { finding() { + }, { name: "v-details-panel-text", components: { VDetailsPanelListHeader: Ae }, props: { title: String } }, void 0, false, void 0, false, he, void 0, void 0) }, props: { object: { type: Object, required: true }, appMap: { type: Object } }, computed: { finding() { return this.resolvedFinding.finding; }, resolvedFinding() { return this.object.resolvedFinding; @@ -356403,7 +356773,7 @@ ${content3} this.isRootObject ? e3.setAsRoot.isActive = true : e3.setAsRoot.isActive = false; return this.isRootObject ? Object.keys(e3).reduce((t4, a3) => ("hide" !== a3 && (t4[a3] = e3[a3]), t4), {}) : e3; } }, methods: { toggleFilter(e3) { - "setAsRoot" === e3 && (this.isRootObject ? this.$root.$emit("removeRoot", this.object.fqid) : this.$root.$emit("makeRoot", this.object)), "hide" === e3 && this.$store.commit(Oe, this.object.fqid); + "setAsRoot" === e3 && (this.isRootObject ? this.$root.$emit("removeRoot", this.object.fqid) : this.$root.$emit("makeRoot", this.object)), "hide" === e3 && this.$store.commit(Te, this.object.fqid); }, resetFilters() { this.$root.$emit("removeRoot", this.object.fqid); } } }, "data-v-bace66d6", false, void 0, false, he, void 0, void 0); @@ -356423,7 +356793,7 @@ ${content3} }, staticRenderFns: [] }, void 0, { name: "v-details-panel-database", components: { VDetailsPanelList: We, VDetailsPanelFilters: mt, VDetailsPanelHeader: ct }, props: { object: { type: Object, required: true }, isRootObject: { type: Boolean, required: false, default: false } }, computed: { queryEvents() { return this.object.children.map((e3) => e3.events).flat(); } } }, "data-v-523f0a9e", false, void 0, false, void 0, void 0, void 0); - var At = de({ render: function() { + var ft = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "details-panel-edge" }, [a3("v-details-panel-header", { attrs: { "object-type": "Edge", title: e3.title } }), e3._v(" "), a3("v-details-panel-list-pairs", { attrs: { title: "Events", items: e3.events } })], 1); }, staticRenderFns: [] }, function(e3) { @@ -356450,7 +356820,7 @@ ${content3} const { from: e3, to: t4 } = this.object; return e3.allEvents.map((e4) => e4.children).flat().filter((e4) => e4.codeObject.ancestors().includes(t4)).map((e4) => ({ from: e4.parent, to: e4 })); } } }, "data-v-75385437", false, void 0, false, he, void 0, void 0); - var ft = de({ render: function() { + var At = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("button", { staticClass: "details-btn", attrs: { type: "button" } }, [e3.icon ? a3("i", { class: e3.iconClass }) : e3._e(), e3._v(" "), a3("span", [e3._t("default")], 2)]); }, staticRenderFns: [] }, function(e3) { @@ -356504,7 +356874,7 @@ ${content3} }), 0)]) : e3._e(), e3._v(" "), e3.hasReturnValue ? a3("div", { staticClass: "event-params" }, [a3("h5", [e3._v("Return value")]), e3._v(" "), a3("ul", { staticClass: "table-01" }, [a3("li", [a3("i", [e3._v(e3._s(e3.object.returnValue.class))]), e3._v(" "), a3("code", [e3._v(e3._s(e3.object.returnValue.value))])])])]) : e3._e(), e3._v(" "), a3("v-details-panel-list", { attrs: { title: "Caller", items: e3.caller } }), e3._v(" "), a3("v-details-panel-list", { attrs: { title: "Children", items: e3.object.children } })], 1); }, staticRenderFns: [] }, function(e3) { e3 && (e3("data-v-7574ee0e_0", { source: ".details-panel-event h3[data-v-7574ee0e]{padding:0}.details-panel-event .event-params[data-v-7574ee0e]{padding:0}.details-panel-event .event-params h5[data-v-7574ee0e]{color:#808b98;font-size:.9rem;line-height:1.2;margin:0 0 .25rem 0;padding:0;text-transform:uppercase}.details-panel-event .event-params .table-01[data-v-7574ee0e]{font-size:14px;font-family:sans-serif;font-weight:500}.details-panel-event .event-params .table-01 li[data-v-7574ee0e]{padding:.5rem}.details-panel-event ul[data-v-7574ee0e]{list-style-type:none;padding:0;margin:0 0 1.5rem 0;width:100%}.details-panel-event ul li[data-v-7574ee0e]{width:100%;border-bottom:1px solid #343742;padding:.5rem;transition:all .3s ease;display:flex;flex-direction:column;justify-content:space-between;gap:.4rem}.details-panel-event ul li a[data-v-7574ee0e]{margin:0;width:100%}", map: void 0, media: void 0 }), e3("data-v-7574ee0e_1", { source: ".details-panel-event[data-v-7574ee0e] .sql-code{margin-bottom:8px;padding:0}", map: void 0, media: void 0 })); - }, { name: "v-details-panel-event", components: { VDetailsButton: ft, VDetailsPanelList: We, VDetailsPanelHeader: ct, VSqlCode: wt }, props: { object: { type: Object, required: true } }, computed: { title() { + }, { name: "v-details-panel-event", components: { VDetailsButton: At, VDetailsPanelList: We, VDetailsPanelHeader: ct, VSqlCode: wt }, props: { object: { type: Object, required: true } }, computed: { title() { return this.object.sqlQuery ? (0, import_models.getSqlLabel)(this.object) : this.object.toString(); }, hasParameters() { return this.object.parameters && this.object.parameters.length; @@ -356712,11 +357082,11 @@ ${content3} const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ fill: "none", viewBox: "0 0 13 13", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("g", { attrs: { "clip-path": "url(#clip0_47_2098)" } }, [a3("path", { attrs: { d: "M12.797 6.5a6.297 6.297 0 11-12.593 0 6.297 6.297 0 0112.593 0zM6.5 7.77a1.168 1.168 0 100 2.335 1.168 1.168 0 000-2.335zM5.391 3.57l.188 3.453a.305.305 0 00.305.288h1.232a.305.305 0 00.305-.288l.188-3.453a.305.305 0 00-.304-.321h-1.61a.305.305 0 00-.304.321z", fill: "#EAEAEA" } })]), a3("defs", [a3("clipPath", { attrs: { id: "clip0_47_2098" } }, [a3("path", { attrs: { fill: "#fff", d: "M0 0h13v13H0z" } })])])])); } }; - var Yt = { functional: true, render(e3, t4) { + var Pt = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M3.5 3.5c-.614-.884-.074-1.962.858-2.5L8 7.226 11.642 1c.932.538 1.472 1.616.858 2.5L8.81 8.61l1.556 2.661a2.5 2.5 0 11-.794.637L8 9.73l-1.572 2.177a2.5 2.5 0 11-.794-.637L7.19 8.61 3.5 3.5zm2.5 10a1.5 1.5 0 10-3 0 1.5 1.5 0 003 0zm7 0a1.5 1.5 0 10-3 0 1.5 1.5 0 003 0z" } })])); } }; - var Pt = { functional: true, render(e3, t4) { + var Yt = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 12 12", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M2.168 2.168a.571.571 0 01.809 0L6 5.192l3.023-3.024a.572.572 0 01.81.809L6.807 6l3.024 3.023a.572.572 0 01-.809.81L6 6.807 2.977 9.832a.572.572 0 01-.81-.809L5.193 6 2.168 2.977a.571.571 0 010-.81z" } })])); } }; @@ -356747,7 +357117,7 @@ ${content3} return a3("p", [e3._v("\n To learn more about making your AppMaps smaller, please see our\n "), a3("a", { attrs: { href: "https://appmap.io/docs/reference/handling-large-appmaps.html" } }, [e3._v("documentation")]), e3._v(".\n ")]); }] }, function(e3) { e3 && e3("data-v-b9153f5c_0", { source: '.details-panel[data-v-b9153f5c]{display:block;font-family:"IBM Plex Sans","Helvetica Neue",Helvetica,Arial,sans-serif;min-width:280px;width:100%;height:100%;padding:1rem;color:#eaeaea;word-break:break-word;border-right:1px solid #424750;overflow:auto}.details-panel__title[data-v-b9153f5c]{margin-bottom:1rem;font-size:0;display:flex;align-items:center;justify-content:space-between}.details-panel__title svg[data-v-b9153f5c]{max-width:20rem;width:100%}.details-panel__hide-panel-icon[data-v-b9153f5c]{fill:#eaeaea;width:14px!important;transform:rotate(90deg)}.details-panel__hide-panel-icon[data-v-b9153f5c]:hover{cursor:pointer;fill:#4362b1;transition:all .3s ease}.details-panel__source[data-v-b9153f5c]{margin-bottom:1rem}.details-panel__source-title[data-v-b9153f5c]{margin:0 0 .25rem;font-size:.75rem;font-weight:400}.details-panel__header-buttons[data-v-b9153f5c]{margin-left:auto;display:inline-flex;align-items:flex-start}.details-panel__subtitle[data-v-b9153f5c]{margin-bottom:1rem;color:#e3e5e8}.details-panel__content[data-v-b9153f5c]{padding:0}.details-panel__selection-nav[data-v-b9153f5c]{display:flex;align-items:center;justify-content:center;margin-top:1.7rem}.details-panel__selection-nav-icon[data-v-b9153f5c]{margin:0 .3rem;fill:#fff}.details-panel__selection-nav-icon[data-v-b9153f5c]:hover{cursor:pointer;fill:#4362b1;transition:all .3s ease}.details-panel__selection-nav-icon-container[data-v-b9153f5c]{overflow:hidden;white-space:nowrap}.details-panel__selection-nav-icon-container .clear-selections-icon[data-v-b9153f5c]{width:1.2rem}.details-panel__selection-nav-icon-container .tooltip[data-v-b9153f5c]{position:absolute;background-color:#fff;color:#000;font-size:.9rem;border:1px solid #ccc;padding:5px;z-index:5;opacity:.9;display:none}.details-panel__selection-nav-icon-container:hover .tooltip[data-v-b9153f5c]{display:inline-block}.details-panel__selection-nav .arrow-left[data-v-b9153f5c],.details-panel__selection-nav .arrow-right[data-v-b9153f5c]{width:1.7rem}.details-panel__selection-nav .arrow-left[data-v-b9153f5c]{transform:rotate(180deg)}.details-panel__selection-nav .disabled[data-v-b9153f5c]{fill:#343742;pointer-events:none}.details-panel__selection-nav .disabled[data-v-b9153f5c]:hover{cursor:default;fill:#343742}.details-panel__selection-nav select[data-v-b9153f5c]{margin:0 .5rem;padding:.25rem .5rem;border-radius:.5rem;background-color:#242c41;color:#eaeaea;border:1px solid #343742;font-size:.9rem;font-weight:400;width:100%}.details-panel__selection-nav select[data-v-b9153f5c]:hover{cursor:pointer;background-color:#343742;transition:all .3s ease}.details-panel__selection-nav select[data-v-b9153f5c]:focus-visible{outline:0}.details-panel__notification[data-v-b9153f5c]{padding:.5rem .75rem;background-color:#242c41;border-radius:.5rem;font-size:.9rem;margin-bottom:1rem}.details-panel__notification svg[data-v-b9153f5c]{width:1rem;height:1rem;fill:#e3e5e8}.details-panel__notification a[data-v-b9153f5c]{color:#768ecb;transition:all .3s ease}.details-panel__notification a[data-v-b9153f5c]:hover{color:#4362b1}.details-panel__notification p[data-v-b9153f5c]{margin:0 0 .5rem 0}.details-panel__notification p.notification-head[data-v-b9153f5c]{display:flex;align-items:center;flex-direction:row;gap:.5rem;margin:.5rem 0}.details-panel__notification.blocked[data-v-b9153f5c]{background-color:#d1245c}.details-panel__notification.blocked a[data-v-b9153f5c]{color:#e3e5e8}.details-panel__notification.trimmed[data-v-b9153f5c]{background-color:#c07d1b}.details-panel__notification.trimmed a[data-v-b9153f5c]{color:#e3e5e8}', map: void 0, media: void 0 }); - }, { name: "v-details-panel", components: { AppMapLogo: ve, VDetailsLabel: Xe, VDetailsPanelAnalysisFinding: dt, VDetailsPanelClass: ut, VDetailsPanelDatabase: vt, VDetailsPanelEdge: At, VDetailsPanelEvent: Et, VDetailsPanelFunction: yt, VDetailsPanelHttp: It, VDetailsPanelPackage: xt, VDetailsPanelQuery: kt, VDetailsPanelRoute: Bt, VDetailsPanelExternalService: Mt, VDetailsPanelLabels: St, VDetailsSearch: zt, VPopper: lt, VSourceCodeLink: rt, VAskNavieButton: de({ render: function() { + }, { name: "v-details-panel", components: { AppMapLogo: ve, VDetailsLabel: Xe, VDetailsPanelAnalysisFinding: dt, VDetailsPanelClass: ut, VDetailsPanelDatabase: vt, VDetailsPanelEdge: ft, VDetailsPanelEvent: Et, VDetailsPanelFunction: yt, VDetailsPanelHttp: It, VDetailsPanelPackage: xt, VDetailsPanelQuery: kt, VDetailsPanelRoute: Bt, VDetailsPanelExternalService: Mt, VDetailsPanelLabels: St, VDetailsSearch: zt, VPopper: lt, VSourceCodeLink: rt, VAskNavieButton: de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "ask-navie ask-navie__wrapper" }, [a3("div", { staticClass: "ask-navie__button", attrs: { "data-cy": "ask-navie-button" } }, [a3("v-compass-icon", { staticClass: "compass-icon" }), e3._v("\n Ask Navie\n ")], 1)]); }, staticRenderFns: [] }, function(e3) { @@ -356755,10 +357125,10 @@ ${content3} }, Dt, "data-v-f176fe18", false, void 0, false, he, void 0, void 0), FeedbackIcon: { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ width: "15", height: "14", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M4.286 2a2 2 0 012-2H13a2 2 0 012 2v3.21a2 2 0 01-2 2H7.857c0-.924-.714-1.802-1.071-2.163-.496-.5-1.083-.72-2.077-.72-.12 0-.255-.006-.397-.012l-.026-.001V2zm3.362 2.115a.724.724 0 000-1.02.71.71 0 00-1.01 0 .724.724 0 000 1.02.711.711 0 001.01 0zm2.857 0a.725.725 0 000-1.02.711.711 0 00-1.01 0 .724.724 0 000 1.02.711.711 0 001.01 0zm2.857 0a.724.724 0 000-1.02.71.71 0 00-1.01 0 .724.724 0 000 1.02.71.71 0 001.01 0z", fill: "#EAEAEA" } }), a3("path", { attrs: { d: "M.774 14S0 14 0 13.219c0-1.682.774-3.125 4.643-3.125 3.869 0 4.643 1.443 4.643 3.125 0 .781-.774.781-.774.781H.774zm3.869-4.266a2.31 2.31 0 001.641-.686c.436-.44.68-1.036.68-1.657 0-.622-.244-1.218-.68-1.657a2.31 2.31 0 00-1.641-.687A2.31 2.31 0 003 5.734a2.355 2.355 0 00-.68 1.657c0 .621.245 1.217.68 1.657a2.31 2.31 0 001.642.686zM7.857 8.292L10 7.21H7.857v1.082z", fill: "#EAEAEA" } })])); - } }, ExclamationIcon: Rt, ScissorsIcon: Yt, NavArrow: { functional: true, render(e3, t4) { + } }, ExclamationIcon: Rt, ScissorsIcon: Pt, NavArrow: { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M5 13h11.86l-3.63 4.36a1 1 0 001.54 1.28l5-6a1.19 1.19 0 00.09-.15c0-.05.05-.08.07-.13A1 1 0 0020 12a1 1 0 00-.07-.36c0-.05-.05-.08-.07-.13a1.19 1.19 0 00-.09-.15l-5-6A1 1 0 0014 5a1 1 0 00-.64.23 1 1 0 00-.13 1.41L16.86 11H5a1 1 0 000 2z" } })])); - } }, ClearIcon: Pt, ChevronDownIcon: { functional: true, render(e3, t4) { + } }, ClearIcon: Yt, ChevronDownIcon: { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 214 245", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M98.893 182.542L6.06 89.546c-4.477-4.486-4.477-11.757 0-16.242l10.827-10.846c4.47-4.478 11.714-4.486 16.194-.02L107 136.14l73.918-73.701c4.481-4.467 11.725-4.459 16.194.019l10.828 10.846c4.477 4.485 4.477 11.757 0 16.242l-92.833 92.996c-4.478 4.485-11.736 4.485-16.214 0z" } })])); } }, CompassIcon: jt }, props: { subtitle: String, appMap: import_models.AppMap, selectedObject: { type: Object }, selectedLabel: { type: String }, filtersRootObjects: { type: Array, default: () => [] }, findings: { type: Array, default: () => [] }, wasAutoPruned: { type: Boolean, default: false }, isGiantAppMap: { type: Boolean, default: false }, showAskNavie: { type: Boolean, default: true } }, data: () => ({ sourceLocation: null, sourceLocationError: null, currentSelection: null }), computed: { selectionStack() { @@ -356823,11 +357193,11 @@ ${content3} this.tabs = this.$children.filter((e4) => "v-tab" === e4.$options.name), e3 = this.initialTab ? this.tabs.find((e4) => e4.tabName === this.initialTab) : this.tabs[0], e3 && this.activateTab(e3); }); } }, "data-v-6aa8555d", false, void 0, false, he, void 0, void 0); - var Tt = { functional: true, render(e3, t4) { + var Ot = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 498 498", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("circle", { attrs: { cx: "248.959", cy: "248.959", r: "248.959", fill: "#FF07AA" } }), a3("path", { attrs: { d: "M337.213 284.858l-75.26-159.04-13.049-25.816-12.411 25.816-111.425 234.239h28.815l13.875-30.854 14.088-30.638 36.991-83.868 30.067-62.684 66.232 146.552 6.924 14.926 21.678 46.566h29.001l-35.526-75.199z", fill: "#fff" } }), a3("path", { attrs: { d: "M337.213 284.858l-75.26-159.04-13.049-25.816-12.411 25.816-111.425 234.239h28.815l13.875-30.854 14.088-30.638 36.991-83.868 30.067-62.684 66.232 146.552 6.924 14.926 21.678 46.566h29.001l-35.526-75.199z", stroke: "#fff" } }), a3("path", { attrs: { stroke: "#FF07AA", d: "M125.068 100.002h260.054v260.054H125.068z" } })])); } }; - var Ot = { functional: true, render(e3, t4) { + var Tt = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 58 58", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("circle", { attrs: { cx: "29", cy: "29", r: "28", stroke: "#D9D9D9", "stroke-width": "2" } }), a3("path", { attrs: { stroke: "#D9D9D9", "stroke-width": "2", d: "M16 20h27M16 38h27M16 29h27" } })])); } }; @@ -357188,7 +357558,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; } } }, [a3("CollapseIcon")], 1)]) : e3._e()], 1)] : e3._e(), e3._v("\n " + e3._s(e3.actor.name) + "\n "), e3.expandable ? a3("span", [e3._v("(" + e3._s(e3.numClasses) + ")")]) : e3._e()], 2)]), e3._v(" "), e3.expandable ? a3("div", { staticClass: "label-container stack stack1" }) : e3._e(), e3._v(" "), e3.expandable ? a3("div", { staticClass: "label-container stack stack2" }) : e3._e()])])])]); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-31738193_0", { source: '.offset[data-v-31738193]{position:relative;height:100%;left:100%;width:0}.sequence-actor[data-v-31738193]{position:sticky;top:10px;z-index:5;font-family:"IBM Plex Mono",monospace}.label-container[data-v-31738193]{margin:3px 0;text-align:center;overflow:hidden;text-overflow:ellipsis;overflow:visible;box-shadow:0 0 20px 0 rgba(0,0,0,.55);z-index:5;min-width:155px;min-height:60px;max-width:169px;width:fit-content;transform:translateX(-50%);position:absolute;background-color:#010306;color:#e3e5e8;font-size:9pt;border:3px solid #ffffff00;border-radius:0;display:grid;grid-template-rows:100%;grid-template-columns:100%;justify-content:center;align-items:center;transition:all .3s ease}.label-container .label[data-v-31738193]{text-shadow:#ffffff21 0 0 20px}.label-container .label.http[data-v-31738193]{background-color:#542168;color:#e3e5e8}.label-container .label.external-service[data-v-31738193]{background-color:#ebdf90;color:#010306}.label-container .label.package[data-v-31738193]{background-color:#6fddd6;color:#010306}.label-container .label.class[data-v-31738193]{background-color:#4362b1;color:#e3e5e8}.label-container .label.database[data-v-31738193]{background-color:#9c2fba;color:#e3e5e8}.label-container--selected[data-v-31738193]{border:3px solid #ff07aa}.label-container--selected .label[data-v-31738193]{text-shadow:#ffffff21 0 0 12px}.label-container .label[data-v-31738193]{letter-spacing:-.5px;height:100%;padding-top:.25rem}.label-container .hover-text-popper[data-v-31738193]{z-index:99999}.label-container .collapse-actor[data-v-31738193],.label-container .expand-actor[data-v-31738193]{z-index:99999;font-size:.65rem;font-weight:500;letter-spacing:-1px;transition:all .3s ease;color:#e3e5e854}.label-container .collapse-actor[data-v-31738193]:hover,.label-container .expand-actor[data-v-31738193]:hover{color:#e3e5e8;cursor:pointer}.label-container .collapse-actor:hover svg[data-v-31738193],.label-container .expand-actor:hover svg[data-v-31738193]{opacity:50%}.label-container .hide-container[data-v-31738193]{display:inline-block;z-index:99999}.label-container .hide-container[data-v-31738193]:hover{color:#00f;text-decoration:underline;cursor:pointer}.label-container .hide-container svg[data-v-31738193]{fill:#010306;opacity:100%}.label-container .hide-container svg[data-v-31738193]:hover{opacity:50%}.label-container .control-wrap[data-v-31738193]{width:100%;display:flex;flex-direction:row-reverse;align-items:center;justify-content:space-between;padding:0 .5rem;margin-bottom:.125rem}.label-container .http[data-v-31738193]{color:#8e45aa}.label-container .external-service[data-v-31738193]{color:#ebdf90}.label-container .package[data-v-31738193]{color:#6fddd6}.label-container .class[data-v-31738193]{color:#4362b1}.label-container .database[data-v-31738193]{color:#9c2fba}.label-container.stack[data-v-31738193]{border-radius:0}.label-container.stack.stack1[data-v-31738193]{z-index:4;margin:8px 0 0 6px;border:1px solid #5b6570}.label-container.stack.stack2[data-v-31738193]{z-index:3;margin:14px 0 0 12px;border:1px solid #393f46}.interactive.label-container[data-v-31738193]:hover{cursor:pointer}.lane[data-v-31738193]{min-width:175px;min-height:3rem}.on-top[data-v-31738193]{position:absolute;z-index:99999;height:100%}.sequence-actor-lane-separator[data-v-31738193]{border-left:1px dashed #505862;position:relative;height:100%;width:1px;top:0;left:100%;float:left}.close-icon[data-v-31738193]{width:12px;height:12px}', map: void 0, media: void 0 }); - }, { name: "v-sequence-actor", components: { XIcon: Pt, VPopper: lt, ExpandIcon: { functional: true, render(e3, t4) { + }, { name: "v-sequence-actor", components: { XIcon: Yt, VPopper: lt, ExpandIcon: { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: ["expand-icon", o2, r2], style: [c5, l2], attrs: Object.assign({ width: "13", height: "13", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M7 3H6v3H3v1h3v3h1V7h3V6H7V3z", fill: "#010306" } }), a3("path", { attrs: { stroke: "#010306", d: "M.5.5h12v12H.5z" } })])); } }, CollapseIcon: { functional: true, render(e3, t4) { @@ -357214,7 +357584,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; } return 0; } }, methods: { hideCodeObject() { - this.$store.commit(Oe, this.actor.id); + this.$store.commit(Te, this.actor.id); }, selectCodeObject() { if (this.appMap) { const e3 = this.appMap.classMap.codeObjects.find((e4) => e4.fqid === this.actor.id); @@ -357476,23 +357846,23 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; return { coeficient: ga(a3), exponent: parseInt(i2) }; } }; - var Aa = ({ coeficient: e3, exponent: t4 }) => { + var fa = ({ coeficient: e3, exponent: t4 }) => { let a3 = t4 % 3; return a3 < 0 && (a3 += 3), { coeficient: ua(e3, a3), exponent: t4 - a3 }; }; - var fa = (e3, t4) => e3 + t4; + var Aa = (e3, t4) => e3 + t4; var ba = ({ elapsedTime: e3 }) => "number" == typeof e3 && e3 >= 0; var wa = (e3) => ba(e3) ? e3.elapsedTime : 0; var Ca = (e3, t4) => e3 > 0 ? `${((e4, t5) => { const { coeficient: a3, exponent: i2 } = va(e4, t5); if (i2 >= -3 && i2 <= 3) return ma(ua(a3, i2)); { - const { coeficient: e6, exponent: t6 } = Aa({ coeficient: a3, exponent: i2 }); + const { coeficient: e6, exponent: t6 } = fa({ coeficient: a3, exponent: i2 }); return `${ma(e6)}e${t6}`; } })(1e3 * e3, t4)} ms` : "unknown"; var Ea = (e3, t4) => e3 > 0 ? `${((e4, t5) => { - const { coeficient: a3, exponent: i2 } = Aa(va(e4, t5)); + const { coeficient: a3, exponent: i2 } = fa(va(e4, t5)); return ha.has(i2) ? `${ma(a3)} ${ha.get(i2)}` : i2 > 0 ? (e4 > 0 ? "+" : "-") + "\u221E " : "0 "; })(e3, t4)}s` : "unknown"; var ya = de({ render: function() { @@ -357504,9 +357874,9 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-29d748f2_0", { source: ".flamegraph-branch[data-v-29d748f2]{flex-grow:1;display:flex;flex-direction:row;align-items:flex-end;flex-wrap:nowrap}", map: void 0, media: void 0 }); }, { name: "v-flamegraph-branch", emits: ["select", "hover"], components: { VFlamegraphNode: async () => (await Promise.resolve().then(function() { - return $n; + return rs; })).default }, props: { events: { type: Array, required: true }, factor: { type: Number, required: true }, focus: { type: Object, default: null }, baseBudget: { type: Number, required: true }, zoomBudget: { type: Number, required: true } }, computed: { children() { - const e3 = this.events.length, t4 = this.events.filter(ba), a3 = t4.map(wa).reduce(fa, 0) || 1, i2 = t4.length, n2 = e3 - i2, s3 = this.factor * (i2 / e3), o2 = this.factor * (n2 / e3) / n2; + const e3 = this.events.length, t4 = this.events.filter(ba), a3 = t4.map(wa).reduce(Aa, 0) || 1, i2 = t4.length, n2 = e3 - i2, s3 = this.factor * (i2 / e3), o2 = this.factor * (n2 / e3) / n2; return this.events.map((e4) => ({ key: e4.id, event: e4, factor: ba(e4) ? s3 * (wa(e4) / a3) : o2 })); } }, methods: { propagateSelect(e3) { this.$emit("select", e3); @@ -358057,16 +358427,20 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; const a3 = JSON.parse(JSON.stringify(e3)); t4 && (a3.viewState = { ...t4 }), this.$root.$emit("exportJSON", a3); } } }, void 0, false, void 0, false, void 0, void 0, void 0); + var Pa = { functional: true, render(e3, t4) { + const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; + return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 14 14", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M.297 7.071a.714.714 0 01.715-.715l5.345.001V1.011a.715.715 0 111.43 0l-.002 5.346 5.346-.001a.716.716 0 010 1.43H7.785l.001 5.345a.715.715 0 01-1.43 0l.001-5.346-5.345.001a.714.714 0 01-.715-.715z" } })])); + } }; var Ya = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 8 7", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M6.756.546A.718.718 0 017.27.333a.72.72 0 01.51.221.79.79 0 01.22.53.792.792 0 01-.193.541L3.89 6.754a.708.708 0 01-1.06.02L.234 4.054a.802.802 0 01-.019-1.109.707.707 0 011.059.02L3.33 5.116 6.738.57a.269.269 0 01.02-.023h-.002z" } })])); } }; - var Pa = { functional: true, render(e3, t4) { + var Fa = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 12 12", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M11.36 11.684a.376.376 0 00.53 0 .37.37 0 000-.526L6.634 5.934 11.757.842a.37.37 0 000-.526.376.376 0 00-.53 0L6.105 5.408.772.109a.376.376 0 00-.53 0 .37.37 0 000 .526l5.333 5.299-5.465 5.43a.37.37 0 000 .527.376.376 0 00.53 0L6.103 6.46l5.257 5.224z" } })])); } }; - var Fa = "savedFilters"; - var Ha = de({ render: function() { + var Ha = "savedFilters"; + var Oa = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "filters", attrs: { "data-cy": "filters-menu" } }, [a3("div", { staticClass: "filters__head" }, [a3("FilterIcon", { staticClass: "filters__head-icon" }), e3._v(" "), a3("h2", { staticClass: "filters__head-text" }, [e3._v("Filters")]), e3._v(" "), a3("button", { staticClass: "filters__head-reset", on: { click: e3.resetFilters } }, [e3._v("\n Reset\n "), a3("ResetIcon")], 1), e3._v(" "), a3("button", { staticClass: "filters__head-close", attrs: { "data-cy": "filters-close" }, on: { click: e3.close } }, [a3("CloseThinIcon")], 1)], 1), e3._v(" "), a3("div", { staticClass: "filters__block" }, [e3._m(0), e3._v(" "), a3("div", { staticClass: "filters__block-body" }, [a3("div", { staticClass: "filters__block-row" }, [a3("div", { staticClass: "filters__block-row-content" }, [a3("v-filters-form", { attrs: { onSubmit: e3.addRootObject, placeholder: "add new root...", suggestions: e3.rootObjectsSuggestions } })], 1)])]), e3._v(" "), e3.filters.rootObjects.length ? a3("div", { staticClass: "filters__block-body filters__block-body--flex" }, e3._l(e3.filters.rootObjects, function(t5, i2) { return a3("div", { key: t5, staticClass: "filters__root" }, [e3._v("\n " + e3._s(t5) + "\n "), a3("CloseThinIcon", { staticClass: "filters__root-icon", on: { click: function(t6) { @@ -358144,10 +358518,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }), 0) : e3._e()], 1); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-044dd038_0", { source: ".filters__form[data-v-044dd038]{position:relative;flex:1;margin-left:.5rem;border-radius:.25rem;display:flex;align-items:center;height:22px;padding:0 .5rem;border:1px solid #242c41;background:#010306}.filters__form--show-suggestions[data-v-044dd038]{border-radius:.25rem .25rem 0 0}.filters__form--show-suggestions.filters__form--suggestions-top[data-v-044dd038]{border-radius:0 0 .25rem .25rem}.filters__form-input[data-v-044dd038]{flex:1;display:inline-block;vertical-align:middle;width:100%;border:0;border-radius:2px;box-shadow:none;background:0 0;font:inherit;color:inherit;outline:0}.filters__form-plus[data-v-044dd038]{flex-shrink:0;margin-left:1rem;width:1em;height:1em;fill:#606060;cursor:pointer}.filters__form-suggestions[data-v-044dd038]{display:none;position:absolute;top:100%;left:0;right:0;border-radius:0 0 .25rem .25rem;border:1px solid #242c41;margin:0;padding:0;max-height:66px;list-style:none;overflow-x:hidden;overflow-y:auto;z-index:1000;background:#010306}.filters__form--show-suggestions .filters__form-suggestions[data-v-044dd038]{display:block}.filters__form--suggestions-top .filters__form-suggestions[data-v-044dd038]{top:auto;bottom:100%;border-radius:.25rem .25rem 0 0}.filters__form-suggestions-item[data-v-044dd038]{padding:0 .5rem;height:22px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#a0a0a0;cursor:pointer}.filters__form-suggestions-item--selected[data-v-044dd038],.filters__form-suggestions-item[data-v-044dd038]:active,.filters__form-suggestions-item[data-v-044dd038]:hover{color:#e3e5e8}", map: void 0, media: void 0 }); - }, { name: "v-filters-form", components: { PlusIcon: { functional: true, render(e3, t4) { - const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; - return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 14 14", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M.297 7.071a.714.714 0 01.715-.715l5.345.001V1.011a.715.715 0 111.43 0l-.002 5.346 5.346-.001a.716.716 0 010 1.43H7.785l.001 5.345a.715.715 0 01-1.43 0l.001-5.346-5.345.001a.714.714 0 01-.715-.715z" } })])); - } } }, props: { onSubmit: { type: Function, required: true }, placeholder: { type: String, default: "" }, suggestions: { type: Array, default: () => [] }, suggestionsPlacement: { type: String, default: "bottom", validator: (e3) => -1 !== ["top", "bottom"].indexOf(e3) } }, data: () => ({ showSuggestions: false, inputValue: "", selectedSuggestion: 0 }), watch: { selectedSuggestion: { handler(e3) { + }, { name: "v-filters-form", components: { PlusIcon: Pa }, props: { onSubmit: { type: Function, required: true }, placeholder: { type: String, default: "" }, suggestions: { type: Array, default: () => [] }, suggestionsPlacement: { type: String, default: "bottom", validator: (e3) => -1 !== ["top", "bottom"].indexOf(e3) } }, data: () => ({ showSuggestions: false, inputValue: "", selectedSuggestion: 0 }), watch: { selectedSuggestion: { handler(e3) { const t4 = this.$refs.suggestionsList.querySelectorAll("li")[e3]; t4.offsetTop < this.$refs.suggestionsList.scrollTop ? this.$refs.suggestionsList.scrollTop = t4.offsetTop : t4.offsetTop >= this.$refs.suggestionsList.scrollTop + this.$refs.suggestionsList.offsetHeight && (this.$refs.suggestionsList.scrollTop = t4.offsetTop - 2 * t4.offsetHeight); } } }, computed: { classes() { @@ -358183,7 +358554,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; window.addEventListener("click", this.onWindowClick), window.addEventListener("keyup", this.onWindowKeyUp, true); }, destroyed() { window.removeEventListener("click", this.onWindowClick), window.removeEventListener("keyup", this.onWindowKeyUp, true); - } }, "data-v-044dd038", false, void 0, false, he, void 0, void 0), CheckIcon: Ya, CloseThinIcon: Pa, FilterIcon: pt, ResetIcon: ht }, props: { filteredAppMap: { type: Object, required: true }, isInBrowser: { type: Boolean } }, data: () => ({ copied: false, newFilterName: "" }), computed: { filters() { + } }, "data-v-044dd038", false, void 0, false, he, void 0, void 0), CheckIcon: Ya, CloseThinIcon: Fa, FilterIcon: pt, ResetIcon: ht }, props: { filteredAppMap: { type: Object, required: true }, isInBrowser: { type: Boolean } }, data: () => ({ copied: false, newFilterName: "" }), computed: { filters() { return this.$store.state.filters; }, savedFilters() { return this.$store.state.savedFilters; @@ -358194,31 +358565,31 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; } }, limitRootEvents: { get() { return this.$store.state.filters.declutter.limitRootEvents.on; }, set(e3) { - this.$store.commit(Ye, { declutterProperty: "limitRootEvents", value: e3 }); + this.$store.commit(Pe, { declutterProperty: "limitRootEvents", value: e3 }); } }, hideMediaRequests: { get() { return this.$store.state.filters.declutter.hideMediaRequests.on; }, set(e3) { - this.$store.commit(Ye, { declutterProperty: "hideMediaRequests", value: e3 }); + this.$store.commit(Pe, { declutterProperty: "hideMediaRequests", value: e3 }); } }, hideUnlabeled: { get() { return this.$store.state.filters.declutter.hideUnlabeled.on; }, set(e3) { - this.$store.commit(Ye, { declutterProperty: "hideUnlabeled", value: e3 }); + this.$store.commit(Pe, { declutterProperty: "hideUnlabeled", value: e3 }); } }, hideExternal: { get() { return this.$store.state.filters.declutter.hideExternalPaths.on; }, set(e3) { - this.$store.commit(Ye, { declutterProperty: "hideExternalPaths", value: e3 }); + this.$store.commit(Pe, { declutterProperty: "hideExternalPaths", value: e3 }); } }, hideElapsedTimeUnder: { get() { return this.$store.state.filters.declutter.hideElapsedTimeUnder.on; }, set(e3) { - this.$store.commit(Ye, { declutterProperty: "hideElapsedTimeUnder", value: e3 }); + this.$store.commit(Pe, { declutterProperty: "hideElapsedTimeUnder", value: e3 }); } }, hideElapsedTime: { get() { return this.$store.state.filters.declutter.hideElapsedTimeUnder.time; }, set(e3) { - this.$store.commit(Pe, e3); + this.$store.commit(Ye, e3); } }, hideName: { get() { return this.$store.state.filters.declutter.hideName.on; }, set(e3) { - this.$store.commit(Ye, { declutterProperty: "hideName", value: e3 }); + this.$store.commit(Pe, { declutterProperty: "hideName", value: e3 }); } }, hiddenNames() { return this.$store.state.filters.declutter.hideName.names; }, rootObjectsSuggestions() { @@ -358240,13 +358611,13 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }, addRootObject(e3) { this.$store.commit(He, e3); }, removeRootObject(e3) { - this.$store.commit(Te, e3); - }, addHiddenName(e3) { this.$store.commit(Oe, e3); + }, addHiddenName(e3) { + this.$store.commit(Te, e3); }, removeHiddenName(e3) { - this.$store.commit(Le, e3), 0 === this.filters.declutter.hideName.names.length && this.$store.commit(Ye, { declutterProperty: "hideName", value: false }); + this.$store.commit(Le, e3), 0 === this.filters.declutter.hideName.names.length && this.$store.commit(Pe, { declutterProperty: "hideName", value: false }); }, getFiltersFromLocalStorage() { - const e3 = localStorage.getItem(Fa); + const e3 = localStorage.getItem(Ha); if (e3) try { return JSON.parse(e3); } catch (e4) { @@ -358254,7 +358625,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; } return []; }, updateFilters(e3) { - this.$store.commit(Ue, e3), this.isInBrowser && localStorage.setItem(Fa, JSON.stringify(e3)); + this.$store.commit(Ue, e3), this.isInBrowser && localStorage.setItem(Ha, JSON.stringify(e3)); }, saveFilter() { const e3 = this.newFilterName.trim(); if ("" === this.newFilterName.trim() || this.newFilterName === Ge) return void (this.newFilterName = ""); @@ -358287,7 +358658,11 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }, optionStyle: (e3) => e3.default ? { fontWeight: "bold" } : { color: "#c8c8c8" }, close() { window.document.body.click(); } } }, "data-v-2f3f2d79", false, void 0, false, he, void 0, void 0); - var Ta = de({ render: function() { + var Ta = { functional: true, render(e3, t4) { + const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; + return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M7.75 0a7.751 7.751 0 000 15.5 7.75 7.75 0 100-15.5zm0 3.438a1.313 1.313 0 110 2.625 1.313 1.313 0 010-2.625zm1.75 7.937a.375.375 0 01-.375.375h-2.75A.375.375 0 016 11.375v-.75c0-.207.168-.375.375-.375h.375v-2h-.375A.375.375 0 016 7.875v-.75c0-.207.168-.375.375-.375h2c.207 0 .375.168.375.375v3.125h.375c.207 0 .375.168.375.375v.75z" } })])); + } }; + var La = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "instructions" }, [a3("button", { staticClass: "instructions__icon", attrs: { type: "button" }, on: { click: e3.toggle } }, [a3("InfoIcon")], 1), e3._v(" "), e3.isOpen ? a3("section", { staticClass: "instructions__container" }, [a3("div", { staticClass: "instructions__head" }, [a3("h1", { staticClass: "instructions__title" }, [e3._v("Welcome to your AppMap!")]), e3._v(" "), a3("button", { staticClass: "instructions__close", on: { click: e3.close } }, [a3("CloseIcon")], 1)]), e3._v(" "), e3._m(0), e3._v(" "), a3("section", { staticClass: "instructions-wrap" }, [e3.isViewingDependency ? a3("div", { staticClass: "dependency-map" }, [a3("h4", [e3._v("Dependency map")]), e3._v(" "), e3._m(1), e3._v(" "), e3._m(2)]) : e3._e(), e3._v(" "), e3.isViewingSequence ? a3("div", { staticClass: "sequence" }, [a3("h4", [e3._v("Sequence diagram")]), e3._v(" "), a3("ul", { staticClass: "feature-list" }, [a3("li", [e3._v("Show details in left panel by selecting an event")]), e3._v(" "), a3("li", [e3._v("\n Expand and collapse sections with the\n "), a3("span", { staticClass: "icons" }, [a3("ExpandSection"), e3._v(" "), a3("CollapseSection")], 1), e3._v("\n icons\n ")]), e3._v(" "), a3("li", [e3._v("Hide sequence diagram actors to optimize map")])]), e3._v(" "), a3("ul", { staticClass: "legend" }, [a3("h5", [e3._v("Legend")]), e3._v(" "), a3("li", [a3("FromArrow"), e3._v("Call arrow")], 1), e3._v(" "), a3("li", [a3("ReturnArrow"), e3._v("Return arrow")], 1), e3._v(" "), a3("li", [a3("LoopBox"), e3._v("Loop container")], 1), e3._v(" "), a3("li", [a3("CollapseSection"), e3._v("Collapse section")], 1), e3._v(" "), a3("li", [a3("ExpandSection"), e3._v("Expand section")], 1), e3._v(" "), a3("li", [a3("XIcon"), e3._v("Hide lifeline")], 1), e3._v(" "), a3("li", [a3("Lifeline"), e3._v("Lifeline")], 1), e3._v(" "), a3("li", [a3("ActiveLifeline"), e3._v("Active lifeline")], 1)])]) : e3._e(), e3._v(" "), e3.isViewingTrace ? a3("div", { staticClass: "trace" }, [a3("h4", [e3._v("Trace view")]), e3._v(" "), e3._m(3), e3._v(" "), e3._m(4)]) : e3._e()])]) : e3._e()]); }, staticRenderFns: [function() { @@ -358307,10 +358682,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; return a3("ul", { staticClass: "legend" }, [a3("h5", [e3._v("Legend")]), e3._v(" "), a3("li", { staticClass: "type-int icon" }, [e3._v("Integer/Number")]), e3._v(" "), a3("li", { staticClass: "type-string icon" }, [e3._v("String")]), e3._v(" "), a3("li", { staticClass: "type-bool icon" }, [e3._v("Boolean")]), e3._v(" "), a3("li", { staticClass: "type-float icon" }, [e3._v("Float/Decimal")]), e3._v(" "), a3("li", { staticClass: "type-object icon" }, [e3._v("Object/Other")])]); }] }, function(e3) { e3 && e3("data-v-7df829c5_0", { source: `@charset "UTF-8";.instructions[data-v-7df829c5]{position:relative;font-family:"IBM Plex Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-size:0;z-index:1000}.instructions__close[data-v-7df829c5],.instructions__icon[data-v-7df829c5]{border:none;padding:.2rem;background:0 0;color:#808b98;font:inherit;font-size:.8rem;outline:0;line-height:0;appearance:none;cursor:pointer}.instructions__close[data-v-7df829c5]:active,.instructions__close[data-v-7df829c5]:hover,.instructions__icon[data-v-7df829c5]:active,.instructions__icon[data-v-7df829c5]:hover{color:#e1e2e2}.instructions__close svg[data-v-7df829c5],.instructions__icon svg[data-v-7df829c5]{fill:currentColor;width:16px}.instructions__container[data-v-7df829c5]{border-radius:.5rem .5rem 0 .5rem;position:absolute;right:0;bottom:100%;margin:0 .75rem 1rem 0;min-width:30vw;height:max-content;max-width:40vw;max-height:80vh;padding:1.5rem;color:#eaeaea;background:#010306;overflow-y:auto}.instructions__head[data-v-7df829c5]{position:relative;display:flex;align-items:flex-start}.instructions__title[data-v-7df829c5]{margin:0;color:#ff07aa;font-size:1.5rem}.instructions__content[data-v-7df829c5]{font-size:.9rem;line-height:1.2rem;word-break:break-word;overflow:auto}.instructions__close[data-v-7df829c5]{margin-left:auto}ul[data-v-7df829c5]{padding-left:1.2rem;word-break:break-word}ul li[data-v-7df829c5]{margin:.3rem 0}ul.feature-list[data-v-7df829c5]{border-bottom:1px solid #808b98;padding-left:1rem;padding-bottom:1rem;line-height:1.3rem}ul.feature-list svg[data-v-7df829c5]{margin:0 .2rem}ul.feature-list .icons[data-v-7df829c5]{margin:0 .25rem}.instructions-wrap[data-v-7df829c5]{width:100%;display:grid;grid-template-columns:1fr;column-gap:2rem;overflow:auto}.instructions-wrap .legend[data-v-7df829c5]{margin:0;padding:0;list-style-type:none;word-break:break-word}.instructions-wrap .legend h5[data-v-7df829c5]{margin:0 0 .4rem 0;color:#808b98;font-size:1rem;font-weight:400}.instructions-wrap .legend li[data-v-7df829c5]{display:flex;flex-direction:row;align-items:center;margin:.5rem 0;line-height:2rem;gap:.5rem;font-size:.85rem}.instructions-wrap .legend li p[data-v-7df829c5]{flex:1;margin:0;line-height:1.5rem}.instructions-wrap .dependency-map[data-v-7df829c5],.instructions-wrap .sequence[data-v-7df829c5],.instructions-wrap .trace[data-v-7df829c5]{padding:1rem;border-radius:1rem;border:1px solid #808b98;width:100%;font-size:.9rem}.instructions-wrap .dependency-map h4[data-v-7df829c5],.instructions-wrap .sequence h4[data-v-7df829c5],.instructions-wrap .trace h4[data-v-7df829c5]{margin:0;color:#ff07aa;font-size:1rem}.instructions-wrap .dependency-map .legend ul[data-v-7df829c5],.instructions-wrap .sequence .legend ul[data-v-7df829c5],.instructions-wrap .trace .legend ul[data-v-7df829c5]{margin:0;padding:0;list-style-type:none}.instructions-wrap .dependency-map .legend ul li[data-v-7df829c5],.instructions-wrap .sequence .legend ul li[data-v-7df829c5],.instructions-wrap .trace .legend ul li[data-v-7df829c5]{display:flex;flex-direction:row;margin:0;line-height:2rem;align-items:flex-start}.instructions-wrap .dependency-map .legend ul li p[data-v-7df829c5],.instructions-wrap .sequence .legend ul li p[data-v-7df829c5],.instructions-wrap .trace .legend ul li p[data-v-7df829c5]{flex:1;margin:0}.instructions-wrap .dependency-map[data-v-7df829c5]{padding-right:1.5rem}.instructions-wrap .dependency-map .icon[data-v-7df829c5]{display:inline-block;height:1rem;width:2rem;margin-right:.5rem}.instructions-wrap .dependency-map .icon.class-pkg[data-v-7df829c5]{background-color:#6fddd6}.instructions-wrap .dependency-map .icon.class[data-v-7df829c5]{background-color:#4362b1}.instructions-wrap .dependency-map .icon.dynamic[data-v-7df829c5]{background-image:url("data:image/svg+xml,%3Csvg width='32' height='12' viewBox='0 0 32 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M32 5.99999L22 0.226492L22 11.7735L32 5.99999ZM2.62268e-07 7L23 6.99999L23 4.99999L-2.62268e-07 5L2.62268e-07 7Z' fill='%23808B98'/%3E%3C/svg%3E%0A");background-repeat:no-repeat;align-self:center}.instructions-wrap .dependency-map .icon.web-service[data-v-7df829c5]{background-color:#c61c38}.instructions-wrap .dependency-map .icon.database[data-v-7df829c5]{background-color:#9c2fba}.instructions-wrap .trace[data-v-7df829c5]{font-family:"IBM Plex Sans","Helvetica Neue",Helvetica,Arial,sans-serif}.instructions-wrap .trace .legend li[data-v-7df829c5]{line-height:2rem;margin:0}.instructions-wrap .trace .icon[data-v-7df829c5]{height:unset;width:unset}.instructions-wrap .trace .icon.type-bool[data-v-7df829c5]:before,.instructions-wrap .trace .icon.type-float[data-v-7df829c5]:before,.instructions-wrap .trace .icon.type-int[data-v-7df829c5]:before,.instructions-wrap .trace .icon.type-object[data-v-7df829c5]:before,.instructions-wrap .trace .icon.type-string[data-v-7df829c5]:before{font-size:1.25rem;margin-right:.3rem;font-size:2rem}.instructions-wrap .trace .icon.type-int[data-v-7df829c5]:before{content:"\u25CF";color:#f92672}.instructions-wrap .trace .icon.type-string[data-v-7df829c5]:before{content:"\u25CF";color:#a6e22e}.instructions-wrap .trace .icon.type-bool[data-v-7df829c5]:before{content:"\u25CF";color:#66d9ef}.instructions-wrap .trace .icon.type-float[data-v-7df829c5]:before{content:"\u25CF";color:#fd971f}.instructions-wrap .trace .icon.type-object[data-v-7df829c5]:before{content:"\u25CF";color:#ae81ff}@media (max-width:1300px){section.instructions-wrap[data-v-7df829c5]{grid-template-columns:1fr}section.instructions-wrap .dependency-map[data-v-7df829c5]{margin:1rem 0}section.instructions-wrap .legend[data-v-7df829c5]{margin-bottom:1rem}section.instructions-wrap .legend[data-v-7df829c5]:last-of-type{margin-bottom:0}}`, map: void 0, media: void 0 }); - }, { name: "v-instructions", components: { CloseIcon: Ut, InfoIcon: { functional: true, render(e3, t4) { - const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; - return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M7.75 0a7.751 7.751 0 000 15.5 7.75 7.75 0 100-15.5zm0 3.438a1.313 1.313 0 110 2.625 1.313 1.313 0 010-2.625zm1.75 7.937a.375.375 0 01-.375.375h-2.75A.375.375 0 016 11.375v-.75c0-.207.168-.375.375-.375h.375v-2h-.375A.375.375 0 016 7.875v-.75c0-.207.168-.375.375-.375h2c.207 0 .375.168.375.375v3.125h.375c.207 0 .375.168.375.375v.75z" } })])); - } }, CollapseSection: { functional: true, render(e3, t4) { + }, { name: "v-instructions", components: { CloseIcon: Ut, InfoIcon: Ta, CollapseSection: { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ width: "13", height: "11", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M0 10.828V0h3.081v1.185H1.483v8.463h1.598v1.18H0zM9.402 4.705v1.27h-6v-1.27h6zM12.983 0v10.828H9.902v-1.18H11.5V1.185H9.902V0h3.081z", fill: "#fff" } })])); } }, ExpandSection: { functional: true, render(e3, t4) { @@ -358325,7 +358697,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; } }, LoopBox: { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ width: "38", height: "19", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M2 8v7a2 2 0 002 2h30a2 2 0 002-2V8H2zM0 4a4 4 0 014-4h30a4 4 0 014 4v11a4 4 0 01-4 4H4a4 4 0 01-4-4V4z", fill: "#444E69" } })])); - } }, XIcon: Pt, Lifeline: { functional: true, render(e3, t4) { + } }, XIcon: Yt, Lifeline: { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ width: "1", height: "25", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M0 4.545V0h1v4.545H0zM0 11.364V6.818h1v4.546H0zM0 18.182v-4.546h1v4.546H0zM0 25v-4.546h1V25H0z", fill: "#EAEAEA" } })])); } }, ActiveLifeline: { functional: true, render(e3, t4) { @@ -358344,7 +358716,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }, close() { this.isOpen = false; } } }, "data-v-7df829c5", false, void 0, false, he, void 0, void 0); - var Oa = de({ render: function() { + var Ua = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { class: e3.classes }, [a3("div", { staticClass: "notification__head", on: { click: e3.onClick } }, [a3("ArrowUpIcon", { staticClass: "notification__arrow" }), e3._v(" "), a3("span", { staticClass: "notification__title" }, [e3._v("\n You\u2019ve been updated to "), a3("b", [e3._v(e3._s(e3.version) + ".")]), a3("em", [e3._v("See details.")])]), e3._v(" "), a3("CloseThinIcon", { staticClass: "notification__close", on: { click: function(t5) { return t5.stopPropagation(), e3.onClose.apply(null, arguments); @@ -358354,7 +358726,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }, { name: "v-notification", components: { ArrowUpIcon: { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 14 16", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M.278 6.265l6.05-5.99a.957.957 0 011.344 0l6.05 5.99a.935.935 0 010 1.331.957.957 0 01-1.345 0L7.951 3.213V16H6.049V3.213L1.623 7.596a.957.957 0 01-1.345 0 .935.935 0 010-1.33z" } })])); - } }, CloseThinIcon: Pa }, props: { version: { type: String, default: "" }, body: { type: String, default: "" } }, data: () => ({ isExpanded: false }), computed: { classes() { + } }, CloseThinIcon: Fa }, props: { version: { type: String, default: "" }, body: { type: String, default: "" } }, data: () => ({ isExpanded: false }), computed: { classes() { const e3 = ["notification"]; return this.isExpanded && e3.push("notification--expanded"), e3; } }, methods: { onClick() { @@ -358362,7 +358734,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }, onClose() { this.$emit("closeEvent"); } } }, "data-v-b6c4943e", false, void 0, false, he, void 0, void 0); - var La = de({ render: function() { + var qa = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { class: e3.classes, attrs: { "data-full-screen-allowed": e3.allowFullscreen } }, [a3("div", { attrs: { "data-cy": "popper-button" }, on: { click: function(t5) { e3.open = !e3.open; @@ -358392,10 +358764,10 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; (0, import_diagrams.getEventTarget)(e3.target, this.$el) || (this.open = false); }); } }, "data-v-4fda552e", false, void 0, false, he, void 0, void 0); - var Ua = 1e3; - var qa = 1e6; - var Ka = 1e9; - var Na = de({ render: function() { + var Ka = 1e3; + var Na = 1e6; + var Ga = 1e9; + var Ja = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "stats-panel", attrs: { "data-cy": "stats-panel" } }, [e3._t("notification"), e3._v(" "), a3("div", { staticClass: "heading" }, [a3("h1", [a3("StatsIconLg"), e3._v("Stats")], 1), e3._v(" "), a3("CloseIcon", { staticClass: "close-me", attrs: { "data-cy": "close-stats-button" }, on: { click: function(t5) { return t5.stopPropagation(), e3.closeStatsPanel.apply(null, arguments); @@ -358422,7 +358794,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; } }, HiddenIcon: { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M13.359 11.238C15.06 9.72 16 8 16 8s-3-5.5-8-5.5c-.96.003-1.91.203-2.79.588l.77.771A5.944 5.944 0 018 3.5c2.12 0 3.879 1.168 5.168 2.457.62.624 1.176 1.308 1.66 2.043-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755-.165.165-.337.328-.517.486l.708.709z", fill: "#808B98" } }), a3("path", { attrs: { d: "M11.297 9.176a3.5 3.5 0 00-4.474-4.474l.823.823a2.5 2.5 0 012.83 2.829l.821.822zm-2.943 1.299l.822.822a3.5 3.5 0 01-4.474-4.474l.823.823a2.5 2.5 0 002.83 2.829z", fill: "#808B98" } }), a3("path", { attrs: { d: "M3.35 5.47c-.18.16-.353.322-.518.487A13.134 13.134 0 001.172 8l.195.288c.335.48.83 1.12 1.465 1.755C4.121 11.332 5.881 12.5 8 12.5c.716 0 1.39-.133 2.02-.36l.77.772A7.03 7.03 0 018 13.5C3 13.5 0 8 0 8s.939-1.721 2.641-3.238l.708.709.001-.001zm10.296 8.884l-12-12 .708-.708 12 12-.708.708z", fill: "#808B98" } })])); - } }, ScissorsIcon: Yt }, props: { stats: { type: Object, default: () => ({}) }, appMap: { type: Object }, pruneFilter: { type: Object } }, data: () => ({ sortBy: "count", sortAscending: false }), computed: { functions() { + } }, ScissorsIcon: Pt }, props: { stats: { type: Object, default: () => ({}) }, appMap: { type: Object }, pruneFilter: { type: Object } }, data: () => ({ sortBy: "count", sortAscending: false }), computed: { functions() { return this.stats.functions ? this.sortFunctions(this.stats.functions.slice()) : []; } }, methods: { updateSorting(e3) { this.sortAscending = !this.sortAscending, this.sortBy = e3; @@ -358432,7 +358804,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; return ["count", "size"].includes(this.sortBy) ? this.sortAscending ? e3[this.sortBy] - t4[this.sortBy] : t4[this.sortBy] - e3[this.sortBy] : this.sortAscending ? e3[this.sortBy].localeCompare(t4[this.sortBy]) : t4[this.sortBy].localeCompare(e3[this.sortBy]); }, displaySize(e3) { let t4, a3; - return e3 > Ka ? (t4 = Ka, a3 = "GB") : e3 > qa ? (t4 = qa, a3 = "MB") : e3 > Ua ? (t4 = Ua, a3 = "KB") : (t4 = 1, a3 = "bytes"), `${(e3 / t4).toFixed(1)} ${a3}`; + return e3 > Ga ? (t4 = Ga, a3 = "GB") : e3 > Na ? (t4 = Na, a3 = "MB") : e3 > Ka ? (t4 = Ka, a3 = "KB") : (t4 = 1, a3 = "bytes"), `${(e3 / t4).toFixed(1)} ${a3}`; }, removeFunctionPrefix: (e3) => e3.startsWith("function:") ? e3.slice(9) : e3, isPath: (e3) => /[\\/]/.test(e3), isHidden(e3) { return !this.appMap.classMap.codeObjectsById[e3]; }, isPruned(e3) { @@ -358448,7 +358820,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; this.$store.commit(Ie, Be), this.$store.commit(be, t4), this.$store.commit(xe, e4), this.$emit("closeStatsPanel"); } } } }, "data-v-d961b2e4", false, void 0, false, he, void 0, void 0); - var Ga = de({ render: function() { + var Va = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("keep-alive", [e3.isActive ? a3("v-tab-content", { class: e3.classes }, [e3._t("default")], 2) : e3._e()], 1); }, staticRenderFns: [] }, function(e3) { @@ -358463,7 +358835,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }, methods: { setActive(e3) { this.isActive = e3; } } }, "data-v-aef5ed48", false, void 0, false, he, void 0, void 0); - var Ja = de({ render: function() { + var Za = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "no-data-notice", attrs: { "data-cy": "notice-no-data" } }, [e3._m(0), e3._v(" "), a3("v-diagram-gray", { staticClass: "empty-state-diagram" })], 1); }, staticRenderFns: [function() { @@ -358472,8 +358844,8 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }] }, function(e3) { e3 && e3("data-v-1d12ab40_0", { source: '.no-data-notice[data-v-1d12ab40]{display:flex;position:absolute;flex-direction:column;justify-content:center;align-items:center;font-family:"IBM Plex Sans","Helvetica Neue",Helvetica,Arial,sans-serif;line-height:1.5;color:#e7e7e7;background-color:#010306;z-index:2147483647;top:0;left:0;bottom:0;right:0}.no-data-notice .notice[data-v-1d12ab40]{display:flex;flex-direction:column;max-width:60%;min-width:16rem}.no-data-notice__title[data-v-1d12ab40]{margin-bottom:1rem;font-size:2rem;font-weight:700;background:linear-gradient(to right,#9c2fba,#ff07aa);-webkit-background-clip:text;-webkit-text-fill-color:transparent}.no-data-notice a[data-v-1d12ab40]{color:#3794ff;text-decoration:none}.no-data-notice a[data-v-1d12ab40]:active,.no-data-notice a[data-v-1d12ab40]:hover{color:#3794ff}.no-data-notice .empty-state-diagram[data-v-1d12ab40]{margin-top:4rem}.no-data-notice .why-me[data-v-1d12ab40]{padding:1rem}.no-data-notice .why-me strong[data-v-1d12ab40]{margin-left:-1rem;color:#9c2fba;margin-bottom:.5rem}', map: void 0, media: void 0 }); }, { components: { VDiagramGray: Gt } }, "data-v-1d12ab40", false, void 0, false, he, void 0, void 0); - var Va = /* @__PURE__ */ new Set(); - var Za = vue_runtime_default.extend({ data: () => ({ ownedElements: /* @__PURE__ */ new Set(), clickHandler: () => { + var Wa = /* @__PURE__ */ new Set(); + var Xa = vue_runtime_default.extend({ data: () => ({ ownedElements: /* @__PURE__ */ new Set(), clickHandler: () => { throw new Error("clickHandler not initialized"); } }), methods: { onLinkClicked(e3) { const t4 = e3.target; @@ -358488,9 +358860,9 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; this.$root.$emit("click-link", a3); } }, dropOwnership(e3) { - this.ownedElements.has(e3) && (this.ownedElements.delete(e3), Va.delete(e3), e3.removeEventListener("click", this.clickHandler)); + this.ownedElements.has(e3) && (this.ownedElements.delete(e3), Wa.delete(e3), e3.removeEventListener("click", this.clickHandler)); }, takeOwnership(e3) { - return !Va.has(e3) && (this.ownedElements.add(e3), Va.add(e3), e3.addEventListener("click", this.clickHandler), true); + return !Wa.has(e3) && (this.ownedElements.add(e3), Wa.add(e3), e3.addEventListener("click", this.clickHandler), true); }, rebindClickHandlers() { this.ownedElements.forEach((e3) => this.dropOwnership(e3)), this.$el.querySelectorAll("a").forEach((e3) => this.takeOwnership(e3)); } }, mounted() { @@ -358498,7 +358870,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }, updated() { this.rebindClickHandlers(); } }); - var Wa = de({ render: function() { + var _a2 = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "unlicensed-notice", attrs: { "data-cy": "notice-unlicensed" } }, [a3("div", { staticClass: "notice" }, [a3("v-appmap-logo"), e3._v(" "), a3("p", { staticClass: "unlicensed-notice__title" }, [e3._v("License expired")]), e3._v(" "), a3("p", [e3._v("\n To continue enjoying all the great features of this software, an active license is required.\n Your support is crucial in helping us enhance and develop new features for our community.\n ")]), e3._v(" "), e3.purchaseUrl ? a3("a", { staticClass: "cta", attrs: { href: e3.purchaseUrl, "data-cy": "purchase", target: "_blank" } }, [a3("v-button", { staticClass: "cta", attrs: { "data-cy": "purchase" } }, [e3._v(" Purchase AppMap ")])], 1) : e3._e(), e3._v(" "), e3._m(0), e3._v(" "), a3("p", [e3._v("Thank you for being a vital part of our community, we hope to see you again soon!")])], 1)]); }, staticRenderFns: [function() { @@ -358506,8 +358878,8 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; return a3("p", [e3._v("\n Need assistance or have questions? Join the\n "), a3("a", { attrs: { href: "https://appmap.io/slack", target: "_blank", rel: "noopener noreferrer" } }, [e3._v("\n AppMap Community Slack\n ")]), e3._v("\n for interactive support or check out our\n "), a3("a", { attrs: { href: "https://appmap.io/docs", target: "_blank", rel: "noopener noreferrer" } }, [e3._v(" documentation")]), e3._v(". For more direct assistance, our support team is just an\n "), a3("a", { attrs: { href: "mailto:support@appmap.io" } }, [e3._v("email")]), e3._v(" away.\n ")]); }] }, function(e3) { e3 && e3("data-v-626338e3_0", { source: '.unlicensed-notice[data-v-626338e3]{display:flex;position:absolute;flex-direction:column;justify-content:center;align-items:center;font-family:"IBM Plex Sans","Helvetica Neue",Helvetica,Arial,sans-serif;line-height:1.5;color:#e7e7e7;background-color:#010306;z-index:2147483647;top:0;left:0;bottom:0;right:0}.unlicensed-notice .notice[data-v-626338e3]{display:flex;flex-direction:column;max-width:60%;min-width:16rem}.unlicensed-notice__title[data-v-626338e3]{margin-bottom:1rem;font-size:2rem;font-weight:700;background:linear-gradient(to right,#9c2fba,#ff07aa);-webkit-background-clip:text;-webkit-text-fill-color:transparent}.unlicensed-notice .cta[data-v-626338e3]{width:fit-content;align-self:center}.unlicensed-notice p[data-v-626338e3]{margin-block-start:1em;margin-block-end:1em}.unlicensed-notice a[data-v-626338e3]{color:#3794ff;text-decoration:none}.unlicensed-notice a[data-v-626338e3]:active,.unlicensed-notice a[data-v-626338e3]:hover{color:#3794ff}.unlicensed-notice .empty-state-diagram[data-v-626338e3]{margin-top:4rem}', map: void 0, media: void 0 }); - }, { components: { VAppmapLogo: ve, VButton: ue }, props: { purchaseUrl: { type: String, required: false } }, mixins: [Za] }, "data-v-626338e3", false, void 0, false, he, void 0, void 0); - var Xa = de({ render: function() { + }, { components: { VAppmapLogo: ve, VButton: ue }, props: { purchaseUrl: { type: String, required: false } }, mixins: [Xa] }, "data-v-626338e3", false, void 0, false, he, void 0, void 0); + var $a = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "configuration-required-notice", attrs: { "data-cy": "notice-configuration" } }, [a3("div", { staticClass: "notice" }, [a3("v-appmap-logo"), e3._v(" "), a3("p", { staticClass: "configuration-required-notice__title" }, [e3._v("Additional configuration required")]), e3._v(" "), a3("p", [e3._v("To finish setting up this view, edit this macro and select an AppMap from the dropdown.")]), e3._v(" "), a3("p", [e3._v("\n If you don't yet have an AppMap, drag one into this page in edit mode. Once uploaded, the\n file can be removed from the page.\n ")]), e3._v(" "), e3._m(0)], 1)]); }, staticRenderFns: [function() { @@ -358515,9 +358887,9 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; return a3("p", [e3._v("\n Need assistance or have questions? Join the\n "), a3("a", { attrs: { href: "https://appmap.io/slack", target: "_blank", rel: "noopener noreferrer" } }, [e3._v("\n AppMap Community Slack\n ")]), e3._v("\n for interactive support or check out our\n "), a3("a", { attrs: { href: "https://appmap.io/docs", target: "_blank", rel: "noopener noreferrer" } }, [e3._v(" documentation")]), e3._v(". For more direct assistance, our support team is just an\n "), a3("a", { attrs: { href: "mailto:support@appmap.io" } }, [e3._v("email")]), e3._v(" away.\n ")]); }] }, function(e3) { e3 && e3("data-v-5d19b6c7_0", { source: '.configuration-required-notice[data-v-5d19b6c7]{display:flex;position:absolute;flex-direction:column;justify-content:center;align-items:center;font-family:"IBM Plex Sans","Helvetica Neue",Helvetica,Arial,sans-serif;line-height:1.5;color:#e7e7e7;background-color:#010306;z-index:2147483647;top:0;left:0;bottom:0;right:0}.configuration-required-notice .notice[data-v-5d19b6c7]{display:flex;flex-direction:column;max-width:60%;min-width:16rem}.configuration-required-notice__title[data-v-5d19b6c7]{margin-bottom:1rem;font-size:2rem;font-weight:700;background:linear-gradient(to right,#9c2fba,#ff07aa);-webkit-background-clip:text;-webkit-text-fill-color:transparent}.configuration-required-notice a[data-v-5d19b6c7]{color:#3794ff;text-decoration:none}.configuration-required-notice a[data-v-5d19b6c7]:active,.configuration-required-notice a[data-v-5d19b6c7]:hover{color:#3794ff}.configuration-required-notice p[data-v-5d19b6c7]{margin-block-start:1em;margin-block-end:1em}', map: void 0, media: void 0 }); - }, vue_runtime_default.extend({ name: "v-configuration-required-notice", components: { VAppmapLogo: ve }, mixins: [Za] }), "data-v-5d19b6c7", false, void 0, false, he, void 0, void 0); - var _a2 = ["", "webkit", "moz"]; - var $a = de({ render: function() { + }, vue_runtime_default.extend({ name: "v-configuration-required-notice", components: { VAppmapLogo: ve }, mixins: [Xa] }), "data-v-5d19b6c7", false, void 0, false, he, void 0, void 0); + var ei = ["", "webkit", "moz"]; + var ti = de({ render: function() { var e3 = this, t4 = this, a3 = t4.$createElement, i2 = t4._self._c || a3; return i2("div", { key: t4.renderKey, ref: "app", class: t4.classes, attrs: { id: "app", "data-cy": "app" }, on: { mousemove: t4.makeResizing, mouseup: t4.stopResizing, mouseleave: t4.stopResizing } }, [i2("div", { staticClass: "loader" }), t4._v(" "), i2("div", { ref: "mainColumnLeft", class: t4.leftColumnClasses, on: { transitionend: t4.detailsPanelTransitionEnd } }, [i2("transition", { attrs: { name: "slide-in-from-left" } }, [t4.showDetailsPanel ? i2("v-details-panel", { staticClass: "slide-in-from-left", attrs: { appMap: t4.filteredAppMap, "selected-object": t4.selectedObject, "selected-label": t4.selectedLabel, "filters-root-objects": t4.filters.rootObjects, findings: t4.findings, wasAutoPruned: t4.wasAutoPruned, isGiantAppMap: t4.isGiantAppMap, showAskNavie: t4.showAskNavie, "data-cy": "sidebar" }, on: { onChangeFilter: function(t5) { e3.eventFilterText = t5; @@ -358552,7 +358924,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }, proxy: true }], null, false, 1709453219) })], 1) : t4._e(), t4._v(" "), i2("div", { staticClass: "diagram-instructions hide-small", attrs: { "data-cy": "instructions-button" } }, [i2("v-instructions", { ref: "instructions", attrs: { currentView: t4.currentView } })], 1)], 1), t4._v(" "), t4.isEmptyAppMap && !t4.isLoading && !t4.hasStats && t4.isLicensed ? i2("v-no-data-notice") : t4._e(), t4._v(" "), t4.isConfigured ? t4._e() : i2("v-configuration-required"), t4._v(" "), t4.isLicensed ? t4._e() : i2("v-unlicensed-notice", { attrs: { "purchase-url": t4.purchaseUrl } })], 1); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-a9fef80a_0", { source: `body,html{width:100%;height:100%;margin:0}body.sb-show-main.sb-main-padded{padding:0}*{box-sizing:border-box}code{color:#6fddd6}@media (max-width:900px){.hide-small{display:none!important}}.appmap-stats{height:95%;overflow-y:auto;overflow:scroll;padding:0}.appmap-stats,.share-appmap{box-shadow:0 0 20px 0 rgba(0,0,0,.2);font-family:"IBM Plex Sans","Helvetica Neue",Helvetica,Arial,sans-serif;position:absolute;top:5rem;right:2rem;background-color:#242c41;border-radius:.5rem;width:calc(100% - 4rem);word-break:break-word;z-index:2}.appmap-stats h1,.share-appmap h1{color:#e3e5e8;font-weight:800}.appmap-stats h3,.share-appmap h3{margin-bottom:.5rem}.appmap-stats .heading,.share-appmap .heading{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding:1rem 2rem;border-bottom:1px solid #808b9869}.appmap-stats .heading svg,.share-appmap .heading svg{margin-right:.5rem}.appmap-stats .content,.share-appmap .content{padding:0 2rem;color:#e3e5e8;line-height:1.5rem}.appmap-stats .share-url p,.share-appmap .share-url p{margin-top:.5rem;margin-bottom:0}.appmap-stats .share-link,.share-appmap .share-link{display:flex;flex-direction:row;justify-content:space-between;align-items:center;background-color:#e3e5e8;padding:.6rem 1.25rem;border-radius:.5rem}.appmap-stats .share-link .url,.share-appmap .share-link .url{color:#4362b1;font-weight:800;transition:all .3s ease}.appmap-stats .share-link .url:hover,.share-appmap .share-link .url:hover{color:#9c2fba;cursor:pointer}.appmap-stats .share-link .icon,.share-appmap .share-link .icon{color:#4362b1}.appmap-stats .share-link .icon:hover,.share-appmap .share-link .icon:hover{cursor:pointer}.appmap-stats .close-me,.share-appmap .close-me{transition:all .3s ease;font-weight:800;width:16px;height:16px;fill:#fff}.appmap-stats .close-me:hover,.share-appmap .close-me:hover{fill:#4362b1;cursor:pointer}.appmap-stats{background-color:transparent}.appmap-stats .notification{padding:1rem;border-radius:.5rem;display:grid;grid-template-columns:auto;gap:.5rem;align-items:baseline;margin:0 1rem 1rem 1rem;box-shadow:0 0 20px 0 rgba(0,0,0,.2)}.appmap-stats .notification .content{margin:0;padding:0}.appmap-stats .notification .notification-head{display:flex;gap:.5rem;align-items:center}.appmap-stats .notification svg{width:1rem;height:1rem;fill:#e3e5e8}.appmap-stats .notification a{color:inherit}.appmap-stats .notification p{margin:0}.appmap-stats .notification.blocked{background-color:#d1245c}.appmap-stats .notification.trimmed{background:#c07d1b}#app{position:relative;display:grid;grid-template-columns:auto 1fr;grid-template-rows:100%;height:100vh;color:#7f7f7f;background-color:#010306}#app.app--loading .loader{display:block}#app.app--loading .main-column{opacity:0;pointer-events:none}#app .loader{display:none;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:80px;height:80px}#app .loader:after{content:"";display:block;width:64px;height:64px;margin:8px;border-radius:50%;border:6px solid transparent;border-color:#ff07aa transparent #ff07aa transparent;animation:loader-animation 1.2s linear infinite}#app .export-options{padding:.5rem 1rem;background-color:#242c41;border-radius:.5rem;border:1px solid #343742}#app .export-options__header{padding-bottom:.2rem;margin-bottom:.7rem;border-bottom:1px solid #565b6d}#app .export-options__body{display:flex;margin-bottom:.2rem}#app .export-options__body button{background:#7f6be6;color:#e1e2e2;text-decoration:none;font-weight:700;font-family:"IBM Plex Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-size:.75rem;transition:all .3s ease;border-radius:5px;border:0;margin:5px;padding:10px}#app .export-options__body button:hover{background:#4f3fa1;cursor:pointer}#app .main-column--left--hidden{display:none}#app .main-column--left{position:relative;grid-column:1;width:420px;transition:width .5s ease-in-out}#app .main-column--left .slide-in-from-left{animation:slide-in-from-left .5s ease-out forwards}#app .main-column--left .sidebar-menu{display:flex;flex-direction:column;align-items:center;margin-top:.5rem;border-right:1px solid #242c41;height:100%}#app .main-column--left .sidebar-menu__icon{margin:.6rem auto}#app .main-column--left .sidebar-menu__hamburger-menu:hover{cursor:pointer;stroke:#4362b1}#app .main-column--left .sidebar-menu__hamburger-menu:hover circle,#app .main-column--left .sidebar-menu__hamburger-menu:hover path{stroke:#4362b1;transition:all .3s ease}#app .main-column--left .sidebar-menu__compass circle{stroke:#c7c9c9;transition:all .3s ease}#app .main-column--left .sidebar-menu__compass path{fill:#c7c9c9;transition:all .3s ease}#app .main-column--left .sidebar-menu__compass:hover{cursor:pointer}#app .main-column--left .sidebar-menu__compass:hover circle{stroke:#ff07aa;transition:all .3s ease}#app .main-column--left .sidebar-menu__compass:hover path{fill:#ff07aa;transition:all .3s ease}#app .main-column--left.manual-resizing{transition:none!important}#app .main-column--right{position:relative;grid-column-start:2;grid-column-end:3;width:100%;min-width:400px;word-break:break-all;overflow:hidden}#app .main-column--right .control-button{border:none;display:inline-flex;align-items:center;padding:.25rem;background:0 0;color:#716e85;font:inherit;font-family:"IBM Plex Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-size:.75rem;outline:0;appearance:none;cursor:pointer;transition:color .3s ease-in}#app .main-column--right .control-button:active,#app .main-column--right .control-button:hover{color:#e1e2e2;transition-timing-function:ease-out}#app .main-column--right .control-button__stroke{width:16px;height:14px;stroke-width:4;stroke:#716e85;fill:none}#app .main-column--right .control-button__stroke path{stroke:#716e85}#app .main-column--right .control-button__stroke:hover path{stroke:#e1e2e2}#app .main-column--right .control-button__icon{width:16px;height:14px;fill:currentColor}#app .main-column--right .download-button{display:inline-block}#app .main-column--right .diagram-instructions{position:absolute;right:1.3rem;bottom:1.3rem}#app .main-column--right .hover-text-popper{display:inline-block}#app .main-column--right .depth-text{width:16px;padding:0 0;text-align:center;display:inline;font-weight:700;font-family:"IBM Plex Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-size:.9rem;cursor:pointer}@keyframes glow{0%,100%{opacity:0}50%{opacity:.75}}#app .main-column--right .ask-navie{position:relative;background-color:inherit;border:none;padding:0}#app .main-column--right .ask-navie:hover{cursor:pointer;filter:drop-shadow(0 0 4px #e3e5e8)!important}#app .main-column--right .ask-navie:hover svg path{fill:#e3e5e8}#app .main-column--right .ask-navie:hover svg circle{stroke:#e3e5e8}#app .main-column--right .ask-navie svg{width:22px}#app .main-column--right .ask-navie svg path{fill:#808b98}#app .main-column--right .ask-navie svg circle{stroke:#808b98}#app .main-column--right .ask-navie-glow{position:absolute;z-index:1;top:0;left:0;animation:glow 5s infinite cubic-bezier(.25,.46,.45,.94);pointer-events:none;transform:translateZ(0);will-change:opacity}#app .main-column--right .ask-navie-glow path{fill:#ff07aa!important}#app .main-column--right .ask-navie-glow circle{stroke:#ff07aa!important}#app .main-column--right .depth-button{width:18px;padding:0 0;aspect-ratio:1/1;border:none;background-color:#716e85;font-weight:700;font-family:"IBM Plex Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-size:1rem;outline:0;appearance:none;cursor:pointer;transition:color .3s ease-in}#app .main-column--right .depth-button:hover{color:#e1e2e2;transition-timing-function:ease-out}#app .main-column--right .depth-button__increase{left:16px}#app .main-column--right .depth-button__decrease{left:-18px}#app .main-column--right .depth-control{position:relative;border-width:2px;border-radius:7px;border-color:#716e85;border-style:solid;padding:0;display:inline-flex;align-items:center;background:0 0;color:#716e85;font:inherit;font-family:"IBM Plex Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-size:.75rem;outline:0;appearance:none;transition:color .3s ease-in}#app .main-column--right .depth-control:hover{color:#e1e2e2;transition-timing-function:ease-out}#app .main-column .main-column--drag{position:absolute;top:0;right:0;bottom:0;width:1px;background:0 0;cursor:col-resize;z-index:100}#app .main-column .main-column--drag:hover{background:#e1e2e2}#app .main-column .main-column--drag::after{content:"";position:absolute;top:0;left:0;right:-8px;bottom:0;background-position:4px 49%;background-repeat:no-repeat;background-image:url("data:image/svg+xml,%3Csvg width='2' height='14' viewBox='0 0 2 14' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23808b98' fill-rule='evenodd'%3E%3Ccircle cx='1' cy='1' r='1'/%3E%3Ccircle cx='1' cy='5' r='1'/%3E%3Ccircle cx='1' cy='9' r='1'/%3E%3Ccircle cx='1' cy='13' r='1'/%3E%3C/g%3E%3C/svg%3E");touch-action:none}#app .trace-view{display:flex;flex-direction:column;width:100%;height:100%}@keyframes loader-animation{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes slide-in-from-left{0%{transform:translateX(-100%)}100%{transform:translateX(0)}}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-button{width:0;height:0}::-webkit-scrollbar-thumb{background:#808b98;border:0;border-radius:50px}::-webkit-scrollbar-thumb:active,::-webkit-scrollbar-thumb:hover{background:#e1e2e2}::-webkit-scrollbar-track{background:#010306;border:0;border-radius:50px}::-webkit-scrollbar-corner{background:0 0}@media (max-width:1250px){#app .main-column--right .hover-text-popper{background-color:transparent;padding:0}#app .main-column--right .hover-text-popper span{display:none}}`, map: void 0, media: void 0 }); - }, { name: "VSCodeExtension", components: { AppMapLogo: Tt, HamburgerMenu: Ot, CloseIcon: Ut, CopyIcon: Lt, ReloadIcon: qt, UploadIcon: Kt, ExportIcon: Nt, FilterIcon: pt, VDetailsPanel: Ft, VDiagramComponent: Wt, VDiagramSequence: pa, VDiagramTrace: ja, VDiagramFlamegraph: ka2, VDownloadSequenceDiagram: Da, VExportJson: Ra, VFilterMenu: Ha, VInstructions: Ta, VNotification: Oa, VPopperMenu: La, VPopper: lt, VStatsPanel: Na, VTabs: Ht, VTab: Ga, VSearchBar: de({ render: function() { + }, { name: "VSCodeExtension", components: { AppMapLogo: Ot, HamburgerMenu: Tt, CloseIcon: Ut, CopyIcon: Lt, ReloadIcon: qt, UploadIcon: Kt, ExportIcon: Nt, FilterIcon: pt, VDetailsPanel: Ft, VDiagramComponent: Wt, VDiagramSequence: pa, VDiagramTrace: ja, VDiagramFlamegraph: ka2, VDownloadSequenceDiagram: Da, VExportJson: Ra, VFilterMenu: Oa, VInstructions: La, VNotification: Ua, VPopperMenu: qa, VPopper: lt, VStatsPanel: Ja, VTabs: Ht, VTab: Va, VSearchBar: de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "search-bar" }, [a3("form", { ref: "form", class: e3.formClasses, on: { submit: function(t5) { return t5.preventDefault(), e3.onFormSubmit.apply(null, arguments); @@ -358571,7 +358943,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; } }, ArrowSearchRightIcon: { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ width: "7", height: "13", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M.147 12.853a.5.5 0 010-.708L5.792 6.5.147.855A.5.5 0 01.855.147l5.998 5.999a.5.5 0 010 .708l-5.998 6a.5.5 0 01-.708 0z", fill: "#716E85" } })])); - } }, CloseThinIcon: Pa, SearchIcon: Qt }, props: { nodesLength: { type: Number, require: false, default: 0 }, currentIndex: { type: Number, default: void 0 }, suggestions: { type: Array, default: () => [] }, initialSearchValue: { type: String, default: "" } }, data() { + } }, CloseThinIcon: Fa, SearchIcon: Qt }, props: { nodesLength: { type: Number, require: false, default: 0 }, currentIndex: { type: Number, default: void 0 }, suggestions: { type: Array, default: () => [] }, initialSearchValue: { type: String, default: "" } }, data() { return { searchValue: this.initialSearchValue, showSuggestions: false, selectedSuggestion: false }; }, watch: { searchValue: { handler(e3) { this.$emit("onChange", e3); @@ -358629,7 +359001,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; window.addEventListener("click", this.onWindowClick), window.addEventListener("keyup", this.onWindowKeyUp, true), window.addEventListener("keydown", this.onWindowKeyDown, true); }, destroyed() { window.removeEventListener("click", this.onWindowClick), window.removeEventListener("keyup", this.onWindowKeyUp, true), window.removeEventListener("keydown", this.onWindowKeyDown, true); - } }, void 0, false, void 0, false, he, void 0, void 0), DiagramGray: Gt, StatsIcon: Jt, ExclamationIcon: Rt, ScissorsIcon: Yt, FullscreenEnterIcon: Vt, FullscreenExitIcon: Zt, VNoDataNotice: Ja, VUnlicensedNotice: Wa, VConfigurationRequired: Xa, VCompassIcon: jt }, store: Ze, data: () => ({ renderKey: 0, isLoading: true, isPanelResizing: false, initialPanelWidth: 0, initialClientX: 0, version: null, versionText: "", VIEW_COMPONENT: ke, VIEW_SEQUENCE: Be, VIEW_FLOW: Me, VIEW_FLAMEGRAPH: Se, eventFilterText: "", eventFilterMatchIndex: void 0, showStatsPanel: false, seqDiagramTimeoutId: void 0, seqDiagramCollapseDepth: 3, maxSeqDiagramCollapseDepth: 9, sequenceDiagramDiffMode: false, isActive: true, isFullscreen: false, showDetailsPanel: false, rightColumnWidth: 0 }), mixins: [Za], props: { defaultView: { type: String, default: ke }, appMapUploadable: { type: Boolean, default: false }, savedFilters: { type: Array, default: () => [] }, allowFullscreen: { type: Boolean, default: false }, isLicensed: { type: Boolean, default: true }, purchaseUrl: { type: String, required: false }, isConfigured: { type: Boolean, default: true }, allowExport: { type: Boolean, default: true }, autoExpandDetailsPanel: { type: Boolean, default: true }, appmapFsPath: { type: String, default: "" }, showAskNavie: { type: Boolean, default: true } }, watch: { "$store.state.currentView": { handler(e3) { + } }, void 0, false, void 0, false, he, void 0, void 0), DiagramGray: Gt, StatsIcon: Jt, ExclamationIcon: Rt, ScissorsIcon: Pt, FullscreenEnterIcon: Vt, FullscreenExitIcon: Zt, VNoDataNotice: Za, VUnlicensedNotice: _a2, VConfigurationRequired: $a, VCompassIcon: jt }, store: Ze, data: () => ({ renderKey: 0, isLoading: true, isPanelResizing: false, initialPanelWidth: 0, initialClientX: 0, version: null, versionText: "", VIEW_COMPONENT: ke, VIEW_SEQUENCE: Be, VIEW_FLOW: Me, VIEW_FLAMEGRAPH: Se, eventFilterText: "", eventFilterMatchIndex: void 0, showStatsPanel: false, seqDiagramTimeoutId: void 0, seqDiagramCollapseDepth: 3, maxSeqDiagramCollapseDepth: 9, sequenceDiagramDiffMode: false, isActive: true, isFullscreen: false, showDetailsPanel: false, rightColumnWidth: 0 }), mixins: [Xa], props: { defaultView: { type: String, default: ke }, appMapUploadable: { type: Boolean, default: false }, savedFilters: { type: Array, default: () => [] }, allowFullscreen: { type: Boolean, default: false }, isLicensed: { type: Boolean, default: true }, purchaseUrl: { type: String, required: false }, isConfigured: { type: Boolean, default: true }, allowExport: { type: Boolean, default: true }, autoExpandDetailsPanel: { type: Boolean, default: true }, appmapFsPath: { type: String, default: "" }, showAskNavie: { type: Boolean, default: true } }, watch: { "$store.state.currentView": { handler(e3) { this.$refs.tabs.activateTab(this.$refs[e3]), this.$root.$emit("stateChanged", "currentView"); } }, "$store.getters.selectedObject": { handler(e3) { if (e3) { @@ -358718,7 +359090,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; if (a4) e3.add(a4); else if (this.filters.declutter.limitRootEvents.on) { this.$store.state.appMap.rootEvents().some((e4) => e4.id === t6) && this.$nextTick(() => { - this.$store.commit(Ye, { declutterProperty: "limitRootEvents", value: false }); + this.$store.commit(Pe, { declutterProperty: "limitRootEvents", value: false }); }); } break; @@ -358789,7 +359161,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; const i2 = () => { this.initializeSavedFilters(); const e4 = this.$store.state.appMap.rootEvents().some((e6) => e6.httpServerRequest); - this.$store.state.savedFilters.some((e6) => "AppMap default" === e6.filterName && e6.default) && !e4 && this.$store.commit(Ye, { declutterProperty: "limitRootEvents", value: e4 }); + this.$store.state.savedFilters.some((e6) => "AppMap default" === e6.filterName && e6.default) && !e4 && this.$store.commit(Pe, { declutterProperty: "limitRootEvents", value: e4 }); }; return a3 ? (() => { this.setState(a3); @@ -358844,7 +359216,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; const e4 = parseInt(i2, 10); if (Number.isNaN(e4)) return; o2 = s3.find((t5) => t5.id === e4), o2 || (o2 = this.$store.state.appMap.events.find((t5) => t5.id === e4), o2 && Object.keys(this.filters.declutter).forEach((e6) => { - this.$store.commit(Ye, { declutterProperty: e6, value: false }); + this.$store.commit(Pe, { declutterProperty: e6, value: false }); })); } else if ("analysis-finding" === a3) { const e4 = i2, t5 = this.findings.find(({ finding: t6 }) => t6.hash_v2 === e4); @@ -358937,7 +359309,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }, initializeSavedFilters() { let e3 = this.savedFilters; if (this.isInBrowser && (!e3 || 0 === e3.length)) { - const t4 = localStorage.getItem(Fa); + const t4 = localStorage.getItem(Ha); if (t4) try { const a4 = JSON.parse(t4); a4.length > 0 && (e3 = a4); @@ -358948,7 +359320,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; const a4 = new import_models.AppMapFilter(), i2 = (0, import_models.serializeFilter)(a4), n2 = { filterName: "AppMap default", state: (0, import_models.base64UrlEncode)(JSON.stringify({ filters: i2 })), default: true }; this.$root.$emit("saveFilter", n2), e3.push(n2); } - this.isInBrowser && localStorage.setItem(Fa, JSON.stringify(e3)), this.$store.commit(Ue, e3); + this.isInBrowser && localStorage.setItem(Ha, JSON.stringify(e3)), this.$store.commit(Ue, e3); const a3 = e3.find((e4) => e4.default); a3 && (this.$store.commit(qe, a3), this.setState(a3.state)); }, updateFilters(e3) { @@ -358998,23 +359370,23 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; this.$root.$on("makeRoot", (e3) => { this.$store.commit(He, e3.fqid); }), this.$root.$on("removeRoot", (e3) => { - this.$store.commit(Te, this.filters.rootObjects.indexOf(e3)); - }), this.resetDetailsPanel(), _a2.forEach((e3) => { + this.$store.commit(Oe, this.filters.rootObjects.indexOf(e3)); + }), this.resetDetailsPanel(), ei.forEach((e3) => { this.$el.addEventListener(e3 + "fullscreenchange", this.checkFullscreen); }), this.rightColumnWidth = this.$refs.mainColumnRight.offsetWidth, this.autoExpandDetailsPanel || this.hideDetailsPanel(); }, beforeUpdate() { this.isGiantAppMap && (this.showStatsPanel = true, this.setView(null)); }, beforeDestroy() { - _a2.forEach((e3) => { + ei.forEach((e3) => { document.removeEventListener(e3 + "fullscreenchange", this.checkFullscreen); }); } }, void 0, false, void 0, false, he, void 0, void 0); - var ei = { functional: true, render(e3, t4) { + var ai = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: ["svg-inline--fa fa-cog fa-w-16", o2, r2], style: [c5, l2], attrs: Object.assign({ "aria-hidden": "true", "data-prefix": "fas", "data-icon": "cog", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { fill: "currentColor", d: "M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z" } })])); } }; - var ti = { added: { color: "#a6e22e", style: "solid" }, removed: { color: "#cd1414", style: "solid" }, changed: { color: "#ead656", style: "dashed" } }; - var ai = de({ render: function() { + var ii = { added: { color: "#a6e22e", style: "solid" }, removed: { color: "#cd1414", style: "solid" }, changed: { color: "#ead656", style: "dashed" } }; + var ni = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "diff" }, [a3("div", { staticClass: "diff__column" }, [a3("v-diagram-trace", { ref: "base", attrs: { events: e3.eventsBase, selectedEventsForDiff: e3.selectedEventsBase, highlightColor: e3.highlightConfig.color, highlightStyle: e3.highlightConfig.style, zoomControls: false, highlightAll: "changed" !== e3.changeType } }), e3._v(" "), a3("div", { staticClass: "diff__filters" }, [a3("v-popper-menu", { attrs: { position: "bottom right", showDot: e3.filtersChanged }, scopedSlots: e3._u([{ key: "icon", fn: function() { return [a3("v-cog")]; @@ -359047,7 +359419,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }, proxy: true }]) })], 1)], 1), e3._v(" "), a3("div", { staticClass: "diff__column" }, [a3("v-diagram-trace", { ref: "working", attrs: { events: e3.eventsWorking, selectedEventsForDiff: e3.selectedEventsWorking, highlightColor: e3.highlightConfig.color, highlightStyle: e3.highlightConfig.style, zoomControls: false, highlightAll: "changed" !== e3.changeType } })], 1)]); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-12446b4c_0", { source: "body[data-v-12446b4c],html[data-v-12446b4c]{width:100%;height:100%;margin:0}*[data-v-12446b4c]{box-sizing:border-box}code[data-v-12446b4c]{color:#6fddd6}.diff[data-v-12446b4c]{display:grid;grid-template-columns:50%;grid-template-rows:max(1fr,100%);height:100vh;color:#7f7f7f;background-color:#1e1e1e}.diff__column[data-v-12446b4c]{position:relative;overflow-y:scroll;width:100%;grid-row:1;border-style:solid;border-color:#010306;border-width:0 2px}.diff__filters[data-v-12446b4c]{position:absolute;top:.5rem;left:.5rem}", map: void 0, media: void 0 }); - }, { name: "v-diff", components: { VDiagramTrace: ja, VPopperMenu: La, VCog: ei }, props: { base: [String, Object], working: [String, Object] }, watch: { allChanges: { handler(e3) { + }, { name: "v-diff", components: { VDiagramTrace: ja, VPopperMenu: qa, VCog: ai }, props: { base: [String, Object], working: [String, Object] }, watch: { allChanges: { handler(e3) { const { base: t4, working: a3 } = this.$refs; if (t4.clearTransform(), t4.focusSelector(".trace-node"), a3.clearTransform(), a3.focusSelector(".trace-node"), e3.length) { const [t5, a4] = e3[0]; @@ -359058,7 +359430,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }, workingAppMap() { return (0, import_models.buildAppMap)(this.working).normalize().build(); }, highlightConfig() { - return ti[this.changeType] || {}; + return ii[this.changeType] || {}; }, filteredBaseAppMap() { return (0, import_models.buildAppMap)({ events: this.baseAppMap.data.events.filter((e3) => this.filterEvent(e3)), classMap: this.baseAppMap.classMap.codeObjects.map((e3) => e3.data), metadata: this.baseAppMap.metadata }).build(); }, filteredWorkingAppMap() { @@ -359095,40 +359467,40 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; "Enter" === a3.key && (e3 = (e3 + 1) % this.allChanges.length, t4()); }), t4(); } }, "data-v-12446b4c", false, void 0, false, he, void 0, void 0); - var ii = { functional: true, render(e3, t4) { + var si = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 22 22", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("circle", { attrs: { cx: "11", cy: "11", r: "10.5", stroke: "#2A84EF" } }), a3("path", { attrs: { d: "M9.933 14.256v-2.952c.984-.048 1.752-.288 2.304-.72.564-.432.846-1.026.846-1.782V8.55c0-.612-.192-1.098-.576-1.458-.384-.372-.9-.558-1.548-.558-.696 0-1.254.198-1.674.594-.408.396-.684.9-.828 1.512l-1.332-.504c.108-.384.264-.75.468-1.098a3.632 3.632 0 011.926-1.584c.432-.156.93-.234 1.494-.234 1.116 0 1.998.306 2.646.918.648.612.972 1.44.972 2.484 0 .576-.102 1.08-.306 1.512-.192.42-.444.78-.756 1.08-.312.3-.666.54-1.062.72-.396.18-.792.306-1.188.378v1.944H9.933zm.702 3.96c-.384 0-.666-.096-.846-.288-.168-.192-.252-.444-.252-.756v-.234c0-.312.084-.564.252-.756.18-.192.462-.288.846-.288.384 0 .66.096.828.288.18.192.27.444.27.756v.234c0 .312-.09.564-.27.756-.168.192-.444.288-.828.288z", fill: "#fff" } })])); } }; - var ni = de({ render: function() { + var oi = de({ render: function() { var e3 = this, t4 = e3.$createElement; return (e3._self._c || t4)("span", { staticClass: "badge" }, [e3._t("default")], 2); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-4fa6a394_0", { source: ".badge[data-v-4fa6a394]{background-color:#3794ff;color:#e3e5e8;padding:.125rem .25rem;border-radius:.25rem;font-size:.65rem;font-weight:600;vertical-align:bottom;text-transform:uppercase;white-space:nowrap}", map: void 0, media: void 0 }); }, { name: "v-badge" }, "data-v-4fa6a394", false, void 0, false, he, void 0, void 0); - var si = { functional: true, render(e3, t4) { + var ri = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 199 199" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M110.312 36.625c26.533 4.547 47.519 25.535 52.067 52.067l9.57 1.423c-4.207-32.801-30.169-58.793-62.956-63.048l1.319 9.558zM36.624 88.689C41.173 62.156 62.16 41.17 88.693 36.622l1.423-9.57c-32.802 4.207-58.794 30.17-63.05 62.956l9.558-1.32zM162.376 110.312c-4.548 26.532-25.536 47.518-52.068 52.063l-1.423 9.573c32.801-4.207 58.794-30.169 63.048-62.956l-9.557 1.32zM88.689 162.375c-26.532-4.547-47.518-25.535-52.065-52.067l-9.572-1.423c4.207 32.801 30.17 58.793 62.956 63.048l-1.319-9.558z", fill: "#7389c6" } }), a3("path", { attrs: { d: "M98.928 97.297v86.935l-10.132-73.4-.163-.024 10.295-13.511-82.698 1.429 71.94-9.931.028-.192 10.73 8.694.535-84.471.178-1.194 10.549 76.425-11.262 9.24 86.435 2.045 2.005.298-76.494 10.559-11.946-12.902zm19.786 13.487l80.287-11.083-80.583-11.98 22.049-30.147-29.674 22.772L99.701 0 87.656 81.02 57.295 58.815 79.899 88.27 0 99.3l80.953 12.035-22.419 30.651 29.745-22.825L99.3 199l11.97-80.515 30.436 22.261-22.992-29.962z", fill: "#7389c6" } })])); } }; - var oi = de({ render: function() { + var ci = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "qs" }, [a3("div", { staticClass: "qs-container" }, [a3("div", { staticClass: "appmap-header" }, [a3("AppMapLogo", { attrs: { width: "120" } }), e3._v(" "), e3.displayAiHelp ? a3("v-ai-help-button", { style: { float: "right" } }) : e3._e()], 1), e3._v(" "), a3("div", { staticClass: "qs-content" }, [e3._t("default")], 2), e3._v(" "), e3.displayHelp ? a3("div", { staticClass: "qs-help" }, [a3("HelpIcon", { staticClass: "qs-help__icon" }), e3._v(" "), a3("div", { staticClass: "qs-help__text" }, [e3._v("\n Stuck?\n "), e3.displayAiHelp ? [a3("a", { attrs: { href: "#", "data-cy": "ai-help-secondary" }, on: { click: function(t5) { return t5.stopPropagation(), t5.preventDefault(), e3.onClickHelp.apply(null, arguments); } } }, [e3._v("\n Ask Navie: AppMap AI\n "), a3("v-badge", [e3._v("NEW")])], 1), e3._v("\n or send us an email at\n "), a3("a", { attrs: { href: "mailto:support@appmap.io", target: "_blank" } }, [e3._v(" support@appmap.io ")])] : [a3("a", { attrs: { href: "mailto:support@appmap.io", target: "_blank" } }, [e3._v("\n Send us an email at support@appmap.io\n ")])]], 2)], 1) : e3._e()])]); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-d3d459ea_0", { source: '.qs[data-v-d3d459ea]{position:relative;width:100%;min-height:100vh;padding:2rem;font-family:var(--vscode-font-family, "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:var(--vscode-font-size,14px);font-weight:var(--vscode-font-weight,normal);line-height:1.75;color:#e3e5e8;background-color:#010306}.qs[data-v-d3d459ea] h2,.qs[data-v-d3d459ea] h3,.qs[data-v-d3d459ea] h4,.qs[data-v-d3d459ea] h5,.qs[data-v-d3d459ea] h6{margin-top:1.25em}.qs[data-v-d3d459ea] p{line-height:1.75}.qs[data-v-d3d459ea] .mb10{margin-bottom:10px}.qs[data-v-d3d459ea] .mb20{margin-bottom:20px}.qs[data-v-d3d459ea] a{color:#2a84ef;text-decoration:none;transition:all .3s ease}.qs[data-v-d3d459ea] a code.inline{color:#2a84ef}.qs[data-v-d3d459ea] a code.inline:hover{color:#fff}.qs[data-v-d3d459ea] a:hover{color:#fff}.qs[data-v-d3d459ea] code{margin:20px 0;display:block;border:1px solid #454545;border-radius:8px;color:#d7ba7d}.qs[data-v-d3d459ea] code.inline{display:inline-block;padding:0 5px 0 5px;margin:0;line-height:1;padding:.25rem;padding-bottom:0;border:none;color:#c6c6c6;background-color:rgba(0,0,0,.25)}.qs[data-v-d3d459ea] code.inline em{color:#d7ba7d;font-style:inherit}.qs[data-v-d3d459ea] ul{padding-left:10px}.qs-container[data-v-d3d459ea]{max-width:930px;margin:auto}.qs-content[data-v-d3d459ea]{margin-bottom:12px;background:#242c41;filter:drop-shadow(2px 2px 2px var(--vscode-welcomePage-tileShadow, rgba(0, 0, 0, .36)));border-radius:8px;margin:1em auto;overflow-x:visible}.qs-help[data-v-d3d459ea]{margin-bottom:12px;display:flex;justify-content:flex-start;align-items:center}.qs-help__icon[data-v-d3d459ea]{margin:0 15px;width:22px;height:22px}.qs-help__text[data-v-d3d459ea]{line-height:18px}header[data-v-d3d459ea]{margin-block-end:2em}h1[data-v-d3d459ea]{margin-block-start:0;font-size:2em;line-height:2.25rem;margin-bottom:.25rem}article[data-v-d3d459ea]{margin-bottom:1.5em}.center[data-v-d3d459ea]{margin:auto;text-align:center}.fit[data-v-d3d459ea]{width:fit-content}.recording-method[data-v-d3d459ea]{padding-left:2rem}.recording-method--disabled[data-v-d3d459ea]{color:#999}.recording-method h3[data-v-d3d459ea]{display:flex}.recording-method[data-v-d3d459ea]:last-child{margin-bottom:2rem}i.header-icon[data-v-d3d459ea]{width:1.75rem;margin-right:.75rem;display:inline-flex;align-items:center}i.header-icon--disabled[data-v-d3d459ea]{opacity:.5}.recommended-badge[data-v-d3d459ea]{background-color:#435089;padding:1px 12px;color:#fff;border-radius:10px;font-size:.85rem;margin-left:.5rem;text-align:center;display:inline-flex;align-items:center}#IntelliJ-screenshot[data-v-d3d459ea]{max-width:100%;padding:1rem;border-radius:10px;background-color:#343e5a}#IntelliJ-screenshot img[data-v-d3d459ea]{max-width:100%;box-shadow:#000 5px 5px 9px}@media (max-width:900px){.recording-method[data-v-d3d459ea]{padding-left:1rem}}@media (max-width:450px){.recording-method[data-v-d3d459ea]{padding-left:0}div#IntelliJ-screenshot[data-v-d3d459ea]{display:none}}', map: void 0, media: void 0 }); - }, { name: "QuickstartLayout", components: { HelpIcon: ii, AppMapLogo: ve, VAiHelpButton: de({ render: function() { + }, { name: "QuickstartLayout", components: { HelpIcon: si, AppMapLogo: ve, VAiHelpButton: de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("v-button", { staticClass: "ask-ai", attrs: { size: "small", kind: "secondary", "data-cy": "ai-help-primary" }, nativeOn: { click: function(t5) { return e3.onClick.apply(null, arguments); } } }, [a3("span", { staticClass: "ask-ai--content" }, [a3("v-ai-icon", { staticClass: "icon" }), e3._v("\n \xA0 Ask Navie: AppMap AI \xA0\n "), a3("v-badge", [e3._v("NEW")])], 1)]); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-7783365a_0", { source: ".ask-ai--content[data-v-7783365a]{display:flex;align-items:center;justify-content:center}.ask-ai svg.icon[data-v-7783365a]{width:1.2rem;height:1.2rem}.ask-ai svg.icon path[data-v-7783365a]{fill:#e3e5e8;transition:fill .2s ease-in-out}.ask-ai:hover svg.icon path[data-v-7783365a]{fill:#010306}", map: void 0, media: void 0 }); - }, { name: "v-ai-help", components: { VBadge: ni, VButton: ue, VAiIcon: si }, methods: { onClick() { + }, { name: "v-ai-help", components: { VBadge: oi, VButton: ue, VAiIcon: ri }, methods: { onClick() { this.$root.$emit("ai-help"); - } } }, "data-v-7783365a", false, void 0, false, he, void 0, void 0), VBadge: ni }, props: { displayHelp: { type: Boolean, default: true } }, inject: { displayAiHelp: { default: false } }, methods: { onClickHelp() { + } } }, "data-v-7783365a", false, void 0, false, he, void 0, void 0), VBadge: oi }, props: { displayHelp: { type: Boolean, default: true } }, inject: { displayAiHelp: { default: false } }, methods: { onClickHelp() { this.$root.$emit("ai-help"); } } }, "data-v-d3d459ea", false, void 0, false, he, void 0, void 0); - var ri = de({ render: function() { + var li = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("v-quickstart-layout", [a3("section", { staticClass: "analysis-findings" }, [a3("div", { staticClass: "header-wrap" }, [a3("header", [a3("h4", { staticClass: "subhead" }, [e3._v("Overview")]), e3._v(" "), a3("h1", { attrs: { "data-cy": "title" } }, [e3._v("Runtime Analysis")])]), e3._v(" "), a3("div", { staticClass: "header-controls" }, [a3("div", { staticClass: "btn", attrs: { "data-cy": "problems-tab-button" }, on: { click: function(t5) { return e3.openProblemsTab(); @@ -359153,7 +359525,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; })], 2)])])])])]); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-9a7f82a4_0", { source: '@charset "UTF-8";.analysis-findings[data-v-9a7f82a4]{padding:2rem}.analysis-findings .header-wrap[data-v-9a7f82a4]{display:flex;flex-direction:row;justify-content:space-between}.analysis-findings .header-wrap h4.subhead[data-v-9a7f82a4]{margin-top:0}.analysis-findings .header-wrap .header-controls[data-v-9a7f82a4]{display:flex;flex-direction:row;gap:1rem;align-items:flex-start}.analysis-findings .header-wrap .header-controls .btn[data-v-9a7f82a4]{border:1px solid #e3e5e8;border-radius:.5rem;padding:.25rem 1rem;transition:all .3s ease}.analysis-findings .header-wrap .header-controls .btn[data-v-9a7f82a4]:hover{background-color:#010306;border-color:#010306;color:#e3e5e8;cursor:pointer}.analysis-findings .mobile-heading[data-v-9a7f82a4]{display:none}.analysis-findings .subhead[data-v-9a7f82a4]{font-size:1.1rem;color:#808b98;line-height:1.6rem;text-transform:uppercase}.analysis-findings .branch[data-v-9a7f82a4]{font-size:1rem;color:#e3e5e8;line-height:1.6rem;font-weight:500}.analysis-findings .findings-overview h3[data-v-9a7f82a4]{color:#808b98}.analysis-findings .findings-overview ul[data-v-9a7f82a4]{list-style-type:none;display:flex;flex-direction:row;gap:1rem;justify-content:flex-start;padding:0}.analysis-findings .findings-overview ul li[data-v-9a7f82a4]{border-radius:.5rem;background-color:#010306;padding:.25rem 1.35rem .25rem 2rem;transition:all .3s ease;display:flex;align-items:center}.analysis-findings .findings-overview ul li[data-v-9a7f82a4]:hover{background-color:#e3e5e8;color:#010306;cursor:pointer}.analysis-findings .findings-overview ul li[data-v-9a7f82a4]:before{font-size:20px;line-height:20px}.analysis-findings .findings-overview ul li.total[data-v-9a7f82a4]{padding:.25rem 1rem}.analysis-findings .findings-overview ul li.security[data-v-9a7f82a4]::before{content:"\u2022";color:#9d1616;font-weight:700;display:inline-block;width:1em;margin-left:-1em}.analysis-findings .findings-overview ul li.performance[data-v-9a7f82a4]::before{content:"\u2022";color:#b54b0f;font-weight:700;display:inline-block;width:1em;margin-left:-1em}.analysis-findings .findings-overview ul li.stability[data-v-9a7f82a4]::before{content:"\u2022";color:#d6993f;font-weight:700;display:inline-block;width:1em;margin-left:-1em}.analysis-findings .findings-overview ul li.maintainability[data-v-9a7f82a4]::before{content:"\u2022";color:#69ad34;font-weight:700;display:inline-block;width:1em;margin-left:-1em}.analysis-findings .findings-list[data-v-9a7f82a4]{margin:0 -1.75rem}.analysis-findings .findings-list ul[data-v-9a7f82a4]{padding:0;list-style-type:none}.analysis-findings .findings-list ul li[data-v-9a7f82a4]{padding:.25rem 1rem;transition:all .3s ease}.analysis-findings .findings-list ul li[data-v-9a7f82a4]:hover{background-color:#1b2131}.analysis-findings .findings-list .list[data-v-9a7f82a4]{display:flex;flex-direction:column;align-content:center}.analysis-findings .findings-list .list li[data-v-9a7f82a4]{border-bottom:1px solid #3f4d72}.analysis-findings .findings-list .item[data-v-9a7f82a4]{display:flex;flex-direction:row;justify-content:space-between;cursor:pointer}.analysis-findings .findings-list .item li[data-v-9a7f82a4]{border-bottom:0}.analysis-findings .findings-list .item li[data-v-9a7f82a4]:first-of-type{border-top:0}.analysis-findings .findings-list .item.header[data-v-9a7f82a4]{font-weight:800;color:#808b98}.analysis-findings .findings-list .item.header li[data-v-9a7f82a4]{padding-bottom:0}h1[data-v-9a7f82a4],h2[data-v-9a7f82a4],h3[data-v-9a7f82a4],h4[data-v-9a7f82a4],h5[data-v-9a7f82a4],h6[data-v-9a7f82a4]{margin:0}.b-0[data-v-9a7f82a4]{border:none}@media (max-width:800px){.analysis-findings .header-wrap[data-v-9a7f82a4]{flex-direction:column;gap:.5rem;margin-bottom:1rem}.analysis-findings .header-wrap header[data-v-9a7f82a4]{margin-bottom:0}.analysis-findings .findings-list .item[data-v-9a7f82a4]{flex-direction:column}.analysis-findings .findings-overview ul[data-v-9a7f82a4]{flex-direction:column;gap:.35rem;width:100%}.analysis-findings .findings-list .list li[data-v-9a7f82a4]{padding-top:.25rem;padding-bottom:.2rem}.analysis-findings .item.header[data-v-9a7f82a4]{display:none}.analysis-findings .mobile-heading[data-v-9a7f82a4]{color:#808b98;display:unset;margin-right:.35rem}}', map: void 0, media: void 0 }); - }, { name: "analysis-findings", components: { VQuickstartLayout: oi }, props: { findings: { default: () => [], type: Array } }, data: () => ({ sortBy: "name", sortAscending: true, filterBy: "all" }), methods: { updateSorting(e3) { + }, { name: "analysis-findings", components: { VQuickstartLayout: ci }, props: { findings: { default: () => [], type: Array } }, data: () => ({ sortBy: "name", sortAscending: true, filterBy: "all" }), methods: { updateSorting(e3) { this.sortBy === e3 && (this.sortAscending = !this.sortAscending), this.sortBy = e3; }, updateFilter(e3) { this.filterBy = e3; @@ -359185,7 +359557,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }, numMaintainabilityFindings() { return this.findingsByImpactDomain.maintainability.length; } } }, "data-v-9a7f82a4", false, void 0, false, he, void 0, void 0); - var ci = de({ render: function() { + var di = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("v-quickstart-layout", [e3.hasNoData ? a3("section", { staticClass: "finding-details" }, [a3("h1", { attrs: { "data-cy": "title" } }, [e3._v("Oops, Something Went Wrong!")]), e3._v(" "), a3("p", [e3._v("We couldn't find any information about this finding")])]) : a3("div", [a3("section", { staticClass: "finding-details" }, [a3("div", { staticClass: "header-wrap" }, [a3("header", [a3("h4", { staticClass: "subhead" }, [e3._v("Finding")]), e3._v(" "), a3("h1", { attrs: { "data-cy": "title" } }, [e3._v(e3._s(e3.title))]), e3._v(" "), e3.description ? a3("p", { attrs: { "data-cy": "description" } }, [e3._v(e3._s(e3.description))]) : e3._e(), e3._v(" "), a3("a", { attrs: { href: e3.docsLink, "data-cy": "docs-link" } }, [e3._v("Learn More")])]), e3._v(" "), a3("div", { staticClass: "header-controls" }, [a3("div", { staticClass: "btn", on: { click: function(t5) { return e3.backToOverview(); @@ -359202,7 +359574,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }), 0)])])]); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-7990c928_0", { source: ".qs .header-controls a[data-v-7990c928]{color:#e3e5e8}.analysis-findings.full-width[data-v-7990c928]{padding-bottom:2rem}.analysis-findings.full-width h3[data-v-7990c928]{display:flex;align-items:center;padding:0 2rem;color:#808b98}.analysis-findings.full-width h3 svg[data-v-7990c928]{margin-right:.5rem}.analysis-findings.full-width .appmap-list[data-v-7990c928]{padding:0;border-top:1px solid #3f4d72;margin-top:.25rem}.analysis-findings.full-width .appmap-list li[data-v-7990c928]{padding:.5rem 2rem;border-bottom:1px solid #3f4d72;list-style-type:none}.analysis-findings.full-width .appmap-list li a[data-v-7990c928]{color:#e3e5e8}.analysis-findings.full-width .appmap-list li[data-v-7990c928]:hover{background-color:#1b2131}h1[data-v-7990c928],h2[data-v-7990c928],h3[data-v-7990c928],h4[data-v-7990c928],h5[data-v-7990c928],h6[data-v-7990c928]{margin:0}.finding-details[data-v-7990c928]{padding:2rem}.finding-details .header-wrap[data-v-7990c928]{display:flex;flex-direction:row;justify-content:space-between}.finding-details .header-wrap h4.subhead[data-v-7990c928]{margin-top:0}.finding-details .header-wrap header[data-v-7990c928]{display:flex;flex-direction:column;gap:.5rem}.finding-details .header-wrap header p[data-v-7990c928]{margin:0}.finding-details .header-wrap .header-controls[data-v-7990c928]{display:flex;flex-direction:row;gap:1rem;align-items:flex-start;justify-content:flex-end;width:100%;position:absolute;right:2rem}.finding-details .header-wrap .header-controls .btn[data-v-7990c928]{border:1px solid #e3e5e8;border-radius:.5rem;padding:.2rem .5rem;transition:all .3s ease;min-width:200px;text-align:center}.finding-details .header-wrap .header-controls .btn[data-v-7990c928]:hover{background-color:#010306;border-color:#010306;color:#e3e5e8;cursor:pointer}.finding-details section .code[data-v-7990c928]{font-family:monospace;font-weight:800}.finding-details .subhead[data-v-7990c928]{font-size:1.1rem;color:#808b98;line-height:1.6rem;text-transform:uppercase;padding:.2rem 0}.finding-details .findings-sort[data-v-7990c928]{display:flex;flex-direction:row;align-items:center}.finding-details .findings-sort select[data-v-7990c928]{border-radius:6px;border:1px solid #8f81d4b3;background-color:transparent;color:#e3e5e8;padding:.4rem .5rem;margin-left:.35rem}.finding-details .finding-details-wrap[data-v-7990c928]{display:flex;gap:1.25rem;justify-content:space-between}.finding-details .finding-details-wrap.row[data-v-7990c928]{flex-direction:row}.finding-details .finding-details-wrap.col[data-v-7990c928]{flex-direction:column;gap:0}.finding-details .finding-details-wrap h3[data-v-7990c928]{color:#808b98}.finding-details .finding-details-wrap ul[data-v-7990c928]{list-style-type:none;display:flex;flex-direction:column;gap:1rem;justify-content:flex-start;padding:0;width:100%}.finding-details .finding-details-wrap ul li[data-v-7990c928]{border-radius:.5rem;background-color:#010306;padding:.25rem 1rem .25rem 1.5rem;transition:all .3s ease}.finding-details .finding-details-wrap ul.card[data-v-7990c928]{margin-top:.25rem}.finding-details .finding-details-wrap section .code[data-v-7990c928]{font-weight:800;color:#808b98;font-family:monospace}.finding-details .finding-details-wrap .card[data-v-7990c928]{border-radius:.5rem;background-color:#010306;padding:.25rem 0;gap:0;margin-top:.15rem}.finding-details .finding-details-wrap .card li[data-v-7990c928]{border-bottom:1px solid #242c41;border-radius:0;word-break:break-word}.finding-details .finding-details-wrap .card li[data-v-7990c928]:last-of-type{border-bottom:0}.finding-details .finding-details-wrap .cardul.stack[data-v-7990c928]{display:flex;flex-direction:column}.finding-details .finding-details-wrap .event-summary[data-v-7990c928],.finding-details .finding-details-wrap .findings-overview[data-v-7990c928]{width:100%;min-width:48%}.finding-details .findings-list[data-v-7990c928]{margin:0 -1.75rem}.finding-details .findings-list ul[data-v-7990c928]{padding:0;list-style-type:none}.finding-details .findings-list ul li[data-v-7990c928]{padding:.25rem 1rem;width:100%;transition:all .3s ease}.finding-details .findings-list ul li[data-v-7990c928]:hover{background-color:#1b2131}.finding-details.full-width[data-v-7990c928]{width:100%;margin:0 -1.75rem}.b-0[data-v-7990c928]{border:none}@media (max-width:900px){.finding-details .header-wrap[data-v-7990c928]{flex-direction:column;gap:.5rem;margin-bottom:1.5rem}.finding-details .header-wrap header[data-v-7990c928]{margin:0}.finding-details .header-wrap header p[data-v-7990c928]{margin-bottom:0}}@media (max-width:800px){.finding-details .finding-details-wrap.row[data-v-7990c928]{flex-direction:column;gap:0}}@media (max-width:500px){.finding-details .header-wrap .header-controls[data-v-7990c928]{position:unset;justify-content:flex-start}.finding-details .header-wrap header h1[data-v-7990c928]{margin-bottom:.25rem}}", map: void 0, media: void 0 }); - }, { name: "FindingDetails", components: { VQuickstartLayout: oi, VAppmapPin: { functional: true, render(e3, t4) { + }, { name: "FindingDetails", components: { VQuickstartLayout: ci, VAppmapPin: { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ width: "10", height: "15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M5.8 13.796C7.214 11.618 10 7.062 10 5A5 5 0 000 5c0 2.061 2.787 6.618 4.2 8.796a.949.949 0 001.6 0zM2.978 8H2l3-6 3 6h-.977L5 3.8 2.977 8z", fill: "#FF07AA" } })])); } }, VPopper: lt }, mixins: [{ data: () => ({ first: false, last: false }) }], props: { findings: { default: () => [], type: Array } }, methods: { displayLocation(e3) { @@ -359238,35 +359610,32 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }, docsLink() { return `https://appmap.io/docs/analysis/rules-reference.html#${this.representativeFinding.finding.ruleId}`; } } }, "data-v-7990c928", false, void 0, false, he, void 0, void 0); - var li = "Something went wrong, please try again later."; - var di = de({ render: function() { + var pi3 = "Something went wrong, please try again later."; + var hi = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; - return a3("div", { staticClass: "signin-sidebar" }, [a3("AppMapLogo", { attrs: { width: "120" } }), e3._v(" "), e3.submitted ? a3("div", { staticClass: "finish-activation" }, [e3._m(2), e3._v(" "), a3("div", { staticClass: "signin-buttons" }, [e3.error ? a3("p", { staticClass: "error" }, [e3._v(e3._s(e3.error))]) : e3._e(), e3._v(" "), a3("input", { directives: [{ name: "model", rawName: "v-model", value: e3.verificationCode, expression: "verificationCode" }], attrs: { id: "verification-code-input", type: "text", placeholder: "verification code" }, domProps: { value: e3.verificationCode }, on: { keydown: e3.keyDown, input: function(t5) { + return a3("div", { staticClass: "signin-sidebar" }, [a3("AppMapLogo", { attrs: { width: "120" } }), e3._v(" "), e3.submitted ? a3("div", { staticClass: "finish-activation" }, [e3._m(1), e3._v(" "), a3("div", { staticClass: "signin-buttons" }, [e3.error ? a3("p", { staticClass: "error" }, [e3._v(e3._s(e3.error))]) : e3._e(), e3._v(" "), a3("input", { directives: [{ name: "model", rawName: "v-model", value: e3.verificationCode, expression: "verificationCode" }], attrs: { id: "verification-code-input", type: "text", placeholder: "verification code" }, domProps: { value: e3.verificationCode }, on: { keydown: e3.keyDown, input: function(t5) { t5.target.composing || (e3.verificationCode = t5.target.value); } } }), e3._v(" "), a3("a", { staticClass: "btn btn-primary", attrs: { href: "/", "data-cy": "verify-button" }, on: { click: function(t5) { return t5.preventDefault(), e3.completeActivation.apply(null, arguments); } } }, [e3._v("\n Complete Activation\n ")]), e3._v(" "), a3("p", { staticClass: "no-email" }, [e3._v("\n Didn't receive the email? Check your spam folder or\n "), a3("a", { staticClass: "link", attrs: { href: "/" }, on: { click: function(t5) { return t5.preventDefault(), e3.reset.apply(null, arguments); - } } }, [e3._v(" try again")]), e3._v(".\n ")])])]) : a3("div", { staticClass: "content-wrap" }, [e3._m(0), e3._v(" "), a3("div", { staticClass: "signin-buttons" }, [e3.error ? a3("p", { staticClass: "error" }, [e3._v(e3._s(e3.error))]) : e3._e(), e3._v(" "), a3("input", { directives: [{ name: "model", rawName: "v-model", value: e3.email, expression: "email" }], attrs: { id: "email-input", type: "email", placeholder: "email address", required: "" }, domProps: { value: e3.email }, on: { keydown: e3.keyDown, input: function(t5) { + } } }, [e3._v(" try again")]), e3._v(".\n ")])])]) : a3("div", { staticClass: "content-wrap" }, [a3("div", { staticClass: "sidebar-title", attrs: { "data-cy": "title" } }, [e3._v("Activate AppMap")]), e3._v(" "), a3("div", { staticClass: "signin-buttons" }, [e3.error ? a3("p", { staticClass: "error" }, [e3._v(e3._s(e3.error))]) : e3._e(), e3._v(" "), a3("input", { directives: [{ name: "model", rawName: "v-model", value: e3.email, expression: "email" }], attrs: { id: "email-input", type: "email", placeholder: "email address", required: "" }, domProps: { value: e3.email }, on: { keydown: e3.keyDown, input: function(t5) { t5.target.composing || (e3.email = t5.target.value); } } }), e3._v(" "), a3("a", { staticClass: "btn btn-primary", attrs: { href: "/", "data-cy": "email-activation-button" }, on: { click: function(t5) { return t5.preventDefault(), e3.activateWithEmail.apply(null, arguments); - } } }, [e3._v("\n Activate with"), a3("span", [a3("EmailIcon", { staticClass: "small-logo" }), e3._v(" Email")], 1)]), e3._v(" "), e3._m(1), e3._v(" "), a3("a", { staticClass: "btn btn-primary", attrs: { "data-cy": "github-activation-button", href: "/" }, on: { click: function(t5) { + } } }, [e3._v("\n Activate with"), a3("span", [a3("EmailIcon", { staticClass: "small-logo" }), e3._v(" Email")], 1)]), e3._v(" "), e3._m(0), e3._v(" "), a3("a", { staticClass: "btn btn-primary", attrs: { "data-cy": "github-activation-button", href: "/" }, on: { click: function(t5) { return t5.preventDefault(), e3.signIn.apply(null, arguments); } } }, [e3._v("\n Activate with "), a3("span", [a3("GitHubLogo", { staticClass: "small-logo" }), e3._v(" GitHub")], 1)]), e3._v(" "), a3("a", { staticClass: "btn btn-primary", attrs: { "data-cy": "gitlab-activation-button", href: "/" }, on: { click: function(t5) { return t5.preventDefault(), e3.signIn.apply(null, arguments); } } }, [e3._v("\n Activate with "), a3("span", [a3("GitLabLogo", { staticClass: "small-logo" }), e3._v(" GitLab")], 1)]), e3._v(" "), a3("div", { staticClass: "accept-tos" }, [a3("p", [e3._v("\n By activating AppMap, I agree to the\n "), a3("a", { staticClass: "link", attrs: { target: "_blank", href: "https://appmap.io/community/terms-and-conditions.html" } }, [e3._v("\n AppMap Terms of Service"), a3("ExternalLinkIcon")], 1)])])]), e3._v(" "), a3("div", { staticClass: "your-data" }, [a3("ShieldIcon"), e3._v(" "), a3("div", { staticClass: "your-data-text", attrs: { "data-cy": "your-data-text" } }, [a3("p", [e3._v("\n Your email address is used solely to issue you an AppMap license. Your source code and\n AppMaps stay on your machine when you use AppMap diagrams and runtime analysis. Consult\n the\n "), a3("a", { staticClass: "link", attrs: { target: "_blank", href: "https://appmap.io/community/terms-and-conditions.html" } }, [e3._v("\n Terms of Service"), a3("ExternalLinkIcon")], 1), e3._v("\n for data privacy terms of Navie AI.\n ")])])], 1)])], 1); }, staticRenderFns: [function() { - var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; - return a3("div", { staticClass: "sidebar-title" }, [a3("h1", { attrs: { "data-cy": "title" } }, [e3._v("Activate AppMap")])]); - }, function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "or-divider-container" }, [a3("div", { staticClass: "line" }), e3._v(" "), a3("p", { staticClass: "or-divider" }, [e3._v("OR")]), e3._v(" "), a3("div", { staticClass: "line" })]); }, function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "sidebar-title" }, [a3("h1", { attrs: { "data-cy": "title" } }, [e3._v("Complete Activation")]), e3._v(" "), a3("p", [e3._v("\n Check your inbox! We've sent you an email with a 6-digit verification code. Enter the code\n below.\n ")])]); }] }, function(e3) { - e3 && e3("data-v-ef1f3e5c_0", { source: '.signin-sidebar[data-v-ef1f3e5c]{background-color:#010306;font-family:"IBM Plex Sans","Helvetica Neue",Helvetica,Arial,sans-serif;color:#e3e5e8;font-size:1rem;width:auto;height:100%;padding:1.5rem;line-height:1.4rem}.signin-sidebar h1[data-v-ef1f3e5c]{line-height:2rem}.signin-sidebar a.link[data-v-ef1f3e5c]{color:#3794ff;text-decoration:none;transition:all .3s ease}.signin-sidebar a.link svg[data-v-ef1f3e5c]{transition:all .3s ease;margin:0 .3rem;width:90%;max-width:14px;height:14px;fill:#3794ff}.signin-sidebar a.link[data-v-ef1f3e5c]:hover{transition:all .3s ease;color:#84bdff}.signin-sidebar a.link:hover svg[data-v-ef1f3e5c]{transition:all .3s ease;fill:#84bdff}.signin-sidebar .btn[data-v-ef1f3e5c]{padding:.7rem 1rem;border-radius:.5rem;transition:all .3s ease;color:#e3e5e8;text-decoration:none;text-align:center;width:90%;justify-content:center;display:flex}.signin-sidebar .btn span[data-v-ef1f3e5c]{display:flex;align-items:center}.signin-sidebar .btn span .small-logo[data-v-ef1f3e5c]{width:17px;margin:0 .5rem}.signin-sidebar .btn.btn-primary[data-v-ef1f3e5c]{background-color:#4186d8;font-weight:600;margin:0 1.25rem}.signin-sidebar .btn.btn-primary[data-v-ef1f3e5c]:hover{background-color:#0e5fbe;transition:all .3s ease}@media (max-width:300px){.signin-sidebar .btn[data-v-ef1f3e5c]{flex-direction:column;align-items:center}}.signin-sidebar .content-wrap[data-v-ef1f3e5c]{margin:2rem 0;width:100%;display:flex;flex-direction:column;align-content:center;gap:1.2rem}.signin-sidebar .content-wrap .sidebar-title h1[data-v-ef1f3e5c]{margin:0 0 .5rem 0}.signin-sidebar .content-wrap p[data-v-ef1f3e5c]{margin:0}.signin-sidebar .signin-buttons[data-v-ef1f3e5c]{display:flex;flex-direction:column;gap:1rem;align-items:center;margin-bottom:1rem}.signin-sidebar .signin-buttons .or-divider-container[data-v-ef1f3e5c]{display:flex;width:90%}.signin-sidebar .signin-buttons .or-divider-container .or-divider[data-v-ef1f3e5c]{margin:.5rem;color:#808b98}.signin-sidebar .signin-buttons .or-divider-container .line[data-v-ef1f3e5c]{align-self:center;height:0;width:90%;border-top:1px solid #808b98}.signin-sidebar .signin-buttons .error[data-v-ef1f3e5c]{color:#ff07aa;font-size:.9rem;margin:0}.signin-sidebar .signin-buttons .accept-tos[data-v-ef1f3e5c]{font-size:.9rem;width:90%}.signin-sidebar input[type=email][data-v-ef1f3e5c],.signin-sidebar input[type=text][data-v-ef1f3e5c]{width:90%;color:#e3e5e8;font-size:1rem;background-color:inherit;border:1px solid #e1e2e2;padding:.75rem;border-radius:10px}.signin-sidebar input[type=email][data-v-ef1f3e5c]:focus,.signin-sidebar input[type=text][data-v-ef1f3e5c]:focus{outline:0}.signin-sidebar .your-data[data-v-ef1f3e5c]{display:flex;flex-direction:row;align-items:center;gap:1rem;padding:1rem;border:1px solid #343742;border-radius:.5rem;font-size:.9rem;line-height:1.2rem}.signin-sidebar .your-data svg[data-v-ef1f3e5c]{width:100%;max-width:33px;height:42px}.signin-sidebar .your-data .your-data-text p[data-v-ef1f3e5c]{margin:.5rem .2rem}@media (max-width:365px){.signin-sidebar .your-data[data-v-ef1f3e5c]{flex-direction:column;align-content:center;text-align:center}}.signin-sidebar .finish-activation .sidebar-title[data-v-ef1f3e5c]{margin-bottom:2rem}.signin-sidebar .finish-activation .no-email[data-v-ef1f3e5c]{font-size:.9rem;line-height:1rem}', map: void 0, media: void 0 }); + e3 && e3("data-v-56bd7fdd_0", { source: '.signin-sidebar[data-v-56bd7fdd]{background-color:#010306;font-family:"IBM Plex Sans","Helvetica Neue",Helvetica,Arial,sans-serif;color:#e3e5e8;width:auto;height:100%;padding:1.5rem;line-height:1.4rem}.signin-sidebar a.link[data-v-56bd7fdd]{color:#3794ff;text-decoration:none;transition:all .3s ease}.signin-sidebar a.link svg[data-v-56bd7fdd]{transition:all .3s ease;margin:0 .3rem;width:90%;max-width:14px;height:14px;fill:#3794ff}.signin-sidebar a.link[data-v-56bd7fdd]:hover{transition:all .3s ease;color:#84bdff}.signin-sidebar a.link:hover svg[data-v-56bd7fdd]{transition:all .3s ease;fill:#84bdff}.signin-sidebar .btn[data-v-56bd7fdd]{padding:.7rem 1rem;border-radius:.5rem;transition:all .3s ease;color:#e3e5e8;text-decoration:none;text-align:center;width:90%;justify-content:center;display:flex}.signin-sidebar .btn span[data-v-56bd7fdd]{display:flex;align-items:center}.signin-sidebar .btn span .small-logo[data-v-56bd7fdd]{width:17px;margin:0 .5rem}.signin-sidebar .btn.btn-primary[data-v-56bd7fdd]{background-color:#4186d8;font-weight:600}.signin-sidebar .btn.btn-primary[data-v-56bd7fdd]:hover{background-color:#0e5fbe;transition:all .3s ease}@media (max-width:300px){.signin-sidebar .btn[data-v-56bd7fdd]{flex-direction:column;align-items:center}}.signin-sidebar .content-wrap[data-v-56bd7fdd]{margin:1em 0;width:100%;display:flex;flex-direction:column;align-content:center;gap:1em}.signin-sidebar .content-wrap .sidebar-title[data-v-56bd7fdd]{line-height:2rem;font-size:1.17em;font-weight:700}.signin-sidebar .content-wrap p[data-v-56bd7fdd]{margin:0}.signin-sidebar .signin-buttons[data-v-56bd7fdd]{display:flex;flex-direction:column;gap:1rem;align-items:center}.signin-sidebar .signin-buttons .or-divider-container[data-v-56bd7fdd]{display:flex;width:90%}.signin-sidebar .signin-buttons .or-divider-container .or-divider[data-v-56bd7fdd]{margin:0 .5rem;color:#808b98}.signin-sidebar .signin-buttons .or-divider-container .line[data-v-56bd7fdd]{align-self:center;height:0;width:90%;border-top:1px solid #808b98}.signin-sidebar .signin-buttons .error[data-v-56bd7fdd]{color:#ff07aa;margin:0}.signin-sidebar .signin-buttons .accept-tos[data-v-56bd7fdd]{width:90%}.signin-sidebar input[type=email][data-v-56bd7fdd],.signin-sidebar input[type=text][data-v-56bd7fdd]{width:90%;color:#e3e5e8;font-size:1em;background-color:inherit;border:1px solid #e1e2e2;padding:.75rem;border-radius:10px}.signin-sidebar input[type=email][data-v-56bd7fdd]:focus,.signin-sidebar input[type=text][data-v-56bd7fdd]:focus{outline:0}.signin-sidebar .your-data[data-v-56bd7fdd]{display:flex;flex-direction:row;align-items:center;gap:1rem;padding:1rem;border:1px solid #343742;border-radius:.5rem;line-height:1.2rem}.signin-sidebar .your-data svg[data-v-56bd7fdd]{width:100%;max-width:33px;height:42px}@media (max-width:365px){.signin-sidebar .your-data[data-v-56bd7fdd]{flex-direction:column;align-content:center;text-align:center}}.signin-sidebar .finish-activation .sidebar-title[data-v-56bd7fdd]{margin-bottom:2rem}.signin-sidebar .finish-activation .no-email[data-v-56bd7fdd]{line-height:1rem}', map: void 0, media: void 0 }); }, { name: "v-sign-in", components: { AppMapLogo: ve, ShieldIcon: { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M16.5 37.791V4.868s3.54 3.754 6.466 3.782c2.674.025 6.466-1.557 6.466-1.557V26c0 3.916-8.621 9.937-12.932 11.79z", fill: "#746DD9" } }), a3("path", { attrs: { d: "M16.5 37.791V4.868s-3.54 3.754-6.466 3.782c-2.674.025-6.466-1.557-6.466-1.557V26c0 3.916 8.621 9.937 12.932 11.79z", fill: "#A79FE9" } }), a3("path", { attrs: { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M17.799 1.378L16.5 0l-1.298 1.377-.001.001-.004.004-.026.027-.115.117a20.25 20.25 0 01-2.061 1.792c-1.399 1.053-2.83 1.794-3.87 1.803-1.234.012-2.856-.361-4.28-.797a30.904 30.904 0 01-2.338-.822l-.03-.013-.005-.002L0 2.456v24.19c0 1.71.908 3.364 1.976 4.759 1.107 1.447 2.597 2.884 4.189 4.2 3.174 2.622 6.996 4.96 9.629 6.091L16.5 42l.706-.304c2.633-1.132 6.455-3.469 9.63-6.092 1.591-1.315 3.08-2.752 4.188-4.199C32.092 30.01 33 28.355 33 26.645V2.456l-2.471 1.032-.007.002-.03.013-.126.05a30.901 30.901 0 01-2.21.772c-1.424.436-3.047.809-4.281.797-1.04-.01-2.471-.75-3.87-1.804a20.25 20.25 0 01-2.176-1.908l-.026-.027-.004-.004zm11.633 4.406c1.062-.354 1.784-.655 1.784-.655v21.517c0 4.455-9.81 11.307-14.716 13.416-4.905-2.11-14.716-8.961-14.716-13.416V5.129s.722.301 1.784.655c1.533.512 3.776 1.134 5.574 1.117 2.155-.02 4.602-1.816 6.061-3.082A19.658 19.658 0 0016.5 2.598s.502.532 1.297 1.221c1.459 1.266 3.906 3.062 6.061 3.082 1.798.017 4.04-.605 5.574-1.117z", fill: "#635BB4" } })])); @@ -359289,7 +359658,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; const e3 = new URL("/api/activations", this.appmapServerUrl); this.addParamsToUrl(e3, { email: this.trimWhitespace(this.email) }); const t4 = await fetch(e3, { method: "POST" }); - 201 === t4.status ? (this.error = "", this.submitted = true) : t4.status < 500 && t4.status >= 400 ? (this.email = "", this.error = this.generateInvalidFieldMsg("email address")) : (this.email = "", this.error = li); + 201 === t4.status ? (this.error = "", this.submitted = true) : t4.status < 500 && t4.status >= 400 ? (this.email = "", this.error = this.generateInvalidFieldMsg("email address")) : (this.email = "", this.error = pi3); }, async completeActivation() { const e3 = new URL("/api/activations/verify", this.appmapServerUrl); this.addParamsToUrl(e3, { email: this.trimWhitespace(this.email), code: this.trimWhitespace(this.verificationCode) }); @@ -359298,51 +359667,51 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; const e4 = await t4.json(); this.$root.$emit("activate", e4.api_key); } catch (e4) { - this.submitted = false, this.error = li; + this.submitted = false, this.error = pi3; } - else this.verificationCode = "", this.error = t4.status < 500 && t4.status >= 400 ? this.generateInvalidFieldMsg("verification code") : this.error = li; + else this.verificationCode = "", this.error = t4.status < 500 && t4.status >= 400 ? this.generateInvalidFieldMsg("verification code") : this.error = pi3; }, addParamsToUrl(e3, t4) { Object.keys(t4).forEach((a3) => e3.searchParams.append(a3, t4[a3])); - }, generateInvalidFieldMsg: (e3) => `Invalid ${e3}, please try again.` } }, "data-v-ef1f3e5c", false, void 0, false, he, void 0, void 0); - var pi3 = de({ render: function() { + }, generateInvalidFieldMsg: (e3) => `Invalid ${e3}, please try again.` } }, "data-v-56bd7fdd", false, void 0, false, he, void 0, void 0); + var gi = de({ render: function() { var e3 = this, t4 = e3.$createElement; return (e3._self._c || t4)("VDiagramSequence", { attrs: { "serialized-diagram": e3.serializedDiagram, interactive: e3.interactive } }); }, staticRenderFns: [] }, void 0, { name: "v-sequence-diagram", components: { VDiagramSequence: pa }, props: { serializedDiagram: { type: Object }, interactive: { type: Boolean, default: true } }, store: Ze }, "data-v-44eb87a2", false, void 0, false, void 0, void 0, void 0); - var hi = { functional: true, render(e3, t4) { + var mi = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 128 128", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("rect", { attrs: { width: "100%", height: "100%", fill: "gray" } }), a3("path", { attrs: { d: "M33 103c0-13.255 10.745-24 24-24h15c13.255 0 24 10.745 24 24H33z", fill: "#D9D9D9" } }), a3("circle", { attrs: { cx: "64.5", cy: "50.5", r: "24.5", fill: "#D9D9D9" } })])); } }; - var gi = { functional: true, render(e3, t4) { + var ui = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 25 24", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M7.884 11v8a1 1 0 01-1 1h-2a1 1 0 01-1-1v-7a1 1 0 011-1h3zm0 0a4 4 0 004-4V6a2 2 0 114 0v5h3a2 2 0 012 2l-1 5c-.144.613-.417 1.14-.777 1.501-.361.36-.79.536-1.223.499h-7a3 3 0 01-3-3" } })])); } }; - var mi = { functional: true, render(e3, t4) { + var vi = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { "clip-rule": "evenodd", d: "M12 3.5a2 2 0 00-2 2h4a2 2 0 00-2-2zm-3.465 0A3.998 3.998 0 0112 1.5c1.48 0 2.773.804 3.465 2h1.785a3 3 0 013 3v12c0 1.657-1.093 3-3 3H6.75a3 3 0 01-3-3v-12a3 3 0 013-3h1.785zM8 5.5H6.75a1 1 0 00-1 1v12a1 1 0 001 1h10.5c.802 0 1-.448 1-1v-12a1 1 0 00-1-1H16a2 2 0 01-2 2h-4a2 2 0 01-2-2z" } })])); } }; - var ui = { functional: true, render(e3, t4) { + var fi = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 41 36", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M24 11.519C33-.981 40.5.019 40.5.019s-5.5 4.5-14.5 17c-6.48 9-11 18-11 18s-3.177-6.64-6-10c-3.025-3.6-9-7.5-9-7.5s4.982-1.311 8 .5c2.5 1.5 7 6 7 6l9-12.5z", fill: "#2AE502" } })])); } }; - var vi = de({ render: function() { + var Ai = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "loader" }, [a3("div", { staticClass: "dot" }), e3._v(" "), a3("div", { staticClass: "dot", style: { "animation-delay": "-0.15s" } }), e3._v(" "), a3("div", { staticClass: "dot", style: { "animation-delay": "-0.3s" } })]); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-067219b5_0", { source: "@keyframes loading-data-v-067219b5{0%,100%{transform:translateY(100%) scaleX(1.2)}50%{transform:translateY(-100%) scaleY(1.1)}}.loader[data-v-067219b5]{display:flex;align-items:center;height:100%;width:100%;gap:12%}.loader .dot[data-v-067219b5]{aspect-ratio:1/1;width:33%;border-radius:2em;background-color:#7196f6;animation:1s infinite loading-data-v-067219b5 ease-in-out}", map: void 0, media: void 0 }); }, vue_runtime_default.extend({ name: "v-loader" }), "data-v-067219b5", false, void 0, false, he, void 0, void 0); - var Ai = { functional: true, render(e3, t4) { + var bi = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 24 28", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M15.89 0H1.83A1.88 1.88 0 000 1.91v24.18A1.88 1.88 0 001.83 28h20.34A1.88 1.88 0 0024 26.09V7.92L15.89 0zm-.3 2.49l6 5.9h-6v-5.9zM2 26V2h12v8h8v16H2z", fill: "#000" } })])); } }; - var fi = de({ render: function() { + var wi = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { class: { "tool-status": 1, "tool-status--complete": e3.complete, "tool-status--interactive": e3.interactive }, attrs: { "data-cy": "tool-status" } }, [e3.complete ? a3(e3.completeIconComponent, { tag: "component", staticClass: "tool-status__loader" }) : a3("v-loader", { staticClass: "tool-status__loader" }), e3._v(" "), a3("div", { staticClass: "tool-status__info" }, [a3("div", { staticClass: "tool-status__action", attrs: { "data-cy": "title" } }, [e3._v(e3._s(e3.title))]), e3._v(" "), a3("div", { staticClass: "tool-status__status", attrs: { "data-cy": "status" } }, [e3._v(e3._s(e3.status))])])], 1); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-291e5d12_0", { source: ".tool-status[data-v-291e5d12]{display:grid;grid-template-columns:1.5rem 1fr;flex-direction:column;border:1px solid #7289c5;border-radius:.5rem;padding:.75rem;width:fit-content;color:#ececec;align-items:stretch}.tool-status__info[data-v-291e5d12]{grid-column:2;padding-left:.5rem}.tool-status__action[data-v-291e5d12]{font-size:.8rem;font-weight:600}.tool-status__status[data-v-291e5d12]{font-size:.75rem}.tool-status__loader[data-v-291e5d12]{justify-self:center;width:75%}.tool-status__loader path[data-v-291e5d12]{fill:#ececec}.tool-status--interactive[data-v-291e5d12]:hover{cursor:pointer;background-color:rgba(0,0,0,.8)}", map: void 0, media: void 0 }); - }, vue_runtime_default.extend({ name: "v-tool-status", components: { VLoader: vi, VCheck: Ya, VDocument: Ai }, props: { title: String, status: String, completeIcon: { type: String, default: "check", validator: (e3) => !!["check", "document"].find((t4) => t4 === e3) }, complete: { type: Boolean, default: false }, interactive: { type: Boolean, default: false } }, computed: { completeIconComponent() { - return "check" === this.completeIcon ? Ya : Ai; + }, vue_runtime_default.extend({ name: "v-tool-status", components: { VLoader: Ai, VCheck: Ya, VDocument: bi }, props: { title: String, status: String, completeIcon: { type: String, default: "check", validator: (e3) => !!["check", "document"].find((t4) => t4 === e3) }, complete: { type: Boolean, default: false }, interactive: { type: Boolean, default: false } }, computed: { completeIconComponent() { + return "check" === this.completeIcon ? Ya : bi; } } }), "data-v-291e5d12", false, void 0, false, he, void 0, void 0); - var bi = de({ render: function() { + var Ci = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { class: e3.classes }, [a3("div", { staticClass: "accordion__header", on: { click: function(t5) { return e3.$emit("toggle"); @@ -359352,7 +359721,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }, { name: "AccordionWithHeader", props: { disabled: { type: Boolean, default: false }, open: { type: Boolean, default: false } }, computed: { classes() { return { accordion: true, "accordion--open": this.open, "accordion--disabled": this.disabled }; } } }, void 0, false, void 0, false, he, void 0, void 0); - var wi = de({ render: function() { + var Ei = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("v-accordion", { class: { "code-selection": 1, "code-selection--open": e3.open }, attrs: { open: e3.open, "data-cy": "code-selection" }, scopedSlots: e3._u([{ key: "header", fn: function() { return [a3("v-tool-status", { class: { "tool-status--open": e3.open }, attrs: { "complete-icon": "document", title: e3.title, status: e3.subTitle, complete: true, interactive: true }, nativeOn: { click: function(t5) { @@ -359361,7 +359730,7 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }, proxy: true }]) }, [e3._v(" "), a3("pre", { attrs: { "data-cy": "code-selection-content" }, domProps: { innerHTML: e3._s(e3.highlightedCode) } })]); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-0be74e6e_0", { source: ".code-selection[data-v-0be74e6e]{color:#ececec}.code-selection--open[data-v-0be74e6e]{background-color:rgba(0,0,0,.4);border:1px solid rgba(255,255,255,.1);border-radius:.5rem}.code-selection pre[data-v-0be74e6e]{max-height:18rem;padding:1rem;overflow:auto;margin:0;border:none;background-color:transparent;padding-top:5px}.code-selection .tool-status--open[data-v-0be74e6e]{width:auto;border-radius:.5rem .5rem 0 0;background-color:rgba(0,0,0,.4);margin-bottom:.5rem}", map: void 0, media: void 0 }); - }, vue_runtime_default.extend({ name: "v-code-selection", components: { VAccordion: bi, VToolStatus: fi }, props: { path: String, lineStart: Number, lineEnd: Number, code: { type: String, required: true }, language: { type: String } }, data: () => ({ open: false }), computed: { highlightedCode() { + }, vue_runtime_default.extend({ name: "v-code-selection", components: { VAccordion: Ci, VToolStatus: wi }, props: { path: String, lineStart: Number, lineEnd: Number, code: { type: String, required: true }, language: { type: String } }, data: () => ({ open: false }), computed: { highlightedCode() { let e3 = this.language; if (!e3 && this.path) { const t4 = this.path.lastIndexOf("."); @@ -359380,29 +359749,29 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }, subTitle() { return this.path ? this.path : "Click to " + (this.open ? "hide" : "expand"); } } }), "data-v-0be74e6e", false, void 0, false, he, void 0, void 0); - var Ci = { functional: true, render(e3, t4) { + var yi = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 22 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { "clip-rule": "evenodd", d: "M.443.443A1.512 1.512 0 011.512 0h13.05c.4 0 .786.16 1.07.443" } }), a3("path", { attrs: { "clip-rule": "evenodd", d: "M14.28.09a.75.75 0 01.75.75v3.73h3.73a.75.75 0 010 1.5h-3.808a1.422 1.422 0 01-1.422-1.422V.84a.75.75 0 01.75-.75zm2.83 15.9a.75.75 0 011.06 0l3.36 3.36a.75.75 0 010 1.06l-3.36 3.36a.75.75 0 11-1.06-1.06l2.08-2.08h-4.91a.75.75 0 010-1.5h4.91l-2.08-2.08a.75.75 0 010-1.06z" } }), a3("path", { attrs: { d: "M1.512 0A1.512 1.512 0 000 1.512v21.056a1.512 1.512 0 001.512 1.512H12.04a.84.84 0 000-1.68H1.68V1.68h12.812l3.428 3.428v8.052a.84.84 0 001.68 0V5.04a1.511 1.511 0 00-.444-1.071L15.632.443A1.514 1.514 0 0014.562 0H1.512z" } })])); } }; - var Ei = { functional: true, render(e3, t4) { + var Ii = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 16 12", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M0 1a1 1 0 011-1h14a1 1 0 110 2H1a1 1 0 01-1-1zm0 5a1 1 0 011-1h14a1 1 0 110 2H1a1 1 0 01-1-1zm0 5a1 1 0 011-1h14a1 1 0 010 2H1a1 1 0 01-1-1z" } })])); } }; - var yi = { functional: true, render(e3, t4) { + var xi = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { "clip-rule": "evenodd", d: "M1.034 1.034A3.53 3.53 0 013.529 0h5.647a.706.706 0 110 1.412H3.53a2.118 2.118 0 00-2.117 2.117v16.942a2.118 2.118 0 002.117 2.117h16.942a2.118 2.118 0 002.117-2.117v-5.648a.706.706 0 011.412 0v5.648A3.53 3.53 0 0120.47 24H3.53A3.53 3.53 0 010 20.47V3.53a3.53 3.53 0 011.034-2.496zM15.529.706c0-.39.316-.706.706-.706h7.06c.389 0 .705.316.705.706v7.059a.706.706 0 11-1.412 0V2.41L12.5 12.5a.706.706 0 11-.998-1L21.59 1.413h-5.355a.706.706 0 01-.706-.706z" } })])); } }; - var Ii = { functional: true, render(e3, t4) { + var ki = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M9.828.722a.5.5 0 01.354.146l4.95 4.95a.5.5 0 010 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134c.082.332.136.671.16 1.013.046.702-.032 1.687-.72 2.375a.5.5 0 01-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 010-.707c.688-.688 1.673-.767 2.375-.72a6 6 0 011.013.16l3.134-3.133a3.001 3.001 0 01-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 01.353-.146zm.122 2.11v.002a.5.5 0 01-.122.51L6.293 6.878a.5.5 0 01-.511.12H5.78l-.014-.004a4.99 4.99 0 00-1.053-.192c-.422-.028-.836.008-1.175.15l5.51 5.509c.141-.34.177-.753.149-1.175a4.999 4.999 0 00-.192-1.054l-.004-.013a.504.504 0 01.12-.513l3.536-3.535a.5.5 0 01.532-.115l.096.022c.087.017.208.034.344.034.115.001.229-.012.343-.04L9.927 2.028a1.373 1.373 0 00-.04.343c0 .155.022.31.062.46l.001.001z" } })])); } }; - var xi = 0; - function ki() { - return xi++; + var Bi = 0; + function Mi() { + return Bi++; } - var Bi = de({ render: function() { + var Si = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; - return a3("div", { class: { "context-container": 1, "context-container--collapsed": e3.collapsed || !e3.isAppliable }, attrs: { "data-cy": "context-container", "data-handle": e3.valueHandle, "data-reference": e3.isReference, title: e3.location } }, [a3("div", { class: { "context-container__header": 1, "context-container__header--collapsable": e3.isCollapsable || !e3.isAppliable }, attrs: { "data-cy": "context-header" }, on: { click: e3.onClickHeader } }, [a3("span", { staticClass: "context-container__title", attrs: { "data-cy": "context-title" } }, [e3._v(e3._s(e3.title))]), e3._v(" "), a3("span", { staticClass: "context-container__button-group" }, [a3("v-popper", { attrs: { "time-to-display": 250, text: "Apply changes", align: "right", placement: "top" } }, [e3.isFile && e3.isPinnable && e3.isAppliable ? a3("span", { class: { "context-container__button": 1, "context-container__button--pending": !!e3.pendingState, "context-container__button--failure": "failure" === e3.pendingState, "context-container__button--success": "success" === e3.pendingState }, attrs: { "data-cy": "apply" }, on: { click: function(t5) { + return a3("div", { class: { "context-container": 1, "context-container--collapsed": e3.collapsed || !e3.isAppliable }, attrs: { "data-cy": "context-container", "data-handle": e3.valueHandle, "data-reference": e3.isReference } }, [a3("div", { class: { "context-container__header": 1, "context-container__header--collapsable": e3.isCollapsable || !e3.isAppliable, "context-container__header--file": !e3.isCollapsable && e3.isFile }, attrs: { "data-cy": "context-header", title: e3.location }, on: { click: e3.onClickHeader } }, [a3("span", { staticClass: "context-container__title", attrs: { "data-cy": "context-title" } }, [e3._v("\u200E" + e3._s(e3.title))]), e3._v(" "), a3("span", { staticClass: "context-container__button-group", attrs: { title: "" } }, [a3("v-popper", { attrs: { "time-to-display": 250, text: "Apply changes", align: "right", placement: "top" } }, [e3.isFile && e3.isPinnable && e3.isAppliable ? a3("span", { class: { "context-container__button": 1, "context-container__button--pending": !!e3.pendingState, "context-container__button--failure": "failure" === e3.pendingState, "context-container__button--success": "success" === e3.pendingState }, attrs: { "data-cy": "apply" }, on: { click: function(t5) { return t5.stopPropagation(), e3.onApply.apply(null, arguments); } } }, [a3("transition", { attrs: { name: "fade", mode: "out-in" } }, ["pending" === e3.pendingState ? a3("v-loader") : "success" === e3.pendingState ? a3("v-check-icon") : "failure" === e3.pendingState ? a3("v-close-icon") : a3("v-apply-icon")], 1)], 1) : e3._e()]), e3._v(" "), a3("v-popper", { attrs: { "time-to-display": 250, text: "Open", align: "right", placement: "top" } }), e3._v(" "), e3.isReference ? a3("span", { staticClass: "context-container__button", attrs: { "data-cy": "jump-to" }, on: { click: function(t5) { return t5.stopPropagation(), e3.onJumpTo.apply(null, arguments); @@ -359424,10 +359793,10 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; }), 0)]; }, proxy: true }], null, false, 3617847181) }) : e3._e()], 1)]), e3._v(" "), e3.collapsed ? e3._e() : a3("div", { ref: "body", staticClass: "context-container__body", attrs: { "data-cy": "context-container-body" } }, [e3._t("default")], 2)]); }, staticRenderFns: [] }, function(e3) { - e3 && e3("data-v-49e5dff3_0", { source: ".context-container[data-v-49e5dff3]{margin:1rem 0;border-radius:.5rem;background-color:rgba(0,0,0,.4);border:1px solid rgba(0,0,0,.1);line-height:1!important;position:relative;box-shadow:0 0 1rem 0 rgba(0,0,0,.33)}.context-container--collapsed .context-container__header[data-v-49e5dff3]{border-bottom:none;border-radius:.5rem}.context-container code[data-v-49e5dff3]{line-height:1.6}.context-container__header[data-v-49e5dff3]{display:flex;align-items:center;justify-content:space-between;background-color:rgba(0,0,0,.2);border-bottom:1px solid rgba(255,255,255,.1);border-radius:.5rem .5rem 0 0}.context-container__header--collapsable[data-v-49e5dff3]{cursor:pointer}.context-container__header--collapsable[data-v-49e5dff3]:hover{background-color:rgba(255,255,255,.1)}.context-container__header--collapsable .context-container__button[data-v-49e5dff3]:last-child{border-radius:0 .5rem .5rem 0}.context-container__title[data-v-49e5dff3]{display:inline-block;padding:.5rem 1rem;color:#e2e4e5;text-wrap:nowrap;text-overflow:ellipsis;overflow:hidden}.context-container__button-group[data-v-49e5dff3]{display:flex;justify-content:end;background-color:rgba(0,0,0,.1);position:relative}.context-container__button-group>:last-of-type .context-container__button[data-v-49e5dff3]{border-radius:0 .5rem 0 0}.context-container__button-group[data-v-49e5dff3] .popper__text{backdrop-filter:blur(12px);background-color:transparent;border-color:rgba(255,255,255,.2);border-bottom:0;border-radius:.5rem .5rem 0 0;padding:.25rem;margin-top:0}.context-container__button-group[data-v-49e5dff3] .popper__text:before{display:none}.context-container__button-group[data-v-49e5dff3]>:nth-child(1){border-left:1px solid rgba(0,0,0,.1)}.context-container__button[data-v-49e5dff3]{display:inline-block;padding:.5rem 1rem;color:#e2e4e5;cursor:pointer;transition:background-color .2s ease-in-out;user-select:none}.context-container__button--pending[data-v-49e5dff3]{width:16px;height:auto;cursor:initial}.context-container__button--pending[data-v-49e5dff3]:hover{background-color:transparent!important}.context-container__button--pending[data-v-49e5dff3]>.loader .dot{filter:drop-shadow(0 0 .25rem #fff);background-color:#e2e4e5!important}.context-container__button--failure svg path[data-v-49e5dff3]{fill:#fd3055!important}.context-container__button--success svg path[data-v-49e5dff3]{fill:#3bf804!important}.context-container__button svg[data-v-49e5dff3]{height:16px;width:16px;vertical-align:text-bottom}.context-container__button svg path[data-v-49e5dff3]{fill:#e2e4e5}.context-container__button--toggled[data-v-49e5dff3]{background-color:rgba(255,255,255,.25)}.context-container__button--toggled svg[data-v-49e5dff3]{transform:scale(1.1);filter:drop-shadow(2px 2px 2px rgba(0, 0, 0, .75))}.context-container__button--toggled svg path[data-v-49e5dff3]{fill:#fff}.context-container__button--toggled[data-v-49e5dff3]:hover{background-color:rgba(255,255,255,.5)!important}.context-container__button[data-v-49e5dff3]:hover{background-color:rgba(255,255,255,.25)}.context-container__button[data-v-49e5dff3]:active{background-color:#4362b1;transition:background-color 0s}.context-container__menu[data-v-49e5dff3]{background-color:rgba(0,0,0,.5);border-radius:0 0 0 .5rem;border:1px solid rgba(255,255,255,.1);border-top:1px solid rgba(0,0,0,.2);border-right:none;overflow:hidden;backdrop-filter:blur(10px)}.context-container__menu-item[data-v-49e5dff3]{padding:.5rem 1rem;cursor:pointer;transition:background-color .2s ease-in-out;user-select:none}.context-container__menu-item[data-v-49e5dff3]:hover{background-color:rgba(255,255,255,.25)}.context-container__menu-item[data-v-49e5dff3]:active{background-color:#4362b1;transition:background-color 0s}.context-container__menu-item--link[data-v-49e5dff3]{cursor:initial}.context-container__menu-item--link[data-v-49e5dff3]:hover{background-color:transparent}.context-container .fade-enter-active[data-v-49e5dff3],.context-container .fade-leave-active[data-v-49e5dff3]{transition:opacity .2s}.context-container .fade-enter[data-v-49e5dff3],.context-container .fade-leave-to[data-v-49e5dff3]{opacity:0}", map: void 0, media: void 0 }); - }, vue_runtime_default.extend({ components: { VPinIcon: Ii, VHamburgerMenuIcon: Ei, VCopyIcon: Lt, VExpandIcon: Vt, VPopperMenu: La, VJumpToIcon: yi, VApplyIcon: Ci, VLoader: vi, VCheckIcon: ui, VCloseIcon: Pt, VPopper: lt }, props: { title: String, contentType: { type: String, validator: (e3) => ["text", "image"].includes(e3), default: "text" }, menuItems: { type: Array, default: () => [] }, handle: { type: Number, required: false }, location: { type: String, required: false }, directory: { type: String, required: false }, isPinnable: { type: Boolean, default: true }, isAppliable: { type: Boolean, default: true } }, inject: { pinnedItems: { default: () => [] } }, data() { + e3 && e3("data-v-235e9473_0", { source: ".context-container[data-v-235e9473]{margin:1rem 0;border-radius:.5rem;background-color:rgba(0,0,0,.4);border:1px solid rgba(0,0,0,.1);line-height:1!important;position:relative;box-shadow:0 0 1rem 0 rgba(0,0,0,.33)}.context-container[is-reference] .context-container__button[data-v-235e9473]:last-of-type{border-radius:0 .5rem .5rem 0}.context-container--collapsed .context-container__header[data-v-235e9473]{border-bottom:none;border-radius:.5rem}.context-container code[data-v-235e9473]{line-height:1.6}.context-container__header[data-v-235e9473]{display:flex;align-items:center;justify-content:space-between;background-color:rgba(0,0,0,.2);border-bottom:1px solid rgba(255,255,255,.1);border-radius:.5rem .5rem 0 0}.context-container__header--collapsable[data-v-235e9473]{cursor:pointer}.context-container__header--collapsable[data-v-235e9473]:hover{background-color:rgba(255,255,255,.1)}.context-container__header--collapsable .context-container__button[data-v-235e9473]:last-child{border-radius:0 .5rem .5rem 0}.context-container__header--file .context-container__title[data-v-235e9473]{color:#3794ff;cursor:pointer}.context-container__header--file .context-container__title[data-v-235e9473]:hover{text-decoration:underline}.context-container__title[data-v-235e9473]{display:inline-block;padding:.5rem 1rem;color:#e2e4e5;text-wrap:nowrap;text-overflow:ellipsis;overflow:hidden;direction:rtl}.context-container__button-group[data-v-235e9473]{display:flex;justify-content:end;background-color:rgba(0,0,0,.1);position:relative}.context-container__button-group>:last-of-type .context-container__button[data-v-235e9473]{border-radius:0 .5rem 0 0}.context-container__button-group[data-v-235e9473] .popper__text{backdrop-filter:blur(12px);background-color:transparent;border-color:rgba(255,255,255,.2);border-bottom:0;border-radius:.5rem .5rem 0 0;padding:.25rem;margin-top:0}.context-container__button-group[data-v-235e9473] .popper__text:before{display:none}.context-container__button-group[data-v-235e9473]>:nth-child(1){border-left:1px solid rgba(0,0,0,.1)}.context-container__button[data-v-235e9473]{display:inline-block;padding:.5rem 1rem;color:#e2e4e5;cursor:pointer;transition:background-color .2s ease-in-out;user-select:none}.context-container__button--pending[data-v-235e9473]{width:16px;height:50%;cursor:initial}.context-container__button--pending[data-v-235e9473]:hover{background-color:transparent!important}.context-container__button--pending[data-v-235e9473]>.loader .dot{filter:drop-shadow(0 0 .25rem #fff);background-color:#e2e4e5!important}.context-container__button--failure svg path[data-v-235e9473]{fill:#fd3055!important}.context-container__button--success svg path[data-v-235e9473]{fill:#3bf804!important}.context-container__button svg[data-v-235e9473]{height:16px;width:16px;vertical-align:text-bottom;overflow:visible}.context-container__button svg path[data-v-235e9473]{fill:#e2e4e5}.context-container__button--toggled[data-v-235e9473]{background-color:rgba(255,255,255,.25)}.context-container__button--toggled svg[data-v-235e9473]{transform:scale(1.1);filter:drop-shadow(2px 2px 2px rgba(0, 0, 0, .75))}.context-container__button--toggled svg path[data-v-235e9473]{fill:#fff}.context-container__button--toggled[data-v-235e9473]:hover{background-color:rgba(255,255,255,.5)!important}.context-container__button[data-v-235e9473]:hover{background-color:rgba(255,255,255,.25)}.context-container__button[data-v-235e9473]:active{background-color:#4362b1;transition:background-color 0s}.context-container__menu[data-v-235e9473]{background-color:rgba(0,0,0,.5);border-radius:0 0 0 .5rem;border:1px solid rgba(255,255,255,.1);border-top:1px solid rgba(0,0,0,.2);border-right:none;overflow:hidden;backdrop-filter:blur(10px)}.context-container__menu-item[data-v-235e9473]{padding:.5rem 1rem;cursor:pointer;transition:background-color .2s ease-in-out;user-select:none}.context-container__menu-item[data-v-235e9473]:hover{background-color:rgba(255,255,255,.25)}.context-container__menu-item[data-v-235e9473]:active{background-color:#4362b1;transition:background-color 0s}.context-container__menu-item--link[data-v-235e9473]{cursor:initial}.context-container__menu-item--link[data-v-235e9473]:hover{background-color:transparent}.context-container .fade-enter-active[data-v-235e9473],.context-container .fade-leave-active[data-v-235e9473]{transition:opacity .2s}.context-container .fade-enter[data-v-235e9473],.context-container .fade-leave-to[data-v-235e9473]{opacity:0}", map: void 0, media: void 0 }); + }, vue_runtime_default.extend({ components: { VPinIcon: ki, VHamburgerMenuIcon: Ii, VCopyIcon: Lt, VExpandIcon: Vt, VPopperMenu: qa, VJumpToIcon: xi, VApplyIcon: yi, VLoader: Ai, VCheckIcon: fi, VCloseIcon: Yt, VPopper: lt }, props: { title: String, contentType: { type: String, validator: (e3) => ["text", "image"].includes(e3), default: "text" }, menuItems: { type: Array, default: () => [] }, handle: { type: Number, required: false }, location: { type: String, required: false }, directory: { type: String, required: false }, isPinnable: { type: Boolean, default: true }, isAppliable: { type: Boolean, default: true } }, inject: { pinnedItems: { default: () => [] } }, data() { const e3 = "number" == typeof this.handle && this.isAppliable; - return { isReference: e3, collapsed: e3 || !this.isPinnable, valueHandle: this.handle ?? ki(), pendingState: void 0 }; + return { isReference: e3, collapsed: e3 || !this.isPinnable, valueHandle: this.handle ?? Mi(), pendingState: void 0 }; }, computed: { pinned() { const { pinnedItems: e3 } = this; return !!e3 && e3.some(({ handle: e4 }) => e4 === this.valueHandle); @@ -359453,17 +359822,17 @@ ${this.actionSpec.elapsedTimeMs} ms` : ""}` : ""; this.pendingState = void 0; }, 2e3); })); - } } }), "data-v-49e5dff3", false, void 0, false, he, void 0, void 0); - var Mi = vue_runtime_default.extend({ props: { handle: { type: Number, required: false } } }); + } } }), "data-v-235e9473", false, void 0, false, he, void 0, void 0); + var Qi = vue_runtime_default.extend({ props: { handle: { type: Number, required: false } } }); es_default.registerAliases(["rake", "Gemfile"], { languageName: "ruby" }), es_default.registerAliases(["vue"], { languageName: "xml" }); - var Si = (e3) => e3.replace(/^\s*?", ...this.pinnedItems.map((e4) => ` @@ -360534,10 +360963,16 @@ ${e4} await Promise.all(i2).then((e4) => { e4.flat(1 / 0).forEach((e6) => { e6.file && !e6.uri ? e6.file.text().then((t5) => { - e6.content = t5, this.$root.$emit("fetch-pinned-files", [new un(e6)]); - }) : this.$root.$emit("fetch-pinned-files", [new un(e6)]); + e6.content = t5, this.$root.$emit("fetch-pinned-files", [new yn(e6)]); + }) : this.$root.$emit("fetch-pinned-files", [new yn(e6)]); }); }); + }, onMouseEnter() { + this.$refs.infoPopper.show(); + }, onMouseLeave() { + this.$refs.infoPopper.hide(); + }, addFiles() { + this.$root.$emit("choose-files-to-pin"); } }, async mounted() { this.$refs.vappmap && this.targetAppmap && this.targetAppmapFsPath && (this.includeAppMap(this.targetAppmapFsPath), await this.$refs.vappmap.loadData(this.targetAppmap)), this.loadNavieConfig(), this.loadMetadata(), this.$root.$on("pin", (e3) => { const t4 = this.pinnedItems.findIndex((t5) => t5.handle === e3.handle); @@ -360550,60 +360985,60 @@ ${e4} this.$refs.vchat.setInput(e3); }).$on("pin-files", (e3) => { e3.forEach((e4) => { - const t4 = new URL(e4.uri), a3 = decodeURIComponent(t4.pathname), i2 = { handle: ki(), pinned: true, type: "file", location: a3, content: e4.content }; + const t4 = new URL(e4.uri), a3 = decodeURIComponent(t4.pathname), i2 = { handle: Mi(), pinned: true, type: "file", location: a3, content: e4.content }; this.$root.$emit("pin", i2); }); }), this.$nextTick(() => { this.$root.$emit("chat-search-loaded"); }); - } }, "data-v-69542344", false, void 0, false, he, void 0, void 0); - var fn3 = { functional: true, render(e3, t4) { + } }, "data-v-f1e12b5c", false, void 0, false, he, void 0, void 0); + var kn = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ width: "32", height: "32", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M16.1 19.2c.672 0 1.008-.48 1.108-1.254.08-1.068.396-1.63 1.694-2.52 1.346-.95 2.098-2.18 2.098-3.972C21 8.804 19.16 7 16.476 7c-2.04 0-3.584.984-4.2 2.58-.187.436-.28.906-.276 1.38 0 .786.406 1.28 1.09 1.28.544 0 .91-.294 1.128-1.02.316-1.184 1.05-1.83 2.148-1.83 1.22 0 2.06.892 2.06 2.168 0 1.126-.416 1.77-1.644 2.65-1.238.866-1.852 1.828-1.852 3.28v.222c0 .856.416 1.49 1.17 1.49z", fill: "#808B98" } }), a3("path", { attrs: { d: "M20.546 5.026l-1.842-1.888 1.43-1.396 1.244 1.274 1.78-.022a5.78 5.78 0 015.848 5.848l-.02 1.78 1.272 1.244a5.778 5.778 0 010 8.268l-1.274 1.244.022 1.78a5.78 5.78 0 01-5.848 5.848l-1.78-.02-1.244 1.272a5.78 5.78 0 01-8.268 0l-1.244-1.274-1.78.022a5.78 5.78 0 01-5.848-5.848l.02-1.78-1.272-1.244a5.78 5.78 0 010-8.268l1.274-1.244-.022-1.78a5.78 5.78 0 015.848-5.848l1.78.02 1.244-1.272a5.779 5.779 0 018.268 0l-1.43 1.396a3.78 3.78 0 00-5.408 0l-1.84 1.888-2.64-.032a3.78 3.78 0 00-3.822 3.824l.032 2.636-1.888 1.842a3.78 3.78 0 000 5.408l1.888 1.84-.032 2.64a3.78 3.78 0 003.824 3.822l2.636-.032 1.842 1.888a3.78 3.78 0 005.408 0l1.84-1.888 2.64.032a3.78 3.78 0 003.822-3.824l-.032-2.636 1.888-1.842a3.78 3.78 0 000-5.408l-1.888-1.84.032-2.64a3.78 3.78 0 00-3.824-3.822l-2.636.032z", fill: "#808B98" } }), a3("path", { attrs: { d: "M14.002 22a2 2 0 114 0 2 2 0 01-4 0z", fill: "#808B98" } })])); } }; - var bn = { functional: true, render(e3, t4) { + var Bn = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ width: "18", height: "19", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M9 1.438a8.063 8.063 0 100 16.125A8.063 8.063 0 009 1.438zm-3.353 8.04a.563.563 0 00-.795.795l2.25 2.25a.563.563 0 00.795 0l5.25-5.25a.562.562 0 00-.795-.795L7.5 11.33 5.647 9.477z", fill: "#5C6997" } })])); } }; - var wn = de({ render: function() { + var Mn = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "language-button", attrs: { "data-cy": "language-button", "data-language": e3.language.toLowerCase() } }, [a3("div", { staticClass: "language-button__name" }, [e3._v(e3._s(e3.language))]), e3._v(" "), a3("div", { staticClass: "language-button__icon" }, [e3._t("default")], 2)]); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-1160cac6_0", { source: ".language-button[data-v-1160cac6]{display:flex;align-items:center;justify-content:center;flex-direction:column;width:fit-content;padding:.5rem 1rem;border-radius:.5rem;color:#fff;font-weight:700;cursor:pointer;border:1px solid rgba(255,255,255,.25);gap:.5rem}.language-button[data-v-1160cac6]:hover{background-color:rgba(255,255,255,.75);border-color:#fff;color:#000}.language-button:hover *>svg path[fill][data-v-1160cac6]{fill:#000}.language-button:hover *>svg path[stroke][data-v-1160cac6]{stroke:#000}.language-button__icon[data-v-1160cac6]{fill:currentColor}", map: void 0, media: void 0 }); }, vue_runtime_default.extend({ props: { language: String } }), "data-v-1160cac6", false, void 0, false, he, void 0, void 0); - var Cn = { functional: true, render(e3, t4) { + var Sn = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ width: "64", height: "65", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("g", { attrs: { "clip-path": "url(#clip0_2_148)" } }, [a3("path", { attrs: { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M23.444 50s-2.492 1.424 1.768 1.9c5.163.574 7.796.5 13.48-.563 0 0 1.5.925 3.586 1.725-12.742 5.362-28.842-.313-18.834-3.063zm-1.551-7.013s-2.785 2.025 1.475 2.462c5.507.563 9.868.6 17.397-.825 0 0 1.043 1.038 2.683 1.6-15.426 4.438-32.594.363-21.555-3.237zM35.017 31.1c3.14 3.55-.827 6.75-.827 6.75s7.974-4.05 4.311-9.113c-3.42-4.725-6.04-7.075 8.152-15.162.013 0-22.28 5.475-11.636 17.525zM51.88 55.174s1.844 1.488-2.022 2.65c-7.364 2.188-30.623 2.85-37.083.088-2.328-.988 2.034-2.375 3.408-2.663 1.424-.3 2.25-.25 2.25-.25-2.58-1.787-16.697 3.513-7.172 5.025 25.968 4.15 47.359-1.862 40.619-4.85zm-27.24-19.45s-11.84 2.763-4.197 3.763c3.23.425 9.665.325 15.655-.163 4.896-.4 9.817-1.274 9.817-1.274s-1.73.725-2.975 1.562c-12.018 3.112-35.227 1.663-28.55-1.513 5.659-2.674 10.25-2.374 10.25-2.374m21.237 11.662c12.221-6.238 6.562-12.237 2.62-11.425-.967.2-1.399.375-1.399.375s.356-.55 1.043-.788c7.795-2.7 13.798 7.95-2.518 12.163 0-.013.19-.175.254-.325zM38.501.5s6.766 6.65-6.422 16.875c-10.568 8.2-2.416 12.887 0 18.225-6.168-5.475-10.695-10.288-7.655-14.775C28.887 14.262 41.236 11.062 38.5.5zM25.848 64.3c11.725.737 29.732-.413 30.152-5.863 0 0-.814 2.062-9.69 3.712C36.3 64 23.953 63.787 16.64 62.6c0-.012 1.501 1.213 9.208 1.7z", fill: "#BCBFC5" } })]), a3("defs", [a3("clipPath", { attrs: { id: "clip0_2_148" } }, [a3("path", { attrs: { fill: "#fff", transform: "translate(0 .5)", d: "M0 0h64v64H0z" } })])])])); } }; - var En = { functional: true, render(e3, t4) { + var Qn = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ width: "64", height: "65", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M25.6 11.167h1.9M19.2 19.7V6.9a4.266 4.266 0 014.267-4.267h17.066A4.267 4.267 0 0144.8 6.9v21.333a4.266 4.266 0 01-4.267 4.267H23.467a4.266 4.266 0 00-4.267 4.267V58.1a4.267 4.267 0 004.267 4.267h17.066A4.267 4.267 0 0044.8 58.1V45.3M34.133 19.7H6.4a4.266 4.266 0 00-4.267 4.267V45.3A4.267 4.267 0 006.4 49.567h12.8M29.867 45.3H57.6a4.267 4.267 0 004.267-4.267V19.7a4.267 4.267 0 00-4.267-4.267H44.8m-8.3 38.4h1.9", stroke: "#C7CACF" } })])); } }; - var yn = { functional: true, render(e3, t4) { + var zn = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ width: "64", height: "65", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("g", { attrs: { "clip-path": "url(#clip0_2_20)" } }, [a3("path", { attrs: { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M35.444.5h-.21l-.149.149-17.133 17.133-.135-.01-.012.158-.375.375-.159.012.01.135L.15 35.585l-.149.15V64.5h64V.5H35.444zM18.33 18.84l.01-.01 24.71 1.901-22.819 22.82-1.9-24.71zm.894 25.717L1.016 36.334v26.432l18.208-18.209zM1.734 63.484l18.48-18.48 40.92 18.48h-59.4zm19.248-19.248l22.755-22.754 18.739 41.494-41.494-18.74zm23.522-23.522l18.48 40.92v-59.4l-18.48 18.48zM62.266 1.516H35.834l8.223 18.208L62.266 1.516zm-42.98 16.368l23.647 1.82L35.011 2.16 19.286 17.884zm-1.902 1.902L1.66 35.511l17.543 7.922-1.819-23.647z", fill: "#C7CACF" } })]), a3("defs", [a3("clipPath", { attrs: { id: "clip0_2_20" } }, [a3("path", { attrs: { fill: "#fff", transform: "translate(0 .5)", d: "M0 0h64v64H0z" } })])])])); } }; - var In = { functional: true, render(e3, t4) { + var jn = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ width: "64", height: "65", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M49.067 26.1v-.713a5.689 5.689 0 00-5.688-5.687H38.4a6.4 6.4 0 100 12.8h4.267a6.4 6.4 0 010 12.8H38.4a6.4 6.4 0 01-6.4-6.4m-8.533-21.333v22.46a8.534 8.534 0 01-4.72 7.633l-3.814 1.907M6.4 45.3V19.7L32 4.767 57.6 19.7v25.6L32 60.233 6.4 45.3z", stroke: "#C7CACF" } })])); } }; - var xn = { functional: true, render(e3, t4) { + var Dn = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("g", { attrs: { "clip-path": "url(#clip0_102_9)" } }, [a3("path", { attrs: { d: "M16.05 12.05L21 17l-4.95 4.95-1.414-1.414 2.536-2.537L4 18v-2h13.172l-2.536-2.536 1.414-1.414zm-8.1-10l1.414 1.414L6.828 6H20v2H6.828l2.536 2.536L7.95 11.95 3 7l4.95-4.95z", fill: "#fff" } })]), a3("defs", [a3("clipPath", { attrs: { id: "clip0_102_9" } }, [a3("path", { attrs: { fill: "#fff", d: "M0 0h24v24H0z" } })])])])); } }; - var kn = { functional: true, render(e3, t4) { + var Rn = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ fill: "#fff", xmlns: "http://www.w3.org/2000/svg", width: "25", height: "25", viewBox: "0 0 102.166 102.166" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M0 8.75h24.666v24.666H0zM77.5 68.75h24.666v24.666H77.5zM87.333 65.167h5V48.451h-2.499v-.017H15.583V37.1h-5v16.318h1.751v.016h74.999z" } })])); } }; - var Bn = { functional: true, render(e3, t4) { + var Pn = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 25 18", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M5 0h18v3H5zM0 5h18v3H0zM5 10h18v3H5zM0 15h18v3H0z" } })])); } }; - var Mn = { functional: true, render(e3, t4) { + var Yn2 = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 24 28", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M8.25 4.5H9v5.534a3.75 3.75 0 01-.51 1.89l-3.322 5.692A2.25 2.25 0 007.112 21h9.777a2.25 2.25 0 001.944-3.384l-3.323-5.691a3.75 3.75 0 01-.51-1.892V4.5h.75a.75.75 0 100-1.5h-7.5a.75.75 0 100 1.5zm2.25 5.534V4.5h3v5.534c0 .93.247 1.842.716 2.646l.48.82H9.304l.48-.82a5.25 5.25 0 00.715-2.646zM8.43 15h7.14l1.965 3.372a.75.75 0 01-.646 1.128H7.11a.75.75 0 01-.648-1.128L8.43 15z" } })])); } }; - var Sn = de({ render: function() { + var Fn = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "code-snippet", attrs: { "data-cy": "code-snippet" } }, [a3("div", { ref: "input", staticClass: "input code-snippet__input", attrs: { type: "text", role: "textbox" }, on: { click: e3.onInputFocus, copy: e3.onCopy } }, [e3.highlightedCode ? a3("pre", { staticClass: "code-snippet__line", domProps: { innerHTML: e3._s(e3.highlightedCode) } }) : e3._l(e3.textLines, function(t5, i2) { return a3("div", { key: i2, staticClass: "code-snippet__line" }, [e3._v("\n " + e3._s(t5) + "\n ")]); @@ -360625,7 +361060,7 @@ ${e4} const e3 = this.transformedText.trim(); this.$root.$emit("clipboard", e3); } } }, "data-v-2eab38e3", false, void 0, false, he, void 0, void 0); - var Qn = de({ render: function() { + var Hn = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { class: { "recording-method": true, "recording-method--unsupported": !e3.supported }, attrs: { "data-sort-score": e3.sortScore } }, [a3("div", { staticClass: "recording-method__header" }, [a3("div", { staticClass: "recording-method__title-wrapper" }, [a3("span", { staticClass: "recording-method__icon" }, [e3._t("icon")], 2), e3._v(" "), a3("h2", { staticClass: "recording-method__title" }, [e3._v(e3._s(e3.title))])])]), e3._v(" "), a3("div", { staticClass: "recording-method__content" }, [e3.supported ? e3._t("supported") : [a3("div", { staticClass: "recording-method__disabled-explanation" }, [e3._v("\n This project does not support " + e3._s(e3.titleLowercase || e3.title) + ".\n ")]), e3._v(" "), e3._t("unsupported")]], 2), e3._v(" "), a3("div", { staticClass: "recording-method__footer" }, [a3("a", { attrs: { href: e3.documentationUrl, target: "_blank" } }, [e3._v("\n Documentation "), a3("v-external-link-icon", { staticClass: "recording-method__external-link-icon" })], 1), e3._v(" "), e3.promptSuggestions ? a3("v-popper-menu", { ref: "promptSuggestionsMenu", attrs: { position: "top left" }, scopedSlots: e3._u([{ key: "icon", fn: function() { return [a3("v-button", { staticClass: "recording-method__ask-navie-button", attrs: { label: "Ask Navie", kind: "ghost", size: "small" }, on: { click: function(e4) { @@ -360640,14 +361075,14 @@ ${e4} }, proxy: true }], null, false, 2788306825) }) : e3._e()], 1)]); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-31c687bf_0", { source: ".recording-method[data-v-31c687bf]{border-radius:.5rem;background-color:rgba(0,0,0,.25);padding:0;box-shadow:0 0 1rem 0 rgba(0,0,0,.25);display:flex;flex-direction:column;justify-content:start;margin:0}.recording-method--unsupported[data-v-31c687bf]{color:#808b98}.recording-method--unsupported .recording-method__header path[data-v-31c687bf],.recording-method--unsupported .recording-method__header svg[data-v-31c687bf]{fill:#808b98}.recording-method__title-wrapper[data-v-31c687bf]{display:flex;gap:.5rem}.recording-method__header[data-v-31c687bf]{padding:1rem;display:flex;flex-wrap:wrap;align-items:center;gap:.5rem 1rem;background-color:rgba(0,0,0,.25);border-radius:.5rem .5rem 0 0;border-bottom:1px solid rgba(255,255,255,.1);flex-direction:column;align-items:flex-start}.recording-method__header h2[data-v-31c687bf]{margin:0}.recording-method__footer[data-v-31c687bf]{padding:1rem;display:flex;flex-wrap:wrap;align-items:center;gap:.5rem 1rem;background-color:rgba(0,0,0,.25);margin-top:auto;border-radius:0 0 .5rem .5rem;border-top:1px solid rgba(0,0,0,.1);justify-content:space-between}.recording-method__content[data-v-31c687bf]{padding:.25rem 1rem}.recording-method__content hr[data-v-31c687bf]{border:none;border-top:1px solid rgba(255,255,255,.1);border-bottom:1px solid rgba(0,0,0,.1)}.recording-method__ask-navie-button[data-v-31c687bf]{color:#c6c6c6;border-color:#c6c6c6}.recording-method__ask-navie-button[data-v-31c687bf]:hover{color:#000;border-color:#000;background-color:#c6c6c6}.recording-method__badge-block[data-v-31c687bf]{display:contents;margin-right:auto}.recording-method__icon[data-v-31c687bf]{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;border-radius:50%;background-color:rgba(0,0,0,.1);border:1px solid rgba(255,255,255,.1);color:#fff;font-size:1.5rem}.recording-method__icon svg[data-v-31c687bf]{width:1rem;height:1rem;fill:#e3e5e8}.recording-method__external-link-icon[data-v-31c687bf]{width:.64rem;height:.64rem;fill:#2a84ef}.recording-method a[data-v-31c687bf]:hover{text-decoration:underline}.recording-method a:hover svg[data-v-31c687bf]{transition:all .3s ease;fill:#e3e5e8;transform:scale(1.25)}.recording-method__title[data-v-31c687bf]{font-size:1.2rem;font-weight:700}.recording-method__ask-navie-button-list[data-v-31c687bf]{display:flex;flex-direction:column;gap:.5rem;overflow:hidden;background-color:#141924;border-radius:1rem;border:1px solid #2d3546}.recording-method__ask-navie-button-list__header[data-v-31c687bf]{display:flex;background-color:rgba(0,0,0,.25);border-bottom:1px solid rgba(255,255,255,.1);padding:.25rem 1rem}.recording-method__ask-navie-button-list__header h2[data-v-31c687bf]{margin:0!important}.recording-method__ask-navie-button-list__body[data-v-31c687bf]{display:flex;flex-direction:column;padding:.25rem 1rem;padding-bottom:1rem;gap:.25rem}.recording-method__disabled-explanation[data-v-31c687bf]{background-color:rgba(236,210,40,.1);border:1px solid rgba(236,210,40,.2);color:#b6af60;border-radius:.5rem;padding:.5rem;margin-top:.5rem}.recording-method__prompt-suggestion[data-v-31c687bf]{text-align:left;color:#c6c6c6;border-color:#c6c6c6}.recording-method__prompt-suggestion[data-v-31c687bf]:hover{color:#000;border-color:#000;background-color:#c6c6c6}", map: void 0, media: void 0 }); - }, vue_runtime_default.extend({ props: { title: { type: String, required: true }, titleLowercase: { type: String, required: false }, supported: { type: Boolean, default: true }, documentationUrl: { type: String, required: true }, defaultBehavior: { type: Boolean, default: false }, promptSuggestions: { type: Array, default: () => [] } }, components: { VExternalLinkIcon: ot, VPopperMenu: La, VButton: ue }, computed: { sortScore() { + }, vue_runtime_default.extend({ props: { title: { type: String, required: true }, titleLowercase: { type: String, required: false }, supported: { type: Boolean, default: true }, documentationUrl: { type: String, required: true }, defaultBehavior: { type: Boolean, default: false }, promptSuggestions: { type: Array, default: () => [] } }, components: { VExternalLinkIcon: ot, VPopperMenu: qa, VButton: ue }, computed: { sortScore() { return this.supported ? this.defaultBehavior ? 1 : 0 : -1; } }, methods: { onPromptSuggestionClick(e3) { this.$root.$emit("submit-to-navie", e3); const { promptSuggestionsMenu: t4 } = this.$refs; t4 instanceof vue_runtime_default && t4.close(); } } }), "data-v-31c687bf", false, void 0, false, he, void 0, void 0); - var zn = de({ render: function() { + var On = de({ render: function() { var e3 = this, t4 = e3.$createElement; return (e3._self._c || t4)("div", { staticClass: "recording-method-grid" }, [e3._t("default")], 2); }, staticRenderFns: [] }, function(e3) { @@ -360659,15 +361094,15 @@ ${e4} }, methods: { sortChildren() { [...this.$el.children].sort((e3, t4) => parseInt(t4.dataset.sortScore, 10) - parseInt(e3.dataset.sortScore, 10)).forEach((e3) => this.$el.appendChild(e3)); } } }, "data-v-d3e9611c", false, void 0, false, he, void 0, void 0); - var jn = (e3, t4, a3, i2, n2, ...s3) => { + var Tn = (e3, t4, a3, i2, n2, ...s3) => { const o2 = [`@help I'm using the AppMap agent for ${e3}.`]; return t4 && o2.push(i2 ? `My web framework is ${i2}.` : "My project doesn't use a supported web framework."), a3 && o2.push(n2 ? `My test framework is ${n2}.` : "My project doesn't use a supported test framework."), o2.push(...s3), o2.filter(Boolean).join(" "); }; - function Dn(e3, t4, a3, i2) { + function Ln(e3, t4, a3, i2) { const n2 = "vscode" === t4 ? "Visual Studio Code" : "JetBrains"; - return { httpRequest: [{ label: "How do I record a HTTP request?", prompt: jn(e3, true, false, a3, i2, "How do I record HTTP requests to my application?") }, { label: "What is HTTP request recording?", prompt: jn(e3, true, false, a3, i2, "What is HTTP request recording?") }, { label: "What frameworks support HTTP request recording?", prompt: jn(e3, true, false, a3, i2, `What web frameworks support HTTP request recording in ${e3}?`) }], process: [{ label: "How do I start a process recording?", prompt: jn(e3, false, false, a3, i2, "How do I start a process recording to record my entire applications behavior from start to finish? Do not explain other recording methods.") }, { label: "What is a process recording?", prompt: jn(e3, false, false, a3, i2, "What is a process recording?") }, { label: "When should I use process recording?", prompt: jn(e3, false, false, a3, i2, `What kinds of ${e3} applications benefit from process recording?`) }], remote: [{ label: "How do I start a remote recording?", prompt: jn(e3, true, false, a3, i2, `How do I start a remote recording in ${n2}?`) }, { label: "How do I stop a remote recording?", prompt: jn(e3, true, false, a3, i2, `How do I stop a remote recording in ${n2}?`) }, { label: "What is a remote recording?", prompt: jn(e3, true, false, a3, i2, "What is a remote recording?") }, { label: "What frameworks support remote recording?", prompt: jn(e3, true, false, a3, i2, `What web frameworks support remote recording in ${e3}?`) }, { label: "When whould I need remote recording?", prompt: jn(e3, true, false, a3, i2, "When would I need to use remote recording?") }], test: [{ label: "How do I record my tests?", prompt: jn(e3, false, true, a3, i2, "How do I record my tests?") }, { label: "What is a test recording?", prompt: jn(e3, false, true, a3, i2, "What is a test recording?") }, { label: "What testing frameworks can I record with?", prompt: jn(e3, false, true, a3, i2, `What testing frameworks are supported for ${e3}?`) }, { label: "Why should I record my tests?", prompt: jn(e3, false, true, a3, i2, "What is the benefit of recording tests and how does additional AppMap data help Navie understand my application?") }], codeBlock: [{ label: "How do I record a code block?", prompt: jn(e3, false, false, a3, i2, "How do I record a code block?") }, { label: "What is a code block recording?", prompt: jn(e3, false, false, a3, i2, "What is a code block recording?") }, { label: "When would I use a code block recording?", prompt: jn(e3, false, false, a3, i2, "When would I need to use a code block recording to record parts of my application?") }] }; + return { httpRequest: [{ label: "How do I record a HTTP request?", prompt: Tn(e3, true, false, a3, i2, "How do I record HTTP requests to my application?") }, { label: "What is HTTP request recording?", prompt: Tn(e3, true, false, a3, i2, "What is HTTP request recording?") }, { label: "What frameworks support HTTP request recording?", prompt: Tn(e3, true, false, a3, i2, `What web frameworks support HTTP request recording in ${e3}?`) }], process: [{ label: "How do I start a process recording?", prompt: Tn(e3, false, false, a3, i2, "How do I start a process recording to record my entire applications behavior from start to finish? Do not explain other recording methods.") }, { label: "What is a process recording?", prompt: Tn(e3, false, false, a3, i2, "What is a process recording?") }, { label: "When should I use process recording?", prompt: Tn(e3, false, false, a3, i2, `What kinds of ${e3} applications benefit from process recording?`) }], remote: [{ label: "How do I start a remote recording?", prompt: Tn(e3, true, false, a3, i2, `How do I start a remote recording in ${n2}?`) }, { label: "How do I stop a remote recording?", prompt: Tn(e3, true, false, a3, i2, `How do I stop a remote recording in ${n2}?`) }, { label: "What is a remote recording?", prompt: Tn(e3, true, false, a3, i2, "What is a remote recording?") }, { label: "What frameworks support remote recording?", prompt: Tn(e3, true, false, a3, i2, `What web frameworks support remote recording in ${e3}?`) }, { label: "When whould I need remote recording?", prompt: Tn(e3, true, false, a3, i2, "When would I need to use remote recording?") }], test: [{ label: "How do I record my tests?", prompt: Tn(e3, false, true, a3, i2, "How do I record my tests?") }, { label: "What is a test recording?", prompt: Tn(e3, false, true, a3, i2, "What is a test recording?") }, { label: "What testing frameworks can I record with?", prompt: Tn(e3, false, true, a3, i2, `What testing frameworks are supported for ${e3}?`) }, { label: "Why should I record my tests?", prompt: Tn(e3, false, true, a3, i2, "What is the benefit of recording tests and how does additional AppMap data help Navie understand my application?") }], codeBlock: [{ label: "How do I record a code block?", prompt: Tn(e3, false, false, a3, i2, "How do I record a code block?") }, { label: "What is a code block recording?", prompt: Tn(e3, false, false, a3, i2, "What is a code block recording?") }, { label: "When would I use a code block recording?", prompt: Tn(e3, false, false, a3, i2, "When would I need to use a code block recording to record parts of my application?") }] }; } - var Rn = de({ render: function() { + var Un = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("section", [e3._m(0), e3._v(" "), e3._m(1), e3._v(" "), a3("h3", [e3._v("Choose an option")]), e3._v(" "), a3("p", [e3._v("\n Depending on your application, you may choose one of the following options for recording\n AppMap traces.\n ")]), e3._v(" "), a3("v-recording-method-grid", [a3("v-recording-method", { attrs: { title: "Record HTTP requests", "documentation-url": "https://appmap.io/docs/reference/appmap-ruby.html#requests-recording", supported: true, "default-behavior": true, "prompt-suggestions": e3.promptSuggestions.httpRequest }, scopedSlots: e3._u([{ key: "icon", fn: function() { return [a3("RequestsIcon")]; @@ -360698,16 +361133,16 @@ ${e4} }, function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("p", [e3._v("\n Before you run your app with AppMap, stop or disable Spring. You can stop Spring with the\n command "), a3("code", { staticClass: "inline" }, [e3._v("spring stop")]), e3._v(", or you can run your Ruby program with the\n environment variable "), a3("code", { staticClass: "inline" }, [e3._v("DISABLE_SPRING=true")]), e3._v(".\n ")]); - }] }, void 0, { name: "RubyRecordingInstructions", components: { VCodeSnippet: Sn, TestsIcon: Mn, RequestsIcon: xn, CodeBlockIcon: Bn, VRecordingMethod: Qn, VRecordingMethodGrid: zn, RemoteRecordingIcon: kn }, props: { webFramework: Object, testFramework: Object, theme: String, complete: Boolean, editor: String }, data() { - return { promptSuggestions: Dn("Ruby", this.editor, this.webFramework?.name, this.testFramework?.name) }; + }] }, void 0, { name: "RubyRecordingInstructions", components: { VCodeSnippet: Fn, TestsIcon: Yn2, RequestsIcon: Dn, CodeBlockIcon: Pn, VRecordingMethod: Hn, VRecordingMethodGrid: On, RemoteRecordingIcon: Rn }, props: { webFramework: Object, testFramework: Object, theme: String, complete: Boolean, editor: String }, data() { + return { promptSuggestions: Ln("Ruby", this.editor, this.webFramework?.name, this.testFramework?.name) }; }, computed: { codeSnippetType() { return this.complete ? "ghost" : "primary"; } } }, void 0, false, void 0, false, void 0, void 0, void 0); - var Yn2 = { functional: true, render(e3, t4) { + var qn = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("path", { attrs: { d: "M3 6.75A3.75 3.75 0 016.75 3h10.5A3.75 3.75 0 0121 6.75v10.5A3.75 3.75 0 0117.25 21H6.75A3.75 3.75 0 013 17.25V6.75zM4.5 9v8.25a2.25 2.25 0 002.25 2.25h10.5a2.25 2.25 0 002.25-2.25V9h-15z" } })])); } }; - var Pn = de({ render: function() { + var Kn = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("section", [e3._m(0), e3._v(" "), a3("v-code-snippet", { attrs: { "clipboard-text": "appmap-python ", "show-copy": false } }), e3._v(" "), a3("h3", [e3._v("Choose an option")]), e3._v(" "), a3("p", [e3._v("The following recording methods are available to Python applications.")]), e3._v(" "), a3("v-recording-method-grid", [a3("v-recording-method", { attrs: { title: "Record HTTP requests", "documentation-url": "https://appmap.io/docs/reference/appmap-python.html#request-recording", supported: true, "default-behavior": true, "prompt-suggestions": e3.promptSuggestions.httpRequest }, scopedSlots: e3._u([{ key: "icon", fn: function() { return [a3("RequestsIcon")]; @@ -360741,10 +361176,10 @@ ${e4} return a3("p", [e3._v("\n To record your Python application with AppMap, run your application using the\n "), a3("code", { staticClass: "inline" }, [e3._v("appmap-python")]), e3._v(" command.\n ")]); }] }, function(e3) { e3 && e3("data-v-31d4a806_0", { source: "code[data-v-31d4a806]{line-height:1;padding:1rem;padding-bottom:.75rem;background-color:rgba(0,0,0,.35);max-width:unset}", map: void 0, media: void 0 }); - }, { name: "PythonRecordingInstructions", components: { VCodeSnippet: Sn, RequestsIcon: xn, RemoteRecordingIcon: kn, CodeBlockIcon: Bn, TestsIcon: Mn, ProcessIcon: Yn2, VRecordingMethod: Qn, VRecordingMethodGrid: zn }, props: { webFramework: Object, testFramework: Object, theme: String, complete: Boolean, editor: String }, data() { - return { promptSuggestions: Dn("Python", this.editor, this.webFramework?.name, this.testFramework?.name) }; + }, { name: "PythonRecordingInstructions", components: { VCodeSnippet: Fn, RequestsIcon: Dn, RemoteRecordingIcon: Rn, CodeBlockIcon: Pn, TestsIcon: Yn2, ProcessIcon: qn, VRecordingMethod: Hn, VRecordingMethodGrid: On }, props: { webFramework: Object, testFramework: Object, theme: String, complete: Boolean, editor: String }, data() { + return { promptSuggestions: Ln("Python", this.editor, this.webFramework?.name, this.testFramework?.name) }; } }, "data-v-31d4a806", false, void 0, false, he, void 0, void 0); - var Fn = de({ render: function() { + var Nn = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("section", [e3._m(0), e3._v(" "), a3("h3", [e3._v("Choose an option")]), e3._v(" "), a3("p", [e3._v("\n Depending on your application, you may choose one of the following options for recording\n AppMap traces.\n ")]), e3._v(" "), a3("v-recording-method-grid", [a3("v-recording-method", { attrs: { title: "Record HTTP requests", "documentation-url": "https://appmap.io/docs/reference/appmap-java.html#requests-recording", supported: true, "default-behavior": true, "prompt-suggestions": e3.promptSuggestions.httpRequest }, scopedSlots: e3._u([{ key: "icon", fn: function() { return [a3("RequestsIcon")]; @@ -360778,18 +361213,18 @@ ${e4} return a3("p", [e3._v("\n Ensure that your application runs with the JVM option\n "), a3("code", { staticClass: "inline" }, [e3._v("-javaagent:~/.appmap/lib/java/appmap.jar")]), e3._v(". This option is required\n to record AppMap trace data.\n ")]); }] }, function(e3) { e3 && e3("data-v-43ab0588_0", { source: ".vscode-screenshot[data-v-43ab0588]{text-align:center;max-width:100%;padding:1rem;border-radius:10px;background-color:#343e5a}", map: void 0, media: void 0 }); - }, { name: "JavaRecordInstructions", props: { editor: String }, components: { ProcessIcon: Yn2, RemoteRecordingIcon: kn, RequestsIcon: xn, CodeBlockIcon: Bn, TestsIcon: Mn, VRecordingMethod: Qn, VRecordingMethodGrid: zn }, data() { - return { webFramework: void 0, testFramework: void 0, promptSuggestions: Dn("Java", this.editor, this.webFramework?.name, this.testFramework?.name) }; + }, { name: "JavaRecordInstructions", props: { editor: String }, components: { ProcessIcon: qn, RemoteRecordingIcon: Rn, RequestsIcon: Dn, CodeBlockIcon: Pn, TestsIcon: Yn2, VRecordingMethod: Hn, VRecordingMethodGrid: On }, data() { + return { webFramework: void 0, testFramework: void 0, promptSuggestions: Ln("Java", this.editor, this.webFramework?.name, this.testFramework?.name) }; }, methods: { onSelectWebFramework(e3) { this.webFramework = "Other" === e3 ? void 0 : e3; }, onSelectTestFramework(e3) { this.testFramework = "Other" === e3 ? void 0 : e3; } } }, "data-v-43ab0588", false, void 0, false, he, void 0, void 0); - var Hn = { functional: true, render(e3, t4) { + var Gn = { functional: true, render(e3, t4) { const { _c: a3, _v: i2, data: n2, children: s3 = [] } = t4, { class: o2, staticClass: r2, style: c5, staticStyle: l2, attrs: d2 = {}, ...p3 } = n2; return a3("svg", { class: [o2, r2], style: [c5, l2], attrs: Object.assign({ viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d2), ...p3 }, s3.concat([a3("g", { attrs: { "clip-path": "url(#clip0_168_1364)" } }, [a3("path", { attrs: { d: "M8 15A7 7 0 108 1a7 7 0 000 14z", fill: "#E13ECB" } }), a3("path", { attrs: { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M8.2 3.71l-.207-.409-.198.413-.35.726-3.133 6.587-.153.323h1.314l.06-.134.389-.865v-.001l.396-.86.001-.004 1.04-2.355.633-1.322 1.663 3.679v.002l.195.42.61 1.31.06.13h1.317l-.153-.323-.999-2.114L8.57 4.44l-.002-.005L8.2 3.71z", fill: "#fff" } })]), a3("defs", [a3("clipPath", { attrs: { id: "clip0_168_1364" } }, [a3("path", { attrs: { fill: "#fff", transform: "translate(1 1)", d: "M0 0h14v14H0z" } })])])])); } }; - var Tn = de({ render: function() { + var Jn = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("section", [a3("p", [e3._v("\n Use the "), a3(e3.runConfigIcon, { tag: "component", staticClass: "run-config-icon" }), e3._v(' "Start with AppMap" option\n from the "Run" menu to start your run configurations with AppMap enabled.\n ')], 1), e3._v(" "), e3._m(0), e3._v(" "), a3("h3", [e3._v("Choose an option")]), e3._v(" "), a3("p", [e3._v("\n Depending on your application, you may choose one of the following options for recording\n AppMap traces.\n ")]), e3._v(" "), a3("v-recording-method-grid", [a3("v-recording-method", { attrs: { title: "Record HTTP requests", "documentation-url": "https://appmap.io/docs/reference/appmap-java.html#requests-recording", supported: true, "default-behavior": true, "prompt-suggestions": e3.promptSuggestions.httpRequest }, scopedSlots: e3._u([{ key: "icon", fn: function() { return [a3("RequestsIcon")]; @@ -360823,12 +361258,12 @@ ${e4} return a3("p", [e3._v('\n Using "Start with AppMap" ensures that your Java code runs with the JVM option\n '), a3("code", { staticClass: "inline" }, [e3._v("-javaagent:~/.appmap/lib/java/appmap.jar")]), e3._v(". This option is required\n to enable AppMap recording.\n ")]); }] }, function(e3) { e3 && e3("data-v-6ba19e32_0", { source: ".run-config-icon[data-v-6ba19e32]{width:22px;transform:translateY(25%)}", map: void 0, media: void 0 }); - }, { name: "IntelliJ", props: { webFramework: Object, testFramework: Object, theme: String }, components: { VRunConfigDark: an, VRunConfigLight: Hn, RequestsIcon: xn, RemoteRecordingIcon: kn, CodeBlockIcon: Bn, TestsIcon: Mn, ProcessIcon: Yn2, VRecordingMethod: Qn, VRecordingMethodGrid: zn }, data() { - return { promptSuggestions: Dn("Java", this.editor, this.webFramework?.name, this.testFramework?.name) }; + }, { name: "IntelliJ", props: { webFramework: Object, testFramework: Object, theme: String }, components: { VRunConfigDark: rn, VRunConfigLight: Gn, RequestsIcon: Dn, RemoteRecordingIcon: Rn, CodeBlockIcon: Pn, TestsIcon: Yn2, ProcessIcon: qn, VRecordingMethod: Hn, VRecordingMethodGrid: On }, data() { + return { promptSuggestions: Ln("Java", this.editor, this.webFramework?.name, this.testFramework?.name) }; }, computed: { runConfigIcon() { - return "dark" === this.theme ? an : Hn; + return "dark" === this.theme ? rn : Gn; } } }, "data-v-6ba19e32", false, void 0, false, he, void 0, void 0); - var On = de({ render: function() { + var Vn = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("section", [e3._m(0), e3._v(" "), a3("v-code-snippet", { attrs: { "clipboard-text": "npx appmap-node ", "show-copy": false } }), e3._v(" "), a3("h3", [e3._v("Choose an option")]), e3._v(" "), a3("p", [e3._v("\n Depending on your application, you may choose one of the following options for recording\n AppMap traces.\n ")]), e3._v(" "), a3("v-recording-method-grid", [a3("v-recording-method", { attrs: { title: "Record HTTP requests", "documentation-url": "https://appmap.io/docs/reference/appmap-node.html#request-recording", supported: true, "default-behavior": true, "prompt-suggestions": e3.promptSuggestions.httpRequest }, scopedSlots: e3._u([{ key: "icon", fn: function() { return [a3("RequestsIcon")]; @@ -360858,10 +361293,10 @@ ${e4} return a3("p", [e3._v("\n To record your application with AppMap, run your application using the\n "), a3("code", { staticClass: "inline" }, [e3._v("appmap-node")]), e3._v(" command.\n ")]); }] }, function(e3) { e3 && e3("data-v-5310215c_0", { source: "code[data-v-5310215c]{line-height:1;padding:1rem;padding-bottom:.75rem;background-color:rgba(0,0,0,.35)}", map: void 0, media: void 0 }); - }, vue_runtime_default.extend({ components: { TestsIcon: Mn, RequestsIcon: xn, RemoteRecordingIcon: kn, ProcessIcon: Yn2, VRecordingMethod: Qn, VRecordingMethodGrid: zn, VCodeSnippet: Sn }, props: { webFramework: Object, testFramework: Object, theme: String, complete: Boolean, editor: String }, data() { - return { promptSuggestions: Dn("Node.js", this.editor, this.webFramework?.name, this.testFramework?.name) }; + }, vue_runtime_default.extend({ components: { TestsIcon: Yn2, RequestsIcon: Dn, RemoteRecordingIcon: Rn, ProcessIcon: qn, VRecordingMethod: Hn, VRecordingMethodGrid: On, VCodeSnippet: Fn }, props: { webFramework: Object, testFramework: Object, theme: String, complete: Boolean, editor: String }, data() { + return { promptSuggestions: Ln("Node.js", this.editor, this.webFramework?.name, this.testFramework?.name) }; } }), "data-v-5310215c", false, void 0, false, he, void 0, void 0); - var Ln = de({ render: function() { + var Zn2 = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "tabbed-content" }, [a3("div", { staticClass: "tabbed-content__tabs" }, e3._l(e3.tabNames, function(t5, i2) { return a3("div", { key: t5, class: { "tabbed-content__tab": 1, "tabbed-content__tab--selected": e3.selectedTab === i2 }, on: { click: function(t6) { @@ -360877,17 +361312,17 @@ ${e4} } }, async updated() { this.justUpdated || (this.$set(this, "tabNames", Object.keys(this.$slots)), this.justUpdated = true, await this.$nextTick(), this.justUpdated = false); } }), "data-v-0ee2ac2a", false, void 0, false, he, void 0, void 0); - var Un = de({ render: function() { + var Wn = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("v-tab-content", { on: { "select-tab": e3.onSelectTab }, scopedSlots: e3._u([e3._l(e3.commands, function(e4, t5) { return { key: e4.name, fn: function() { return [a3("v-code-snippet", { key: t5, attrs: { language: "shell", "clipboard-text": e4.command } })]; }, proxy: true }; })], null, true) }); - }, staticRenderFns: [] }, void 0, vue_runtime_default.extend({ components: { VTabContent: Ln, VCodeSnippet: Sn }, props: { commands: { type: Array, default: () => [] } }, data: () => ({ selectedTab: 0 }), methods: { onSelectTab(e3, t4) { + }, staticRenderFns: [] }, void 0, vue_runtime_default.extend({ components: { VTabContent: Zn2, VCodeSnippet: Fn }, props: { commands: { type: Array, default: () => [] } }, data: () => ({ selectedTab: 0 }), methods: { onSelectTab(e3, t4) { this.$emit("select-tab", e3, t4); } } }), "data-v-75d019f8", false, void 0, false, void 0, void 0, void 0); - var qn = de({ render: function() { + var Xn2 = de({ render: function() { var e3 = this, t4 = e3.$createElement; return (e3._self._c || t4)("div", { class: e3.classes }, [e3._t("default")], 2); }, staticRenderFns: [] }, function(e3) { @@ -360895,13 +361330,13 @@ ${e4} }, { name: "FlashMessage", props: { type: { type: String, default: "info", validator: (e3) => ["success", "error", "info"].includes(e3) } }, computed: { classes() { return { flash: true, [`flash--${this.type}`]: true }; } } }, "data-v-0f6c9a04", false, void 0, false, he, void 0, void 0); - var Kn = de({ render: function() { + var _n = de({ render: function() { var e3 = this, t4 = e3.$createElement; return (e3._self._c || t4)("div", { staticClass: "spinner" }, [e3._t("default")], 2); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-3e9a4015_0", { source: ".spinner[data-v-3e9a4015]{display:flex;place-self:center;line-height:0;animation:spin-data-v-3e9a4015 4s linear infinite}@keyframes spin-data-v-3e9a4015{from{transform:rotate(0)}to{transform:rotate(360deg)}}", map: void 0, media: void 0 }); }, { name: "SpinnerAnimation" }, "data-v-3e9a4015", false, void 0, false, he, void 0, void 0); - var Nn = de({ render: function() { + var $n = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", { staticClass: "java-status" }, [a3("div", { attrs: { "data-cy": "status-debug-config", "data-status": e3.debugConfigurationStatus } }, ["success" === e3.debugConfigurationStatus ? [a3("v-flash-message", { attrs: { type: "info" } }, [a3("span", { staticClass: "split" }, [a3("v-success-icon", { staticClass: "status-icon" }), e3._v(" "), a3("span", [e3._v("Test and debug configurations have been added to " + e3._s(e3.projectName) + ".")])], 1)])] : "pending" === e3.debugConfigurationStatus ? [a3("v-flash-message", { attrs: { type: "info" } }, [a3("span", { staticClass: "split" }, [a3("v-spinner", [a3("v-loader-icon", { staticClass: "status-icon" })], 1), e3._v(" "), a3("span", [e3._v("Test and debug configurations are being added to " + e3._s(e3.projectName) + ".")])], 1)])] : "failure" === e3.debugConfigurationStatus ? [a3("v-flash-message", { attrs: { type: "error" } }, [a3("span", { staticClass: "split" }, [a3("v-failure-icon", { staticClass: "status-icon status-icon--failure" }), e3._v(" "), a3("span", [e3._v("\n Test and debug configurations couldn't be located for " + e3._s(e3.projectName) + ". To try adding\n them again,\n "), a3("a", { attrs: { href: "#", "data-cy": "add-java-configs" }, on: { click: function(t5) { return t5.stopPropagation(), t5.preventDefault(), e3.$root.$emit("add-java-configs", e3.projectPath); @@ -360910,7 +361345,7 @@ ${e4} } } }, [e3._v("\n Add them now\n ")])], 1)])] : e3._e()], 2)]); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-7caa48c5_0", { source: ".java-status[data-v-7caa48c5]{margin-bottom:1rem;display:flex;flex-direction:column;width:100%}.java-status .status-icon[data-v-7caa48c5]{display:flex;width:18px;height:18px;margin:-4px .5em -4px .5em;transform-origin:center}.java-status .status-icon path[data-v-7caa48c5]{fill:#768ecb}.java-status .status-icon--failure path[data-v-7caa48c5]{fill:#fd3055}.java-status .split[data-v-7caa48c5]{display:grid;grid-template-columns:24px 1fr auto;gap:1rem;align-items:center}.java-status .button[data-v-7caa48c5]{border-color:#768ecb;color:#768ecb;margin-left:auto}.java-status .button[data-v-7caa48c5]:hover{background-color:rgba(255,255,255,.75);border-color:#fff;color:#000}", map: void 0, media: void 0 }); - }, vue_runtime_default.extend({ components: { VFlashMessage: qn, VSpinner: Kn, VLoaderIcon: ce, VFailureIcon: Rt, VSuccessIcon: Ya, VButton: ue }, props: { projectName: String, projectPath: String, enumDebugConfigurationStatus: { type: Number, default: void 0 } }, computed: { hasDebugConfigurationStatus() { + }, vue_runtime_default.extend({ components: { VFlashMessage: Xn2, VSpinner: _n, VLoaderIcon: ce, VFailureIcon: Rt, VSuccessIcon: Ya, VButton: ue }, props: { projectName: String, projectPath: String, enumDebugConfigurationStatus: { type: Number, default: void 0 } }, computed: { hasDebugConfigurationStatus() { return void 0 !== this.enumDebugConfigurationStatus; }, debugConfigurationStatus() { switch (this.enumDebugConfigurationStatus) { @@ -360924,16 +361359,16 @@ ${e4} return "requesting"; } } } }), "data-v-7caa48c5", false, void 0, false, he, void 0, void 0); - var Gn = { python: [{ name: "pip", command: "pip install --require-virtualenv appmap" }, { name: "pipenv", command: "pipenv install --dev appmap" }, { name: "poetry", command: "poetry add --dev appmap" }], "node.js": [{ name: "npm", command: "npm i --save-dev appmap-node" }, { name: "yarn", command: "yarn add -D appmap-node" }, { name: "pnpm", command: "pnpm add -D appmap-node" }] }; - var Jn = vue_runtime_default.extend({ components: { VAccordion: bi, VCheckIcon: bn, VLanguageButton: wn, VJavaIcon: Cn, VPythonIcon: En, VRubyIcon: yn, VNodeIcon: In, VRubyRecordInstructions: Rn, VPythonRecordInstructions: Pn, VJavaRecordInstructions: Fn, VNodeRecordInstructions: On, VIntellijJavaRecordInstructions: Tn, VCommandPicker: Un, VButton: ue, VCodeSnippet: Sn, VJavaStatus: Nn }, props: { description: String, projects: { type: Array, default: () => [] }, editor: String }, watch: { projects(e3) { + var es = { python: [{ name: "pip", command: "pip install --require-virtualenv appmap" }, { name: "pipenv", command: "pipenv install --dev appmap" }, { name: "poetry", command: "poetry add --dev appmap" }], "node.js": [{ name: "npm", command: "npm i --save-dev appmap-node" }, { name: "yarn", command: "yarn add -D appmap-node" }, { name: "pnpm", command: "pnpm add -D appmap-node" }] }; + var ts = vue_runtime_default.extend({ components: { VAccordion: Ci, VCheckIcon: Bn, VLanguageButton: Mn, VJavaIcon: Sn, VPythonIcon: Qn, VRubyIcon: zn, VNodeIcon: jn, VRubyRecordInstructions: Un, VPythonRecordInstructions: Kn, VJavaRecordInstructions: Nn, VNodeRecordInstructions: Vn, VIntellijJavaRecordInstructions: Jn, VCommandPicker: Wn, VButton: ue, VCodeSnippet: Fn, VJavaStatus: $n }, props: { description: String, projects: { type: Array, default: () => [] }, editor: String }, watch: { projects(e3) { if (!this.selectedProject) return; const t4 = e3.find((e4) => e4.path === this.selectedProject?.path); this.selectedProject = t4; - } }, data: () => ({ openSection: "project", selectedProject: void 0, selectedLanguageName: void 0, languages: { Java: Cn, Python: En, Ruby: yn, "Node.js": In }, javaLaunchConfigurationSnippet: '{\n "version": "0.2.0",\n "configurations": [\n {\n "type": "java",\n "name": "Run with AppMap",\n "request": "launch",\n "mainClass": "",\n "vmArgs": "-javaagent:${userHome}/.appmap/lib/java/appmap.jar"\n }\n ]\n}\n', javaTestConfigurationSnippet: '{\n "java.test.config": [\n {\n "name": "Test with AppMap",\n "vmArgs": [\n "-javaagent:${userHome}/.appmap/lib/java/appmap.jar",\n "-Dappmap.output.directory=${command:appmap.getAppmapDir}"\n ]\n }\n ]\n}' }), computed: { selectedLanguage() { + } }, data: () => ({ openSection: "project", selectedProject: void 0, selectedLanguageName: void 0, languages: { Java: Sn, Python: Qn, Ruby: zn, "Node.js": jn }, javaLaunchConfigurationSnippet: '{\n "version": "0.2.0",\n "configurations": [\n {\n "type": "java",\n "name": "Run with AppMap",\n "request": "launch",\n "mainClass": "",\n "vmArgs": "-javaagent:${userHome}/.appmap/lib/java/appmap.jar"\n }\n ]\n}\n', javaTestConfigurationSnippet: '{\n "java.test.config": [\n {\n "name": "Test with AppMap",\n "vmArgs": [\n "-javaagent:${userHome}/.appmap/lib/java/appmap.jar",\n "-Dappmap.output.directory=${command:appmap.getAppmapDir}"\n ]\n }\n ]\n}' }), computed: { selectedLanguage() { return this.selectedLanguageName?.toLowerCase(); }, commands() { const e3 = this.selectedLanguageName?.toLowerCase(); - return e3 ? Gn[e3] : []; + return e3 ? es[e3] : []; }, projectName() { return this.selectedProject?.name; }, projectPath() { @@ -360960,12 +361395,12 @@ ${e4} } }, mounted() { 1 === this.projects.length && this.onSelectProject(this.projects[0]); } }); - var Vn = de({ render: function() { + var as = de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("QuickstartLayout", [a3("section", { staticClass: "project-picker" }, [a3("header", { staticClass: "content content--header" }, [a3("h1", { attrs: { "data-cy": "title" } }, [e3._v("Recording AppMap data")])]), e3._v(" "), a3("main", [0 === e3.projects.length ? a3("article", { staticClass: "empty-state", attrs: { "data-cy": "empty-state-article" } }, [a3("div", { staticClass: "card" }, [a3("div", { staticClass: "empty-icon" }, [a3("EmptyIcon")], 1), e3._v(" "), a3("div", { staticClass: "content", attrs: { "data-cy": "empty-state-content" } }, [a3("p", [e3._v("No projects were found in this workspace.")]), e3._v(" "), a3("p", [e3._v("Open a project to see if it's ready to create AppMaps.")])])])]) : a3("article", { staticClass: "project-list" }, [a3("v-project-configuration", { ref: "projectConfiguration", attrs: { projects: e3.projects, editor: e3.editor, description: "Configure your project" }, on: { "select-project": e3.onSelectProject, "select-language": e3.onSelectLanguage } }, [a3("div", { staticClass: "install-instructions" })])], 1)]), e3._v(" "), a3("p", { staticClass: "content content--footer" }, [e3._v("\n By downloading and using AppMap you agree to the\n "), a3("a", { attrs: { href: "https://appmap.io/community/terms-and-conditions" } }, [e3._v("Terms and Conditions")]), e3._v(".\n ")])])]); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-18282806_0", { source: "main[data-v-18282806]{counter-reset:step}h2[data-v-18282806]{margin-block-end:0;counter-increment:step;border-bottom:1px solid #716e85;margin-bottom:.5rem}.project-picker h3[data-v-18282806]{text-transform:uppercase;color:#808b98}.project-picker .project-list p[data-v-18282806]{margin-bottom:1.75rem}.project-picker .subtitle[data-v-18282806]{color:#808b98;font-size:1.25rem}.table-wrap[data-v-18282806]::-webkit-scrollbar-thumb{background:#716e85}.qs h2[data-v-18282806]{margin-bottom:.5rem}tr[data-v-18282806] :first-child{text-align:left;padding-left:6ex;position:relative}p[data-v-18282806]{margin:.5rem 0}.empty-state[data-v-18282806]{border-radius:.5rem;border:1px dashed #67727e;margin:2rem;padding:3rem}.empty-state .card[data-v-18282806]{display:flex;flex-direction:row;align-items:center;justify-content:center}.empty-state .card .empty-icon[data-v-18282806]{padding:0 2rem}.content[data-v-18282806]{padding:2em}.content--header[data-v-18282806]{padding-bottom:0}.content--footer[data-v-18282806]{padding-top:0;padding-bottom:1rem}.good[data-v-18282806]{color:#7fc14a}.ok[data-v-18282806]{color:#e5b219}.bad[data-v-18282806]{color:#fd3055}.install-instructions[data-v-18282806]{display:flex;flex-direction:column;align-items:flex-start}.install-instructions .next-button[data-v-18282806]{margin-left:auto}.install-instructions .full-width[data-v-18282806]{width:100%}.install-instructions .code-snippet[data-v-18282806]{margin-top:.25rem;margin-bottom:0;width:100%}.install-instructions section[data-v-18282806]{margin-bottom:1.75rem;width:100%}", map: void 0, media: void 0 }); - }, { name: "ProjectPicker", components: { QuickstartLayout: oi, VProjectConfiguration: de({ render: function() { + }, { name: "ProjectPicker", components: { QuickstartLayout: ci, VProjectConfiguration: de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", [a3("v-accordion", { class: { "project-configuration": 1, "project-configuration--open": "project" === e3.openSection }, attrs: { open: "project" === e3.openSection, "data-active": "project" === e3.openSection, "data-cy": "project-selection" }, on: { toggle: function(t5) { return e3.onClickSection("project"); @@ -361003,21 +361438,21 @@ ${e4} } } })], 1)]) : e3._e()], 1); }, staticRenderFns: [] }, function(e3) { e3 && e3("data-v-68ea0296_0", { source: ".project-configuration[data-v-68ea0296]:first-child{border-top:1px solid rgba(255,255,255,.25)}.project-configuration__project[data-v-68ea0296]{display:flex;width:100%;border-bottom:1px solid rgba(128,128,128,.25);padding:.5rem .5rem;cursor:pointer}.project-configuration__project[data-v-68ea0296]:hover{color:#000;background-color:rgba(255,255,255,.75)}.project-configuration__project:hover .project-configuration__project-path[data-v-68ea0296]{color:#000}.project-configuration__project[data-v-68ea0296]:last-child{border-bottom:0}.project-configuration__project-name[data-v-68ea0296]{flex-grow:1;font-weight:700}.project-configuration__project-path[data-v-68ea0296]{color:#808b98;text-overflow:ellipsis;overflow:hidden;direction:rtl}.project-configuration__step[data-v-68ea0296]{display:flex;align-items:center;justify-content:space-between;padding:.5rem 2rem;border-bottom:1px solid rgba(255,255,255,.25)}.project-configuration__step--disabled[data-v-68ea0296]{cursor:initial;user-select:text}.project-configuration__step--disabled .project-configuration__step-title[data-v-68ea0296]{color:#808b98}.project-configuration__step-title[data-v-68ea0296]{font-weight:700;flex-grow:1}.project-configuration__step-result[data-v-68ea0296]{display:flex;align-items:center;gap:.5rem}.project-configuration__languages[data-v-68ea0296]{display:flex;flex-wrap:wrap;gap:.5rem;align-self:center}.project-configuration__content[data-v-68ea0296]{display:flex;flex-direction:column;padding:0 2rem;padding-bottom:1rem}.project-configuration__content .next-button[data-v-68ea0296]{margin-left:auto}.project-configuration__content .code-snippet[data-v-68ea0296]{margin-top:.25rem}.project-configuration__content section[data-v-68ea0296]{max-width:100%;margin-bottom:1rem}.project-configuration__content section.significant[data-v-68ea0296]{border-radius:.5rem;border-bottom:1px solid rgba(0,0,0,.1);background-color:rgba(0,0,0,.1);padding:0 1rem}.project-configuration__content section ul[data-v-68ea0296]{margin-left:.5rem}.project-configuration__content section h3[data-v-68ea0296]:first-child{margin-top:.5rem}.project-configuration__content p[data-v-68ea0296]{max-width:100%}.project-configuration__content code.inline[data-v-68ea0296]{display:initial;overflow-wrap:break-word;hyphens:manual}.project-configuration--open[data-v-68ea0296]{background-color:rgba(0,0,0,.25)}.project-configuration--open .project-configuration__step[data-v-68ea0296]{background-color:transparent;border-bottom:none;padding-bottom:0;cursor:initial;user-select:text}.project-configuration--open .project-configuration__step-title[data-v-68ea0296]{font-size:1.25rem;font-weight:700}.project-configuration--open .project-configuration__content[data-v-68ea0296]{border-bottom:1px solid rgba(255,255,255,.25)}.project-configuration .center[data-v-68ea0296]{place-self:center}.project-configuration .mb0[data-v-68ea0296]{margin-bottom:0}.project-configuration .java-launch-configurations[data-v-68ea0296]{display:flex;flex-direction:column}.project-configuration .java-launch-configurations__card[data-v-68ea0296]{display:flex;flex-direction:column;border-radius:.5rem;margin-bottom:1rem}.project-configuration .java-launch-configurations__card *[data-v-68ea0296]{margin:0;margin-bottom:.5rem}.project-configuration .screenshot[data-v-68ea0296]{text-align:center;max-width:100%;padding:1rem;border-radius:10px}.project-configuration .screenshot img[data-v-68ea0296]{box-shadow:10px 10px 10px rgba(0,0,0,.5);border-radius:.5rem;border:1px solid rgba(255,255,255,.1);max-width:100%}", map: void 0, media: void 0 }); - }, Jn, "data-v-68ea0296", false, void 0, false, he, void 0, void 0), EmptyIcon: fn3 }, props: { projects: { type: Array, default: () => [] }, editor: { type: String, validator: (e3) => -1 !== ["vscode", "jetbrains"].indexOf(e3) } }, data: () => ({ selectedLanguage: void 0 }), computed: { projectConfiguration() { + }, ts, "data-v-68ea0296", false, void 0, false, he, void 0, void 0), EmptyIcon: kn }, props: { projects: { type: Array, default: () => [] }, editor: { type: String, validator: (e3) => -1 !== ["vscode", "jetbrains"].indexOf(e3) } }, data: () => ({ selectedLanguage: void 0 }), computed: { projectConfiguration() { return this.$refs.projectConfiguration; } }, methods: { onSelectProject(e3) { this.selectedProject = this.projects.find((t4) => t4.path === e3.path), this.$root.$emit("select-project", e3); }, onSelectLanguage(e3) { this.selectedLanguage = e3.toLowerCase(); } } }, "data-v-18282806", false, void 0, false, he, void 0, void 0); - var Zn2 = { __proto__: null, VButton: ue, VDetailsPanel: Ft, VTabs: Ht, VVsCodeExtension: $a, VDiff: ai, VAnalysisFindings: ri, VFindingDetails: ci, VSidebarSignIn: di, VSequenceDiagram: pi3, VChat: en, VChatSearch: An, VInstallGuide: Vn }; - var Xn2 = function(e3) { - Xn2.installed || (Xn2.installed = true, Object.entries(Zn2).forEach(([t4, a3]) => { + var is2 = { __proto__: null, VButton: ue, VDetailsPanel: Ft, VTabs: Ht, VVsCodeExtension: ti, VDiff: ni, VAnalysisFindings: li, VFindingDetails: di, VSidebarSignIn: hi, VSequenceDiagram: gi, VChat: an, VChatSearch: xn, VInstallGuide: as }; + var ss = function(e3) { + ss.installed || (ss.installed = true, Object.entries(is2).forEach(([t4, a3]) => { e3.component(t4, a3); })); }; - var _n = { install: Xn2 }; - var $n = { __proto__: null, default: de({ render: function() { + var os = { install: ss }; + var rs = { __proto__: null, default: de({ render: function() { var e3 = this, t4 = e3.$createElement, a3 = e3._self._c || t4; return a3("div", [e3.areChildrenVisible ? a3("v-flamegraph-branch", { attrs: { events: e3.children, factor: e3.childrenFactor, focus: e3.focus, "base-budget": e3.baseBudget, "zoom-budget": e3.childrenZoomBudget }, on: { select: e3.propagateSelect, hover: e3.propagateHover } }) : e3._e(), e3._v(" "), a3("v-flamegraph-item", { attrs: { event: e3.event, classes: e3.classes, "item-style": e3.style, content: e3.content }, on: { select: e3.propagateSelect, hover: e3.propagateHover, mousedown: e3.mousedown, mouseup: e3.mouseup } })], 1); }, staticRenderFns: [] }, void 0, { name: "v-flamegraph-node", emits: ["select", "hover"], components: { VFlamegraphBranch: ya, VFlamegraphItem: de({ render: function(e3, t4) { @@ -361063,7 +361498,7 @@ ${e4} }, areChildrenVisible() { return this.event.children.length > 0; }, childrenFactor() { - return ba(this.event) ? this.factor * Math.min(1, this.children.map(wa).reduce(fa, 0) / wa(this.event)) : this.factor; + return ba(this.event) ? this.factor * Math.min(1, this.children.map(wa).reduce(Aa, 0) / wa(this.event)) : this.factor; } }, methods: { propagateSelect(e3) { this.$emit("select", e3); }, propagateHover(e3) { @@ -361193,7 +361628,7 @@ ${e4} const app = new vue_runtime_default({ el: "#app", render(h3) { - return h3(An, { + return h3(xn, { ref: "ui", props: { appmapRpcPort: initialData.appmapRpcPort, @@ -361203,6 +361638,8 @@ ${e4} appmapYmlPresent: this.appmapYmlPresent, targetAppmapData: initialData.targetAppmapData, targetAppmapFsPath: initialData.targetAppmapFsPath, + editorType: "intellij", + useAnimation: initialData.useAnimation, openNewChat() { vsCodeBridge_default.postMessage({ command: "open-new-chat" }); } @@ -361235,6 +361672,10 @@ ${e4} } }); handleAppMapMessages(app, vsCodeBridge_default, messages2); + messages2.on("pin-files", (props) => { + const { requests } = props; + app.$root.$emit("pin-files", requests); + }); messages2.on("update", (props) => { Object.entries(props).filter(([key]) => key !== "type").forEach(([key, value]) => { if (key in app.$data && app[key] !== value) { @@ -361242,6 +361683,7 @@ ${e4} } }); }); + app.$on("choose-files-to-pin", () => vsCodeBridge_default.postMessage({ command: "choose-files-to-pin" })); app.$on("open-install-instructions", () => vsCodeBridge_default.postMessage({ command: "open-install-instructions" })); app.$on("open-record-instructions", () => vsCodeBridge_default.postMessage({ command: "open-record-instructions" })); app.$on("open-appmap", (path3) => vsCodeBridge_default.postMessage({ command: "open-appmap", path: path3 })); @@ -361253,7 +361695,7 @@ ${e4} } // main.js - vue_runtime_default.use(_n); + vue_runtime_default.use(os); mountWebview(); })(); /*! Bundled license information: @@ -361392,7 +361834,7 @@ cytoscape/dist/cytoscape.esm.mjs: (*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License *) (*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License *) -mermaid/dist/mermaid-6dc72991.js: +mermaid/dist/mermaid-2490e8f2.js: (*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT *) (*! Check if previously processed *) (*! @@ -361411,11 +361853,11 @@ sax/lib/sax.js: (*! http://mths.be/fromcodepoint v0.1.0 by @mathias *) dompurify/dist/purify.js: - (*! @license DOMPurify 3.1.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.3/LICENSE *) + (*! @license DOMPurify 3.1.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.7/LICENSE *) socket.io-client/dist/socket.io.js: (*! - * Socket.IO v4.7.5 + * Socket.IO v4.8.0 * (c) 2014-2024 Guillermo Rauch * Released under the MIT License. *) diff --git a/appland-navie/dist/main.js.map b/appland-navie/dist/main.js.map index 7b569491..774a47af 100644 --- a/appland-navie/dist/main.js.map +++ b/appland-navie/dist/main.js.map @@ -1 +1 @@ -{"version":3,"sources":["../node_modules/base64-js/index.js","../node_modules/ieee754/index.js","../node_modules/node-libs-browser/node_modules/isarray/index.js","../node_modules/node-libs-browser/node_modules/buffer/index.js","../node_modules/process/browser.js","../polyfillShim.js","../node_modules/vue/dist/vue.runtime.common.prod.js","../node_modules/vue/dist/vue.runtime.common.js","../node_modules/safe-buffer/index.js","../node_modules/randombytes/browser.js","../node_modules/inherits/inherits_browser.js","../node_modules/events/events.js","../node_modules/process-nextick-args/index.js","../node_modules/readable-stream/node_modules/isarray/index.js","../node_modules/readable-stream/lib/internal/streams/stream.js","../node_modules/readable-stream/node_modules/safe-buffer/index.js","../node_modules/core-util-is/lib/util.js","../node_modules/util/support/isBuffer.js","../node_modules/util/node_modules/inherits/inherits_browser.js","../node_modules/util/util.js","../node_modules/readable-stream/lib/internal/streams/BufferList.js","../node_modules/readable-stream/lib/internal/streams/destroy.js","../node_modules/util-deprecate/browser.js","../node_modules/readable-stream/lib/_stream_writable.js","../node_modules/readable-stream/lib/_stream_duplex.js","../node_modules/node-libs-browser/node_modules/string_decoder/lib/string_decoder.js","../node_modules/readable-stream/lib/_stream_readable.js","../node_modules/readable-stream/lib/_stream_transform.js","../node_modules/readable-stream/lib/_stream_passthrough.js","../node_modules/readable-stream/readable.js","../node_modules/readable-stream/writable.js","../node_modules/readable-stream/duplex.js","../node_modules/readable-stream/transform.js","../node_modules/readable-stream/passthrough.js","../node_modules/stream-browserify/index.js","../node_modules/md5.js/node_modules/readable-stream/lib/internal/streams/stream.js","../node_modules/md5.js/node_modules/readable-stream/lib/internal/streams/buffer_list.js","../node_modules/md5.js/node_modules/readable-stream/lib/internal/streams/destroy.js","../node_modules/md5.js/node_modules/readable-stream/errors.js","../node_modules/md5.js/node_modules/readable-stream/lib/internal/streams/state.js","../node_modules/md5.js/node_modules/readable-stream/lib/_stream_writable.js","../node_modules/md5.js/node_modules/readable-stream/lib/_stream_duplex.js","../node_modules/md5.js/node_modules/readable-stream/lib/internal/streams/end-of-stream.js","../node_modules/md5.js/node_modules/readable-stream/lib/internal/streams/async_iterator.js","../node_modules/md5.js/node_modules/readable-stream/lib/internal/streams/from.js","../node_modules/md5.js/node_modules/readable-stream/lib/_stream_readable.js","../node_modules/md5.js/node_modules/readable-stream/lib/_stream_transform.js","../node_modules/md5.js/node_modules/readable-stream/lib/_stream_passthrough.js","../node_modules/md5.js/node_modules/readable-stream/lib/internal/streams/pipeline.js","../node_modules/md5.js/node_modules/readable-stream/readable.js","../node_modules/md5.js/node_modules/hash-base/index.js","../node_modules/md5.js/index.js","../node_modules/ripemd160/node_modules/readable-stream/lib/internal/streams/stream.js","../node_modules/ripemd160/node_modules/readable-stream/lib/internal/streams/buffer_list.js","../node_modules/ripemd160/node_modules/readable-stream/lib/internal/streams/destroy.js","../node_modules/ripemd160/node_modules/readable-stream/errors.js","../node_modules/ripemd160/node_modules/readable-stream/lib/internal/streams/state.js","../node_modules/ripemd160/node_modules/readable-stream/lib/_stream_writable.js","../node_modules/ripemd160/node_modules/readable-stream/lib/_stream_duplex.js","../node_modules/ripemd160/node_modules/readable-stream/lib/internal/streams/end-of-stream.js","../node_modules/ripemd160/node_modules/readable-stream/lib/internal/streams/async_iterator.js","../node_modules/ripemd160/node_modules/readable-stream/lib/internal/streams/from.js","../node_modules/ripemd160/node_modules/readable-stream/lib/_stream_readable.js","../node_modules/ripemd160/node_modules/readable-stream/lib/_stream_transform.js","../node_modules/ripemd160/node_modules/readable-stream/lib/_stream_passthrough.js","../node_modules/ripemd160/node_modules/readable-stream/lib/internal/streams/pipeline.js","../node_modules/ripemd160/node_modules/readable-stream/readable.js","../node_modules/ripemd160/node_modules/hash-base/index.js","../node_modules/ripemd160/index.js","../node_modules/sha.js/hash.js","../node_modules/sha.js/sha.js","../node_modules/sha.js/sha1.js","../node_modules/sha.js/sha256.js","../node_modules/sha.js/sha224.js","../node_modules/sha.js/sha512.js","../node_modules/sha.js/sha384.js","../node_modules/sha.js/index.js","../node_modules/cipher-base/index.js","../node_modules/create-hash/browser.js","../node_modules/create-hmac/legacy.js","../node_modules/create-hash/md5.js","../node_modules/create-hmac/browser.js","../node_modules/browserify-sign/browser/algorithms.json","../node_modules/browserify-sign/algos.js","../node_modules/pbkdf2/lib/precondition.js","../node_modules/pbkdf2/lib/default-encoding.js","../node_modules/pbkdf2/lib/to-buffer.js","../node_modules/pbkdf2/lib/sync.js","../node_modules/pbkdf2/lib/async.js","../node_modules/pbkdf2/index.js","../node_modules/des.js/lib/des/utils.js","../node_modules/minimalistic-assert/index.js","../node_modules/des.js/lib/des/cipher.js","../node_modules/des.js/lib/des/des.js","../node_modules/des.js/lib/des/cbc.js","../node_modules/des.js/lib/des/ede.js","../node_modules/des.js/lib/des.js","../node_modules/browserify-des/index.js","../node_modules/browserify-aes/modes/ecb.js","../node_modules/buffer-xor/index.js","../node_modules/browserify-aes/modes/cbc.js","../node_modules/browserify-aes/modes/cfb.js","../node_modules/browserify-aes/modes/cfb8.js","../node_modules/browserify-aes/modes/cfb1.js","../node_modules/browserify-aes/modes/ofb.js","../node_modules/browserify-aes/incr32.js","../node_modules/browserify-aes/modes/ctr.js","../node_modules/browserify-aes/modes/list.json","../node_modules/browserify-aes/modes/index.js","../node_modules/browserify-aes/aes.js","../node_modules/browserify-aes/ghash.js","../node_modules/browserify-aes/authCipher.js","../node_modules/browserify-aes/streamCipher.js","../node_modules/evp_bytestokey/index.js","../node_modules/browserify-aes/encrypter.js","../node_modules/browserify-aes/decrypter.js","../node_modules/browserify-aes/browser.js","../node_modules/browserify-des/modes.js","../node_modules/browserify-cipher/browser.js","../node_modules/bn.js/lib/bn.js","../node_modules/brorand/index.js","../node_modules/miller-rabin/lib/mr.js","../node_modules/diffie-hellman/lib/generatePrime.js","../node_modules/diffie-hellman/lib/primes.json","../node_modules/diffie-hellman/lib/dh.js","../node_modules/diffie-hellman/browser.js","../node_modules/browserify-rsa/node_modules/bn.js/lib/bn.js","../node_modules/browserify-rsa/index.js","../node_modules/elliptic/package.json","../node_modules/minimalistic-crypto-utils/lib/utils.js","../node_modules/elliptic/lib/elliptic/utils.js","../node_modules/elliptic/lib/elliptic/curve/base.js","../node_modules/elliptic/lib/elliptic/curve/short.js","../node_modules/elliptic/lib/elliptic/curve/mont.js","../node_modules/elliptic/lib/elliptic/curve/edwards.js","../node_modules/elliptic/lib/elliptic/curve/index.js","../node_modules/hash.js/lib/hash/utils.js","../node_modules/hash.js/lib/hash/common.js","../node_modules/hash.js/lib/hash/sha/common.js","../node_modules/hash.js/lib/hash/sha/1.js","../node_modules/hash.js/lib/hash/sha/256.js","../node_modules/hash.js/lib/hash/sha/224.js","../node_modules/hash.js/lib/hash/sha/512.js","../node_modules/hash.js/lib/hash/sha/384.js","../node_modules/hash.js/lib/hash/sha.js","../node_modules/hash.js/lib/hash/ripemd.js","../node_modules/hash.js/lib/hash/hmac.js","../node_modules/hash.js/lib/hash.js","../node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js","../node_modules/elliptic/lib/elliptic/curves.js","../node_modules/hmac-drbg/lib/hmac-drbg.js","../node_modules/elliptic/lib/elliptic/ec/key.js","../node_modules/elliptic/lib/elliptic/ec/signature.js","../node_modules/elliptic/lib/elliptic/ec/index.js","../node_modules/elliptic/lib/elliptic/eddsa/key.js","../node_modules/elliptic/lib/elliptic/eddsa/signature.js","../node_modules/elliptic/lib/elliptic/eddsa/index.js","../node_modules/elliptic/lib/elliptic.js","../node_modules/browserify-sign/node_modules/bn.js/lib/bn.js","../node_modules/vm-browserify/index.js","../node_modules/asn1.js/lib/asn1/api.js","../node_modules/asn1.js/lib/asn1/base/reporter.js","../node_modules/asn1.js/lib/asn1/base/buffer.js","../node_modules/asn1.js/lib/asn1/base/node.js","../node_modules/asn1.js/lib/asn1/base/index.js","../node_modules/asn1.js/lib/asn1/constants/der.js","../node_modules/asn1.js/lib/asn1/constants/index.js","../node_modules/asn1.js/lib/asn1/decoders/der.js","../node_modules/asn1.js/lib/asn1/decoders/pem.js","../node_modules/asn1.js/lib/asn1/decoders/index.js","../node_modules/asn1.js/lib/asn1/encoders/der.js","../node_modules/asn1.js/lib/asn1/encoders/pem.js","../node_modules/asn1.js/lib/asn1/encoders/index.js","../node_modules/asn1.js/lib/asn1.js","../node_modules/parse-asn1/certificate.js","../node_modules/parse-asn1/asn1.js","../node_modules/parse-asn1/aesid.json","../node_modules/parse-asn1/fixProc.js","../node_modules/parse-asn1/index.js","../node_modules/browserify-sign/browser/curves.json","../node_modules/browserify-sign/browser/sign.js","../node_modules/browserify-sign/browser/verify.js","../node_modules/browserify-sign/browser/index.js","../node_modules/create-ecdh/browser.js","../node_modules/public-encrypt/mgf.js","../node_modules/public-encrypt/xor.js","../node_modules/public-encrypt/withPublic.js","../node_modules/public-encrypt/publicEncrypt.js","../node_modules/public-encrypt/privateDecrypt.js","../node_modules/public-encrypt/browser.js","../node_modules/randomfill/browser.js","../node_modules/crypto-browserify/index.js","../node_modules/crypto-js/core.js","../node_modules/crypto-js/sha256.js","../node_modules/@appland/sql-parser/dist/sqlite-parser.js","../node_modules/@appland/models/src/index.js","../node_modules/@appland/models/src/codeObjectType.js","../node_modules/@appland/models/src/codeObjectId.js","../node_modules/@appland/models/src/util.js","../node_modules/@appland/models/src/sql/normalize.js","../node_modules/@appland/models/src/sql/parse.js","../node_modules/@appland/models/src/sql/parseError.js","../node_modules/@appland/models/src/sql/sqlErrorHandler.js","../node_modules/@appland/models/src/sql/analyze.js","../node_modules/@appland/models/src/codeObject.js","../node_modules/@appland/models/src/classMap.js","../node_modules/@appland/models/src/callTree/callNode.js","../node_modules/@appland/models/src/eventSource.js","../node_modules/@appland/models/src/callTree/callTree.js","../node_modules/@appland/models/src/appMap.js","../node_modules/@appland/models/src/hashBuilder.js","../node_modules/@appland/models/src/event.js","../node_modules/@appland/models/src/appMapBuilder/eventStack.js","../node_modules/@appland/models/src/appMapBuilder/eventSorter.js","../node_modules/@appland/models/src/appMapBuilder/index.js","../node_modules/@appland/models/src/eventNavigator.js","../node_modules/@appland/models/src/eventInfo.js","../node_modules/@appland/models/src/appMapFilter.js","../node_modules/@appland/models/src/serialize.js","../node_modules/sql-formatter/lib/core/tokenTypes.js","../node_modules/sql-formatter/lib/utils.js","../node_modules/sql-formatter/lib/core/Indentation.js","../node_modules/sql-formatter/lib/core/InlineBlock.js","../node_modules/sql-formatter/lib/core/Params.js","../node_modules/sql-formatter/lib/core/token.js","../node_modules/sql-formatter/lib/core/Formatter.js","../node_modules/sql-formatter/lib/core/regexFactory.js","../node_modules/sql-formatter/lib/core/Tokenizer.js","../node_modules/sql-formatter/lib/languages/Db2Formatter.js","../node_modules/sql-formatter/lib/languages/MariaDbFormatter.js","../node_modules/sql-formatter/lib/languages/MySqlFormatter.js","../node_modules/sql-formatter/lib/languages/N1qlFormatter.js","../node_modules/sql-formatter/lib/languages/PlSqlFormatter.js","../node_modules/sql-formatter/lib/languages/PostgreSqlFormatter.js","../node_modules/sql-formatter/lib/languages/RedshiftFormatter.js","../node_modules/sql-formatter/lib/languages/SparkSqlFormatter.js","../node_modules/sql-formatter/lib/languages/StandardSqlFormatter.js","../node_modules/sql-formatter/lib/languages/TSqlFormatter.js","../node_modules/sql-formatter/lib/sqlFormatter.js","../node_modules/highlight.js/lib/core.js","../node_modules/@appland/openapi/src/statusCodes.ts","../node_modules/@appland/openapi/src/appmap/propertiesParserV1.ts","../node_modules/@appland/openapi/src/appmap/propertiesParserV2.ts","../node_modules/@appland/openapi/src/appmap/index.ts","../node_modules/@appland/openapi/src/util.ts","../node_modules/@appland/openapi/src/schemaInferrer.ts","../node_modules/@appland/openapi/src/Warnings.ts","../node_modules/@appland/openapi/src/response.ts","../node_modules/punycode/punycode.js","../node_modules/es-errors/index.js","../node_modules/es-errors/eval.js","../node_modules/es-errors/range.js","../node_modules/es-errors/ref.js","../node_modules/es-errors/syntax.js","../node_modules/es-errors/type.js","../node_modules/es-errors/uri.js","../node_modules/has-symbols/shams.js","../node_modules/has-symbols/index.js","../node_modules/has-proto/index.js","../node_modules/function-bind/implementation.js","../node_modules/function-bind/index.js","../node_modules/hasown/index.js","../node_modules/get-intrinsic/index.js","../node_modules/es-define-property/index.js","../node_modules/gopd/index.js","../node_modules/define-data-property/index.js","../node_modules/has-property-descriptors/index.js","../node_modules/set-function-length/index.js","../node_modules/call-bind/index.js","../node_modules/call-bind/callBound.js","../node_modules/object-inspect/util.inspect.js","../node_modules/object-inspect/index.js","../node_modules/side-channel/index.js","../node_modules/node-libs-browser/node_modules/qs/lib/formats.js","../node_modules/node-libs-browser/node_modules/qs/lib/utils.js","../node_modules/node-libs-browser/node_modules/qs/lib/stringify.js","../node_modules/node-libs-browser/node_modules/qs/lib/parse.js","../node_modules/node-libs-browser/node_modules/qs/lib/index.js","../node_modules/node-libs-browser/node_modules/url/url.js","../node_modules/@appland/openapi/src/rpcRequest.ts","../node_modules/@appland/openapi/src/objectSchema.ts","../node_modules/@appland/openapi/src/method.ts","../node_modules/@appland/openapi/src/path.ts","../node_modules/@appland/openapi/src/model.ts","../node_modules/@appland/openapi/src/securitySchemes.ts","../node_modules/@appland/openapi/src/parseHTTPServerRequests.ts","../node_modules/@appland/openapi/src/index.ts","../node_modules/yallist/iterator.js","../node_modules/yallist/yallist.js","../node_modules/lru-cache/index.js","../node_modules/@appland/sequence-diagram/dist/mergeWindow.js","../node_modules/@appland/sequence-diagram/dist/selectEvents.js","../node_modules/@appland/sequence-diagram/dist/buildDiagram.js","../node_modules/@datastructures-js/heap/src/heap.js","../node_modules/@datastructures-js/heap/src/minHeap.js","../node_modules/@datastructures-js/heap/src/maxHeap.js","../node_modules/@datastructures-js/heap/index.js","../node_modules/@datastructures-js/priority-queue/src/minPriorityQueue.js","../node_modules/@datastructures-js/priority-queue/src/maxPriorityQueue.js","../node_modules/@datastructures-js/priority-queue/src/priorityQueue.js","../node_modules/@datastructures-js/priority-queue/index.js","../node_modules/@appland/sequence-diagram/dist/diff.js","../node_modules/@appland/sequence-diagram/dist/buildDiffDiagram.js","../node_modules/@appland/sequence-diagram/dist/unparseDiagram.js","../node_modules/@appland/sequence-diagram/dist/validateDiagram.js","../node_modules/@appland/sequence-diagram/dist/formatter/json.js","../node_modules/diff/src/diff/base.js","../node_modules/diff/src/diff/character.js","../node_modules/diff/src/util/params.js","../node_modules/diff/src/diff/word.js","../node_modules/diff/src/diff/line.js","../node_modules/diff/src/diff/sentence.js","../node_modules/diff/src/diff/css.js","../node_modules/diff/src/diff/json.js","../node_modules/diff/src/diff/array.js","../node_modules/diff/src/patch/parse.js","../node_modules/diff/src/util/distance-iterator.js","../node_modules/diff/src/patch/apply.js","../node_modules/diff/src/patch/create.js","../node_modules/diff/src/util/array.js","../node_modules/diff/src/patch/merge.js","../node_modules/diff/src/patch/reverse.js","../node_modules/diff/src/convert/dmp.js","../node_modules/diff/src/convert/xml.js","../node_modules/diff/src/index.js","../node_modules/@appland/sequence-diagram/dist/formatter/plantUML.js","../node_modules/@appland/sequence-diagram/dist/formatter/text.js","../node_modules/@appland/sequence-diagram/dist/formatter.js","../node_modules/@appland/sequence-diagram/dist/priority.js","../node_modules/@appland/sequence-diagram/dist/specification.js","../node_modules/@appland/sequence-diagram/dist/types.js","../node_modules/d3-selection/src/namespaces.js","../node_modules/d3-selection/src/namespace.js","../node_modules/d3-selection/src/creator.js","../node_modules/d3-selection/src/selector.js","../node_modules/d3-selection/src/selection/select.js","../node_modules/d3-selection/src/array.js","../node_modules/d3-selection/src/selectorAll.js","../node_modules/d3-selection/src/selection/selectAll.js","../node_modules/d3-selection/src/matcher.js","../node_modules/d3-selection/src/selection/selectChild.js","../node_modules/d3-selection/src/selection/selectChildren.js","../node_modules/d3-selection/src/selection/filter.js","../node_modules/d3-selection/src/selection/sparse.js","../node_modules/d3-selection/src/selection/enter.js","../node_modules/d3-selection/src/constant.js","../node_modules/d3-selection/src/selection/data.js","../node_modules/d3-selection/src/selection/exit.js","../node_modules/d3-selection/src/selection/join.js","../node_modules/d3-selection/src/selection/merge.js","../node_modules/d3-selection/src/selection/order.js","../node_modules/d3-selection/src/selection/sort.js","../node_modules/d3-selection/src/selection/call.js","../node_modules/d3-selection/src/selection/nodes.js","../node_modules/d3-selection/src/selection/node.js","../node_modules/d3-selection/src/selection/size.js","../node_modules/d3-selection/src/selection/empty.js","../node_modules/d3-selection/src/selection/each.js","../node_modules/d3-selection/src/selection/attr.js","../node_modules/d3-selection/src/window.js","../node_modules/d3-selection/src/selection/style.js","../node_modules/d3-selection/src/selection/property.js","../node_modules/d3-selection/src/selection/classed.js","../node_modules/d3-selection/src/selection/text.js","../node_modules/d3-selection/src/selection/html.js","../node_modules/d3-selection/src/selection/raise.js","../node_modules/d3-selection/src/selection/lower.js","../node_modules/d3-selection/src/selection/append.js","../node_modules/d3-selection/src/selection/insert.js","../node_modules/d3-selection/src/selection/remove.js","../node_modules/d3-selection/src/selection/clone.js","../node_modules/d3-selection/src/selection/datum.js","../node_modules/d3-selection/src/selection/on.js","../node_modules/d3-selection/src/selection/dispatch.js","../node_modules/d3-selection/src/selection/iterator.js","../node_modules/d3-selection/src/selection/index.js","../node_modules/d3-selection/src/select.js","../node_modules/d3-selection/src/create.js","../node_modules/d3-selection/src/local.js","../node_modules/d3-selection/src/sourceEvent.js","../node_modules/d3-selection/src/pointer.js","../node_modules/d3-selection/src/pointers.js","../node_modules/d3-selection/src/selectAll.js","../node_modules/d3-selection/src/index.js","../node_modules/deepmerge/dist/cjs.js","../node_modules/d3-dispatch/src/dispatch.js","../node_modules/d3-dispatch/src/index.js","../node_modules/d3-drag/src/noevent.js","../node_modules/d3-drag/src/nodrag.js","../node_modules/d3-drag/src/index.js","../node_modules/d3-color/src/define.js","../node_modules/d3-color/src/color.js","../node_modules/d3-color/src/math.js","../node_modules/d3-color/src/lab.js","../node_modules/d3-color/src/cubehelix.js","../node_modules/d3-color/src/index.js","../node_modules/d3-interpolate/src/basis.js","../node_modules/d3-interpolate/src/basisClosed.js","../node_modules/d3-interpolate/src/constant.js","../node_modules/d3-interpolate/src/color.js","../node_modules/d3-interpolate/src/rgb.js","../node_modules/d3-interpolate/src/numberArray.js","../node_modules/d3-interpolate/src/array.js","../node_modules/d3-interpolate/src/date.js","../node_modules/d3-interpolate/src/number.js","../node_modules/d3-interpolate/src/object.js","../node_modules/d3-interpolate/src/string.js","../node_modules/d3-interpolate/src/value.js","../node_modules/d3-interpolate/src/discrete.js","../node_modules/d3-interpolate/src/hue.js","../node_modules/d3-interpolate/src/round.js","../node_modules/d3-interpolate/src/transform/decompose.js","../node_modules/d3-interpolate/src/transform/parse.js","../node_modules/d3-interpolate/src/transform/index.js","../node_modules/d3-interpolate/src/zoom.js","../node_modules/d3-interpolate/src/hsl.js","../node_modules/d3-interpolate/src/lab.js","../node_modules/d3-interpolate/src/hcl.js","../node_modules/d3-interpolate/src/cubehelix.js","../node_modules/d3-interpolate/src/piecewise.js","../node_modules/d3-interpolate/src/quantize.js","../node_modules/d3-interpolate/src/index.js","../node_modules/d3-timer/src/timer.js","../node_modules/d3-timer/src/timeout.js","../node_modules/d3-timer/src/index.js","../node_modules/d3-transition/src/transition/schedule.js","../node_modules/d3-transition/src/interrupt.js","../node_modules/d3-transition/src/selection/interrupt.js","../node_modules/d3-transition/src/transition/tween.js","../node_modules/d3-transition/src/transition/interpolate.js","../node_modules/d3-transition/src/transition/attr.js","../node_modules/d3-transition/src/transition/attrTween.js","../node_modules/d3-transition/src/transition/delay.js","../node_modules/d3-transition/src/transition/duration.js","../node_modules/d3-transition/src/transition/ease.js","../node_modules/d3-transition/src/transition/easeVarying.js","../node_modules/d3-transition/src/transition/filter.js","../node_modules/d3-transition/src/transition/merge.js","../node_modules/d3-transition/src/transition/on.js","../node_modules/d3-transition/src/transition/remove.js","../node_modules/d3-transition/src/transition/select.js","../node_modules/d3-transition/src/transition/selectAll.js","../node_modules/d3-transition/src/transition/selection.js","../node_modules/d3-transition/src/transition/style.js","../node_modules/d3-transition/src/transition/styleTween.js","../node_modules/d3-transition/src/transition/text.js","../node_modules/d3-transition/src/transition/textTween.js","../node_modules/d3-transition/src/transition/transition.js","../node_modules/d3-transition/src/transition/end.js","../node_modules/d3-transition/src/transition/index.js","../node_modules/d3-ease/src/cubic.js","../node_modules/d3-ease/src/index.js","../node_modules/d3-transition/src/selection/transition.js","../node_modules/d3-transition/src/selection/index.js","../node_modules/d3-transition/src/index.js","../node_modules/d3-zoom/src/constant.js","../node_modules/d3-zoom/src/event.js","../node_modules/d3-zoom/src/transform.js","../node_modules/d3-zoom/src/noevent.js","../node_modules/d3-zoom/src/zoom.js","../node_modules/d3-zoom/src/index.js","../node_modules/lodash/_listCacheClear.js","../node_modules/lodash/eq.js","../node_modules/lodash/_assocIndexOf.js","../node_modules/lodash/_listCacheDelete.js","../node_modules/lodash/_listCacheGet.js","../node_modules/lodash/_listCacheHas.js","../node_modules/lodash/_listCacheSet.js","../node_modules/lodash/_ListCache.js","../node_modules/lodash/_stackClear.js","../node_modules/lodash/_stackDelete.js","../node_modules/lodash/_stackGet.js","../node_modules/lodash/_stackHas.js","../node_modules/lodash/_freeGlobal.js","../node_modules/lodash/_root.js","../node_modules/lodash/_Symbol.js","../node_modules/lodash/_getRawTag.js","../node_modules/lodash/_objectToString.js","../node_modules/lodash/_baseGetTag.js","../node_modules/lodash/isObject.js","../node_modules/lodash/isFunction.js","../node_modules/lodash/_coreJsData.js","../node_modules/lodash/_isMasked.js","../node_modules/lodash/_toSource.js","../node_modules/lodash/_baseIsNative.js","../node_modules/lodash/_getValue.js","../node_modules/lodash/_getNative.js","../node_modules/lodash/_Map.js","../node_modules/lodash/_nativeCreate.js","../node_modules/lodash/_hashClear.js","../node_modules/lodash/_hashDelete.js","../node_modules/lodash/_hashGet.js","../node_modules/lodash/_hashHas.js","../node_modules/lodash/_hashSet.js","../node_modules/lodash/_Hash.js","../node_modules/lodash/_mapCacheClear.js","../node_modules/lodash/_isKeyable.js","../node_modules/lodash/_getMapData.js","../node_modules/lodash/_mapCacheDelete.js","../node_modules/lodash/_mapCacheGet.js","../node_modules/lodash/_mapCacheHas.js","../node_modules/lodash/_mapCacheSet.js","../node_modules/lodash/_MapCache.js","../node_modules/lodash/_stackSet.js","../node_modules/lodash/_Stack.js","../node_modules/lodash/_arrayEach.js","../node_modules/lodash/_defineProperty.js","../node_modules/lodash/_baseAssignValue.js","../node_modules/lodash/_assignValue.js","../node_modules/lodash/_copyObject.js","../node_modules/lodash/_baseTimes.js","../node_modules/lodash/isObjectLike.js","../node_modules/lodash/_baseIsArguments.js","../node_modules/lodash/isArguments.js","../node_modules/lodash/isArray.js","../node_modules/lodash/stubFalse.js","../node_modules/lodash/isBuffer.js","../node_modules/lodash/_isIndex.js","../node_modules/lodash/isLength.js","../node_modules/lodash/_baseIsTypedArray.js","../node_modules/lodash/_baseUnary.js","../node_modules/lodash/_nodeUtil.js","../node_modules/lodash/isTypedArray.js","../node_modules/lodash/_arrayLikeKeys.js","../node_modules/lodash/_isPrototype.js","../node_modules/lodash/_overArg.js","../node_modules/lodash/_nativeKeys.js","../node_modules/lodash/_baseKeys.js","../node_modules/lodash/isArrayLike.js","../node_modules/lodash/keys.js","../node_modules/lodash/_baseAssign.js","../node_modules/lodash/_nativeKeysIn.js","../node_modules/lodash/_baseKeysIn.js","../node_modules/lodash/keysIn.js","../node_modules/lodash/_baseAssignIn.js","../node_modules/lodash/_cloneBuffer.js","../node_modules/lodash/_copyArray.js","../node_modules/lodash/_arrayFilter.js","../node_modules/lodash/stubArray.js","../node_modules/lodash/_getSymbols.js","../node_modules/lodash/_copySymbols.js","../node_modules/lodash/_arrayPush.js","../node_modules/lodash/_getPrototype.js","../node_modules/lodash/_getSymbolsIn.js","../node_modules/lodash/_copySymbolsIn.js","../node_modules/lodash/_baseGetAllKeys.js","../node_modules/lodash/_getAllKeys.js","../node_modules/lodash/_getAllKeysIn.js","../node_modules/lodash/_DataView.js","../node_modules/lodash/_Promise.js","../node_modules/lodash/_Set.js","../node_modules/lodash/_WeakMap.js","../node_modules/lodash/_getTag.js","../node_modules/lodash/_initCloneArray.js","../node_modules/lodash/_Uint8Array.js","../node_modules/lodash/_cloneArrayBuffer.js","../node_modules/lodash/_cloneDataView.js","../node_modules/lodash/_cloneRegExp.js","../node_modules/lodash/_cloneSymbol.js","../node_modules/lodash/_cloneTypedArray.js","../node_modules/lodash/_initCloneByTag.js","../node_modules/lodash/_baseCreate.js","../node_modules/lodash/_initCloneObject.js","../node_modules/lodash/_baseIsMap.js","../node_modules/lodash/isMap.js","../node_modules/lodash/_baseIsSet.js","../node_modules/lodash/isSet.js","../node_modules/lodash/_baseClone.js","../node_modules/lodash/clone.js","../node_modules/lodash/constant.js","../node_modules/lodash/_createBaseFor.js","../node_modules/lodash/_baseFor.js","../node_modules/lodash/_baseForOwn.js","../node_modules/lodash/_createBaseEach.js","../node_modules/lodash/_baseEach.js","../node_modules/lodash/identity.js","../node_modules/lodash/_castFunction.js","../node_modules/lodash/forEach.js","../node_modules/lodash/each.js","../node_modules/lodash/_baseFilter.js","../node_modules/lodash/_setCacheAdd.js","../node_modules/lodash/_setCacheHas.js","../node_modules/lodash/_SetCache.js","../node_modules/lodash/_arraySome.js","../node_modules/lodash/_cacheHas.js","../node_modules/lodash/_equalArrays.js","../node_modules/lodash/_mapToArray.js","../node_modules/lodash/_setToArray.js","../node_modules/lodash/_equalByTag.js","../node_modules/lodash/_equalObjects.js","../node_modules/lodash/_baseIsEqualDeep.js","../node_modules/lodash/_baseIsEqual.js","../node_modules/lodash/_baseIsMatch.js","../node_modules/lodash/_isStrictComparable.js","../node_modules/lodash/_getMatchData.js","../node_modules/lodash/_matchesStrictComparable.js","../node_modules/lodash/_baseMatches.js","../node_modules/lodash/isSymbol.js","../node_modules/lodash/_isKey.js","../node_modules/lodash/memoize.js","../node_modules/lodash/_memoizeCapped.js","../node_modules/lodash/_stringToPath.js","../node_modules/lodash/_arrayMap.js","../node_modules/lodash/_baseToString.js","../node_modules/lodash/toString.js","../node_modules/lodash/_castPath.js","../node_modules/lodash/_toKey.js","../node_modules/lodash/_baseGet.js","../node_modules/lodash/get.js","../node_modules/lodash/_baseHasIn.js","../node_modules/lodash/_hasPath.js","../node_modules/lodash/hasIn.js","../node_modules/lodash/_baseMatchesProperty.js","../node_modules/lodash/_baseProperty.js","../node_modules/lodash/_basePropertyDeep.js","../node_modules/lodash/property.js","../node_modules/lodash/_baseIteratee.js","../node_modules/lodash/filter.js","../node_modules/lodash/_baseHas.js","../node_modules/lodash/has.js","../node_modules/lodash/isEmpty.js","../node_modules/lodash/isUndefined.js","../node_modules/lodash/_baseMap.js","../node_modules/lodash/map.js","../node_modules/lodash/_arrayReduce.js","../node_modules/lodash/_baseReduce.js","../node_modules/lodash/reduce.js","../node_modules/lodash/isString.js","../node_modules/lodash/_asciiSize.js","../node_modules/lodash/_hasUnicode.js","../node_modules/lodash/_unicodeSize.js","../node_modules/lodash/_stringSize.js","../node_modules/lodash/size.js","../node_modules/lodash/transform.js","../node_modules/lodash/_isFlattenable.js","../node_modules/lodash/_baseFlatten.js","../node_modules/lodash/_apply.js","../node_modules/lodash/_overRest.js","../node_modules/lodash/_baseSetToString.js","../node_modules/lodash/_shortOut.js","../node_modules/lodash/_setToString.js","../node_modules/lodash/_baseRest.js","../node_modules/lodash/_baseFindIndex.js","../node_modules/lodash/_baseIsNaN.js","../node_modules/lodash/_strictIndexOf.js","../node_modules/lodash/_baseIndexOf.js","../node_modules/lodash/_arrayIncludes.js","../node_modules/lodash/_arrayIncludesWith.js","../node_modules/lodash/noop.js","../node_modules/lodash/_createSet.js","../node_modules/lodash/_baseUniq.js","../node_modules/lodash/isArrayLikeObject.js","../node_modules/lodash/union.js","../node_modules/lodash/_baseValues.js","../node_modules/lodash/values.js","../node_modules/graphlib/lib/lodash.js","../node_modules/graphlib/lib/graph.js","../node_modules/graphlib/lib/version.js","../node_modules/graphlib/lib/index.js","../node_modules/graphlib/lib/json.js","../node_modules/graphlib/lib/alg/components.js","../node_modules/graphlib/lib/data/priority-queue.js","../node_modules/graphlib/lib/alg/dijkstra.js","../node_modules/graphlib/lib/alg/dijkstra-all.js","../node_modules/graphlib/lib/alg/tarjan.js","../node_modules/graphlib/lib/alg/find-cycles.js","../node_modules/graphlib/lib/alg/floyd-warshall.js","../node_modules/graphlib/lib/alg/topsort.js","../node_modules/graphlib/lib/alg/is-acyclic.js","../node_modules/graphlib/lib/alg/dfs.js","../node_modules/graphlib/lib/alg/postorder.js","../node_modules/graphlib/lib/alg/preorder.js","../node_modules/graphlib/lib/alg/prim.js","../node_modules/graphlib/lib/alg/index.js","../node_modules/graphlib/index.js","../node_modules/dagre/lib/graphlib.js","../node_modules/lodash/cloneDeep.js","../node_modules/lodash/_isIterateeCall.js","../node_modules/lodash/defaults.js","../node_modules/lodash/_createFind.js","../node_modules/lodash/_trimmedEndIndex.js","../node_modules/lodash/_baseTrim.js","../node_modules/lodash/toNumber.js","../node_modules/lodash/toFinite.js","../node_modules/lodash/toInteger.js","../node_modules/lodash/findIndex.js","../node_modules/lodash/find.js","../node_modules/lodash/flatten.js","../node_modules/lodash/forIn.js","../node_modules/lodash/last.js","../node_modules/lodash/mapValues.js","../node_modules/lodash/_baseExtremum.js","../node_modules/lodash/_baseGt.js","../node_modules/lodash/max.js","../node_modules/lodash/_assignMergeValue.js","../node_modules/lodash/isPlainObject.js","../node_modules/lodash/_safeGet.js","../node_modules/lodash/toPlainObject.js","../node_modules/lodash/_baseMergeDeep.js","../node_modules/lodash/_baseMerge.js","../node_modules/lodash/_createAssigner.js","../node_modules/lodash/merge.js","../node_modules/lodash/_baseLt.js","../node_modules/lodash/min.js","../node_modules/lodash/minBy.js","../node_modules/lodash/now.js","../node_modules/lodash/_baseSet.js","../node_modules/lodash/_basePickBy.js","../node_modules/lodash/_basePick.js","../node_modules/lodash/_flatRest.js","../node_modules/lodash/pick.js","../node_modules/lodash/_baseRange.js","../node_modules/lodash/_createRange.js","../node_modules/lodash/range.js","../node_modules/lodash/_baseSortBy.js","../node_modules/lodash/_compareAscending.js","../node_modules/lodash/_compareMultiple.js","../node_modules/lodash/_baseOrderBy.js","../node_modules/lodash/sortBy.js","../node_modules/lodash/uniqueId.js","../node_modules/lodash/_baseZipObject.js","../node_modules/lodash/zipObject.js","../node_modules/dagre/lib/lodash.js","../node_modules/dagre/lib/data/list.js","../node_modules/dagre/lib/greedy-fas.js","../node_modules/dagre/lib/acyclic.js","../node_modules/dagre/lib/util.js","../node_modules/dagre/lib/normalize.js","../node_modules/dagre/lib/rank/util.js","../node_modules/dagre/lib/rank/feasible-tree.js","../node_modules/dagre/lib/rank/network-simplex.js","../node_modules/dagre/lib/rank/index.js","../node_modules/dagre/lib/parent-dummy-chains.js","../node_modules/dagre/lib/nesting-graph.js","../node_modules/dagre/lib/add-border-segments.js","../node_modules/dagre/lib/coordinate-system.js","../node_modules/dagre/lib/order/init-order.js","../node_modules/dagre/lib/order/cross-count.js","../node_modules/dagre/lib/order/barycenter.js","../node_modules/dagre/lib/order/resolve-conflicts.js","../node_modules/dagre/lib/order/sort.js","../node_modules/dagre/lib/order/sort-subgraph.js","../node_modules/dagre/lib/order/build-layer-graph.js","../node_modules/dagre/lib/order/add-subgraph-constraints.js","../node_modules/dagre/lib/order/index.js","../node_modules/dagre/lib/position/bk.js","../node_modules/dagre/lib/position/index.js","../node_modules/dagre/lib/layout.js","../node_modules/dagre/lib/debug.js","../node_modules/dagre/lib/version.js","../node_modules/dagre/index.js","../node_modules/d3-shape/src/constant.js","../node_modules/d3-shape/src/math.js","../node_modules/d3-path/src/path.js","../node_modules/d3-path/src/index.js","../node_modules/d3-shape/src/path.js","../node_modules/d3-shape/src/arc.js","../node_modules/d3-shape/src/array.js","../node_modules/d3-shape/src/curve/linear.js","../node_modules/d3-shape/src/point.js","../node_modules/d3-shape/src/line.js","../node_modules/d3-shape/src/area.js","../node_modules/d3-shape/src/descending.js","../node_modules/d3-shape/src/identity.js","../node_modules/d3-shape/src/pie.js","../node_modules/d3-shape/src/curve/radial.js","../node_modules/d3-shape/src/lineRadial.js","../node_modules/d3-shape/src/areaRadial.js","../node_modules/d3-shape/src/pointRadial.js","../node_modules/d3-shape/src/curve/bump.js","../node_modules/d3-shape/src/link.js","../node_modules/d3-shape/src/symbol/asterisk.js","../node_modules/d3-shape/src/symbol/circle.js","../node_modules/d3-shape/src/symbol/cross.js","../node_modules/d3-shape/src/symbol/diamond.js","../node_modules/d3-shape/src/symbol/diamond2.js","../node_modules/d3-shape/src/symbol/plus.js","../node_modules/d3-shape/src/symbol/square.js","../node_modules/d3-shape/src/symbol/square2.js","../node_modules/d3-shape/src/symbol/star.js","../node_modules/d3-shape/src/symbol/triangle.js","../node_modules/d3-shape/src/symbol/triangle2.js","../node_modules/d3-shape/src/symbol/wye.js","../node_modules/d3-shape/src/symbol/times.js","../node_modules/d3-shape/src/symbol.js","../node_modules/d3-shape/src/noop.js","../node_modules/d3-shape/src/curve/basis.js","../node_modules/d3-shape/src/curve/basisClosed.js","../node_modules/d3-shape/src/curve/basisOpen.js","../node_modules/d3-shape/src/curve/bundle.js","../node_modules/d3-shape/src/curve/cardinal.js","../node_modules/d3-shape/src/curve/cardinalClosed.js","../node_modules/d3-shape/src/curve/cardinalOpen.js","../node_modules/d3-shape/src/curve/catmullRom.js","../node_modules/d3-shape/src/curve/catmullRomClosed.js","../node_modules/d3-shape/src/curve/catmullRomOpen.js","../node_modules/d3-shape/src/curve/linearClosed.js","../node_modules/d3-shape/src/curve/monotone.js","../node_modules/d3-shape/src/curve/natural.js","../node_modules/d3-shape/src/curve/step.js","../node_modules/d3-shape/src/offset/none.js","../node_modules/d3-shape/src/order/none.js","../node_modules/d3-shape/src/stack.js","../node_modules/d3-shape/src/offset/expand.js","../node_modules/d3-shape/src/offset/diverging.js","../node_modules/d3-shape/src/offset/silhouette.js","../node_modules/d3-shape/src/offset/wiggle.js","../node_modules/d3-shape/src/order/appearance.js","../node_modules/d3-shape/src/order/ascending.js","../node_modules/d3-shape/src/order/descending.js","../node_modules/d3-shape/src/order/insideOut.js","../node_modules/d3-shape/src/order/reverse.js","../node_modules/d3-shape/src/index.js","../node_modules/@appland/diagrams/dist/index.cjs","../node_modules/tty-browserify/index.js","../node_modules/picocolors/picocolors.js","../node_modules/postcss/lib/tokenize.js","../node_modules/postcss/lib/terminal-highlight.js","../node_modules/postcss/lib/css-syntax-error.js","../node_modules/postcss/lib/symbols.js","../node_modules/postcss/lib/stringifier.js","../node_modules/postcss/lib/stringify.js","../node_modules/postcss/lib/node.js","../node_modules/postcss/lib/declaration.js","../node_modules/source-map-js/lib/base64.js","../node_modules/source-map-js/lib/base64-vlq.js","../node_modules/source-map-js/lib/util.js","../node_modules/source-map-js/lib/array-set.js","../node_modules/source-map-js/lib/mapping-list.js","../node_modules/source-map-js/lib/source-map-generator.js","../node_modules/source-map-js/lib/binary-search.js","../node_modules/source-map-js/lib/quick-sort.js","../node_modules/source-map-js/lib/source-map-consumer.js","../node_modules/source-map-js/lib/source-node.js","../node_modules/source-map-js/source-map.js","../node_modules/path-browserify/index.js","../node_modules/nanoid/non-secure/index.cjs","../node_modules/idb-wrapper/idbstore.js","../node_modules/xtend/index.js","../node_modules/abstract-leveldown/abstract-iterator.js","../node_modules/abstract-leveldown/abstract-chained-batch.js","../node_modules/abstract-leveldown/abstract-leveldown.js","../node_modules/ltgt/index.js","../node_modules/level-js/iterator.js","../node_modules/isbuffer/index.js","../node_modules/level-js/node_modules/object-keys/foreach.js","../node_modules/level-js/node_modules/object-keys/isArguments.js","../node_modules/level-js/node_modules/object-keys/shim.js","../node_modules/level-js/node_modules/object-keys/index.js","../node_modules/level-js/node_modules/xtend/has-keys.js","../node_modules/level-js/node_modules/xtend/index.js","../node_modules/typedarray-to-buffer/index.js","../node_modules/level-js/index.js","../node_modules/prr/prr.js","../node_modules/deferred-leveldown/deferred-leveldown.js","../node_modules/errno/node_modules/prr/prr.js","../node_modules/errno/custom.js","../node_modules/errno/errno.js","../node_modules/levelup/lib/errors.js","../node_modules/isarray/index.js","../node_modules/levelup/node_modules/readable-stream/lib/_stream_readable.js","../node_modules/levelup/node_modules/readable-stream/lib/_stream_duplex.js","../node_modules/levelup/node_modules/readable-stream/lib/_stream_writable.js","../node_modules/levelup/node_modules/readable-stream/lib/_stream_transform.js","../node_modules/levelup/node_modules/readable-stream/lib/_stream_passthrough.js","../node_modules/levelup/node_modules/readable-stream/readable.js","../node_modules/levelup/package.json","../node_modules/semver/semver.browser.js","../node_modules/levelup/lib/util.js","../node_modules/levelup/lib/read-stream.js","../node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js","../node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js","../node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js","../node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js","../node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js","../node_modules/bl/node_modules/readable-stream/readable.js","../node_modules/bl/bl.js","../node_modules/levelup/lib/write-stream.js","../node_modules/levelup/lib/batch.js","../node_modules/levelup/lib/levelup.js","../node_modules/fwd-stream/node_modules/readable-stream/lib/_stream_readable.js","../node_modules/fwd-stream/node_modules/readable-stream/lib/_stream_duplex.js","../node_modules/fwd-stream/node_modules/readable-stream/lib/_stream_writable.js","../node_modules/fwd-stream/node_modules/readable-stream/writable.js","../node_modules/fwd-stream/node_modules/readable-stream/lib/_stream_transform.js","../node_modules/fwd-stream/node_modules/readable-stream/lib/_stream_passthrough.js","../node_modules/fwd-stream/node_modules/readable-stream/readable.js","../node_modules/fwd-stream/node_modules/readable-stream/duplex.js","../node_modules/fwd-stream/index.js","../node_modules/string-range/index.js","../node_modules/clone/clone.js","../node_modules/level-fix-range/index.js","../node_modules/is/index.js","../node_modules/foreach/index.js","../node_modules/level-sublevel/node_modules/object-keys/shim.js","../node_modules/level-sublevel/node_modules/object-keys/index.js","../node_modules/level-sublevel/node_modules/xtend/has-keys.js","../node_modules/level-sublevel/node_modules/xtend/index.js","../node_modules/level-sublevel/batch.js","../node_modules/level-sublevel/sub.js","../node_modules/level-hooks/index.js","../node_modules/level-sublevel/index.js","../node_modules/level-blobs/node_modules/readable-stream/lib/_stream_readable.js","../node_modules/level-blobs/node_modules/readable-stream/lib/_stream_duplex.js","../node_modules/level-blobs/node_modules/readable-stream/lib/_stream_writable.js","../node_modules/level-blobs/node_modules/readable-stream/writable.js","../node_modules/level-blobs/node_modules/readable-stream/lib/_stream_transform.js","../node_modules/level-blobs/node_modules/readable-stream/lib/_stream_passthrough.js","../node_modules/level-blobs/node_modules/readable-stream/readable.js","../node_modules/level-peek/node_modules/level-fix-range/index.js","../node_modules/level-peek/index.js","../node_modules/wrappy/wrappy.js","../node_modules/once/once.js","../node_modules/level-blobs/index.js","../node_modules/octal/index.js","../node_modules/level-filesystem/errno.js","../node_modules/buffer-from/index.js","../node_modules/typedarray/index.js","../node_modules/concat-stream/index.js","../node_modules/level-filesystem/stat.js","../node_modules/level-filesystem/node_modules/xtend/has-keys.js","../node_modules/level-filesystem/node_modules/xtend/index.js","../node_modules/level-filesystem/paths.js","../node_modules/level-filesystem/watchers.js","../node_modules/level-filesystem/index.js","../node_modules/browserify-fs/index.js","../node_modules/postcss/lib/previous-map.js","../node_modules/postcss/lib/input.js","../node_modules/postcss/lib/map-generator.js","../node_modules/postcss/lib/comment.js","../node_modules/postcss/lib/container.js","../node_modules/postcss/lib/document.js","../node_modules/postcss/lib/warn-once.js","../node_modules/postcss/lib/warning.js","../node_modules/postcss/lib/result.js","../node_modules/postcss/lib/at-rule.js","../node_modules/postcss/lib/root.js","../node_modules/postcss/lib/list.js","../node_modules/postcss/lib/rule.js","../node_modules/postcss/lib/parser.js","../node_modules/postcss/lib/parse.js","../node_modules/postcss/lib/lazy-result.js","../node_modules/postcss/lib/no-work-result.js","../node_modules/postcss/lib/processor.js","../node_modules/postcss/lib/fromJSON.js","../node_modules/postcss/lib/postcss.js","../node_modules/postcss-value-parser/lib/parse.js","../node_modules/postcss-value-parser/lib/walk.js","../node_modules/postcss-value-parser/lib/stringify.js","../node_modules/postcss-value-parser/lib/unit.js","../node_modules/postcss-value-parser/lib/index.js","../node_modules/gradient-parser/build/node.js","../node_modules/highlight.js/lib/languages/1c.js","../node_modules/highlight.js/lib/languages/abnf.js","../node_modules/highlight.js/lib/languages/accesslog.js","../node_modules/highlight.js/lib/languages/actionscript.js","../node_modules/highlight.js/lib/languages/ada.js","../node_modules/highlight.js/lib/languages/angelscript.js","../node_modules/highlight.js/lib/languages/apache.js","../node_modules/highlight.js/lib/languages/applescript.js","../node_modules/highlight.js/lib/languages/arcade.js","../node_modules/highlight.js/lib/languages/arduino.js","../node_modules/highlight.js/lib/languages/armasm.js","../node_modules/highlight.js/lib/languages/xml.js","../node_modules/highlight.js/lib/languages/asciidoc.js","../node_modules/highlight.js/lib/languages/aspectj.js","../node_modules/highlight.js/lib/languages/autohotkey.js","../node_modules/highlight.js/lib/languages/autoit.js","../node_modules/highlight.js/lib/languages/avrasm.js","../node_modules/highlight.js/lib/languages/awk.js","../node_modules/highlight.js/lib/languages/axapta.js","../node_modules/highlight.js/lib/languages/bash.js","../node_modules/highlight.js/lib/languages/basic.js","../node_modules/highlight.js/lib/languages/bnf.js","../node_modules/highlight.js/lib/languages/brainfuck.js","../node_modules/highlight.js/lib/languages/c.js","../node_modules/highlight.js/lib/languages/cal.js","../node_modules/highlight.js/lib/languages/capnproto.js","../node_modules/highlight.js/lib/languages/ceylon.js","../node_modules/highlight.js/lib/languages/clean.js","../node_modules/highlight.js/lib/languages/clojure.js","../node_modules/highlight.js/lib/languages/clojure-repl.js","../node_modules/highlight.js/lib/languages/cmake.js","../node_modules/highlight.js/lib/languages/coffeescript.js","../node_modules/highlight.js/lib/languages/coq.js","../node_modules/highlight.js/lib/languages/cos.js","../node_modules/highlight.js/lib/languages/cpp.js","../node_modules/highlight.js/lib/languages/crmsh.js","../node_modules/highlight.js/lib/languages/crystal.js","../node_modules/highlight.js/lib/languages/csharp.js","../node_modules/highlight.js/lib/languages/csp.js","../node_modules/highlight.js/lib/languages/css.js","../node_modules/highlight.js/lib/languages/d.js","../node_modules/highlight.js/lib/languages/markdown.js","../node_modules/highlight.js/lib/languages/dart.js","../node_modules/highlight.js/lib/languages/delphi.js","../node_modules/highlight.js/lib/languages/diff.js","../node_modules/highlight.js/lib/languages/django.js","../node_modules/highlight.js/lib/languages/dns.js","../node_modules/highlight.js/lib/languages/dockerfile.js","../node_modules/highlight.js/lib/languages/dos.js","../node_modules/highlight.js/lib/languages/dsconfig.js","../node_modules/highlight.js/lib/languages/dts.js","../node_modules/highlight.js/lib/languages/dust.js","../node_modules/highlight.js/lib/languages/ebnf.js","../node_modules/highlight.js/lib/languages/elixir.js","../node_modules/highlight.js/lib/languages/elm.js","../node_modules/highlight.js/lib/languages/ruby.js","../node_modules/highlight.js/lib/languages/erb.js","../node_modules/highlight.js/lib/languages/erlang-repl.js","../node_modules/highlight.js/lib/languages/erlang.js","../node_modules/highlight.js/lib/languages/excel.js","../node_modules/highlight.js/lib/languages/fix.js","../node_modules/highlight.js/lib/languages/flix.js","../node_modules/highlight.js/lib/languages/fortran.js","../node_modules/highlight.js/lib/languages/fsharp.js","../node_modules/highlight.js/lib/languages/gams.js","../node_modules/highlight.js/lib/languages/gauss.js","../node_modules/highlight.js/lib/languages/gcode.js","../node_modules/highlight.js/lib/languages/gherkin.js","../node_modules/highlight.js/lib/languages/glsl.js","../node_modules/highlight.js/lib/languages/gml.js","../node_modules/highlight.js/lib/languages/go.js","../node_modules/highlight.js/lib/languages/golo.js","../node_modules/highlight.js/lib/languages/gradle.js","../node_modules/highlight.js/lib/languages/graphql.js","../node_modules/highlight.js/lib/languages/groovy.js","../node_modules/highlight.js/lib/languages/haml.js","../node_modules/highlight.js/lib/languages/handlebars.js","../node_modules/highlight.js/lib/languages/haskell.js","../node_modules/highlight.js/lib/languages/haxe.js","../node_modules/highlight.js/lib/languages/hsp.js","../node_modules/highlight.js/lib/languages/http.js","../node_modules/highlight.js/lib/languages/hy.js","../node_modules/highlight.js/lib/languages/inform7.js","../node_modules/highlight.js/lib/languages/ini.js","../node_modules/highlight.js/lib/languages/irpf90.js","../node_modules/highlight.js/lib/languages/isbl.js","../node_modules/highlight.js/lib/languages/java.js","../node_modules/highlight.js/lib/languages/javascript.js","../node_modules/highlight.js/lib/languages/jboss-cli.js","../node_modules/highlight.js/lib/languages/json.js","../node_modules/highlight.js/lib/languages/julia.js","../node_modules/highlight.js/lib/languages/julia-repl.js","../node_modules/highlight.js/lib/languages/kotlin.js","../node_modules/highlight.js/lib/languages/lasso.js","../node_modules/highlight.js/lib/languages/latex.js","../node_modules/highlight.js/lib/languages/ldif.js","../node_modules/highlight.js/lib/languages/leaf.js","../node_modules/highlight.js/lib/languages/less.js","../node_modules/highlight.js/lib/languages/lisp.js","../node_modules/highlight.js/lib/languages/livecodeserver.js","../node_modules/highlight.js/lib/languages/livescript.js","../node_modules/highlight.js/lib/languages/llvm.js","../node_modules/highlight.js/lib/languages/lsl.js","../node_modules/highlight.js/lib/languages/lua.js","../node_modules/highlight.js/lib/languages/makefile.js","../node_modules/highlight.js/lib/languages/mathematica.js","../node_modules/highlight.js/lib/languages/matlab.js","../node_modules/highlight.js/lib/languages/maxima.js","../node_modules/highlight.js/lib/languages/mel.js","../node_modules/highlight.js/lib/languages/mercury.js","../node_modules/highlight.js/lib/languages/mipsasm.js","../node_modules/highlight.js/lib/languages/mizar.js","../node_modules/highlight.js/lib/languages/perl.js","../node_modules/highlight.js/lib/languages/mojolicious.js","../node_modules/highlight.js/lib/languages/monkey.js","../node_modules/highlight.js/lib/languages/moonscript.js","../node_modules/highlight.js/lib/languages/n1ql.js","../node_modules/highlight.js/lib/languages/nestedtext.js","../node_modules/highlight.js/lib/languages/nginx.js","../node_modules/highlight.js/lib/languages/nim.js","../node_modules/highlight.js/lib/languages/nix.js","../node_modules/highlight.js/lib/languages/node-repl.js","../node_modules/highlight.js/lib/languages/nsis.js","../node_modules/highlight.js/lib/languages/objectivec.js","../node_modules/highlight.js/lib/languages/ocaml.js","../node_modules/highlight.js/lib/languages/openscad.js","../node_modules/highlight.js/lib/languages/oxygene.js","../node_modules/highlight.js/lib/languages/parser3.js","../node_modules/highlight.js/lib/languages/pf.js","../node_modules/highlight.js/lib/languages/pgsql.js","../node_modules/highlight.js/lib/languages/php.js","../node_modules/highlight.js/lib/languages/php-template.js","../node_modules/highlight.js/lib/languages/plaintext.js","../node_modules/highlight.js/lib/languages/pony.js","../node_modules/highlight.js/lib/languages/powershell.js","../node_modules/highlight.js/lib/languages/processing.js","../node_modules/highlight.js/lib/languages/profile.js","../node_modules/highlight.js/lib/languages/prolog.js","../node_modules/highlight.js/lib/languages/properties.js","../node_modules/highlight.js/lib/languages/protobuf.js","../node_modules/highlight.js/lib/languages/puppet.js","../node_modules/highlight.js/lib/languages/purebasic.js","../node_modules/highlight.js/lib/languages/python.js","../node_modules/highlight.js/lib/languages/python-repl.js","../node_modules/highlight.js/lib/languages/q.js","../node_modules/highlight.js/lib/languages/qml.js","../node_modules/highlight.js/lib/languages/r.js","../node_modules/highlight.js/lib/languages/reasonml.js","../node_modules/highlight.js/lib/languages/rib.js","../node_modules/highlight.js/lib/languages/roboconf.js","../node_modules/highlight.js/lib/languages/routeros.js","../node_modules/highlight.js/lib/languages/rsl.js","../node_modules/highlight.js/lib/languages/ruleslanguage.js","../node_modules/highlight.js/lib/languages/rust.js","../node_modules/highlight.js/lib/languages/sas.js","../node_modules/highlight.js/lib/languages/scala.js","../node_modules/highlight.js/lib/languages/scheme.js","../node_modules/highlight.js/lib/languages/scilab.js","../node_modules/highlight.js/lib/languages/scss.js","../node_modules/highlight.js/lib/languages/shell.js","../node_modules/highlight.js/lib/languages/smali.js","../node_modules/highlight.js/lib/languages/smalltalk.js","../node_modules/highlight.js/lib/languages/sml.js","../node_modules/highlight.js/lib/languages/sqf.js","../node_modules/highlight.js/lib/languages/sql.js","../node_modules/highlight.js/lib/languages/stan.js","../node_modules/highlight.js/lib/languages/stata.js","../node_modules/highlight.js/lib/languages/step21.js","../node_modules/highlight.js/lib/languages/stylus.js","../node_modules/highlight.js/lib/languages/subunit.js","../node_modules/highlight.js/lib/languages/swift.js","../node_modules/highlight.js/lib/languages/taggerscript.js","../node_modules/highlight.js/lib/languages/yaml.js","../node_modules/highlight.js/lib/languages/tap.js","../node_modules/highlight.js/lib/languages/tcl.js","../node_modules/highlight.js/lib/languages/thrift.js","../node_modules/highlight.js/lib/languages/tp.js","../node_modules/highlight.js/lib/languages/twig.js","../node_modules/highlight.js/lib/languages/typescript.js","../node_modules/highlight.js/lib/languages/vala.js","../node_modules/highlight.js/lib/languages/vbnet.js","../node_modules/highlight.js/lib/languages/vbscript.js","../node_modules/highlight.js/lib/languages/vbscript-html.js","../node_modules/highlight.js/lib/languages/verilog.js","../node_modules/highlight.js/lib/languages/vhdl.js","../node_modules/highlight.js/lib/languages/vim.js","../node_modules/highlight.js/lib/languages/wasm.js","../node_modules/highlight.js/lib/languages/wren.js","../node_modules/highlight.js/lib/languages/x86asm.js","../node_modules/highlight.js/lib/languages/xl.js","../node_modules/highlight.js/lib/languages/xquery.js","../node_modules/highlight.js/lib/languages/zephir.js","../node_modules/highlight.js/lib/index.js","../node_modules/ts-dedent/src/index.ts","../node_modules/dayjs/dayjs.min.js","../node_modules/@braintree/sanitize-url/dist/index.js","../node_modules/d3-array/src/ascending.js","../node_modules/d3-array/src/descending.js","../node_modules/d3-array/src/bisector.js","../node_modules/d3-array/src/number.js","../node_modules/d3-array/src/bisect.js","../node_modules/internmap/src/index.js","../node_modules/d3-array/src/ticks.js","../node_modules/d3-array/src/max.js","../node_modules/d3-array/src/min.js","../node_modules/d3-array/src/range.js","../node_modules/d3-array/src/index.js","../node_modules/d3-axis/src/identity.js","../node_modules/d3-axis/src/axis.js","../node_modules/d3-axis/src/index.js","../node_modules/d3-brush/src/constant.js","../node_modules/d3-brush/src/event.js","../node_modules/d3-brush/src/noevent.js","../node_modules/d3-brush/src/brush.js","../node_modules/d3-brush/src/index.js","../node_modules/d3-chord/src/index.js","../node_modules/d3-contour/src/index.js","../node_modules/d3-delaunay/src/index.js","../node_modules/d3-dsv/src/index.js","../node_modules/d3-fetch/src/text.js","../node_modules/d3-fetch/src/xml.js","../node_modules/d3-fetch/src/index.js","../node_modules/d3-quadtree/src/index.js","../node_modules/d3-force/src/index.js","../node_modules/d3-format/src/formatDecimal.js","../node_modules/d3-format/src/exponent.js","../node_modules/d3-format/src/formatGroup.js","../node_modules/d3-format/src/formatNumerals.js","../node_modules/d3-format/src/formatSpecifier.js","../node_modules/d3-format/src/formatTrim.js","../node_modules/d3-format/src/formatPrefixAuto.js","../node_modules/d3-format/src/formatRounded.js","../node_modules/d3-format/src/formatTypes.js","../node_modules/d3-format/src/identity.js","../node_modules/d3-format/src/locale.js","../node_modules/d3-format/src/defaultLocale.js","../node_modules/d3-format/src/precisionFixed.js","../node_modules/d3-format/src/precisionPrefix.js","../node_modules/d3-format/src/precisionRound.js","../node_modules/d3-format/src/index.js","../node_modules/d3-geo/src/index.js","../node_modules/d3-hierarchy/src/index.js","../node_modules/d3-polygon/src/index.js","../node_modules/d3-random/src/index.js","../node_modules/d3-scale/src/init.js","../node_modules/d3-scale/src/ordinal.js","../node_modules/d3-scale/src/band.js","../node_modules/d3-scale/src/constant.js","../node_modules/d3-scale/src/number.js","../node_modules/d3-scale/src/continuous.js","../node_modules/d3-scale/src/tickFormat.js","../node_modules/d3-scale/src/linear.js","../node_modules/d3-scale/src/nice.js","../node_modules/d3-time/src/interval.js","../node_modules/d3-time/src/millisecond.js","../node_modules/d3-time/src/duration.js","../node_modules/d3-time/src/second.js","../node_modules/d3-time/src/minute.js","../node_modules/d3-time/src/hour.js","../node_modules/d3-time/src/day.js","../node_modules/d3-time/src/week.js","../node_modules/d3-time/src/month.js","../node_modules/d3-time/src/year.js","../node_modules/d3-time/src/ticks.js","../node_modules/d3-time/src/index.js","../node_modules/d3-time-format/src/locale.js","../node_modules/d3-time-format/src/defaultLocale.js","../node_modules/d3-time-format/src/index.js","../node_modules/d3-scale/src/time.js","../node_modules/d3-scale/src/index.js","../node_modules/d3-scale-chromatic/src/colors.js","../node_modules/d3-scale-chromatic/src/categorical/Tableau10.js","../node_modules/d3-scale-chromatic/src/index.js","../node_modules/d3/src/index.js","../node_modules/mermaid/node_modules/dompurify/src/utils.js","../node_modules/mermaid/node_modules/dompurify/src/tags.js","../node_modules/mermaid/node_modules/dompurify/src/attrs.js","../node_modules/mermaid/node_modules/dompurify/src/regexp.js","../node_modules/mermaid/node_modules/dompurify/src/purify.js","../node_modules/khroma/dist/utils/channel.js","../node_modules/khroma/dist/utils/lang.js","../node_modules/khroma/dist/utils/unit.js","../node_modules/khroma/dist/utils/index.js","../node_modules/khroma/dist/constants.js","../node_modules/khroma/dist/channels/type.js","../node_modules/khroma/dist/channels/index.js","../node_modules/khroma/dist/channels/reusable.js","../node_modules/khroma/dist/color/hex.js","../node_modules/khroma/dist/color/hsl.js","../node_modules/khroma/dist/color/keyword.js","../node_modules/khroma/dist/color/rgb.js","../node_modules/khroma/dist/color/index.js","../node_modules/khroma/dist/methods/change.js","../node_modules/khroma/dist/methods/rgba.js","../node_modules/khroma/dist/methods/channel.js","../node_modules/khroma/dist/methods/luminance.js","../node_modules/khroma/dist/methods/is_light.js","../node_modules/khroma/dist/methods/is_dark.js","../node_modules/khroma/dist/methods/adjust_channel.js","../node_modules/khroma/dist/methods/lighten.js","../node_modules/khroma/dist/methods/darken.js","../node_modules/khroma/dist/methods/adjust.js","../node_modules/khroma/dist/methods/mix.js","../node_modules/khroma/dist/methods/invert.js","../node_modules/khroma/dist/methods/index.js","../node_modules/khroma/dist/index.js","../node_modules/lodash-es/_freeGlobal.js","../node_modules/lodash-es/_root.js","../node_modules/lodash-es/_Symbol.js","../node_modules/lodash-es/_getRawTag.js","../node_modules/lodash-es/_objectToString.js","../node_modules/lodash-es/_baseGetTag.js","../node_modules/lodash-es/isObject.js","../node_modules/lodash-es/isFunction.js","../node_modules/lodash-es/_coreJsData.js","../node_modules/lodash-es/_isMasked.js","../node_modules/lodash-es/_toSource.js","../node_modules/lodash-es/_baseIsNative.js","../node_modules/lodash-es/_getValue.js","../node_modules/lodash-es/_getNative.js","../node_modules/lodash-es/_nativeCreate.js","../node_modules/lodash-es/_hashClear.js","../node_modules/lodash-es/_hashDelete.js","../node_modules/lodash-es/_hashGet.js","../node_modules/lodash-es/_hashHas.js","../node_modules/lodash-es/_hashSet.js","../node_modules/lodash-es/_Hash.js","../node_modules/lodash-es/_listCacheClear.js","../node_modules/lodash-es/eq.js","../node_modules/lodash-es/_assocIndexOf.js","../node_modules/lodash-es/_listCacheDelete.js","../node_modules/lodash-es/_listCacheGet.js","../node_modules/lodash-es/_listCacheHas.js","../node_modules/lodash-es/_listCacheSet.js","../node_modules/lodash-es/_ListCache.js","../node_modules/lodash-es/_Map.js","../node_modules/lodash-es/_mapCacheClear.js","../node_modules/lodash-es/_isKeyable.js","../node_modules/lodash-es/_getMapData.js","../node_modules/lodash-es/_mapCacheDelete.js","../node_modules/lodash-es/_mapCacheGet.js","../node_modules/lodash-es/_mapCacheHas.js","../node_modules/lodash-es/_mapCacheSet.js","../node_modules/lodash-es/_MapCache.js","../node_modules/lodash-es/memoize.js","../node_modules/lodash-es/_stackClear.js","../node_modules/lodash-es/_stackDelete.js","../node_modules/lodash-es/_stackGet.js","../node_modules/lodash-es/_stackHas.js","../node_modules/lodash-es/_stackSet.js","../node_modules/lodash-es/_Stack.js","../node_modules/lodash-es/_defineProperty.js","../node_modules/lodash-es/_baseAssignValue.js","../node_modules/lodash-es/_assignMergeValue.js","../node_modules/lodash-es/_createBaseFor.js","../node_modules/lodash-es/_baseFor.js","../node_modules/lodash-es/_cloneBuffer.js","../node_modules/lodash-es/_Uint8Array.js","../node_modules/lodash-es/_cloneArrayBuffer.js","../node_modules/lodash-es/_cloneTypedArray.js","../node_modules/lodash-es/_copyArray.js","../node_modules/lodash-es/_baseCreate.js","../node_modules/lodash-es/_overArg.js","../node_modules/lodash-es/_getPrototype.js","../node_modules/lodash-es/_isPrototype.js","../node_modules/lodash-es/_initCloneObject.js","../node_modules/lodash-es/isObjectLike.js","../node_modules/lodash-es/_baseIsArguments.js","../node_modules/lodash-es/isArguments.js","../node_modules/lodash-es/isArray.js","../node_modules/lodash-es/isLength.js","../node_modules/lodash-es/isArrayLike.js","../node_modules/lodash-es/isArrayLikeObject.js","../node_modules/lodash-es/stubFalse.js","../node_modules/lodash-es/isBuffer.js","../node_modules/lodash-es/isPlainObject.js","../node_modules/lodash-es/_baseIsTypedArray.js","../node_modules/lodash-es/_baseUnary.js","../node_modules/lodash-es/_nodeUtil.js","../node_modules/lodash-es/isTypedArray.js","../node_modules/lodash-es/_safeGet.js","../node_modules/lodash-es/_assignValue.js","../node_modules/lodash-es/_copyObject.js","../node_modules/lodash-es/_baseTimes.js","../node_modules/lodash-es/_isIndex.js","../node_modules/lodash-es/_arrayLikeKeys.js","../node_modules/lodash-es/_nativeKeysIn.js","../node_modules/lodash-es/_baseKeysIn.js","../node_modules/lodash-es/keysIn.js","../node_modules/lodash-es/toPlainObject.js","../node_modules/lodash-es/_baseMergeDeep.js","../node_modules/lodash-es/_baseMerge.js","../node_modules/lodash-es/identity.js","../node_modules/lodash-es/_apply.js","../node_modules/lodash-es/_overRest.js","../node_modules/lodash-es/constant.js","../node_modules/lodash-es/_baseSetToString.js","../node_modules/lodash-es/_shortOut.js","../node_modules/lodash-es/_setToString.js","../node_modules/lodash-es/_baseRest.js","../node_modules/lodash-es/_isIterateeCall.js","../node_modules/lodash-es/_createAssigner.js","../node_modules/lodash-es/merge.js","../node_modules/stylis/src/Enum.js","../node_modules/stylis/src/Utility.js","../node_modules/stylis/src/Tokenizer.js","../node_modules/stylis/src/Parser.js","../node_modules/stylis/src/Prefixer.js","../node_modules/stylis/src/Serializer.js","../node_modules/stylis/src/Middleware.js","../node_modules/stylis/index.js","../node_modules/lodash-es/_nativeKeys.js","../node_modules/lodash-es/_baseKeys.js","../node_modules/lodash-es/_DataView.js","../node_modules/lodash-es/_Promise.js","../node_modules/lodash-es/_Set.js","../node_modules/lodash-es/_WeakMap.js","../node_modules/lodash-es/_getTag.js","../node_modules/lodash-es/isEmpty.js","../node_modules/katex/dist/katex.mjs","../node_modules/mermaid/dist/svgDrawCommon-5e1cfd1d.js","../node_modules/mermaid/dist/c4Diagram-ae766693.js","../node_modules/mermaid/dist/flowDb-c1833063.js","../node_modules/lodash-es/isSymbol.js","../node_modules/lodash-es/_arrayMap.js","../node_modules/lodash-es/_baseToString.js","../node_modules/lodash-es/_trimmedEndIndex.js","../node_modules/lodash-es/_baseTrim.js","../node_modules/lodash-es/toNumber.js","../node_modules/lodash-es/toFinite.js","../node_modules/lodash-es/toInteger.js","../node_modules/lodash-es/noop.js","../node_modules/lodash-es/_arrayEach.js","../node_modules/lodash-es/_baseFindIndex.js","../node_modules/lodash-es/_baseIsNaN.js","../node_modules/lodash-es/_strictIndexOf.js","../node_modules/lodash-es/_baseIndexOf.js","../node_modules/lodash-es/_arrayIncludes.js","../node_modules/lodash-es/keys.js","../node_modules/lodash-es/_isKey.js","../node_modules/lodash-es/_memoizeCapped.js","../node_modules/lodash-es/_stringToPath.js","../node_modules/lodash-es/toString.js","../node_modules/lodash-es/_castPath.js","../node_modules/lodash-es/_toKey.js","../node_modules/lodash-es/_baseGet.js","../node_modules/lodash-es/get.js","../node_modules/lodash-es/_arrayPush.js","../node_modules/lodash-es/_isFlattenable.js","../node_modules/lodash-es/_baseFlatten.js","../node_modules/lodash-es/flatten.js","../node_modules/lodash-es/_flatRest.js","../node_modules/lodash-es/_hasUnicode.js","../node_modules/lodash-es/_arrayReduce.js","../node_modules/lodash-es/_baseAssign.js","../node_modules/lodash-es/_baseAssignIn.js","../node_modules/lodash-es/_arrayFilter.js","../node_modules/lodash-es/stubArray.js","../node_modules/lodash-es/_getSymbols.js","../node_modules/lodash-es/_copySymbols.js","../node_modules/lodash-es/_getSymbolsIn.js","../node_modules/lodash-es/_copySymbolsIn.js","../node_modules/lodash-es/_baseGetAllKeys.js","../node_modules/lodash-es/_getAllKeys.js","../node_modules/lodash-es/_getAllKeysIn.js","../node_modules/lodash-es/_initCloneArray.js","../node_modules/lodash-es/_cloneDataView.js","../node_modules/lodash-es/_cloneRegExp.js","../node_modules/lodash-es/_cloneSymbol.js","../node_modules/lodash-es/_initCloneByTag.js","../node_modules/lodash-es/_baseIsMap.js","../node_modules/lodash-es/isMap.js","../node_modules/lodash-es/_baseIsSet.js","../node_modules/lodash-es/isSet.js","../node_modules/lodash-es/_baseClone.js","../node_modules/lodash-es/clone.js","../node_modules/lodash-es/cloneDeep.js","../node_modules/lodash-es/_setCacheAdd.js","../node_modules/lodash-es/_setCacheHas.js","../node_modules/lodash-es/_SetCache.js","../node_modules/lodash-es/_arraySome.js","../node_modules/lodash-es/_cacheHas.js","../node_modules/lodash-es/_equalArrays.js","../node_modules/lodash-es/_mapToArray.js","../node_modules/lodash-es/_setToArray.js","../node_modules/lodash-es/_equalByTag.js","../node_modules/lodash-es/_equalObjects.js","../node_modules/lodash-es/_baseIsEqualDeep.js","../node_modules/lodash-es/_baseIsEqual.js","../node_modules/lodash-es/_baseIsMatch.js","../node_modules/lodash-es/_isStrictComparable.js","../node_modules/lodash-es/_getMatchData.js","../node_modules/lodash-es/_matchesStrictComparable.js","../node_modules/lodash-es/_baseMatches.js","../node_modules/lodash-es/_baseHasIn.js","../node_modules/lodash-es/_hasPath.js","../node_modules/lodash-es/hasIn.js","../node_modules/lodash-es/_baseMatchesProperty.js","../node_modules/lodash-es/_baseProperty.js","../node_modules/lodash-es/_basePropertyDeep.js","../node_modules/lodash-es/property.js","../node_modules/lodash-es/_baseIteratee.js","../node_modules/lodash-es/_baseForOwn.js","../node_modules/lodash-es/_createBaseEach.js","../node_modules/lodash-es/_baseEach.js","../node_modules/lodash-es/now.js","../node_modules/lodash-es/defaults.js","../node_modules/lodash-es/_arrayIncludesWith.js","../node_modules/lodash-es/last.js","../node_modules/lodash-es/_castFunction.js","../node_modules/lodash-es/forEach.js","../node_modules/lodash-es/each.js","../node_modules/lodash-es/_baseFilter.js","../node_modules/lodash-es/filter.js","../node_modules/lodash-es/_createFind.js","../node_modules/lodash-es/findIndex.js","../node_modules/lodash-es/find.js","../node_modules/lodash-es/_baseMap.js","../node_modules/lodash-es/map.js","../node_modules/lodash-es/forIn.js","../node_modules/lodash-es/forOwn.js","../node_modules/lodash-es/_baseGt.js","../node_modules/lodash-es/_baseHas.js","../node_modules/lodash-es/has.js","../node_modules/lodash-es/isString.js","../node_modules/lodash-es/_baseValues.js","../node_modules/lodash-es/values.js","../node_modules/lodash-es/isUndefined.js","../node_modules/lodash-es/_baseLt.js","../node_modules/lodash-es/mapValues.js","../node_modules/lodash-es/_baseExtremum.js","../node_modules/lodash-es/max.js","../node_modules/lodash-es/min.js","../node_modules/lodash-es/minBy.js","../node_modules/lodash-es/_baseSet.js","../node_modules/lodash-es/_basePickBy.js","../node_modules/lodash-es/_baseSortBy.js","../node_modules/lodash-es/_compareAscending.js","../node_modules/lodash-es/_compareMultiple.js","../node_modules/lodash-es/_baseOrderBy.js","../node_modules/lodash-es/_asciiSize.js","../node_modules/lodash-es/_unicodeSize.js","../node_modules/lodash-es/_stringSize.js","../node_modules/lodash-es/_basePick.js","../node_modules/lodash-es/pick.js","../node_modules/lodash-es/_baseRange.js","../node_modules/lodash-es/_createRange.js","../node_modules/lodash-es/range.js","../node_modules/lodash-es/_baseReduce.js","../node_modules/lodash-es/reduce.js","../node_modules/lodash-es/size.js","../node_modules/lodash-es/sortBy.js","../node_modules/lodash-es/_createSet.js","../node_modules/lodash-es/_baseUniq.js","../node_modules/lodash-es/union.js","../node_modules/lodash-es/uniqueId.js","../node_modules/lodash-es/_baseZipObject.js","../node_modules/lodash-es/zipObject.js","../node_modules/lodash-es/lodash.js","../node_modules/dagre-d3-es/src/graphlib/graph.js","../node_modules/dagre-d3-es/src/graphlib/index.js","../node_modules/dagre-d3-es/src/dagre/data/list.js","../node_modules/dagre-d3-es/src/dagre/greedy-fas.js","../node_modules/dagre-d3-es/src/dagre/acyclic.js","../node_modules/dagre-d3-es/src/dagre/util.js","../node_modules/dagre-d3-es/src/dagre/add-border-segments.js","../node_modules/dagre-d3-es/src/dagre/coordinate-system.js","../node_modules/dagre-d3-es/src/dagre/normalize.js","../node_modules/dagre-d3-es/src/dagre/rank/util.js","../node_modules/dagre-d3-es/src/dagre/rank/feasible-tree.js","../node_modules/dagre-d3-es/src/graphlib/alg/components.js","../node_modules/dagre-d3-es/src/graphlib/data/priority-queue.js","../node_modules/dagre-d3-es/src/graphlib/alg/dijkstra.js","../node_modules/dagre-d3-es/src/graphlib/alg/dijkstra-all.js","../node_modules/dagre-d3-es/src/graphlib/alg/tarjan.js","../node_modules/dagre-d3-es/src/graphlib/alg/find-cycles.js","../node_modules/dagre-d3-es/src/graphlib/alg/floyd-warshall.js","../node_modules/dagre-d3-es/src/graphlib/alg/topsort.js","../node_modules/dagre-d3-es/src/graphlib/alg/is-acyclic.js","../node_modules/dagre-d3-es/src/graphlib/alg/dfs.js","../node_modules/dagre-d3-es/src/graphlib/alg/postorder.js","../node_modules/dagre-d3-es/src/graphlib/alg/preorder.js","../node_modules/dagre-d3-es/src/graphlib/alg/prim.js","../node_modules/dagre-d3-es/src/graphlib/alg/index.js","../node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js","../node_modules/dagre-d3-es/src/dagre/rank/index.js","../node_modules/dagre-d3-es/src/dagre/nesting-graph.js","../node_modules/dagre-d3-es/src/dagre/order/add-subgraph-constraints.js","../node_modules/dagre-d3-es/src/dagre/order/build-layer-graph.js","../node_modules/dagre-d3-es/src/dagre/order/cross-count.js","../node_modules/dagre-d3-es/src/dagre/order/init-order.js","../node_modules/dagre-d3-es/src/dagre/order/barycenter.js","../node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js","../node_modules/dagre-d3-es/src/dagre/order/sort.js","../node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js","../node_modules/dagre-d3-es/src/dagre/order/index.js","../node_modules/dagre-d3-es/src/dagre/parent-dummy-chains.js","../node_modules/dagre-d3-es/src/dagre/position/bk.js","../node_modules/dagre-d3-es/src/dagre/position/index.js","../node_modules/dagre-d3-es/src/dagre/layout.js","../node_modules/dagre-d3-es/src/dagre/index.js","../node_modules/dagre-d3-es/src/dagre-js/util.js","../node_modules/dagre-d3-es/src/dagre-js/arrows.js","../node_modules/dagre-d3-es/src/dagre-js/label/add-html-label.js","../node_modules/dagre-d3-es/src/dagre-js/label/add-svg-label.js","../node_modules/dagre-d3-es/src/dagre-js/label/add-text-label.js","../node_modules/dagre-d3-es/src/dagre-js/label/add-label.js","../node_modules/dagre-d3-es/src/dagre-js/create-clusters.js","../node_modules/dagre-d3-es/src/dagre-js/create-edge-labels.js","../node_modules/dagre-d3-es/src/dagre-js/intersect/intersect-node.js","../node_modules/dagre-d3-es/src/dagre-js/create-edge-paths.js","../node_modules/dagre-d3-es/src/dagre-js/create-nodes.js","../node_modules/dagre-d3-es/src/dagre-js/position-clusters.js","../node_modules/dagre-d3-es/src/dagre-js/position-edge-labels.js","../node_modules/dagre-d3-es/src/dagre-js/position-nodes.js","../node_modules/dagre-d3-es/src/dagre-js/intersect/intersect-ellipse.js","../node_modules/dagre-d3-es/src/dagre-js/intersect/intersect-circle.js","../node_modules/dagre-d3-es/src/dagre-js/intersect/intersect-line.js","../node_modules/dagre-d3-es/src/dagre-js/intersect/intersect-polygon.js","../node_modules/dagre-d3-es/src/dagre-js/intersect/intersect-rect.js","../node_modules/dagre-d3-es/src/dagre-js/shapes.js","../node_modules/dagre-d3-es/src/dagre-js/render.js","../node_modules/dagre-d3-es/src/dagre-js/intersect/index.js","../node_modules/dagre-d3-es/src/index.js","../node_modules/dagre-d3-es/src/graphlib/json.js","../node_modules/mdast-util-to-string/lib/index.js","../node_modules/mdast-util-to-string/index.js","../node_modules/micromark-util-chunked/index.js","../node_modules/micromark-util-combine-extensions/index.js","../node_modules/micromark-util-character/lib/unicode-punctuation-regex.js","../node_modules/micromark-util-character/index.js","../node_modules/micromark-factory-space/index.js","../node_modules/micromark/lib/initialize/content.js","../node_modules/micromark/lib/initialize/document.js","../node_modules/micromark-util-classify-character/index.js","../node_modules/micromark-util-resolve-all/index.js","../node_modules/micromark-core-commonmark/lib/attention.js","../node_modules/micromark-core-commonmark/lib/autolink.js","../node_modules/micromark-core-commonmark/lib/blank-line.js","../node_modules/micromark-core-commonmark/lib/block-quote.js","../node_modules/micromark-core-commonmark/lib/character-escape.js","../node_modules/character-entities/index.js","../node_modules/decode-named-character-reference/index.js","../node_modules/micromark-core-commonmark/lib/character-reference.js","../node_modules/micromark-core-commonmark/lib/code-fenced.js","../node_modules/micromark-core-commonmark/lib/code-indented.js","../node_modules/micromark-core-commonmark/lib/code-text.js","../node_modules/micromark-util-subtokenize/index.js","../node_modules/micromark-core-commonmark/lib/content.js","../node_modules/micromark-factory-destination/index.js","../node_modules/micromark-factory-label/index.js","../node_modules/micromark-factory-title/index.js","../node_modules/micromark-factory-whitespace/index.js","../node_modules/micromark-util-normalize-identifier/index.js","../node_modules/micromark-core-commonmark/lib/definition.js","../node_modules/micromark-core-commonmark/lib/hard-break-escape.js","../node_modules/micromark-core-commonmark/lib/heading-atx.js","../node_modules/micromark-util-html-tag-name/index.js","../node_modules/micromark-core-commonmark/lib/html-flow.js","../node_modules/micromark-core-commonmark/lib/html-text.js","../node_modules/micromark-core-commonmark/lib/label-end.js","../node_modules/micromark-core-commonmark/lib/label-start-image.js","../node_modules/micromark-core-commonmark/lib/label-start-link.js","../node_modules/micromark-core-commonmark/lib/line-ending.js","../node_modules/micromark-core-commonmark/lib/thematic-break.js","../node_modules/micromark-core-commonmark/lib/list.js","../node_modules/micromark-core-commonmark/lib/setext-underline.js","../node_modules/micromark-core-commonmark/index.js","../node_modules/micromark/lib/initialize/flow.js","../node_modules/micromark/lib/initialize/text.js","../node_modules/micromark/lib/create-tokenizer.js","../node_modules/micromark/lib/constructs.js","../node_modules/micromark/lib/parse.js","../node_modules/micromark/lib/preprocess.js","../node_modules/micromark/lib/postprocess.js","../node_modules/micromark-util-decode-numeric-character-reference/index.js","../node_modules/micromark-util-decode-string/index.js","../node_modules/unist-util-stringify-position/lib/index.js","../node_modules/unist-util-stringify-position/index.js","../node_modules/mdast-util-from-markdown/lib/index.js","../node_modules/mdast-util-from-markdown/index.js","../node_modules/mermaid/dist/createText-ca0c5216.js","../node_modules/mermaid/dist/edges-066a5561.js","../node_modules/mermaid/dist/index-01f381cb.js","../node_modules/mermaid/dist/styles-483fbfea.js","../node_modules/mermaid/dist/flowDiagram-b222e15a.js","../node_modules/mermaid/dist/flowDiagram-v2-13329dc7.js","../node_modules/mermaid/node_modules/uuid/dist/esm-node/regex.js","../node_modules/mermaid/node_modules/uuid/dist/esm-node/validate.js","../node_modules/mermaid/node_modules/uuid/dist/esm-node/stringify.js","../node_modules/mermaid/node_modules/uuid/dist/esm-node/parse.js","../node_modules/mermaid/node_modules/uuid/dist/esm-node/v35.js","../node_modules/mermaid/node_modules/uuid/dist/esm-node/sha1.js","../node_modules/mermaid/node_modules/uuid/dist/esm-node/v5.js","../node_modules/mermaid/node_modules/uuid/dist/esm-node/index.js","../node_modules/mermaid/dist/erDiagram-09d1c15f.js","../node_modules/mermaid/dist/gitGraphDiagram-942e62fe.js","../node_modules/dayjs/plugin/isoWeek.js","../node_modules/dayjs/plugin/customParseFormat.js","../node_modules/dayjs/plugin/advancedFormat.js","../node_modules/mermaid/dist/ganttDiagram-b62c793e.js","../node_modules/mermaid/dist/infoDiagram-94cd232f.js","../node_modules/mermaid/dist/pieDiagram-bb1d19e5.js","../node_modules/mermaid/dist/quadrantDiagram-c759a472.js","../node_modules/mermaid/dist/xychartDiagram-f11f50a6.js","../node_modules/mermaid/dist/requirementDiagram-87253d64.js","../node_modules/mermaid/dist/sequenceDiagram-6894f283.js","../node_modules/mermaid/dist/styles-b83b31c9.js","../node_modules/mermaid/dist/classDiagram-fb54d2a0.js","../node_modules/mermaid/dist/classDiagram-v2-a2b738ad.js","../node_modules/mermaid/dist/styles-0784dbeb.js","../node_modules/mermaid/dist/stateDiagram-5dee940d.js","../node_modules/mermaid/dist/stateDiagram-v2-1992cada.js","../node_modules/mermaid/dist/journeyDiagram-6625b456.js","../node_modules/elkjs/lib/elk.bundled.js","../node_modules/mermaid/dist/flowchart-elk-definition-ae0efee6.js","../node_modules/mermaid/dist/timeline-definition-bf702344.js","../node_modules/cytoscape/dist/cytoscape.esm.mjs","../node_modules/layout-base/layout-base.js","../node_modules/cose-base/cose-base.js","../node_modules/cytoscape-cose-bilkent/cytoscape-cose-bilkent.js","../node_modules/mermaid/dist/mindmap-definition-307c710a.js","../node_modules/d3-sankey/node_modules/d3-array/dist/d3-array.js","../node_modules/d3-sankey/node_modules/d3-path/dist/d3-path.js","../node_modules/d3-sankey/node_modules/d3-shape/dist/d3-shape.js","../node_modules/d3-sankey/dist/d3-sankey.js","../node_modules/mermaid/dist/sankeyDiagram-707fac0f.js","../node_modules/mermaid/dist/blockDiagram-9f4a6865.js","../node_modules/mermaid/dist/mermaid-6dc72991.js","../node_modules/object-keys/isArguments.js","../node_modules/object-keys/implementation.js","../node_modules/object-keys/index.js","../node_modules/object.assign/implementation.js","../node_modules/object.assign/polyfill.js","../node_modules/assert/assert.js","../node_modules/sax/lib/sax.js","../node_modules/dompurify/src/utils.js","../node_modules/dompurify/src/tags.js","../node_modules/dompurify/src/attrs.js","../node_modules/dompurify/src/regexp.js","../node_modules/dompurify/src/purify.js","../node_modules/@appland/client/src/loadConfiguration.ts","../node_modules/stream-http/lib/capability.js","../node_modules/stream-http/lib/response.js","../node_modules/to-arraybuffer/index.js","../node_modules/stream-http/lib/request.js","../node_modules/stream-http/node_modules/xtend/immutable.js","../node_modules/builtin-status-codes/browser.js","../node_modules/stream-http/index.js","../node_modules/https-browserify/index.js","../node_modules/@appland/client/src/configuration.ts","../node_modules/@appland/client/src/buildRequest.ts","../node_modules/@appland/client/src/handleError.ts","../node_modules/@appland/client/src/get.ts","../node_modules/@appland/client/src/retryOn503.ts","../node_modules/@appland/client/src/retryOnError.ts","../node_modules/@appland/client/src/reportJson.ts","../node_modules/@appland/client/src/verbose.ts","../node_modules/@appland/client/src/retry.ts","../node_modules/@appland/client/src/licenseKey.ts","../node_modules/@appland/client/src/mapset.ts","../node_modules/@appland/client/src/app.ts","../node_modules/form-data/lib/browser.js","../node_modules/@appland/client/src/appMap.ts","../node_modules/@appland/client/src/makeRequest.ts","../node_modules/@appland/client/src/usage.ts","../node_modules/socket.io-client/node_modules/engine.io-client/node_modules/engine.io-parser/build/esm/commons.js","../node_modules/socket.io-client/node_modules/engine.io-client/node_modules/engine.io-parser/build/esm/encodePacket.browser.js","../node_modules/socket.io-client/node_modules/engine.io-client/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.js","../node_modules/socket.io-client/node_modules/engine.io-client/node_modules/engine.io-parser/build/esm/decodePacket.browser.js","../node_modules/socket.io-client/node_modules/engine.io-client/node_modules/engine.io-parser/build/esm/index.js","../node_modules/socket.io-client/node_modules/@socket.io/component-emitter/index.mjs","../node_modules/socket.io-client/node_modules/engine.io-client/build/esm/globalThis.browser.js","../node_modules/socket.io-client/node_modules/engine.io-client/build/esm/util.js","../node_modules/socket.io-client/node_modules/engine.io-client/build/esm/contrib/parseqs.js","../node_modules/socket.io-client/node_modules/engine.io-client/build/esm/transport.js","../node_modules/socket.io-client/node_modules/engine.io-client/build/esm/contrib/yeast.js","../node_modules/socket.io-client/node_modules/engine.io-client/build/esm/contrib/has-cors.js","../node_modules/socket.io-client/node_modules/engine.io-client/build/esm/transports/xmlhttprequest.browser.js","../node_modules/socket.io-client/node_modules/engine.io-client/build/esm/transports/polling.js","../node_modules/socket.io-client/node_modules/engine.io-client/build/esm/transports/websocket-constructor.browser.js","../node_modules/socket.io-client/node_modules/engine.io-client/build/esm/transports/websocket.js","../node_modules/socket.io-client/node_modules/engine.io-client/build/esm/transports/webtransport.js","../node_modules/socket.io-client/node_modules/engine.io-client/build/esm/transports/index.js","../node_modules/socket.io-client/node_modules/engine.io-client/build/esm/contrib/parseuri.js","../node_modules/socket.io-client/node_modules/engine.io-client/build/esm/socket.js","../node_modules/socket.io-client/node_modules/engine.io-client/build/esm/index.js","../node_modules/socket.io-client/build/esm/url.js","../node_modules/socket.io-client/node_modules/socket.io-parser/build/esm/is-binary.js","../node_modules/socket.io-client/node_modules/socket.io-parser/build/esm/binary.js","../node_modules/socket.io-client/node_modules/socket.io-parser/build/esm/index.js","../node_modules/socket.io-client/build/esm/on.js","../node_modules/socket.io-client/build/esm/socket.js","../node_modules/socket.io-client/build/esm/contrib/backo2.js","../node_modules/socket.io-client/build/esm/manager.js","../node_modules/socket.io-client/build/esm/index.js","../node_modules/@appland/client/src/aiClient.ts","../node_modules/@appland/client/src/ai.ts","../node_modules/@appland/client/src/index.ts","../node_modules/@appland/rpc/built/search.js","../node_modules/@appland/rpc/built/appmap.js","../node_modules/@appland/rpc/built/explain.js","../node_modules/@appland/rpc/built/configuration.js","../node_modules/@appland/rpc/built/file.js","../node_modules/@appland/rpc/built/navie.js","../node_modules/@appland/rpc/built/index.js","../node_modules/uuid/dist/esm-node/rng.js","../node_modules/uuid/dist/esm-node/regex.js","../node_modules/uuid/dist/esm-node/validate.js","../node_modules/uuid/dist/esm-node/stringify.js","../node_modules/uuid/dist/esm-node/v1.js","../node_modules/uuid/dist/esm-node/parse.js","../node_modules/uuid/dist/esm-node/v35.js","../node_modules/uuid/dist/esm-node/md5.js","../node_modules/uuid/dist/esm-node/v3.js","../node_modules/uuid/dist/esm-node/v4.js","../node_modules/uuid/dist/esm-node/sha1.js","../node_modules/uuid/dist/esm-node/v5.js","../node_modules/uuid/dist/esm-node/nil.js","../node_modules/uuid/dist/esm-node/version.js","../node_modules/uuid/dist/esm-node/index.js","../node_modules/jayson/lib/generateRequest.js","../node_modules/jayson/lib/client/browser/index.js","../main.js","../node_modules/vue/dist/vue.runtime.mjs","../node_modules/@appland/components/dist/index.js","../node_modules/vuex/dist/vuex.esm.js","../node_modules/highlight.js/es/core.js","../node_modules/highlight.js/es/languages/sql.js","../node_modules/diff/lib/index.mjs","../node_modules/dom-to-svg/src/index.ts","../node_modules/postcss/lib/postcss.mjs","../node_modules/dom-to-svg/src/css.ts","../node_modules/dom-to-svg/src/dom.ts","../node_modules/dom-to-svg/src/stacking.ts","../node_modules/dom-to-svg/src/traversal.ts","../node_modules/dom-to-svg/src/element.ts","../node_modules/dom-to-svg/src/accessibility.ts","../node_modules/dom-to-svg/src/gradients.ts","../node_modules/dom-to-svg/src/svg.ts","../node_modules/dom-to-svg/src/text.ts","../node_modules/dom-to-svg/src/util.ts","../node_modules/dom-to-svg/src/inline.ts","../node_modules/highlight.js/es/index.js","../node_modules/mermaid/dist/mermaid.core.mjs","../node_modules/pako/dist/pako.esm.mjs","../node_modules/js-base64/base64.mjs","../node_modules/marked/src/defaults.ts","../node_modules/marked/src/helpers.ts","../node_modules/marked/src/Tokenizer.ts","../node_modules/marked/src/rules.ts","../node_modules/marked/src/Lexer.ts","../node_modules/marked/src/Renderer.ts","../node_modules/marked/src/TextRenderer.ts","../node_modules/marked/src/Parser.ts","../node_modules/marked/src/Hooks.ts","../node_modules/marked/src/Instance.ts","../node_modules/marked/src/marked.ts","../webview.js","../../appland-shared/messagePublisher.js","../../appland-shared/vsCodeBridge.js","../../appland-shared/handleAppMapMessages.js"],"sourcesContent":["'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // 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\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // 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.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","/* eslint-disable */\nvar _globalThis = (function (Object) {\n function get() {\n var _global = this || self;\n\n delete Object.prototype.__magic__;\n return _global;\n }\n\n if (typeof globalThis === \"object\") {\n return globalThis;\n }\n\n if (this) {\n return get();\n } else {\n Object.defineProperty(Object.prototype, \"__magic__\", {\n configurable: true,\n get: get,\n });\n var _global = __magic__;\n return _global;\n }\n})(Object);\n\nimport { Buffer } from \"buffer\";\nimport process from \"process\";\nvar _global = _globalThis;\nexport { Buffer, process, _global as global };\n","/*!\n * Vue.js v2.7.16\n * (c) 2014-2023 Evan You\n * Released under the MIT License.\n */\n/*!\n * Vue.js v2.7.16\n * (c) 2014-2023 Evan You\n * Released under the MIT License.\n */\n\"use strict\";const t=Object.freeze({}),e=Array.isArray;function n(t){return null==t}function o(t){return null!=t}function r(t){return!0===t}function s(t){return\"string\"==typeof t||\"number\"==typeof t||\"symbol\"==typeof t||\"boolean\"==typeof t}function i(t){return\"function\"==typeof t}function c(t){return null!==t&&\"object\"==typeof t}const a=Object.prototype.toString;function l(t){return\"[object Object]\"===a.call(t)}function u(t){const e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function f(t){return o(t)&&\"function\"==typeof t.then&&\"function\"==typeof t.catch}function d(t){return null==t?\"\":Array.isArray(t)||l(t)&&t.toString===a?JSON.stringify(t,p,2):String(t)}function p(t,e){return e&&e.__v_isRef?e.value:e}function h(t){const e=parseFloat(t);return isNaN(e)?t:e}function m(t,e){const n=Object.create(null),o=t.split(\",\");for(let t=0;tn[t.toLowerCase()]:t=>n[t]}const _=m(\"key,ref,slot,slot-scope,is\");function v(t,e){const n=t.length;if(n){if(e===t[n-1])return void(t.length=n-1);const o=t.indexOf(e);if(o>-1)return t.splice(o,1)}}const y=Object.prototype.hasOwnProperty;function g(t,e){return y.call(t,e)}function b(t){const e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}const $=/-(\\w)/g,w=b((t=>t.replace($,((t,e)=>e?e.toUpperCase():\"\")))),C=b((t=>t.charAt(0).toUpperCase()+t.slice(1))),x=/\\B([A-Z])/g,O=b((t=>t.replace(x,\"-$1\").toLowerCase()));const k=Function.prototype.bind?function(t,e){return t.bind(e)}:function(t,e){function n(n){const o=arguments.length;return o?o>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n};function S(t,e){e=e||0;let n=t.length-e;const o=new Array(n);for(;n--;)o[n]=t[n+e];return o}function j(t,e){for(const n in e)t[n]=e[n];return t}function A(t){const e={};for(let n=0;n!1,P=t=>t;function I(t,e){if(t===e)return!0;const n=c(t),o=c(e);if(!n||!o)return!n&&!o&&String(t)===String(e);try{const n=Array.isArray(t),o=Array.isArray(e);if(n&&o)return t.length===e.length&&t.every(((t,n)=>I(t,e[n])));if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(n||o)return!1;{const n=Object.keys(t),o=Object.keys(e);return n.length===o.length&&n.every((n=>I(t[n],e[n])))}}catch(t){return!1}}function D(t,e){for(let n=0;n0,Z=K&&K.indexOf(\"edge/\")>0;K&&K.indexOf(\"android\");const J=K&&/iphone|ipad|ipod|ios/.test(K);K&&/chrome\\/\\d+/.test(K),K&&/phantomjs/.test(K);const X=K&&K.match(/firefox\\/(\\d+)/),Q={}.watch;let Y,tt=!1;if(W)try{const t={};Object.defineProperty(t,\"passive\",{get(){tt=!0}}),window.addEventListener(\"test-passive\",null,t)}catch(t){}const et=()=>(void 0===Y&&(Y=!W&&\"undefined\"!=typeof global&&(global.process&&\"server\"===global.process.env.VUE_ENV)),Y),nt=W&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function ot(t){return\"function\"==typeof t&&/native code/.test(t.toString())}const rt=\"undefined\"!=typeof Symbol&&ot(Symbol)&&\"undefined\"!=typeof Reflect&&ot(Reflect.ownKeys);let st;st=\"undefined\"!=typeof Set&&ot(Set)?Set:class{constructor(){this.set=Object.create(null)}has(t){return!0===this.set[t]}add(t){this.set[t]=!0}clear(){this.set=Object.create(null)}};let it=null;function ct(t=null){t||it&&it._scope.off(),it=t,t&&t._scope.on()}class at{constructor(t,e,n,o,r,s,i,c){this.tag=t,this.data=e,this.children=n,this.text=o,this.elm=r,this.ns=void 0,this.context=s,this.fnContext=void 0,this.fnOptions=void 0,this.fnScopeId=void 0,this.key=e&&e.key,this.componentOptions=i,this.componentInstance=void 0,this.parent=void 0,this.raw=!1,this.isStatic=!1,this.isRootInsert=!0,this.isComment=!1,this.isCloned=!1,this.isOnce=!1,this.asyncFactory=c,this.asyncMeta=void 0,this.isAsyncPlaceholder=!1}get child(){return this.componentInstance}}const lt=(t=\"\")=>{const e=new at;return e.text=t,e.isComment=!0,e};function ut(t){return new at(void 0,void 0,void 0,String(t))}function ft(t){const e=new at(t.tag,t.data,t.children&&t.children.slice(),t.text,t.elm,t.context,t.componentOptions,t.asyncFactory);return e.ns=t.ns,e.isStatic=t.isStatic,e.key=t.key,e.isComment=t.isComment,e.fnContext=t.fnContext,e.fnOptions=t.fnOptions,e.fnScopeId=t.fnScopeId,e.asyncMeta=t.asyncMeta,e.isCloned=!0,e}let dt=0;const pt=[],ht=()=>{for(let t=0;tt)),e._pending=!1}pt.length=0};class mt{constructor(){this._pending=!1,this.id=dt++,this.subs=[]}addSub(t){this.subs.push(t)}removeSub(t){this.subs[this.subs.indexOf(t)]=null,this._pending||(this._pending=!0,pt.push(this))}depend(t){mt.target&&mt.target.addDep(this)}notify(t){const e=this.subs.filter((t=>t));for(let t=0,n=e.length;t{const t=e[n];if(Rt(t))return t.value;{const e=t&&t.__ob__;return e&&e.dep.depend(),t}},set:t=>{const o=e[n];Rt(o)&&!Rt(t)?o.value=t:e[n]=t}})}function Bt(t,e,n){const o=t[e];if(Rt(o))return o;const r={get value(){const o=t[e];return void 0===o?n:o},set value(n){t[e]=n}};return V(r,Lt,!0),r}const Vt=\"__v_rawToReadonly\",zt=\"__v_rawToShallowReadonly\";function Ht(t){return Wt(t,!1)}function Wt(t,e){if(!l(t))return t;if(Mt(t))return t;const n=e?zt:Vt,o=t[n];if(o)return o;const r=Object.create(Object.getPrototypeOf(t));V(t,n,r),V(r,\"__v_isReadonly\",!0),V(r,\"__v_raw\",t),Rt(t)&&V(r,Lt,!0),(e||Nt(t))&&V(r,\"__v_isShallow\",!0);const s=Object.keys(t);for(let n=0;n{const o=Ke(t,null,n,u,e);return s&&o&&o.__ob__&&o.__ob__.dep.depend(),o};let d,p,h=!1,m=!1;if(Rt(n)?(d=()=>n.value,h=Nt(n)):Dt(n)?(d=()=>(n.__ob__.dep.depend(),n),s=!0):e(n)?(m=!0,h=n.some((t=>Dt(t)||Nt(t))),d=()=>n.map((t=>Rt(t)?t.value:Dt(t)?(t.__ob__.dep.depend(),yn(t)):i(t)?f(t,Zt):void 0))):d=i(n)?o?()=>f(n,Zt):()=>{if(!u||!u._isDestroyed)return p&&p(),f(n,qt,[_])}:T,o&&s){const t=d;d=()=>yn(t())}let _=t=>{p=v.onStop=()=>{f(t,Jt)}};if(et())return _=T,o?r&&f(o,Gt,[d(),m?[]:void 0,_]):d(),T;const v=new wn(it,d,T,{lazy:!0});v.noRecurse=!o;let y=m?[]:Qt;return v.run=()=>{if(v.active)if(o){const t=v.get();(s||h||(m?t.some(((t,e)=>M(t,y[e]))):M(t,y)))&&(p&&p(),f(o,Gt,[t,y===Qt?void 0:y,_]),y=t)}else v.get()},\"sync\"===c?v.update=v.run:\"post\"===c?(v.post=!0,v.update=()=>zn(v)):v.update=()=>{if(u&&u===it&&!u._isMounted){const t=u._preWatchers||(u._preWatchers=[]);t.indexOf(v)<0&&t.push(v)}else zn(v)},o?r?v.run():y=v.get():\"post\"===c&&u?u.$once(\"hook:mounted\",(()=>v.get())):v.get(),()=>{v.teardown()}}let te;class ee{constructor(t=!1){this.detached=t,this.active=!0,this.effects=[],this.cleanups=[],this.parent=te,!t&&te&&(this.index=(te.scopes||(te.scopes=[])).push(this)-1)}run(t){if(this.active){const e=te;try{return te=this,t()}finally{te=e}}}on(){te=this}off(){te=this.parent}stop(t){if(this.active){let e,n;for(e=0,n=this.effects.length;e{const e=\"&\"===t.charAt(0),n=\"~\"===(t=e?t.slice(1):t).charAt(0),o=\"!\"===(t=n?t.slice(1):t).charAt(0);return{name:t=o?t.slice(1):t,once:n,capture:o,passive:e}}));function se(t,n){function o(){const t=o.fns;if(!e(t))return Ke(t,null,arguments,n,\"v-on handler\");{const e=t.slice();for(let t=0;t0&&(l=fe(l,`${i||\"\"}_${a}`),ue(l[0])&&ue(f)&&(c[u]=ut(f.text+l[0].text),l.shift()),c.push.apply(c,l)):s(l)?ue(f)?c[u]=ut(f.text+l):\"\"!==l&&c.push(ut(l)):ue(l)&&ue(f)?c[u]=ut(f.text+l.text):(r(t._isVList)&&o(l.tag)&&n(l.key)&&o(i)&&(l.key=`__vlist${i}_${a}__`),c.push(l)));return c}function de(t,n){let r,s,i,a,l=null;if(e(t)||\"string\"==typeof t)for(l=new Array(t.length),r=0,s=t.length;r0,c=n?!!n.$stable:!i,a=n&&n.$key;if(n){if(n._normalized)return n._normalized;if(c&&r&&r!==t&&a===r.$key&&!i&&!r.$hasNormal)return r;s={};for(const t in n)n[t]&&\"$\"!==t[0]&&(s[t]=Ee(e,o,t,n[t]))}else s={};for(const t in o)t in s||(s[t]=Pe(o,t));return n&&Object.isExtensible(n)&&(n._normalized=s),V(s,\"$stable\",c),V(s,\"$key\",a),V(s,\"$hasNormal\",i),s}function Ee(t,n,o,r){const s=function(){const n=it;ct(t);let o=arguments.length?r.apply(null,arguments):r({});o=o&&\"object\"==typeof o&&!e(o)?[o]:le(o);const s=o&&o[0];return ct(n),o&&(!s||1===o.length&&s.isComment&&!Ae(s))?void 0:o};return r.proxy&&Object.defineProperty(n,o,{get:s,enumerable:!0,configurable:!0}),s}function Pe(t,e){return()=>t[e]}function Ie(e){return{get attrs(){if(!e._attrsProxy){const n=e._attrsProxy={};V(n,\"_v_attr_proxy\",!0),De(n,e.$attrs,t,e,\"$attrs\")}return e._attrsProxy},get listeners(){if(!e._listenersProxy){De(e._listenersProxy={},e.$listeners,t,e,\"$listeners\")}return e._listenersProxy},get slots(){return function(t){t._slotsProxy||Me(t._slotsProxy={},t.$scopedSlots);return t._slotsProxy}(e)},emit:k(e.$emit,e),expose(t){t&&Object.keys(t).forEach((n=>Ut(e,t,n)))}}}function De(t,e,n,o,r){let s=!1;for(const i in e)i in t?e[i]!==n[i]&&(s=!0):(s=!0,Ne(t,i,o,r));for(const n in t)n in e||(s=!0,delete t[n]);return s}function Ne(t,e,n,o){Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:()=>n[o][e]})}function Me(t,e){for(const n in e)t[n]=e[n];for(const n in t)n in e||delete t[n]}function Le(){const t=it;return t._setupContext||(t._setupContext=Ie(t))}let Re=null;function Fe(t,e){return(t.__esModule||rt&&\"Module\"===t[Symbol.toStringTag])&&(t=t.default),c(t)?e.extend(t):t}function Ue(t){if(e(t))for(let e=0;eWe(t,o,r+\" (Promise/async)\"))),s._handled=!0)}catch(t){We(t,o,r)}return s}function qe(t,e,n){if(U.errorHandler)try{return U.errorHandler.call(null,t,e,n)}catch(e){e!==t&&Ge(e)}Ge(t)}function Ge(t,e,n){if(!W||\"undefined\"==typeof console)throw t;console.error(t)}let Ze=!1;const Je=[];let Xe,Qe=!1;function Ye(){Qe=!1;const t=Je.slice(0);Je.length=0;for(let e=0;e{t.then(Ye),J&&setTimeout(T)},Ze=!0}else if(q||\"undefined\"==typeof MutationObserver||!ot(MutationObserver)&&\"[object MutationObserverConstructor]\"!==MutationObserver.toString())Xe=\"undefined\"!=typeof setImmediate&&ot(setImmediate)?()=>{setImmediate(Ye)}:()=>{setTimeout(Ye,0)};else{let t=1;const e=new MutationObserver(Ye),n=document.createTextNode(String(t));e.observe(n,{characterData:!0}),Xe=()=>{t=(t+1)%2,n.data=String(t)},Ze=!0}function tn(t,e){let n;if(Je.push((()=>{if(t)try{t.call(e)}catch(t){We(t,e,\"nextTick\")}else n&&n(e)})),Qe||(Qe=!0,Xe()),!t&&\"undefined\"!=typeof Promise)return new Promise((t=>{n=t}))}function en(t){return(e,n=it)=>{if(n)return function(t,e,n){const o=t.$options;o[e]=oo(o[e],n)}(n,t,e)}}const nn=en(\"beforeMount\"),on=en(\"mounted\"),rn=en(\"beforeUpdate\"),sn=en(\"updated\"),cn=en(\"beforeDestroy\"),an=en(\"destroyed\"),ln=en(\"activated\"),un=en(\"deactivated\"),fn=en(\"serverPrefetch\"),dn=en(\"renderTracked\"),pn=en(\"renderTriggered\"),hn=en(\"errorCaptured\");const mn=\"2.7.16\";var _n=Object.freeze({__proto__:null,version:mn,defineComponent:function(t){return t},ref:function(t){return Ft(t,!1)},shallowRef:function(t){return Ft(t,!0)},isRef:Rt,toRef:Bt,toRefs:function(t){const n=e(t)?new Array(t.length):{};for(const e in t)n[e]=Bt(t,e);return n},unref:function(t){return Rt(t)?t.value:t},proxyRefs:function(t){if(Dt(t))return t;const e={},n=Object.keys(t);for(let o=0;o{e.depend()}),(()=>{e.notify()})),r={get value(){return n()},set value(t){o(t)}};return V(r,Lt,!0),r},triggerRef:function(t){t.dep&&t.dep.notify()},reactive:function(t){return It(t,!1),t},isReactive:Dt,isReadonly:Mt,isShallow:Nt,isProxy:function(t){return Dt(t)||Mt(t)},shallowReactive:Pt,markRaw:function(t){return Object.isExtensible(t)&&V(t,\"__v_skip\",!0),t},toRaw:function t(e){const n=e&&e.__v_raw;return n?t(n):e},readonly:Ht,shallowReadonly:function(t){return Wt(t,!0)},computed:function(t,e){let n,o;const r=i(t);r?(n=t,o=T):(n=t.get,o=t.set);const s=et()?null:new wn(it,n,T,{lazy:!0}),c={effect:s,get value(){return s?(s.dirty&&s.evaluate(),mt.target&&s.depend(),s.value):n()},set value(t){o(t)}};return V(c,Lt,!0),V(c,\"__v_isReadonly\",r),c},watch:function(t,e,n){return Yt(t,e,n)},watchEffect:function(t,e){return Yt(t,null,e)},watchPostEffect:Xt,watchSyncEffect:function(t,e){return Yt(t,null,{flush:\"sync\"})},EffectScope:ee,effectScope:function(t){return new ee(t)},onScopeDispose:function(t){te&&te.cleanups.push(t)},getCurrentScope:ne,provide:function(t,e){it&&(oe(it)[t]=e)},inject:function(t,e,n=!1){const o=it;if(o){const r=o.$parent&&o.$parent._provided;if(r&&t in r)return r[t];if(arguments.length>1)return n&&i(e)?e.call(o):e}},h:function(t,e,n){return ze(it,t,e,n,2,!0)},getCurrentInstance:function(){return it&&{proxy:it}},useSlots:function(){return Le().slots},useAttrs:function(){return Le().attrs},useListeners:function(){return Le().listeners},mergeDefaults:function(t,n){const o=e(t)?t.reduce(((t,e)=>(t[e]={},t)),{}):t;for(const t in n){const r=o[t];r?e(r)||i(r)?o[t]={type:r,default:n[t]}:r.default=n[t]:null===r&&(o[t]={default:n[t]})}return o},nextTick:tn,set:At,del:Tt,useCssModule:function(e=\"$style\"){{if(!it)return t;const n=it[e];return n||t}},useCssVars:function(t){if(!W)return;const e=it;e&&Xt((()=>{const n=e.$el,o=t(e,e._setupProxy);if(n&&1===n.nodeType){const t=n.style;for(const e in o)t.setProperty(`--${e}`,o[e])}}))},defineAsyncComponent:function(t){i(t)&&(t={loader:t});const{loader:e,loadingComponent:n,errorComponent:o,delay:r=200,timeout:s,suspensible:c=!1,onError:a}=t;let l=null,u=0;const f=()=>{let t;return l||(t=l=e().catch((t=>{if(t=t instanceof Error?t:new Error(String(t)),a)return new Promise(((e,n)=>{a(t,(()=>e((u++,l=null,f()))),(()=>n(t)),u+1)}));throw t})).then((e=>t!==l&&l?l:(e&&(e.__esModule||\"Module\"===e[Symbol.toStringTag])&&(e=e.default),e))))};return()=>({component:f(),delay:r,timeout:s,error:o,loading:n})},onBeforeMount:nn,onMounted:on,onBeforeUpdate:rn,onUpdated:sn,onBeforeUnmount:cn,onUnmounted:an,onActivated:ln,onDeactivated:un,onServerPrefetch:fn,onRenderTracked:dn,onRenderTriggered:pn,onErrorCaptured:function(t,e=it){hn(t,e)}});const vn=new st;function yn(t){return gn(t,vn),vn.clear(),t}function gn(t,n){let o,r;const s=e(t);if(!(!s&&!c(t)||t.__v_skip||Object.isFrozen(t)||t instanceof at)){if(t.__ob__){const e=t.__ob__.dep.id;if(n.has(e))return;n.add(e)}if(s)for(o=t.length;o--;)gn(t[o],n);else if(Rt(t))gn(t.value,n);else for(r=Object.keys(t),o=r.length;o--;)gn(t[r[o]],n)}}let bn,$n=0;class wn{constructor(t,e,n,o,r){!function(t,e=te){e&&e.active&&e.effects.push(t)}(this,te&&!te._vm?te:t?t._scope:void 0),(this.vm=t)&&r&&(t._watcher=this),o?(this.deep=!!o.deep,this.user=!!o.user,this.lazy=!!o.lazy,this.sync=!!o.sync,this.before=o.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++$n,this.active=!0,this.post=!1,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new st,this.newDepIds=new st,this.expression=\"\",i(e)?this.getter=e:(this.getter=function(t){if(z.test(t))return;const e=t.split(\".\");return function(t){for(let n=0;n{Sn=e}}function An(t){for(;t&&(t=t.$parent);)if(t._inactive)return!0;return!1}function Tn(t,e){if(e){if(t._directInactive=!1,An(t))return}else if(t._directInactive)return;if(t._inactive||null===t._inactive){t._inactive=!1;for(let e=0;edocument.createEvent(\"Event\").timeStamp&&(Un=()=>t.now())}const Bn=(t,e)=>{if(t.post){if(!e.post)return 1}else if(e.post)return-1;return t.id-e.id};function Vn(){let t,e;for(Fn=Un(),Ln=!0,In.sort(Bn),Rn=0;RnRn&&In[e].id>t.id;)e--;In.splice(e+1,0,t)}else In.push(t);Mn||(Mn=!0,tn(Vn))}}function Hn(t,e){if(t){const n=Object.create(null),o=rt?Reflect.ownKeys(t):Object.keys(t);for(let r=0;r(this.$slots||Te(i,n.scopedSlots,this.$slots=Se(s,i)),this.$slots),Object.defineProperty(this,\"scopedSlots\",{enumerable:!0,get(){return Te(i,n.scopedSlots,this.slots())}}),u&&(this.$options=a,this.$slots=this.slots(),this.$scopedSlots=Te(i,n.scopedSlots,this.$slots)),a._scopeId?this._c=(t,n,o,r)=>{const s=ze(l,t,n,o,r,f);return s&&!e(s)&&(s.fnScopeId=a._scopeId,s.fnContext=i),s}:this._c=(t,e,n,o)=>ze(l,t,e,n,o,f)}function Kn(t,e,n,o,r){const s=ft(t);return s.fnContext=n,s.fnOptions=o,e.slot&&((s.data||(s.data={})).slot=e.slot),s}function qn(t,e){for(const n in e)t[w(n)]=e[n]}function Gn(t){return t.name||t.__name||t._componentTag}ke(Wn.prototype);const Zn={init(t,e){if(t.componentInstance&&!t.componentInstance._isDestroyed&&t.data.keepAlive){const e=t;Zn.prepatch(e,e)}else{(t.componentInstance=function(t,e){const n={_isComponent:!0,_parentVnode:t,parent:e},r=t.data.inlineTemplate;o(r)&&(n.render=r.render,n.staticRenderFns=r.staticRenderFns);return new t.componentOptions.Ctor(n)}(t,Sn)).$mount(e?t.elm:void 0,e)}},prepatch(e,n){const o=n.componentOptions;!function(e,n,o,r,s){const i=r.data.scopedSlots,c=e.$scopedSlots,a=!!(i&&!i.$stable||c!==t&&!c.$stable||i&&e.$scopedSlots.$key!==i.$key||!i&&e.$scopedSlots.$key);let l=!!(s||e.$options._renderChildren||a);const u=e.$vnode;e.$options._parentVnode=r,e.$vnode=r,e._vnode&&(e._vnode.parent=r),e.$options._renderChildren=s;const f=r.data.attrs||t;e._attrsProxy&&De(e._attrsProxy,f,u.data&&u.data.attrs||t,e,\"$attrs\")&&(l=!0),e.$attrs=f,o=o||t;const d=e.$options._parentListeners;if(e._listenersProxy&&De(e._listenersProxy,o,d||t,e,\"$listeners\"),e.$listeners=e.$options._parentListeners=o,kn(e,o,d),n&&e.$options.props){xt(!1);const t=e._props,o=e.$options._propKeys||[];for(let r=0;rv(r,s)));const u=t=>{for(let t=0,e=r.length;t{t.resolved=Fe(n,e),i?r.length=0:u(!0)})),p=N((e=>{o(t.errorComp)&&(t.error=!0,u(!0))})),h=t(d,p);return c(h)&&(f(h)?n(t.resolved)&&h.then(d,p):f(h.component)&&(h.component.then(d,p),o(h.error)&&(t.errorComp=Fe(h.error,e)),o(h.loading)&&(t.loadingComp=Fe(h.loading,e),0===h.delay?t.loading=!0:a=setTimeout((()=>{a=null,n(t.resolved)&&n(t.error)&&(t.loading=!0,u(!1))}),h.delay||200)),o(h.timeout)&&(l=setTimeout((()=>{l=null,n(t.resolved)&&p(null)}),h.timeout)))),i=!1,t.loading?t.loadingComp:t.resolved}}(p,d),void 0===s))return function(t,e,n,o,r){const s=lt();return s.asyncFactory=t,s.asyncMeta={data:e,context:n,children:o,tag:r},s}(p,i,a,l,u);i=i||{},Co(s),o(i.model)&&function(t,n){const r=t.model&&t.model.prop||\"value\",s=t.model&&t.model.event||\"input\";(n.attrs||(n.attrs={}))[r]=n.model.value;const i=n.on||(n.on={}),c=i[s],a=n.model.callback;o(c)?(e(c)?-1===c.indexOf(a):c!==a)&&(i[s]=[a].concat(c)):i[s]=a}(s.options,i);const h=function(t,e,r){const s=e.options.props;if(n(s))return;const i={},{attrs:c,props:a}=t;if(o(c)||o(a))for(const t in s){const e=O(t);ae(i,a,t,e,!0)||ae(i,c,t,e,!1)}return i}(i,s);if(r(s.options.functional))return function(n,r,s,i,c){const a=n.options,l={},u=a.props;if(o(u))for(const e in u)l[e]=ao(e,u,r||t);else o(s.attrs)&&qn(l,s.attrs),o(s.props)&&qn(l,s.props);const f=new Wn(s,l,c,i,n),d=a.render.call(null,f._c,f);if(d instanceof at)return Kn(d,s,f.parent,a);if(e(d)){const t=le(d)||[],e=new Array(t.length);for(let n=0;n{t(n,o),e(n,o)};return n._merged=!0,n}let Yn=T;const to=U.optionMergeStrategies;function eo(t,e,n=!0){if(!e)return t;let o,r,s;const i=rt?Reflect.ownKeys(e):Object.keys(e);for(let c=0;c{to[t]=oo})),R.forEach((function(t){to[t+\"s\"]=ro})),to.watch=function(t,n,o,r){if(t===Q&&(t=void 0),n===Q&&(n=void 0),!n)return Object.create(t||null);if(!t)return n;const s={};j(s,t);for(const t in n){let o=s[t];const r=n[t];o&&!e(o)&&(o=[o]),s[t]=o?o.concat(r):e(r)?r:[r]}return s},to.props=to.methods=to.inject=to.computed=function(t,e,n,o){if(!t)return e;const r=Object.create(null);return j(r,t),e&&j(r,e),r},to.provide=function(t,e){return t?function(){const n=Object.create(null);return eo(n,i(t)?t.call(this):t),e&&eo(n,i(e)?e.call(this):e,!1),n}:e};const so=function(t,e){return void 0===e?t:e};function io(t,n,o){if(i(n)&&(n=n.options),function(t,n){const o=t.props;if(!o)return;const r={};let s,i,c;if(e(o))for(s=o.length;s--;)i=o[s],\"string\"==typeof i&&(c=w(i),r[c]={type:null});else if(l(o))for(const t in o)i=o[t],c=w(t),r[c]=l(i)?i:{type:i};t.props=r}(n),function(t,n){const o=t.inject;if(!o)return;const r=t.inject={};if(e(o))for(let t=0;t-1)if(s&&!g(r,\"default\"))c=!1;else if(\"\"===c||c===O(t)){const t=po(String,r.type);(t<0||a-1:\"string\"==typeof t?t.split(\",\").indexOf(n)>-1:(o=t,\"[object RegExp]\"===a.call(o)&&t.test(n));var o}function jo(t,e){const{cache:n,keys:o,_vnode:r,$vnode:s}=t;for(const t in n){const s=n[t];if(s){const i=s.name;i&&!e(i)&&Ao(n,t,o,r)}}s.componentOptions.children=void 0}function Ao(t,e,n,o){const r=t[e];!r||o&&r.tag===o.tag||r.componentInstance.$destroy(),t[e]=null,v(n,e)}!function(e){e.prototype._init=function(e){const n=this;n._uid=wo++,n._isVue=!0,n.__v_skip=!0,n._scope=new ee(!0),n._scope.parent=void 0,n._scope._vm=!0,e&&e._isComponent?function(t,e){const n=t.$options=Object.create(t.constructor.options),o=e._parentVnode;n.parent=e.parent,n._parentVnode=o;const r=o.componentOptions;n.propsData=r.propsData,n._parentListeners=r.listeners,n._renderChildren=r.children,n._componentTag=r.tag,e.render&&(n.render=e.render,n.staticRenderFns=e.staticRenderFns)}(n,e):n.$options=io(Co(n.constructor),e||{},n),n._renderProxy=n,n._self=n,function(t){const e=t.$options;let n=e.parent;if(n&&!e.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(t)}t.$parent=n,t.$root=n?n.$root:t,t.$children=[],t.$refs={},t._provided=n?n._provided:Object.create(null),t._watcher=null,t._inactive=null,t._directInactive=!1,t._isMounted=!1,t._isDestroyed=!1,t._isBeingDestroyed=!1}(n),function(t){t._events=Object.create(null),t._hasHookEvent=!1;const e=t.$options._parentListeners;e&&kn(t,e)}(n),function(e){e._vnode=null,e._staticTrees=null;const n=e.$options,o=e.$vnode=n._parentVnode,r=o&&o.context;e.$slots=Se(n._renderChildren,r),e.$scopedSlots=o?Te(e.$parent,o.data.scopedSlots,e.$slots):t,e._c=(t,n,o,r)=>ze(e,t,n,o,r,!1),e.$createElement=(t,n,o,r)=>ze(e,t,n,o,r,!0);const s=o&&o.data;jt(e,\"$attrs\",s&&s.attrs||t,null,!0),jt(e,\"$listeners\",n._parentListeners||t,null,!0)}(n),Pn(n,\"beforeCreate\",void 0,!1),function(t){const e=Hn(t.$options.inject,t);e&&(xt(!1),Object.keys(e).forEach((n=>{jt(t,n,e[n])})),xt(!0))}(n),_o(n),function(t){const e=t.$options.provide;if(e){const n=i(e)?e.call(t):e;if(!c(n))return;const o=oe(t),r=rt?Reflect.ownKeys(n):Object.keys(n);for(let t=0;t1?S(n):n;const o=S(arguments,1),r=`event handler for \"${t}\"`;for(let t=0,s=n.length;tparseInt(this.max)&&Ao(t,e[0],e,this._vnode),this.vnodeToCache=null}}},created(){this.cache=Object.create(null),this.keys=[]},destroyed(){for(const t in this.cache)Ao(this.cache,t,this.keys)},mounted(){this.cacheVNode(),this.$watch(\"include\",(t=>{jo(this,(e=>So(t,e)))})),this.$watch(\"exclude\",(t=>{jo(this,(e=>!So(t,e)))}))},updated(){this.cacheVNode()},render(){const t=this.$slots.default,e=Ue(t),n=e&&e.componentOptions;if(n){const t=ko(n),{include:o,exclude:r}=this;if(o&&(!t||!So(o,t))||r&&t&&So(r,t))return e;const{cache:s,keys:i}=this,c=null==e.key?n.Ctor.cid+(n.tag?`::${n.tag}`:\"\"):e.key;s[c]?(e.componentInstance=s[c].componentInstance,v(i,c),i.push(c)):(this.vnodeToCache=e,this.keyToCache=c),e.data.keepAlive=!0}return e||t&&t[0]}}};!function(t){const e={get:()=>U};Object.defineProperty(t,\"config\",e),t.util={warn:Yn,extend:j,mergeOptions:io,defineReactive:jt},t.set=At,t.delete=Tt,t.nextTick=tn,t.observable=t=>(St(t),t),t.options=Object.create(null),R.forEach((e=>{t.options[e+\"s\"]=Object.create(null)})),t.options._base=t,j(t.options.components,Eo),function(t){t.use=function(t){const e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;const n=S(arguments,1);return n.unshift(this),i(t.install)?t.install.apply(t,n):i(t)&&t.apply(null,n),e.push(t),this}}(t),function(t){t.mixin=function(t){return this.options=io(this.options,t),this}}(t),Oo(t),function(t){R.forEach((e=>{t[e]=function(t,n){return n?(\"component\"===e&&l(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),\"directive\"===e&&i(n)&&(n={bind:n,update:n}),this.options[e+\"s\"][t]=n,n):this.options[e+\"s\"][t]}}))}(t)}(xo),Object.defineProperty(xo.prototype,\"$isServer\",{get:et}),Object.defineProperty(xo.prototype,\"$ssrContext\",{get(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(xo,\"FunctionalRenderContext\",{value:Wn}),xo.version=mn;const Po=m(\"style,class\"),Io=m(\"input,textarea,option,select,progress\"),Do=m(\"contenteditable,draggable,spellcheck\"),No=m(\"events,caret,typing,plaintext-only\"),Mo=(t,e)=>Bo(e)||\"false\"===e?\"false\":\"contenteditable\"===t&&No(e)?e:\"true\",Lo=m(\"allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,truespeed,typemustmatch,visible\"),Ro=\"http://www.w3.org/1999/xlink\",Fo=t=>\":\"===t.charAt(5)&&\"xlink\"===t.slice(0,5),Uo=t=>Fo(t)?t.slice(6,t.length):\"\",Bo=t=>null==t||!1===t;function Vo(t){let e=t.data,n=t,r=t;for(;o(r.componentInstance);)r=r.componentInstance._vnode,r&&r.data&&(e=zo(r.data,e));for(;o(n=n.parent);)n&&n.data&&(e=zo(e,n.data));return function(t,e){if(o(t)||o(e))return Ho(t,Wo(e));return\"\"}(e.staticClass,e.class)}function zo(t,e){return{staticClass:Ho(t.staticClass,e.staticClass),class:o(t.class)?[t.class,e.class]:e.class}}function Ho(t,e){return t?e?t+\" \"+e:t:e||\"\"}function Wo(t){return Array.isArray(t)?function(t){let e,n=\"\";for(let r=0,s=t.length;rqo(t)||Go(t);const Jo=Object.create(null);const Xo=m(\"text,number,password,search,email,tel,url\");var Qo=Object.freeze({__proto__:null,createElement:function(t,e){const n=document.createElement(t);return\"select\"!==t||e.data&&e.data.attrs&&void 0!==e.data.attrs.multiple&&n.setAttribute(\"multiple\",\"multiple\"),n},createElementNS:function(t,e){return document.createElementNS(Ko[t],e)},createTextNode:function(t){return document.createTextNode(t)},createComment:function(t){return document.createComment(t)},insertBefore:function(t,e,n){t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},appendChild:function(t,e){t.appendChild(e)},parentNode:function(t){return t.parentNode},nextSibling:function(t){return t.nextSibling},tagName:function(t){return t.tagName},setTextContent:function(t,e){t.textContent=e},setStyleScope:function(t,e){t.setAttribute(e,\"\")}}),Yo={create(t,e){tr(e)},update(t,e){t.data.ref!==e.data.ref&&(tr(t,!0),tr(e))},destroy(t){tr(t,!0)}};function tr(t,n){const r=t.data.ref;if(!o(r))return;const s=t.context,c=t.componentInstance||t.elm,a=n?null:c,l=n?void 0:c;if(i(r))return void Ke(r,s,[a],s,\"template ref function\");const u=t.data.refInFor,f=\"string\"==typeof r||\"number\"==typeof r,d=Rt(r),p=s.$refs;if(f||d)if(u){const t=f?p[r]:r.value;n?e(t)&&v(t,c):e(t)?t.includes(c)||t.push(c):f?(p[r]=[c],er(s,r,p[r])):r.value=[c]}else if(f){if(n&&p[r]!==c)return;p[r]=l,er(s,r,a)}else if(d){if(n&&r.value!==c)return;r.value=a}}function er({_setupState:t},e,n){t&&g(t,e)&&(Rt(t[e])?t[e].value=n:t[e]=n)}const nr=new at(\"\",{},[]),or=[\"create\",\"activate\",\"update\",\"remove\",\"destroy\"];function rr(t,e){return t.key===e.key&&t.asyncFactory===e.asyncFactory&&(t.tag===e.tag&&t.isComment===e.isComment&&o(t.data)===o(e.data)&&function(t,e){if(\"input\"!==t.tag)return!0;let n;const r=o(n=t.data)&&o(n=n.attrs)&&n.type,s=o(n=e.data)&&o(n=n.attrs)&&n.type;return r===s||Xo(r)&&Xo(s)}(t,e)||r(t.isAsyncPlaceholder)&&n(e.asyncFactory.error))}function sr(t,e,n){let r,s;const i={};for(r=e;r<=n;++r)s=t[r].key,o(s)&&(i[s]=r);return i}var ir={create:cr,update:cr,destroy:function(t){cr(t,nr)}};function cr(t,e){(t.data.directives||e.data.directives)&&function(t,e){const n=t===nr,o=e===nr,r=lr(t.data.directives,t.context),s=lr(e.data.directives,e.context),i=[],c=[];let a,l,u;for(a in s)l=r[a],u=s[a],l?(u.oldValue=l.value,u.oldArg=l.arg,fr(u,\"update\",e,t),u.def&&u.def.componentUpdated&&c.push(u)):(fr(u,\"bind\",e,t),u.def&&u.def.inserted&&i.push(u));if(i.length){const o=()=>{for(let n=0;n{for(let n=0;n-1?mr(t,e,n):Lo(e)?Bo(n)?t.removeAttribute(e):(n=\"allowfullscreen\"===e&&\"EMBED\"===t.tagName?\"true\":e,t.setAttribute(e,n)):Do(e)?t.setAttribute(e,Mo(e,n)):Fo(e)?Bo(n)?t.removeAttributeNS(Ro,Uo(e)):t.setAttributeNS(Ro,e,n):mr(t,e,n)}function mr(t,e,n){if(Bo(n))t.removeAttribute(e);else{if(q&&!G&&\"TEXTAREA\"===t.tagName&&\"placeholder\"===e&&\"\"!==n&&!t.__ieph){const e=n=>{n.stopImmediatePropagation(),t.removeEventListener(\"input\",e)};t.addEventListener(\"input\",e),t.__ieph=!0}t.setAttribute(e,n)}}var _r={create:pr,update:pr};function vr(t,e){const r=e.elm,s=e.data,i=t.data;if(n(s.staticClass)&&n(s.class)&&(n(i)||n(i.staticClass)&&n(i.class)))return;let c=Vo(e);const a=r._transitionClasses;o(a)&&(c=Ho(c,Wo(a))),c!==r._prevClass&&(r.setAttribute(\"class\",c),r._prevClass=c)}var yr={create:vr,update:vr};const gr=\"__r\",br=\"__c\";let $r;function wr(t,e,n){const o=$r;return function r(){null!==e.apply(null,arguments)&&Or(t,r,n,o)}}const Cr=Ze&&!(X&&Number(X[1])<=53);function xr(t,e,n,o){if(Cr){const t=Fn,n=e;e=n._wrapper=function(e){if(e.target===e.currentTarget||e.timeStamp>=t||e.timeStamp<=0||e.target.ownerDocument!==document)return n.apply(this,arguments)}}$r.addEventListener(t,e,tt?{capture:n,passive:o}:n)}function Or(t,e,n,o){(o||$r).removeEventListener(t,e._wrapper||e,n)}function kr(t,e){if(n(t.data.on)&&n(e.data.on))return;const r=e.data.on||{},s=t.data.on||{};$r=e.elm||t.elm,function(t){if(o(t[gr])){const e=q?\"change\":\"input\";t[e]=[].concat(t[gr],t[e]||[]),delete t[gr]}o(t[br])&&(t.change=[].concat(t[br],t.change||[]),delete t[br])}(r),ie(r,s,xr,Or,wr,e.context),$r=void 0}var Sr={create:kr,update:kr,destroy:t=>kr(t,nr)};let jr;function Ar(t,e){if(n(t.data.domProps)&&n(e.data.domProps))return;let s,i;const c=e.elm,a=t.data.domProps||{};let l=e.data.domProps||{};for(s in(o(l.__ob__)||r(l._v_attr_proxy))&&(l=e.data.domProps=j({},l)),a)s in l||(c[s]=\"\");for(s in l){if(i=l[s],\"textContent\"===s||\"innerHTML\"===s){if(e.children&&(e.children.length=0),i===a[s])continue;1===c.childNodes.length&&c.removeChild(c.childNodes[0])}if(\"value\"===s&&\"PROGRESS\"!==c.tagName){c._value=i;const t=n(i)?\"\":String(i);Tr(c,t)&&(c.value=t)}else if(\"innerHTML\"===s&&Go(c.tagName)&&n(c.innerHTML)){jr=jr||document.createElement(\"div\"),jr.innerHTML=`${i}`;const t=jr.firstChild;for(;c.firstChild;)c.removeChild(c.firstChild);for(;t.firstChild;)c.appendChild(t.firstChild)}else if(i!==a[s])try{c[s]=i}catch(t){}}}function Tr(t,e){return!t.composing&&(\"OPTION\"===t.tagName||function(t,e){let n=!0;try{n=document.activeElement!==t}catch(t){}return n&&t.value!==e}(t,e)||function(t,e){const n=t.value,r=t._vModifiers;if(o(r)){if(r.number)return h(n)!==h(e);if(r.trim)return n.trim()!==e.trim()}return n!==e}(t,e))}var Er={create:Ar,update:Ar};const Pr=b((function(t){const e={},n=/:(.+)/;return t.split(/;(?![^(]*\\))/g).forEach((function(t){if(t){const o=t.split(n);o.length>1&&(e[o[0].trim()]=o[1].trim())}})),e}));function Ir(t){const e=Dr(t.style);return t.staticStyle?j(t.staticStyle,e):e}function Dr(t){return Array.isArray(t)?A(t):\"string\"==typeof t?Pr(t):t}const Nr=/^--/,Mr=/\\s*!important$/,Lr=(t,e,n)=>{if(Nr.test(e))t.style.setProperty(e,n);else if(Mr.test(n))t.style.setProperty(O(e),n.replace(Mr,\"\"),\"important\");else{const o=Ur(e);if(Array.isArray(n))for(let e=0,r=n.length;e-1?e.split(zr).forEach((e=>t.classList.add(e))):t.classList.add(e);else{const n=` ${t.getAttribute(\"class\")||\"\"} `;n.indexOf(\" \"+e+\" \")<0&&t.setAttribute(\"class\",(n+e).trim())}}function Wr(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(\" \")>-1?e.split(zr).forEach((e=>t.classList.remove(e))):t.classList.remove(e),t.classList.length||t.removeAttribute(\"class\");else{let n=` ${t.getAttribute(\"class\")||\"\"} `;const o=\" \"+e+\" \";for(;n.indexOf(o)>=0;)n=n.replace(o,\" \");n=n.trim(),n?t.setAttribute(\"class\",n):t.removeAttribute(\"class\")}}function Kr(t){if(t){if(\"object\"==typeof t){const e={};return!1!==t.css&&j(e,qr(t.name||\"v\")),j(e,t),e}return\"string\"==typeof t?qr(t):void 0}}const qr=b((t=>({enterClass:`${t}-enter`,enterToClass:`${t}-enter-to`,enterActiveClass:`${t}-enter-active`,leaveClass:`${t}-leave`,leaveToClass:`${t}-leave-to`,leaveActiveClass:`${t}-leave-active`}))),Gr=W&&!G,Zr=\"transition\",Jr=\"animation\";let Xr=\"transition\",Qr=\"transitionend\",Yr=\"animation\",ts=\"animationend\";Gr&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Xr=\"WebkitTransition\",Qr=\"webkitTransitionEnd\"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Yr=\"WebkitAnimation\",ts=\"webkitAnimationEnd\"));const es=W?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:t=>t();function ns(t){es((()=>{es(t)}))}function os(t,e){const n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),Hr(t,e))}function rs(t,e){t._transitionClasses&&v(t._transitionClasses,e),Wr(t,e)}function ss(t,e,n){const{type:o,timeout:r,propCount:s}=cs(t,e);if(!o)return n();const i=o===Zr?Qr:ts;let c=0;const a=()=>{t.removeEventListener(i,l),n()},l=e=>{e.target===t&&++c>=s&&a()};setTimeout((()=>{c0&&(l=Zr,u=s,f=r.length):e===Jr?a>0&&(l=Jr,u=a,f=c.length):(u=Math.max(s,a),l=u>0?s>a?Zr:Jr:null,f=l?l===Zr?r.length:c.length:0);return{type:l,timeout:u,propCount:f,hasTransform:l===Zr&&is.test(n[Xr+\"Property\"])}}function as(t,e){for(;t.lengthls(e)+ls(t[n]))))}function ls(t){return 1e3*Number(t.slice(0,-1).replace(\",\",\".\"))}function us(t,e){const r=t.elm;o(r._leaveCb)&&(r._leaveCb.cancelled=!0,r._leaveCb());const s=Kr(t.data.transition);if(n(s))return;if(o(r._enterCb)||1!==r.nodeType)return;const{css:a,type:l,enterClass:u,enterToClass:f,enterActiveClass:d,appearClass:p,appearToClass:m,appearActiveClass:_,beforeEnter:v,enter:y,afterEnter:g,enterCancelled:b,beforeAppear:$,appear:w,afterAppear:C,appearCancelled:x,duration:O}=s;let k=Sn,S=Sn.$vnode;for(;S&&S.parent;)k=S.context,S=S.parent;const j=!k._isMounted||!t.isRootInsert;if(j&&!w&&\"\"!==w)return;const A=j&&p?p:u,T=j&&_?_:d,E=j&&m?m:f,P=j&&$||v,I=j&&i(w)?w:y,D=j&&C||g,M=j&&x||b,L=h(c(O)?O.enter:O),R=!1!==a&&!G,F=ps(I),U=r._enterCb=N((()=>{R&&(rs(r,E),rs(r,T)),U.cancelled?(R&&rs(r,A),M&&M(r)):D&&D(r),r._enterCb=null}));t.data.show||ce(t,\"insert\",(()=>{const e=r.parentNode,n=e&&e._pending&&e._pending[t.key];n&&n.tag===t.tag&&n.elm._leaveCb&&n.elm._leaveCb(),I&&I(r,U)})),P&&P(r),R&&(os(r,A),os(r,T),ns((()=>{rs(r,A),U.cancelled||(os(r,E),F||(ds(L)?setTimeout(U,L):ss(r,l,U)))}))),t.data.show&&(e&&e(),I&&I(r,U)),R||F||U()}function fs(t,e){const r=t.elm;o(r._enterCb)&&(r._enterCb.cancelled=!0,r._enterCb());const s=Kr(t.data.transition);if(n(s)||1!==r.nodeType)return e();if(o(r._leaveCb))return;const{css:i,type:a,leaveClass:l,leaveToClass:u,leaveActiveClass:f,beforeLeave:d,leave:p,afterLeave:m,leaveCancelled:_,delayLeave:v,duration:y}=s,g=!1!==i&&!G,b=ps(p),$=h(c(y)?y.leave:y),w=r._leaveCb=N((()=>{r.parentNode&&r.parentNode._pending&&(r.parentNode._pending[t.key]=null),g&&(rs(r,u),rs(r,f)),w.cancelled?(g&&rs(r,l),_&&_(r)):(e(),m&&m(r)),r._leaveCb=null}));function C(){w.cancelled||(!t.data.show&&r.parentNode&&((r.parentNode._pending||(r.parentNode._pending={}))[t.key]=t),d&&d(r),g&&(os(r,l),os(r,f),ns((()=>{rs(r,l),w.cancelled||(os(r,u),b||(ds($)?setTimeout(w,$):ss(r,a,w)))}))),p&&p(r,w),g||b||w())}v?v(C):C()}function ds(t){return\"number\"==typeof t&&!isNaN(t)}function ps(t){if(n(t))return!1;const e=t.fns;return o(e)?ps(Array.isArray(e)?e[0]:e):(t._length||t.length)>1}function hs(t,e){!0!==e.data.show&&us(e)}const ms=function(t){let i,c;const a={},{modules:l,nodeOps:u}=t;for(i=0;im?(f=n(r[y+1])?null:r[y+1].elm,b(t,f,r,h,y,s)):h>y&&w(e,p,m)}(f,m,_,s,l):o(_)?(o(t.text)&&u.setTextContent(f,\"\"),b(f,null,_,0,_.length-1,s)):o(m)?w(m,0,m.length-1):o(t.text)&&u.setTextContent(f,\"\"):t.text!==e.text&&u.setTextContent(f,e.text),o(h)&&o(p=h.hook)&&o(p=p.postpatch)&&p(t,e)}function k(t,e,n){if(r(n)&&o(t.parent))t.parent.data.pendingInsert=e;else for(let t=0;t{const t=document.activeElement;t&&t.vmodel&&Cs(t,\"input\")}));const _s={inserted(t,e,n,o){\"select\"===n.tag?(o.elm&&!o.elm._vOptions?ce(n,\"postpatch\",(()=>{_s.componentUpdated(t,e,n)})):vs(t,e,n.context),t._vOptions=[].map.call(t.options,bs)):(\"textarea\"===n.tag||Xo(t.type))&&(t._vModifiers=e.modifiers,e.modifiers.lazy||(t.addEventListener(\"compositionstart\",$s),t.addEventListener(\"compositionend\",ws),t.addEventListener(\"change\",ws),G&&(t.vmodel=!0)))},componentUpdated(t,e,n){if(\"select\"===n.tag){vs(t,e,n.context);const o=t._vOptions,r=t._vOptions=[].map.call(t.options,bs);if(r.some(((t,e)=>!I(t,o[e])))){(t.multiple?e.value.some((t=>gs(t,r))):e.value!==e.oldValue&&gs(e.value,r))&&Cs(t,\"change\")}}}};function vs(t,e,n){ys(t,e),(q||Z)&&setTimeout((()=>{ys(t,e)}),0)}function ys(t,e,n){const o=e.value,r=t.multiple;if(r&&!Array.isArray(o))return;let s,i;for(let e=0,n=t.options.length;e-1,i.selected!==s&&(i.selected=s);else if(I(bs(i),o))return void(t.selectedIndex!==e&&(t.selectedIndex=e));r||(t.selectedIndex=-1)}function gs(t,e){return e.every((e=>!I(e,t)))}function bs(t){return\"_value\"in t?t._value:t.value}function $s(t){t.target.composing=!0}function ws(t){t.target.composing&&(t.target.composing=!1,Cs(t.target,\"input\"))}function Cs(t,e){const n=document.createEvent(\"HTMLEvents\");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function xs(t){return!t.componentInstance||t.data&&t.data.transition?t:xs(t.componentInstance._vnode)}var Os={bind(t,{value:e},n){const o=(n=xs(n)).data&&n.data.transition,r=t.__vOriginalDisplay=\"none\"===t.style.display?\"\":t.style.display;e&&o?(n.data.show=!0,us(n,(()=>{t.style.display=r}))):t.style.display=e?r:\"none\"},update(t,{value:e,oldValue:n},o){if(!e==!n)return;(o=xs(o)).data&&o.data.transition?(o.data.show=!0,e?us(o,(()=>{t.style.display=t.__vOriginalDisplay})):fs(o,(()=>{t.style.display=\"none\"}))):t.style.display=e?t.__vOriginalDisplay:\"none\"},unbind(t,e,n,o,r){r||(t.style.display=t.__vOriginalDisplay)}},ks={model:_s,show:Os};const Ss={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function js(t){const e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?js(Ue(e.children)):t}function As(t){const e={},n=t.$options;for(const o in n.propsData)e[o]=t[o];const o=n._parentListeners;for(const t in o)e[w(t)]=o[t];return e}function Ts(t,e){if(/\\d-keep-alive$/.test(e.tag))return t(\"keep-alive\",{props:e.componentOptions.propsData})}const Es=t=>t.tag||Ae(t),Ps=t=>\"show\"===t.name;var Is={name:\"transition\",props:Ss,abstract:!0,render(t){let e=this.$slots.default;if(!e)return;if(e=e.filter(Es),!e.length)return;const n=this.mode,o=e[0];if(function(t){for(;t=t.parent;)if(t.data.transition)return!0}(this.$vnode))return o;const r=js(o);if(!r)return o;if(this._leaving)return Ts(t,o);const i=`__transition-${this._uid}-`;r.key=null==r.key?r.isComment?i+\"comment\":i+r.tag:s(r.key)?0===String(r.key).indexOf(i)?r.key:i+r.key:r.key;const c=(r.data||(r.data={})).transition=As(this),a=this._vnode,l=js(a);if(r.data.directives&&r.data.directives.some(Ps)&&(r.data.show=!0),l&&l.data&&!function(t,e){return e.key===t.key&&e.tag===t.tag}(r,l)&&!Ae(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){const e=l.data.transition=j({},c);if(\"out-in\"===n)return this._leaving=!0,ce(e,\"afterLeave\",(()=>{this._leaving=!1,this.$forceUpdate()})),Ts(t,o);if(\"in-out\"===n){if(Ae(r))return a;let t;const n=()=>{t()};ce(c,\"afterEnter\",n),ce(c,\"enterCancelled\",n),ce(e,\"delayLeave\",(e=>{t=e}))}}return o}};const Ds=j({tag:String,moveClass:String},Ss);delete Ds.mode;var Ns={props:Ds,beforeMount(){const t=this._update;this._update=(e,n)=>{const o=jn(this);this.__patch__(this._vnode,this.kept,!1,!0),this._vnode=this.kept,o(),t.call(this,e,n)}},render(t){const e=this.tag||this.$vnode.data.tag||\"span\",n=Object.create(null),o=this.prevChildren=this.children,r=this.$slots.default||[],s=this.children=[],i=As(this);for(let t=0;t{if(t.data.moved){const n=t.elm,o=n.style;os(n,e),o.transform=o.WebkitTransform=o.transitionDuration=\"\",n.addEventListener(Qr,n._moveCb=function t(o){o&&o.target!==n||o&&!/transform$/.test(o.propertyName)||(n.removeEventListener(Qr,t),n._moveCb=null,rs(n,e))})}})))},methods:{hasMove(t,e){if(!Gr)return!1;if(this._hasMove)return this._hasMove;const n=t.cloneNode();t._transitionClasses&&t._transitionClasses.forEach((t=>{Wr(n,t)})),Hr(n,e),n.style.display=\"none\",this.$el.appendChild(n);const o=cs(n);return this.$el.removeChild(n),this._hasMove=o.hasTransform}}};function Ms(t){t.elm._moveCb&&t.elm._moveCb(),t.elm._enterCb&&t.elm._enterCb()}function Ls(t){t.data.newPos=t.elm.getBoundingClientRect()}function Rs(t){const e=t.data.pos,n=t.data.newPos,o=e.left-n.left,r=e.top-n.top;if(o||r){t.data.moved=!0;const e=t.elm.style;e.transform=e.WebkitTransform=`translate(${o}px,${r}px)`,e.transitionDuration=\"0s\"}}var Fs={Transition:Is,TransitionGroup:Ns};xo.config.mustUseProp=(t,e,n)=>\"value\"===n&&Io(t)&&\"button\"!==e||\"selected\"===n&&\"option\"===t||\"checked\"===n&&\"input\"===t||\"muted\"===n&&\"video\"===t,xo.config.isReservedTag=Zo,xo.config.isReservedAttr=Po,xo.config.getTagNamespace=function(t){return Go(t)?\"svg\":\"math\"===t?\"math\":void 0},xo.config.isUnknownElement=function(t){if(!W)return!0;if(Zo(t))return!1;if(t=t.toLowerCase(),null!=Jo[t])return Jo[t];const e=document.createElement(t);return t.indexOf(\"-\")>-1?Jo[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:Jo[t]=/HTMLUnknownElement/.test(e.toString())},j(xo.options.directives,ks),j(xo.options.components,Fs),xo.prototype.__patch__=W?ms:T,xo.prototype.$mount=function(t,e){return function(t,e,n){let o;t.$el=e,t.$options.render||(t.$options.render=lt),Pn(t,\"beforeMount\"),o=()=>{t._update(t._render(),n)},new wn(t,o,T,{before(){t._isMounted&&!t._isDestroyed&&Pn(t,\"beforeUpdate\")}},!0),n=!1;const r=t._preWatchers;if(r)for(let t=0;t{U.devtools&&nt&&nt.emit(\"init\",xo)}),0),j(xo,_n),module.exports=xo;","if (process.env.NODE_ENV === 'production') {\n module.exports = require('./vue.runtime.common.prod.js')\n} else {\n module.exports = require('./vue.runtime.common.dev.js')\n}\n","/*! safe-buffer. MIT License. Feross Aboukhadijeh */\n/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer')\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.prototype = Object.create(Buffer.prototype)\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n","'use strict'\n\n// limit of Crypto.getRandomValues()\n// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues\nvar MAX_BYTES = 65536\n\n// Node supports requesting up to this number of bytes\n// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48\nvar MAX_UINT32 = 4294967295\n\nfunction oldBrowser () {\n throw new Error('Secure random number generation is not supported by this browser.\\nUse Chrome, Firefox or Internet Explorer 11')\n}\n\nvar Buffer = require('safe-buffer').Buffer\nvar crypto = global.crypto || global.msCrypto\n\nif (crypto && crypto.getRandomValues) {\n module.exports = randomBytes\n} else {\n module.exports = oldBrowser\n}\n\nfunction randomBytes (size, cb) {\n // phantomjs needs to throw\n if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')\n\n var bytes = Buffer.allocUnsafe(size)\n\n if (size > 0) { // getRandomValues fails on IE if size == 0\n if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues\n // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues\n for (var generated = 0; generated < size; generated += MAX_BYTES) {\n // buffer.slice automatically checks if the end is past the end of\n // the buffer so we don't have to here\n crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES))\n }\n } else {\n crypto.getRandomValues(bytes)\n }\n }\n\n if (typeof cb === 'function') {\n return process.nextTick(function () {\n cb(null, bytes)\n })\n }\n\n return bytes\n}\n","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n }\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n","'use strict';\n\nif (typeof process === 'undefined' ||\n !process.version ||\n process.version.indexOf('v0.') === 0 ||\n process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {\n module.exports = { nextTick: nextTick };\n} else {\n module.exports = process\n}\n\nfunction nextTick(fn, arg1, arg2, arg3) {\n if (typeof fn !== 'function') {\n throw new TypeError('\"callback\" argument must be a function');\n }\n var len = arguments.length;\n var args, i;\n switch (len) {\n case 0:\n case 1:\n return process.nextTick(fn);\n case 2:\n return process.nextTick(function afterTickOne() {\n fn.call(null, arg1);\n });\n case 3:\n return process.nextTick(function afterTickTwo() {\n fn.call(null, arg1, arg2);\n });\n case 4:\n return process.nextTick(function afterTickThree() {\n fn.call(null, arg1, arg2, arg3);\n });\n default:\n args = new Array(len - 1);\n i = 0;\n while (i < args.length) {\n args[i++] = arguments[i];\n }\n return process.nextTick(function afterTick() {\n fn.apply(null, args);\n });\n }\n}\n\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","module.exports = require('stream');\n","/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer')\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\n\nfunction isArray(arg) {\n if (Array.isArray) {\n return Array.isArray(arg);\n }\n return objectToString(arg) === '[object Array]';\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('buffer').Buffer.isBuffer;\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n","module.exports = function isBuffer(arg) {\n return arg instanceof Buffer;\n}\n","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||\n function getOwnPropertyDescriptors(obj) {\n var keys = Object.keys(obj);\n var descriptors = {};\n for (var i = 0; i < keys.length; i++) {\n descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);\n }\n return descriptors;\n };\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n if (typeof process !== 'undefined' && process.noDeprecation === true) {\n return fn;\n }\n\n // Allow for deprecating things in the process of starting up.\n if (typeof process === 'undefined') {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nvar kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;\n\nexports.promisify = function promisify(original) {\n if (typeof original !== 'function')\n throw new TypeError('The \"original\" argument must be of type Function');\n\n if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n if (typeof fn !== 'function') {\n throw new TypeError('The \"util.promisify.custom\" argument must be of type Function');\n }\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return fn;\n }\n\n function fn() {\n var promiseResolve, promiseReject;\n var promise = new Promise(function (resolve, reject) {\n promiseResolve = resolve;\n promiseReject = reject;\n });\n\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n args.push(function (err, value) {\n if (err) {\n promiseReject(err);\n } else {\n promiseResolve(value);\n }\n });\n\n try {\n original.apply(this, args);\n } catch (err) {\n promiseReject(err);\n }\n\n return promise;\n }\n\n Object.setPrototypeOf(fn, Object.getPrototypeOf(original));\n\n if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return Object.defineProperties(\n fn,\n getOwnPropertyDescriptors(original)\n );\n}\n\nexports.promisify.custom = kCustomPromisifiedSymbol\n\nfunction callbackifyOnRejected(reason, cb) {\n // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).\n // Because `null` is a special error value in callbacks which means \"no error\n // occurred\", we error-wrap so the callback consumer can distinguish between\n // \"the promise rejected with null\" or \"the promise fulfilled with undefined\".\n if (!reason) {\n var newReason = new Error('Promise was rejected with a falsy value');\n newReason.reason = reason;\n reason = newReason;\n }\n return cb(reason);\n}\n\nfunction callbackify(original) {\n if (typeof original !== 'function') {\n throw new TypeError('The \"original\" argument must be of type Function');\n }\n\n // We DO NOT return the promise as it gives the user a false sense that\n // the promise is actually somehow related to the callback's execution\n // and that the callback throwing will reject the promise.\n function callbackified() {\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n var self = this;\n var cb = function() {\n return maybeCb.apply(self, arguments);\n };\n // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n original.apply(this, args)\n .then(function(ret) { process.nextTick(cb, null, ret) },\n function(rej) { process.nextTick(callbackifyOnRejected, rej, cb) });\n }\n\n Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));\n Object.defineProperties(callbackified,\n getOwnPropertyDescriptors(original));\n return callbackified;\n}\nexports.callbackify = callbackify;\n","'use strict';\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar Buffer = require('safe-buffer').Buffer;\nvar util = require('util');\n\nfunction copyBuffer(src, target, offset) {\n src.copy(target, offset);\n}\n\nmodule.exports = function () {\n function BufferList() {\n _classCallCheck(this, BufferList);\n\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n\n BufferList.prototype.push = function push(v) {\n var entry = { data: v, next: null };\n if (this.length > 0) this.tail.next = entry;else this.head = entry;\n this.tail = entry;\n ++this.length;\n };\n\n BufferList.prototype.unshift = function unshift(v) {\n var entry = { data: v, next: this.head };\n if (this.length === 0) this.tail = entry;\n this.head = entry;\n ++this.length;\n };\n\n BufferList.prototype.shift = function shift() {\n if (this.length === 0) return;\n var ret = this.head.data;\n if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;\n --this.length;\n return ret;\n };\n\n BufferList.prototype.clear = function clear() {\n this.head = this.tail = null;\n this.length = 0;\n };\n\n BufferList.prototype.join = function join(s) {\n if (this.length === 0) return '';\n var p = this.head;\n var ret = '' + p.data;\n while (p = p.next) {\n ret += s + p.data;\n }return ret;\n };\n\n BufferList.prototype.concat = function concat(n) {\n if (this.length === 0) return Buffer.alloc(0);\n var ret = Buffer.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n return ret;\n };\n\n return BufferList;\n}();\n\nif (util && util.inspect && util.inspect.custom) {\n module.exports.prototype[util.inspect.custom] = function () {\n var obj = util.inspect({ length: this.length });\n return this.constructor.name + ' ' + obj;\n };\n}","'use strict';\n\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n\n// undocumented cb() API, needed for core, not for public API\nfunction destroy(err, cb) {\n var _this = this;\n\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n pna.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n pna.nextTick(emitErrorNT, this, err);\n }\n }\n\n return this;\n }\n\n // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n\n // if this is a duplex stream mark the writable part as destroyed as well\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n if (!_this._writableState) {\n pna.nextTick(emitErrorNT, _this, err);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n pna.nextTick(emitErrorNT, _this, err);\n }\n } else if (cb) {\n cb(err);\n }\n });\n\n return this;\n}\n\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\n\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\n\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy\n};","\n/**\n * Module exports.\n */\n\nmodule.exports = deprecate;\n\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new \"deprecated\" version of `fn`\n * @api public\n */\n\nfunction deprecate (fn, msg) {\n if (config('noDeprecation')) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config('throwDeprecation')) {\n throw new Error(msg);\n } else if (config('traceDeprecation')) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n}\n\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\nfunction config (name) {\n // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n try {\n if (!global.localStorage) return false;\n } catch (_) {\n return false;\n }\n var val = global.localStorage[name];\n if (null == val) return false;\n return String(val).toLowerCase() === 'true';\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n'use strict';\n\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n\nmodule.exports = Writable;\n\n/* */\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n}\n\n// It seems a linked list but it is not\n// there will be only 2 of these for each stream\nfunction CorkedRequest(state) {\n var _this = this;\n\n this.next = null;\n this.entry = null;\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* */\n\n/**/\nvar asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;\n/**/\n\n/**/\nvar Duplex;\n/**/\n\nWritable.WritableState = WritableState;\n\n/**/\nvar util = Object.create(require('core-util-is'));\nutil.inherits = require('inherits');\n/**/\n\n/**/\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n/**/\nvar Stream = require('./internal/streams/stream');\n/**/\n\n/**/\n\nvar Buffer = require('safe-buffer').Buffer;\nvar OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/**/\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nutil.inherits(Writable, Stream);\n\nfunction nop() {}\n\nfunction WritableState(options, stream) {\n Duplex = Duplex || require('./_stream_duplex');\n\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n var isDuplex = stream instanceof Duplex;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n var hwm = options.highWaterMark;\n var writableHwm = options.writableHighWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n\n if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;\n\n // cast to ints.\n this.highWaterMark = Math.floor(this.highWaterMark);\n\n // if _final has been called\n this.finalCalled = false;\n\n // drain event flag.\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function (er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n\n // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n\n // count buffered requests\n this.bufferedRequestCount = 0;\n\n // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n this.corkedRequestsFree = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n};\n\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function () {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})();\n\n// Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\nvar realHasInstance;\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function (object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function (object) {\n return object instanceof this;\n };\n}\n\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n\n // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {\n return new Writable(options);\n }\n\n this._writableState = new WritableState(options, this);\n\n // legacy.\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n\n if (typeof options.writev === 'function') this._writev = options.writev;\n\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n\n if (typeof options.final === 'function') this._final = options.final;\n }\n\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function () {\n this.emit('error', new Error('Cannot pipe, not readable'));\n};\n\nfunction writeAfterEnd(stream, cb) {\n var er = new Error('write after end');\n // TODO: defer error events consistently everywhere, not just the cb\n stream.emit('error', er);\n pna.nextTick(cb, er);\n}\n\n// Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\nfunction validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n pna.nextTick(cb, er);\n valid = false;\n }\n return valid;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n\n if (typeof cb !== 'function') cb = nop;\n\n if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n\n return ret;\n};\n\nWritable.prototype.cork = function () {\n var state = this._writableState;\n\n state.corked++;\n};\n\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n return chunk;\n}\n\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function () {\n return this._writableState.highWaterMark;\n }\n});\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n\n state.length += len;\n\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret) state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n pna.nextTick(cb, er);\n // this can emit finish, and it will always happen\n // after error\n pna.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n // this can emit finish, but finish must\n // always follow error\n finishMaybe(stream, state);\n }\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n\n onwriteStateUpdate(state);\n\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state);\n\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n /**/\n asyncWrite(afterWrite, stream, state, finished, cb);\n /**/\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n\n doWrite(stream, state, true, state.length, buffer, '', holder.finish);\n\n // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null) state.lastBufferedRequest = null;\n }\n\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new Error('_write() is not implemented'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending) endWritable(this, state, cb);\n};\n\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n if (err) {\n stream.emit('error', err);\n }\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function') {\n state.pendingcb++;\n state.finalCalled = true;\n pna.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n }\n }\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);\n }\n state.ended = true;\n stream.writable = false;\n}\n\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n\n // reuse the free corkReq.\n state.corkedRequestsFree.next = corkReq;\n}\n\nObject.defineProperty(Writable.prototype, 'destroyed', {\n get: function () {\n if (this._writableState === undefined) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._writableState.destroyed = value;\n }\n});\n\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\nWritable.prototype._destroy = function (err, cb) {\n this.end();\n cb(err);\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n'use strict';\n\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n\n/**/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) {\n keys.push(key);\n }return keys;\n};\n/**/\n\nmodule.exports = Duplex;\n\n/**/\nvar util = Object.create(require('core-util-is'));\nutil.inherits = require('inherits');\n/**/\n\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\n\nutil.inherits(Duplex, Readable);\n\n{\n // avoid scope creep, the keys array can then be collected\n var keys = objectKeys(Writable.prototype);\n for (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n}\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n\n Readable.call(this, options);\n Writable.call(this, options);\n\n if (options && options.readable === false) this.readable = false;\n\n if (options && options.writable === false) this.writable = false;\n\n this.allowHalfOpen = true;\n if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;\n\n this.once('end', onend);\n}\n\nObject.defineProperty(Duplex.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function () {\n return this._writableState.highWaterMark;\n }\n});\n\n// the no-half-open enforcer\nfunction onend() {\n // if we allow half-open state, or if the writable side ended,\n // then we're ok.\n if (this.allowHalfOpen || this._writableState.ended) return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n pna.nextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n self.end();\n}\n\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n get: function () {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});\n\nDuplex.prototype._destroy = function (err, cb) {\n this.push(null);\n this.end();\n\n pna.nextTick(cb, err);\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n/**/\n\nvar Buffer = require('safe-buffer').Buffer;\n/**/\n\nvar isEncoding = Buffer.isEncoding || function (encoding) {\n encoding = '' + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':\n return true;\n default:\n return false;\n }\n};\n\nfunction _normalizeEncoding(enc) {\n if (!enc) return 'utf8';\n var retried;\n while (true) {\n switch (enc) {\n case 'utf8':\n case 'utf-8':\n return 'utf8';\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return 'utf16le';\n case 'latin1':\n case 'binary':\n return 'latin1';\n case 'base64':\n case 'ascii':\n case 'hex':\n return enc;\n default:\n if (retried) return; // undefined\n enc = ('' + enc).toLowerCase();\n retried = true;\n }\n }\n};\n\n// Do not cache `Buffer.isEncoding` when checking encoding names as some\n// modules monkey-patch it to support additional encodings\nfunction normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters.\nexports.StringDecoder = StringDecoder;\nfunction StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case 'utf16le':\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case 'utf8':\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case 'base64':\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer.allocUnsafe(nb);\n}\n\nStringDecoder.prototype.write = function (buf) {\n if (buf.length === 0) return '';\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf);\n if (r === undefined) return '';\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);\n return r || '';\n};\n\nStringDecoder.prototype.end = utf8End;\n\n// Returns only complete characters in a Buffer\nStringDecoder.prototype.text = utf8Text;\n\n// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer\nStringDecoder.prototype.fillLast = function (buf) {\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);\n this.lastNeed -= buf.length;\n};\n\n// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a\n// continuation byte. If an invalid byte is detected, -2 is returned.\nfunction utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n}\n\n// Checks at most 3 bytes at the end of a Buffer in order to detect an\n// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)\n// needed to complete the UTF-8 character (if applicable) are returned.\nfunction utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}\n\n// Validates as many continuation bytes for a multi-byte UTF-8 character as\n// needed or are available. If we see a non-continuation byte where we expect\n// one, we \"replace\" the validated continuation bytes we've seen so far with\n// a single UTF-8 replacement character ('\\ufffd'), to match v8's UTF-8 decoding\n// behavior. The continuation byte check is included three times in the case\n// where all of the continuation bytes for a character exist in the same buffer.\n// It is also done this way as a slight performance increase instead of using a\n// loop.\nfunction utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n}\n\n// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.\nfunction utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== undefined) return r;\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n}\n\n// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a\n// partial character, the character's bytes are buffered until the required\n// number of bytes are available.\nfunction utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}\n\n// For UTF-8, a replacement character is added when ending on a partial\n// character.\nfunction utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n}\n\n// UTF-16LE typically needs two bytes per character, but even if we have an even\n// number of bytes available, we need to check if we end on a leading/high\n// surrogate. In that case, we need to wait for the next two bytes in order to\n// decode the last character properly.\nfunction utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n}\n\n// For UTF-16LE we do not explicitly append special replacement characters if we\n// end on a partial character, we simply let v8 handle that.\nfunction utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n}\n\nfunction base64Text(buf, i) {\n var n = (buf.length - i) % 3;\n if (n === 0) return buf.toString('base64', i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf[buf.length - 1];\n } else {\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n }\n return buf.toString('base64', i, buf.length - n);\n}\n\nfunction base64End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);\n return r;\n}\n\n// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)\nfunction simpleWrite(buf) {\n return buf.toString(this.encoding);\n}\n\nfunction simpleEnd(buf) {\n return buf && buf.length ? this.write(buf) : '';\n}","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n\nmodule.exports = Readable;\n\n/**/\nvar isArray = require('isarray');\n/**/\n\n/**/\nvar Duplex;\n/**/\n\nReadable.ReadableState = ReadableState;\n\n/**/\nvar EE = require('events').EventEmitter;\n\nvar EElistenerCount = function (emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n/**/\nvar Stream = require('./internal/streams/stream');\n/**/\n\n/**/\n\nvar Buffer = require('safe-buffer').Buffer;\nvar OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/**/\n\n/**/\nvar util = Object.create(require('core-util-is'));\nutil.inherits = require('inherits');\n/**/\n\n/**/\nvar debugUtil = require('util');\nvar debug = void 0;\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function () {};\n}\n/**/\n\nvar BufferList = require('./internal/streams/BufferList');\nvar destroyImpl = require('./internal/streams/destroy');\nvar StringDecoder;\n\nutil.inherits(Readable, Stream);\n\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\n\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);\n\n // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\n\nfunction ReadableState(options, stream) {\n Duplex = Duplex || require('./_stream_duplex');\n\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n var isDuplex = stream instanceof Duplex;\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n var hwm = options.highWaterMark;\n var readableHwm = options.readableHighWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n\n if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;\n\n // cast to ints.\n this.highWaterMark = Math.floor(this.highWaterMark);\n\n // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n\n if (!(this instanceof Readable)) return new Readable(options);\n\n this._readableState = new ReadableState(options, this);\n\n // legacy\n this.readable = true;\n\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n\n Stream.call(this);\n}\n\nObject.defineProperty(Readable.prototype, 'destroyed', {\n get: function () {\n if (this._readableState === undefined) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n }\n});\n\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\nReadable.prototype._destroy = function (err, cb) {\n this.push(null);\n cb(err);\n};\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\n\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n if (er) {\n stream.emit('error', er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (addToFront) {\n if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n stream.emit('error', new Error('stream.push() after EOF'));\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n }\n }\n\n return needMoreData(state);\n}\n\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n stream.emit('data', chunk);\n stream.read(0);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n\n if (state.needReadable) emitReadable(stream);\n }\n maybeReadMore(stream, state);\n}\n\nfunction chunkInvalid(state, chunk) {\n var er;\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n return er;\n}\n\n// if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes. This is to work around cases where hwm=0,\n// such as the repl. Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\nfunction needMoreData(state) {\n return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n}\n\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n};\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this._readableState.decoder = new StringDecoder(enc);\n this._readableState.encoding = enc;\n return this;\n};\n\n// Don't raise the hwm > 8MB\nvar MAX_HWM = 0x800000;\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n}\n\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n }\n // If we're asking for more than the current hwm, then raise the hwm.\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n;\n // Don't have enough\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n\n if (n !== 0) state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug('need readable', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0) state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n\n if (ret === null) {\n state.needReadable = true;\n n = 0;\n } else {\n state.length -= n;\n }\n\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended) endReadable(this);\n }\n\n if (ret !== null) this.emit('data', ret);\n\n return ret;\n};\n\nfunction onEofChunk(stream, state) {\n if (state.ended) return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n\n // emit 'readable' now to make sure it gets picked up.\n emitReadable(stream);\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}\n\nfunction emitReadable_(stream) {\n debug('emit readable');\n stream.emit('readable');\n flow(stream);\n}\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n pna.nextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n var len = state.length;\n while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;else len = state.length;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function (n) {\n this.emit('error', new Error('_read() is not implemented'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);\n\n dest.on('unpipe', onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n\n var cleanedUp = false;\n function cleanup() {\n debug('cleanup');\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n\n cleanedUp = true;\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n\n // If the user pushes more data while we're writing to dest then we'll end up\n // in ondata again. However, we only want to increase awaitDrain once because\n // dest will only emit one 'drain' event for the multiple writes.\n // => Introduce a guard on increasing awaitDrain.\n var increasedAwaitDrain = false;\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n increasedAwaitDrain = false;\n var ret = dest.write(chunk);\n if (false === ret && !increasedAwaitDrain) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', state.awaitDrain);\n state.awaitDrain++;\n increasedAwaitDrain = true;\n }\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n }\n\n // Make sure our error handler is attached before userland ones.\n prependListener(dest, 'error', onerror);\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function () {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = { hasUnpiped: false };\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0) return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n\n if (!dest) dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++) {\n dests[i].emit('unpipe', this, { hasUnpiped: false });\n }return this;\n }\n\n // try to find the right one.\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n\n dest.emit('unpipe', this, unpipeInfo);\n\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n\n if (ev === 'data') {\n // Start flowing on next tick if stream isn't explicitly paused\n if (this._readableState.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n var state = this._readableState;\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.emittedReadable = false;\n if (!state.reading) {\n pna.nextTick(nReadingNextTick, this);\n } else if (state.length) {\n emitReadable(this);\n }\n }\n }\n\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function () {\n var state = this._readableState;\n if (!state.flowing) {\n debug('resume');\n state.flowing = true;\n resume(this, state);\n }\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n pna.nextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n if (!state.reading) {\n debug('resume read 0');\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n state.awaitDrain = 0;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n if (false !== this._readableState.flowing) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n while (state.flowing && stream.read() !== null) {}\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n\n var state = this._readableState;\n var paused = false;\n\n stream.on('end', function () {\n debug('wrapped end');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n\n _this.push(null);\n });\n\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk);\n\n // don't skip over falsy values in objectMode\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n var ret = _this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function (method) {\n return function () {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n\n // proxy certain important events.\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n this._read = function (n) {\n debug('wrapped _read', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return this;\n};\n\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function () {\n return this._readableState.highWaterMark;\n }\n});\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = fromListPartial(n, state.buffer, state.decoder);\n }\n\n return ret;\n}\n\n// Extracts only enough buffered data to satisfy the amount requested.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromListPartial(n, list, hasStrings) {\n var ret;\n if (n < list.head.data.length) {\n // slice is the same for buffers and strings\n ret = list.head.data.slice(0, n);\n list.head.data = list.head.data.slice(n);\n } else if (n === list.head.data.length) {\n // first chunk is a perfect match\n ret = list.shift();\n } else {\n // result spans more than one buffer\n ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);\n }\n return ret;\n}\n\n// Copies a specified amount of characters from the list of buffered data\n// chunks.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction copyFromBufferString(n, list) {\n var p = list.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}\n\n// Copies a specified amount of bytes from the list of buffered data chunks.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction copyFromBuffer(n, list) {\n var ret = Buffer.allocUnsafe(n);\n var p = list.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n\n // If we get here before consuming all the bytes, then that is a\n // bug in node. Should never happen.\n if (state.length > 0) throw new Error('\"endReadable()\" called on non-empty stream');\n\n if (!state.endEmitted) {\n state.ended = true;\n pna.nextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n }\n}\n\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n'use strict';\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n\n/**/\nvar util = Object.create(require('core-util-is'));\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(Transform, Duplex);\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n\n var cb = ts.writecb;\n\n if (!cb) {\n return this.emit('error', new Error('write callback called multiple times'));\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n\n cb(er);\n\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n\n Duplex.call(this, options);\n\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n\n if (typeof options.flush === 'function') this._flush = options.flush;\n }\n\n // When the writable side finishes, then flush out anything remaining.\n this.on('prefinish', prefinish);\n}\n\nfunction prefinish() {\n var _this = this;\n\n if (typeof this._flush === 'function') {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function (chunk, encoding, cb) {\n throw new Error('_transform() is not implemented');\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\nTransform.prototype._destroy = function (err, cb) {\n var _this2 = this;\n\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n _this2.emit('close');\n });\n};\n\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data);\n\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');\n\n if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');\n\n return stream.push(null);\n}","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n'use strict';\n\nmodule.exports = PassThrough;\n\nvar Transform = require('./_stream_transform');\n\n/**/\nvar util = Object.create(require('core-util-is'));\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options);\n\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk);\n};","var Stream = require('stream');\nif (process.env.READABLE_STREAM === 'disable' && Stream) {\n module.exports = Stream;\n exports = module.exports = Stream.Readable;\n exports.Readable = Stream.Readable;\n exports.Writable = Stream.Writable;\n exports.Duplex = Stream.Duplex;\n exports.Transform = Stream.Transform;\n exports.PassThrough = Stream.PassThrough;\n exports.Stream = Stream;\n} else {\n exports = module.exports = require('./lib/_stream_readable.js');\n exports.Stream = Stream || exports;\n exports.Readable = exports;\n exports.Writable = require('./lib/_stream_writable.js');\n exports.Duplex = require('./lib/_stream_duplex.js');\n exports.Transform = require('./lib/_stream_transform.js');\n exports.PassThrough = require('./lib/_stream_passthrough.js');\n}\n","var Stream = require(\"stream\")\nvar Writable = require(\"./lib/_stream_writable.js\")\n\nif (process.env.READABLE_STREAM === 'disable') {\n module.exports = Stream && Stream.Writable || Writable\n} else {\n module.exports = Writable\n}\n","module.exports = require('./readable').Duplex\n","module.exports = require('./readable').Transform\n","module.exports = require('./readable').PassThrough\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Stream;\n\nvar EE = require('events').EventEmitter;\nvar inherits = require('inherits');\n\ninherits(Stream, EE);\nStream.Readable = require('readable-stream/readable.js');\nStream.Writable = require('readable-stream/writable.js');\nStream.Duplex = require('readable-stream/duplex.js');\nStream.Transform = require('readable-stream/transform.js');\nStream.PassThrough = require('readable-stream/passthrough.js');\n\n// Backwards-compat with node 0.4.x\nStream.Stream = Stream;\n\n\n\n// old-style streams. Note that the pipe method (the only relevant\n// part of this class) is overridden in the Readable class.\n\nfunction Stream() {\n EE.call(this);\n}\n\nStream.prototype.pipe = function(dest, options) {\n var source = this;\n\n function ondata(chunk) {\n if (dest.writable) {\n if (false === dest.write(chunk) && source.pause) {\n source.pause();\n }\n }\n }\n\n source.on('data', ondata);\n\n function ondrain() {\n if (source.readable && source.resume) {\n source.resume();\n }\n }\n\n dest.on('drain', ondrain);\n\n // If the 'end' option is not supplied, dest.end() will be called when\n // source gets the 'end' or 'close' events. Only dest.end() once.\n if (!dest._isStdio && (!options || options.end !== false)) {\n source.on('end', onend);\n source.on('close', onclose);\n }\n\n var didOnEnd = false;\n function onend() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n dest.end();\n }\n\n\n function onclose() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n if (typeof dest.destroy === 'function') dest.destroy();\n }\n\n // don't leave dangling pipes when there are errors.\n function onerror(er) {\n cleanup();\n if (EE.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }\n\n source.on('error', onerror);\n dest.on('error', onerror);\n\n // remove all the event listeners that were added.\n function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n }\n\n source.on('end', cleanup);\n source.on('close', cleanup);\n\n dest.on('close', cleanup);\n\n dest.emit('pipe', source);\n\n // Allow for unix-like usage: A.pipe(B).pipe(C)\n return dest;\n};\n","module.exports = require('stream');\n","'use strict';\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar _require = require('buffer'),\n Buffer = _require.Buffer;\nvar _require2 = require('util'),\n inspect = _require2.inspect;\nvar custom = inspect && inspect.custom || 'inspect';\nfunction copyBuffer(src, target, offset) {\n Buffer.prototype.copy.call(src, target, offset);\n}\nmodule.exports = /*#__PURE__*/function () {\n function BufferList() {\n _classCallCheck(this, BufferList);\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n _createClass(BufferList, [{\n key: \"push\",\n value: function push(v) {\n var entry = {\n data: v,\n next: null\n };\n if (this.length > 0) this.tail.next = entry;else this.head = entry;\n this.tail = entry;\n ++this.length;\n }\n }, {\n key: \"unshift\",\n value: function unshift(v) {\n var entry = {\n data: v,\n next: this.head\n };\n if (this.length === 0) this.tail = entry;\n this.head = entry;\n ++this.length;\n }\n }, {\n key: \"shift\",\n value: function shift() {\n if (this.length === 0) return;\n var ret = this.head.data;\n if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;\n --this.length;\n return ret;\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.head = this.tail = null;\n this.length = 0;\n }\n }, {\n key: \"join\",\n value: function join(s) {\n if (this.length === 0) return '';\n var p = this.head;\n var ret = '' + p.data;\n while (p = p.next) ret += s + p.data;\n return ret;\n }\n }, {\n key: \"concat\",\n value: function concat(n) {\n if (this.length === 0) return Buffer.alloc(0);\n var ret = Buffer.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n return ret;\n }\n\n // Consumes a specified amount of bytes or characters from the buffered data.\n }, {\n key: \"consume\",\n value: function consume(n, hasStrings) {\n var ret;\n if (n < this.head.data.length) {\n // `slice` is the same for buffers and strings.\n ret = this.head.data.slice(0, n);\n this.head.data = this.head.data.slice(n);\n } else if (n === this.head.data.length) {\n // First chunk is a perfect match.\n ret = this.shift();\n } else {\n // Result spans more than one buffer.\n ret = hasStrings ? this._getString(n) : this._getBuffer(n);\n }\n return ret;\n }\n }, {\n key: \"first\",\n value: function first() {\n return this.head.data;\n }\n\n // Consumes a specified amount of characters from the buffered data.\n }, {\n key: \"_getString\",\n value: function _getString(n) {\n var p = this.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n\n // Consumes a specified amount of bytes from the buffered data.\n }, {\n key: \"_getBuffer\",\n value: function _getBuffer(n) {\n var ret = Buffer.allocUnsafe(n);\n var p = this.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n\n // Make sure the linked list only shows the minimal necessary information.\n }, {\n key: custom,\n value: function value(_, options) {\n return inspect(this, _objectSpread(_objectSpread({}, options), {}, {\n // Only inspect one level.\n depth: 0,\n // It should not recurse.\n customInspect: false\n }));\n }\n }]);\n return BufferList;\n}();","'use strict';\n\n// undocumented cb() API, needed for core, not for public API\nfunction destroy(err, cb) {\n var _this = this;\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n process.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n process.nextTick(emitErrorNT, this, err);\n }\n }\n return this;\n }\n\n // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n\n // if this is a duplex stream mark the writable part as destroyed as well\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n if (!_this._writableState) {\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, _this);\n cb(err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n });\n return this;\n}\nfunction emitErrorAndCloseNT(self, err) {\n emitErrorNT(self, err);\n emitCloseNT(self);\n}\nfunction emitCloseNT(self) {\n if (self._writableState && !self._writableState.emitClose) return;\n if (self._readableState && !self._readableState.emitClose) return;\n self.emit('close');\n}\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\nfunction errorOrDestroy(stream, err) {\n // We have tests that rely on errors being emitted\n // in the same tick, so changing this is semver major.\n // For now when you opt-in to autoDestroy we allow\n // the error to be emitted nextTick. In a future\n // semver major update we should change the default to this.\n\n var rState = stream._readableState;\n var wState = stream._writableState;\n if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);\n}\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy,\n errorOrDestroy: errorOrDestroy\n};","'use strict';\n\nconst codes = {};\n\nfunction createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error\n }\n\n function getMessage (arg1, arg2, arg3) {\n if (typeof message === 'string') {\n return message\n } else {\n return message(arg1, arg2, arg3)\n }\n }\n\n class NodeError extends Base {\n constructor (arg1, arg2, arg3) {\n super(getMessage(arg1, arg2, arg3));\n }\n }\n\n NodeError.prototype.name = Base.name;\n NodeError.prototype.code = code;\n\n codes[code] = NodeError;\n}\n\n// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js\nfunction oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n const len = expected.length;\n expected = expected.map((i) => String(i));\n if (len > 2) {\n return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` +\n expected[len - 1];\n } else if (len === 2) {\n return `one of ${thing} ${expected[0]} or ${expected[1]}`;\n } else {\n return `of ${thing} ${expected[0]}`;\n }\n } else {\n return `of ${thing} ${String(expected)}`;\n }\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith\nfunction startsWith(str, search, pos) {\n\treturn str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\nfunction endsWith(str, search, this_len) {\n\tif (this_len === undefined || this_len > str.length) {\n\t\tthis_len = str.length;\n\t}\n\treturn str.substring(this_len - search.length, this_len) === search;\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes\nfunction includes(str, search, start) {\n if (typeof start !== 'number') {\n start = 0;\n }\n\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n}\n\ncreateErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {\n return 'The value \"' + value + '\" is invalid for option \"' + name + '\"'\n}, TypeError);\ncreateErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {\n // determiner: 'must be' or 'must not be'\n let determiner;\n if (typeof expected === 'string' && startsWith(expected, 'not ')) {\n determiner = 'must not be';\n expected = expected.replace(/^not /, '');\n } else {\n determiner = 'must be';\n }\n\n let msg;\n if (endsWith(name, ' argument')) {\n // For cases like 'first argument'\n msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`;\n } else {\n const type = includes(name, '.') ? 'property' : 'argument';\n msg = `The \"${name}\" ${type} ${determiner} ${oneOf(expected, 'type')}`;\n }\n\n msg += `. Received type ${typeof actual}`;\n return msg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');\ncreateErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {\n return 'The ' + name + ' method is not implemented'\n});\ncreateErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');\ncreateErrorType('ERR_STREAM_DESTROYED', function (name) {\n return 'Cannot call ' + name + ' after a stream was destroyed';\n});\ncreateErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');\ncreateErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');\ncreateErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');\ncreateErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);\ncreateErrorType('ERR_UNKNOWN_ENCODING', function (arg) {\n return 'Unknown encoding: ' + arg\n}, TypeError);\ncreateErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');\n\nmodule.exports.codes = codes;\n","'use strict';\n\nvar ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;\nfunction highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n}\nfunction getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name = isDuplex ? duplexKey : 'highWaterMark';\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n return Math.floor(hwm);\n }\n\n // Default value\n return state.objectMode ? 16 : 16 * 1024;\n}\nmodule.exports = {\n getHighWaterMark: getHighWaterMark\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n'use strict';\n\nmodule.exports = Writable;\n\n/* */\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n}\n\n// It seems a linked list but it is not\n// there will be only 2 of these for each stream\nfunction CorkedRequest(state) {\n var _this = this;\n this.next = null;\n this.entry = null;\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* */\n\n/**/\nvar Duplex;\n/**/\n\nWritable.WritableState = WritableState;\n\n/**/\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n/**/\nvar Stream = require('./internal/streams/stream');\n/**/\n\nvar Buffer = require('buffer').Buffer;\nvar OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\nvar destroyImpl = require('./internal/streams/destroy');\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,\n ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\nrequire('inherits')(Writable, Stream);\nfunction nop() {}\nfunction WritableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream,\n // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex);\n\n // if _final has been called\n this.finalCalled = false;\n\n // drain event flag.\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function (er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n\n // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n\n // Should close be emitted on destroy. Defaults to true.\n this.emitClose = options.emitClose !== false;\n\n // Should .destroy() be called after 'finish' (and potentially 'end')\n this.autoDestroy = !!options.autoDestroy;\n\n // count buffered requests\n this.bufferedRequestCount = 0;\n\n // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n this.corkedRequestsFree = new CorkedRequest(this);\n}\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n};\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})();\n\n// Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\nvar realHasInstance;\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function realHasInstance(object) {\n return object instanceof this;\n };\n}\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n\n // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the WritableState constructor, at least with V8 6.5\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex);\n\n // legacy.\n this.writable = true;\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n if (typeof options.writev === 'function') this._writev = options.writev;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n if (typeof options.final === 'function') this._final = options.final;\n }\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function () {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n};\nfunction writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END();\n // TODO: defer error events consistently everywhere, not just the cb\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n}\n\n// Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\nfunction validChunk(stream, state, chunk, cb) {\n var er;\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== 'string' && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);\n }\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n return true;\n}\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n if (typeof cb !== 'function') cb = nop;\n if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n};\nWritable.prototype.cork = function () {\n this._writableState.corked++;\n};\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\nObject.defineProperty(Writable.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n return chunk;\n}\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n});\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret) state.needDrain = true;\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n return ret;\n}\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n process.nextTick(cb, er);\n // this can emit finish, and it will always happen\n // after error\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n // this can emit finish, but finish must\n // always follow error\n finishMaybe(stream, state);\n }\n}\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state) || stream.destroyed;\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, '', holder.finish);\n\n // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n break;\n }\n }\n if (entry === null) state.lastBufferedRequest = null;\n }\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));\n};\nWritable.prototype._writev = null;\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending) endWritable(this, state, cb);\n return this;\n};\nObject.defineProperty(Writable.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n if (err) {\n errorOrDestroy(stream, err);\n }\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function' && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the readable side is ready for autoDestroy as well\n var rState = stream._readableState;\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n return need;\n}\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished) process.nextTick(cb);else stream.once('finish', cb);\n }\n state.ended = true;\n stream.writable = false;\n}\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n\n // reuse the free corkReq.\n state.corkedRequestsFree.next = corkReq;\n}\nObject.defineProperty(Writable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._writableState === undefined) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._writableState.destroyed = value;\n }\n});\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\nWritable.prototype._destroy = function (err, cb) {\n cb(err);\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n'use strict';\n\n/**/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n};\n/**/\n\nmodule.exports = Duplex;\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\nrequire('inherits')(Duplex, Readable);\n{\n // Allow the keys array to be GC'ed.\n var keys = objectKeys(Writable.prototype);\n for (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n}\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n Readable.call(this, options);\n Writable.call(this, options);\n this.allowHalfOpen = true;\n if (options) {\n if (options.readable === false) this.readable = false;\n if (options.writable === false) this.writable = false;\n if (options.allowHalfOpen === false) {\n this.allowHalfOpen = false;\n this.once('end', onend);\n }\n }\n}\nObject.defineProperty(Duplex.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\n\n// the no-half-open enforcer\nfunction onend() {\n // If the writable side ended, then we're ok.\n if (this._writableState.ended) return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n process.nextTick(onEndNT, this);\n}\nfunction onEndNT(self) {\n self.end();\n}\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});","// Ported from https://github.com/mafintosh/end-of-stream with\n// permission from the author, Mathias Buus (@mafintosh).\n\n'use strict';\n\nvar ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n callback.apply(this, args);\n };\n}\nfunction noop() {}\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\nfunction eos(stream, opts, callback) {\n if (typeof opts === 'function') return eos(stream, null, opts);\n if (!opts) opts = {};\n callback = once(callback || noop);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable = opts.writable || opts.writable !== false && stream.writable;\n var onlegacyfinish = function onlegacyfinish() {\n if (!stream.writable) onfinish();\n };\n var writableEnded = stream._writableState && stream._writableState.finished;\n var onfinish = function onfinish() {\n writable = false;\n writableEnded = true;\n if (!readable) callback.call(stream);\n };\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n var onend = function onend() {\n readable = false;\n readableEnded = true;\n if (!writable) callback.call(stream);\n };\n var onerror = function onerror(err) {\n callback.call(stream, err);\n };\n var onclose = function onclose() {\n var err;\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n if (writable && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n var onrequest = function onrequest() {\n stream.req.on('finish', onfinish);\n };\n if (isRequest(stream)) {\n stream.on('complete', onfinish);\n stream.on('abort', onclose);\n if (stream.req) onrequest();else stream.on('request', onrequest);\n } else if (writable && !stream._writableState) {\n // legacy streams\n stream.on('end', onlegacyfinish);\n stream.on('close', onlegacyfinish);\n }\n stream.on('end', onend);\n stream.on('finish', onfinish);\n if (opts.error !== false) stream.on('error', onerror);\n stream.on('close', onclose);\n return function () {\n stream.removeListener('complete', onfinish);\n stream.removeListener('abort', onclose);\n stream.removeListener('request', onrequest);\n if (stream.req) stream.req.removeListener('finish', onfinish);\n stream.removeListener('end', onlegacyfinish);\n stream.removeListener('close', onlegacyfinish);\n stream.removeListener('finish', onfinish);\n stream.removeListener('end', onend);\n stream.removeListener('error', onerror);\n stream.removeListener('close', onclose);\n };\n}\nmodule.exports = eos;","'use strict';\n\nvar _Object$setPrototypeO;\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar finished = require('./end-of-stream');\nvar kLastResolve = Symbol('lastResolve');\nvar kLastReject = Symbol('lastReject');\nvar kError = Symbol('error');\nvar kEnded = Symbol('ended');\nvar kLastPromise = Symbol('lastPromise');\nvar kHandlePromise = Symbol('handlePromise');\nvar kStream = Symbol('stream');\nfunction createIterResult(value, done) {\n return {\n value: value,\n done: done\n };\n}\nfunction readAndResolve(iter) {\n var resolve = iter[kLastResolve];\n if (resolve !== null) {\n var data = iter[kStream].read();\n // we defer if data is null\n // we can be expecting either 'end' or\n // 'error'\n if (data !== null) {\n iter[kLastPromise] = null;\n iter[kLastResolve] = null;\n iter[kLastReject] = null;\n resolve(createIterResult(data, false));\n }\n }\n}\nfunction onReadable(iter) {\n // we wait for the next tick, because it might\n // emit an error with process.nextTick\n process.nextTick(readAndResolve, iter);\n}\nfunction wrapForNext(lastPromise, iter) {\n return function (resolve, reject) {\n lastPromise.then(function () {\n if (iter[kEnded]) {\n resolve(createIterResult(undefined, true));\n return;\n }\n iter[kHandlePromise](resolve, reject);\n }, reject);\n };\n}\nvar AsyncIteratorPrototype = Object.getPrototypeOf(function () {});\nvar ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {\n get stream() {\n return this[kStream];\n },\n next: function next() {\n var _this = this;\n // if we have detected an error in the meanwhile\n // reject straight away\n var error = this[kError];\n if (error !== null) {\n return Promise.reject(error);\n }\n if (this[kEnded]) {\n return Promise.resolve(createIterResult(undefined, true));\n }\n if (this[kStream].destroyed) {\n // We need to defer via nextTick because if .destroy(err) is\n // called, the error will be emitted via nextTick, and\n // we cannot guarantee that there is no error lingering around\n // waiting to be emitted.\n return new Promise(function (resolve, reject) {\n process.nextTick(function () {\n if (_this[kError]) {\n reject(_this[kError]);\n } else {\n resolve(createIterResult(undefined, true));\n }\n });\n });\n }\n\n // if we have multiple next() calls\n // we will wait for the previous Promise to finish\n // this logic is optimized to support for await loops,\n // where next() is only called once at a time\n var lastPromise = this[kLastPromise];\n var promise;\n if (lastPromise) {\n promise = new Promise(wrapForNext(lastPromise, this));\n } else {\n // fast path needed to support multiple this.push()\n // without triggering the next() queue\n var data = this[kStream].read();\n if (data !== null) {\n return Promise.resolve(createIterResult(data, false));\n }\n promise = new Promise(this[kHandlePromise]);\n }\n this[kLastPromise] = promise;\n return promise;\n }\n}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {\n return this;\n}), _defineProperty(_Object$setPrototypeO, \"return\", function _return() {\n var _this2 = this;\n // destroy(err, cb) is a private API\n // we can guarantee we have that here, because we control the\n // Readable class this is attached to\n return new Promise(function (resolve, reject) {\n _this2[kStream].destroy(null, function (err) {\n if (err) {\n reject(err);\n return;\n }\n resolve(createIterResult(undefined, true));\n });\n });\n}), _Object$setPrototypeO), AsyncIteratorPrototype);\nvar createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {\n var _Object$create;\n var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {\n value: stream,\n writable: true\n }), _defineProperty(_Object$create, kLastResolve, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kLastReject, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kError, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kEnded, {\n value: stream._readableState.endEmitted,\n writable: true\n }), _defineProperty(_Object$create, kHandlePromise, {\n value: function value(resolve, reject) {\n var data = iterator[kStream].read();\n if (data) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(data, false));\n } else {\n iterator[kLastResolve] = resolve;\n iterator[kLastReject] = reject;\n }\n },\n writable: true\n }), _Object$create));\n iterator[kLastPromise] = null;\n finished(stream, function (err) {\n if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {\n var reject = iterator[kLastReject];\n // reject if we are waiting for data in the Promise\n // returned by next() and store the error\n if (reject !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n reject(err);\n }\n iterator[kError] = err;\n return;\n }\n var resolve = iterator[kLastResolve];\n if (resolve !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(undefined, true));\n }\n iterator[kEnded] = true;\n });\n stream.on('readable', onReadable.bind(null, iterator));\n return iterator;\n};\nmodule.exports = createReadableStreamAsyncIterator;","'use strict';\n\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar ERR_INVALID_ARG_TYPE = require('../../../errors').codes.ERR_INVALID_ARG_TYPE;\nfunction from(Readable, iterable, opts) {\n var iterator;\n if (iterable && typeof iterable.next === 'function') {\n iterator = iterable;\n } else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();else throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable);\n var readable = new Readable(_objectSpread({\n objectMode: true\n }, opts));\n // Reading boolean to protect against _read\n // being called before last iteration completion.\n var reading = false;\n readable._read = function () {\n if (!reading) {\n reading = true;\n next();\n }\n };\n function next() {\n return _next2.apply(this, arguments);\n }\n function _next2() {\n _next2 = _asyncToGenerator(function* () {\n try {\n var _yield$iterator$next = yield iterator.next(),\n value = _yield$iterator$next.value,\n done = _yield$iterator$next.done;\n if (done) {\n readable.push(null);\n } else if (readable.push(yield value)) {\n next();\n } else {\n reading = false;\n }\n } catch (err) {\n readable.destroy(err);\n }\n });\n return _next2.apply(this, arguments);\n }\n return readable;\n}\nmodule.exports = from;\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nmodule.exports = Readable;\n\n/**/\nvar Duplex;\n/**/\n\nReadable.ReadableState = ReadableState;\n\n/**/\nvar EE = require('events').EventEmitter;\nvar EElistenerCount = function EElistenerCount(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n/**/\nvar Stream = require('./internal/streams/stream');\n/**/\n\nvar Buffer = require('buffer').Buffer;\nvar OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/**/\nvar debugUtil = require('util');\nvar debug;\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function debug() {};\n}\n/**/\n\nvar BufferList = require('./internal/streams/buffer_list');\nvar destroyImpl = require('./internal/streams/destroy');\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;\n\n// Lazy loaded to improve the startup performance.\nvar StringDecoder;\nvar createReadableStreamAsyncIterator;\nvar from;\nrequire('inherits')(Readable, Stream);\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);\n\n // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\nfunction ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex);\n\n // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true;\n\n // Should close be emitted on destroy. Defaults to true.\n this.emitClose = options.emitClose !== false;\n\n // Should .destroy() be called after 'end' (and potentially 'finish')\n this.autoDestroy = !!options.autoDestroy;\n\n // has it been destroyed\n this.destroyed = false;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n if (!(this instanceof Readable)) return new Readable(options);\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the ReadableState constructor, at least with V8 6.5\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex);\n\n // legacy\n this.readable = true;\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n Stream.call(this);\n}\nObject.defineProperty(Readable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n }\n});\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\nReadable.prototype._destroy = function (err, cb) {\n cb(err);\n};\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug('readableAddChunk', chunk);\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (addToFront) {\n if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n }\n\n // We can push more data if we are below the highWaterMark.\n // Also, if we have no data yet, we can stand some more bytes.\n // This is to work around cases where hwm=0, such as the repl.\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n}\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit('data', chunk);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n if (state.needReadable) emitReadable(stream);\n }\n maybeReadMore(stream, state);\n}\nfunction chunkInvalid(state, chunk) {\n var er;\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);\n }\n return er;\n}\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n};\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder;\n // If setEncoding(null), decoder.encoding equals utf8\n this._readableState.encoding = this._readableState.decoder.encoding;\n\n // Iterate over current buffer to convert already stored Buffers:\n var p = this._readableState.buffer.head;\n var content = '';\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n this._readableState.buffer.clear();\n if (content !== '') this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n};\n\n// Don't raise the hwm > 1GB\nvar MAX_HWM = 0x40000000;\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n}\n\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n }\n // If we're asking for more than the current hwm, then raise the hwm.\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n;\n // Don't have enough\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0) state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug('need readable', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0) state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended) endReadable(this);\n }\n if (ret !== null) this.emit('data', ret);\n return ret;\n};\nfunction onEofChunk(stream, state) {\n debug('onEofChunk');\n if (state.ended) return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n if (state.sync) {\n // if we are sync, wait until next tick to emit the data.\n // Otherwise we risk emitting data in the flow()\n // the readable code triggers during a read() call\n emitReadable(stream);\n } else {\n // emit 'readable' now to make sure it gets picked up.\n state.needReadable = false;\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}\nfunction emitReadable_(stream) {\n var state = stream._readableState;\n debug('emitReadable_', state.destroyed, state.length, state.ended);\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit('readable');\n state.emittedReadable = false;\n }\n\n // The stream needs another readable event if\n // 1. It is not flowing, as the flow mechanism will take\n // care of it.\n // 2. It is not ended.\n // 3. It is below the highWaterMark, so we can schedule\n // another readable later.\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n}\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n}\nfunction maybeReadMore_(stream, state) {\n // Attempt to read more data if we should.\n //\n // The conditions for reading more data are (one of):\n // - Not enough data buffered (state.length < state.highWaterMark). The loop\n // is responsible for filling the buffer with enough data if such data\n // is available. If highWaterMark is 0 and we are not in the flowing mode\n // we should _not_ attempt to buffer any extra data. We'll get more data\n // when the stream consumer calls read() instead.\n // - No data in the buffer, and the stream is in flowing mode. In this mode\n // the loop below is responsible for ensuring read() is called. Failing to\n // call read here would abort the flow and there's no other mechanism for\n // continuing the flow if the stream consumer has just subscribed to the\n // 'data' event.\n //\n // In addition to the above conditions to keep reading data, the following\n // conditions prevent the data from being read:\n // - The stream has ended (state.ended).\n // - There is already a pending 'read' operation (state.reading). This is a\n // case where the the stream has called the implementation defined _read()\n // method, but they are processing the call asynchronously and have _not_\n // called push() with new data. In this case we skip performing more\n // read()s. The execution ends in this method again after the _read() ends\n // up calling push() with more data.\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function (n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));\n};\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);\n dest.on('unpipe', onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n function onend() {\n debug('onend');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n var cleanedUp = false;\n function cleanup() {\n debug('cleanup');\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n cleanedUp = true;\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n debug('dest.write', ret);\n if (ret === false) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', state.awaitDrain);\n state.awaitDrain++;\n }\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);\n }\n\n // Make sure our error handler is attached before userland ones.\n prependListener(dest, 'error', onerror);\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n return dest;\n};\nfunction pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n };\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0) return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n if (!dest) dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, {\n hasUnpiped: false\n });\n return this;\n }\n\n // try to find the right one.\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n dest.emit('unpipe', this, unpipeInfo);\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n if (ev === 'data') {\n // update readableListening so that resume() may be a no-op\n // a few lines down. This is needed to support once('readable').\n state.readableListening = this.listenerCount('readable') > 0;\n\n // Try start flowing on next tick if stream isn't explicitly paused\n if (state.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug('on readable', state.length, state.reading);\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\nReadable.prototype.removeListener = function (ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n if (ev === 'readable') {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n return res;\n};\nReadable.prototype.removeAllListeners = function (ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n if (ev === 'readable' || ev === undefined) {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n return res;\n};\nfunction updateReadableListening(self) {\n var state = self._readableState;\n state.readableListening = self.listenerCount('readable') > 0;\n if (state.resumeScheduled && !state.paused) {\n // flowing needs to be set to true now, otherwise\n // the upcoming resume will not flow.\n state.flowing = true;\n\n // crude way to check if we should resume\n } else if (self.listenerCount('data') > 0) {\n self.resume();\n }\n}\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function () {\n var state = this._readableState;\n if (!state.flowing) {\n debug('resume');\n // we flow only if there is no one listening\n // for readable, but we still have to call\n // resume()\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n state.paused = false;\n return this;\n};\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n}\nfunction resume_(stream, state) {\n debug('resume', state.reading);\n if (!state.reading) {\n stream.read(0);\n }\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n if (this._readableState.flowing !== false) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n this._readableState.paused = true;\n return this;\n};\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n while (state.flowing && stream.read() !== null);\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n var state = this._readableState;\n var paused = false;\n stream.on('end', function () {\n debug('wrapped end');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n _this.push(null);\n });\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk);\n\n // don't skip over falsy values in objectMode\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n var ret = _this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n\n // proxy certain important events.\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n this._read = function (n) {\n debug('wrapped _read', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n return this;\n};\nif (typeof Symbol === 'function') {\n Readable.prototype[Symbol.asyncIterator] = function () {\n if (createReadableStreamAsyncIterator === undefined) {\n createReadableStreamAsyncIterator = require('./internal/streams/async_iterator');\n }\n return createReadableStreamAsyncIterator(this);\n };\n}\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableFlowing', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n});\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\nObject.defineProperty(Readable.prototype, 'readableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n});\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n}\nfunction endReadable(stream) {\n var state = stream._readableState;\n debug('endReadable', state.endEmitted);\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n}\nfunction endReadableNT(state, stream) {\n debug('endReadableNT', state.endEmitted, state.length);\n\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the writable side is ready for autoDestroy as well\n var wState = stream._writableState;\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n}\nif (typeof Symbol === 'function') {\n Readable.from = function (iterable, opts) {\n if (from === undefined) {\n from = require('./internal/streams/from');\n }\n return from(Readable, iterable, opts);\n };\n}\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n'use strict';\n\nmodule.exports = Transform;\nvar _require$codes = require('../errors').codes,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,\n ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\nvar Duplex = require('./_stream_duplex');\nrequire('inherits')(Transform, Duplex);\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n if (cb === null) {\n return this.emit('error', new ERR_MULTIPLE_CALLBACK());\n }\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null)\n // single equals check for both `null` and `undefined`\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n if (typeof options.flush === 'function') this._flush = options.flush;\n }\n\n // When the writable side finishes, then flush out anything remaining.\n this.on('prefinish', prefinish);\n}\nfunction prefinish() {\n var _this = this;\n if (typeof this._flush === 'function' && !this._readableState.destroyed) {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));\n};\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\nTransform.prototype._destroy = function (err, cb) {\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n });\n};\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n if (data != null)\n // single equals check for both `null` and `undefined`\n stream.push(data);\n\n // TODO(BridgeAR): Write a test for these two error cases\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n}","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n'use strict';\n\nmodule.exports = PassThrough;\nvar Transform = require('./_stream_transform');\nrequire('inherits')(PassThrough, Transform);\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options);\n Transform.call(this, options);\n}\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk);\n};","// Ported from https://github.com/mafintosh/pump with\n// permission from the author, Mathias Buus (@mafintosh).\n\n'use strict';\n\nvar eos;\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n callback.apply(void 0, arguments);\n };\n}\nvar _require$codes = require('../../../errors').codes,\n ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\nfunction noop(err) {\n // Rethrow the error if it exists to avoid swallowing it\n if (err) throw err;\n}\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\nfunction destroyer(stream, reading, writing, callback) {\n callback = once(callback);\n var closed = false;\n stream.on('close', function () {\n closed = true;\n });\n if (eos === undefined) eos = require('./end-of-stream');\n eos(stream, {\n readable: reading,\n writable: writing\n }, function (err) {\n if (err) return callback(err);\n closed = true;\n callback();\n });\n var destroyed = false;\n return function (err) {\n if (closed) return;\n if (destroyed) return;\n destroyed = true;\n\n // request.destroy just do .end - .abort is what we want\n if (isRequest(stream)) return stream.abort();\n if (typeof stream.destroy === 'function') return stream.destroy();\n callback(err || new ERR_STREAM_DESTROYED('pipe'));\n };\n}\nfunction call(fn) {\n fn();\n}\nfunction pipe(from, to) {\n return from.pipe(to);\n}\nfunction popCallback(streams) {\n if (!streams.length) return noop;\n if (typeof streams[streams.length - 1] !== 'function') return noop;\n return streams.pop();\n}\nfunction pipeline() {\n for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {\n streams[_key] = arguments[_key];\n }\n var callback = popCallback(streams);\n if (Array.isArray(streams[0])) streams = streams[0];\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS('streams');\n }\n var error;\n var destroys = streams.map(function (stream, i) {\n var reading = i < streams.length - 1;\n var writing = i > 0;\n return destroyer(stream, reading, writing, function (err) {\n if (!error) error = err;\n if (err) destroys.forEach(call);\n if (reading) return;\n destroys.forEach(call);\n callback(error);\n });\n });\n return streams.reduce(pipe);\n}\nmodule.exports = pipeline;","var Stream = require('stream');\nif (process.env.READABLE_STREAM === 'disable' && Stream) {\n module.exports = Stream.Readable;\n Object.assign(module.exports, Stream);\n module.exports.Stream = Stream;\n} else {\n exports = module.exports = require('./lib/_stream_readable.js');\n exports.Stream = Stream || exports;\n exports.Readable = exports;\n exports.Writable = require('./lib/_stream_writable.js');\n exports.Duplex = require('./lib/_stream_duplex.js');\n exports.Transform = require('./lib/_stream_transform.js');\n exports.PassThrough = require('./lib/_stream_passthrough.js');\n exports.finished = require('./lib/internal/streams/end-of-stream.js');\n exports.pipeline = require('./lib/internal/streams/pipeline.js');\n}\n","'use strict'\nvar Buffer = require('safe-buffer').Buffer\nvar Transform = require('readable-stream').Transform\nvar inherits = require('inherits')\n\nfunction throwIfNotStringOrBuffer (val, prefix) {\n if (!Buffer.isBuffer(val) && typeof val !== 'string') {\n throw new TypeError(prefix + ' must be a string or a buffer')\n }\n}\n\nfunction HashBase (blockSize) {\n Transform.call(this)\n\n this._block = Buffer.allocUnsafe(blockSize)\n this._blockSize = blockSize\n this._blockOffset = 0\n this._length = [0, 0, 0, 0]\n\n this._finalized = false\n}\n\ninherits(HashBase, Transform)\n\nHashBase.prototype._transform = function (chunk, encoding, callback) {\n var error = null\n try {\n this.update(chunk, encoding)\n } catch (err) {\n error = err\n }\n\n callback(error)\n}\n\nHashBase.prototype._flush = function (callback) {\n var error = null\n try {\n this.push(this.digest())\n } catch (err) {\n error = err\n }\n\n callback(error)\n}\n\nHashBase.prototype.update = function (data, encoding) {\n throwIfNotStringOrBuffer(data, 'Data')\n if (this._finalized) throw new Error('Digest already called')\n if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding)\n\n // consume data\n var block = this._block\n var offset = 0\n while (this._blockOffset + data.length - offset >= this._blockSize) {\n for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++]\n this._update()\n this._blockOffset = 0\n }\n while (offset < data.length) block[this._blockOffset++] = data[offset++]\n\n // update length\n for (var j = 0, carry = data.length * 8; carry > 0; ++j) {\n this._length[j] += carry\n carry = (this._length[j] / 0x0100000000) | 0\n if (carry > 0) this._length[j] -= 0x0100000000 * carry\n }\n\n return this\n}\n\nHashBase.prototype._update = function () {\n throw new Error('_update is not implemented')\n}\n\nHashBase.prototype.digest = function (encoding) {\n if (this._finalized) throw new Error('Digest already called')\n this._finalized = true\n\n var digest = this._digest()\n if (encoding !== undefined) digest = digest.toString(encoding)\n\n // reset state\n this._block.fill(0)\n this._blockOffset = 0\n for (var i = 0; i < 4; ++i) this._length[i] = 0\n\n return digest\n}\n\nHashBase.prototype._digest = function () {\n throw new Error('_digest is not implemented')\n}\n\nmodule.exports = HashBase\n","'use strict'\nvar inherits = require('inherits')\nvar HashBase = require('hash-base')\nvar Buffer = require('safe-buffer').Buffer\n\nvar ARRAY16 = new Array(16)\n\nfunction MD5 () {\n HashBase.call(this, 64)\n\n // state\n this._a = 0x67452301\n this._b = 0xefcdab89\n this._c = 0x98badcfe\n this._d = 0x10325476\n}\n\ninherits(MD5, HashBase)\n\nMD5.prototype._update = function () {\n var M = ARRAY16\n for (var i = 0; i < 16; ++i) M[i] = this._block.readInt32LE(i * 4)\n\n var a = this._a\n var b = this._b\n var c = this._c\n var d = this._d\n\n a = fnF(a, b, c, d, M[0], 0xd76aa478, 7)\n d = fnF(d, a, b, c, M[1], 0xe8c7b756, 12)\n c = fnF(c, d, a, b, M[2], 0x242070db, 17)\n b = fnF(b, c, d, a, M[3], 0xc1bdceee, 22)\n a = fnF(a, b, c, d, M[4], 0xf57c0faf, 7)\n d = fnF(d, a, b, c, M[5], 0x4787c62a, 12)\n c = fnF(c, d, a, b, M[6], 0xa8304613, 17)\n b = fnF(b, c, d, a, M[7], 0xfd469501, 22)\n a = fnF(a, b, c, d, M[8], 0x698098d8, 7)\n d = fnF(d, a, b, c, M[9], 0x8b44f7af, 12)\n c = fnF(c, d, a, b, M[10], 0xffff5bb1, 17)\n b = fnF(b, c, d, a, M[11], 0x895cd7be, 22)\n a = fnF(a, b, c, d, M[12], 0x6b901122, 7)\n d = fnF(d, a, b, c, M[13], 0xfd987193, 12)\n c = fnF(c, d, a, b, M[14], 0xa679438e, 17)\n b = fnF(b, c, d, a, M[15], 0x49b40821, 22)\n\n a = fnG(a, b, c, d, M[1], 0xf61e2562, 5)\n d = fnG(d, a, b, c, M[6], 0xc040b340, 9)\n c = fnG(c, d, a, b, M[11], 0x265e5a51, 14)\n b = fnG(b, c, d, a, M[0], 0xe9b6c7aa, 20)\n a = fnG(a, b, c, d, M[5], 0xd62f105d, 5)\n d = fnG(d, a, b, c, M[10], 0x02441453, 9)\n c = fnG(c, d, a, b, M[15], 0xd8a1e681, 14)\n b = fnG(b, c, d, a, M[4], 0xe7d3fbc8, 20)\n a = fnG(a, b, c, d, M[9], 0x21e1cde6, 5)\n d = fnG(d, a, b, c, M[14], 0xc33707d6, 9)\n c = fnG(c, d, a, b, M[3], 0xf4d50d87, 14)\n b = fnG(b, c, d, a, M[8], 0x455a14ed, 20)\n a = fnG(a, b, c, d, M[13], 0xa9e3e905, 5)\n d = fnG(d, a, b, c, M[2], 0xfcefa3f8, 9)\n c = fnG(c, d, a, b, M[7], 0x676f02d9, 14)\n b = fnG(b, c, d, a, M[12], 0x8d2a4c8a, 20)\n\n a = fnH(a, b, c, d, M[5], 0xfffa3942, 4)\n d = fnH(d, a, b, c, M[8], 0x8771f681, 11)\n c = fnH(c, d, a, b, M[11], 0x6d9d6122, 16)\n b = fnH(b, c, d, a, M[14], 0xfde5380c, 23)\n a = fnH(a, b, c, d, M[1], 0xa4beea44, 4)\n d = fnH(d, a, b, c, M[4], 0x4bdecfa9, 11)\n c = fnH(c, d, a, b, M[7], 0xf6bb4b60, 16)\n b = fnH(b, c, d, a, M[10], 0xbebfbc70, 23)\n a = fnH(a, b, c, d, M[13], 0x289b7ec6, 4)\n d = fnH(d, a, b, c, M[0], 0xeaa127fa, 11)\n c = fnH(c, d, a, b, M[3], 0xd4ef3085, 16)\n b = fnH(b, c, d, a, M[6], 0x04881d05, 23)\n a = fnH(a, b, c, d, M[9], 0xd9d4d039, 4)\n d = fnH(d, a, b, c, M[12], 0xe6db99e5, 11)\n c = fnH(c, d, a, b, M[15], 0x1fa27cf8, 16)\n b = fnH(b, c, d, a, M[2], 0xc4ac5665, 23)\n\n a = fnI(a, b, c, d, M[0], 0xf4292244, 6)\n d = fnI(d, a, b, c, M[7], 0x432aff97, 10)\n c = fnI(c, d, a, b, M[14], 0xab9423a7, 15)\n b = fnI(b, c, d, a, M[5], 0xfc93a039, 21)\n a = fnI(a, b, c, d, M[12], 0x655b59c3, 6)\n d = fnI(d, a, b, c, M[3], 0x8f0ccc92, 10)\n c = fnI(c, d, a, b, M[10], 0xffeff47d, 15)\n b = fnI(b, c, d, a, M[1], 0x85845dd1, 21)\n a = fnI(a, b, c, d, M[8], 0x6fa87e4f, 6)\n d = fnI(d, a, b, c, M[15], 0xfe2ce6e0, 10)\n c = fnI(c, d, a, b, M[6], 0xa3014314, 15)\n b = fnI(b, c, d, a, M[13], 0x4e0811a1, 21)\n a = fnI(a, b, c, d, M[4], 0xf7537e82, 6)\n d = fnI(d, a, b, c, M[11], 0xbd3af235, 10)\n c = fnI(c, d, a, b, M[2], 0x2ad7d2bb, 15)\n b = fnI(b, c, d, a, M[9], 0xeb86d391, 21)\n\n this._a = (this._a + a) | 0\n this._b = (this._b + b) | 0\n this._c = (this._c + c) | 0\n this._d = (this._d + d) | 0\n}\n\nMD5.prototype._digest = function () {\n // create padding and handle blocks\n this._block[this._blockOffset++] = 0x80\n if (this._blockOffset > 56) {\n this._block.fill(0, this._blockOffset, 64)\n this._update()\n this._blockOffset = 0\n }\n\n this._block.fill(0, this._blockOffset, 56)\n this._block.writeUInt32LE(this._length[0], 56)\n this._block.writeUInt32LE(this._length[1], 60)\n this._update()\n\n // produce result\n var buffer = Buffer.allocUnsafe(16)\n buffer.writeInt32LE(this._a, 0)\n buffer.writeInt32LE(this._b, 4)\n buffer.writeInt32LE(this._c, 8)\n buffer.writeInt32LE(this._d, 12)\n return buffer\n}\n\nfunction rotl (x, n) {\n return (x << n) | (x >>> (32 - n))\n}\n\nfunction fnF (a, b, c, d, m, k, s) {\n return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + b) | 0\n}\n\nfunction fnG (a, b, c, d, m, k, s) {\n return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + b) | 0\n}\n\nfunction fnH (a, b, c, d, m, k, s) {\n return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + b) | 0\n}\n\nfunction fnI (a, b, c, d, m, k, s) {\n return (rotl((a + ((c ^ (b | (~d)))) + m + k) | 0, s) + b) | 0\n}\n\nmodule.exports = MD5\n","module.exports = require('stream');\n","'use strict';\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar _require = require('buffer'),\n Buffer = _require.Buffer;\nvar _require2 = require('util'),\n inspect = _require2.inspect;\nvar custom = inspect && inspect.custom || 'inspect';\nfunction copyBuffer(src, target, offset) {\n Buffer.prototype.copy.call(src, target, offset);\n}\nmodule.exports = /*#__PURE__*/function () {\n function BufferList() {\n _classCallCheck(this, BufferList);\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n _createClass(BufferList, [{\n key: \"push\",\n value: function push(v) {\n var entry = {\n data: v,\n next: null\n };\n if (this.length > 0) this.tail.next = entry;else this.head = entry;\n this.tail = entry;\n ++this.length;\n }\n }, {\n key: \"unshift\",\n value: function unshift(v) {\n var entry = {\n data: v,\n next: this.head\n };\n if (this.length === 0) this.tail = entry;\n this.head = entry;\n ++this.length;\n }\n }, {\n key: \"shift\",\n value: function shift() {\n if (this.length === 0) return;\n var ret = this.head.data;\n if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;\n --this.length;\n return ret;\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.head = this.tail = null;\n this.length = 0;\n }\n }, {\n key: \"join\",\n value: function join(s) {\n if (this.length === 0) return '';\n var p = this.head;\n var ret = '' + p.data;\n while (p = p.next) ret += s + p.data;\n return ret;\n }\n }, {\n key: \"concat\",\n value: function concat(n) {\n if (this.length === 0) return Buffer.alloc(0);\n var ret = Buffer.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n return ret;\n }\n\n // Consumes a specified amount of bytes or characters from the buffered data.\n }, {\n key: \"consume\",\n value: function consume(n, hasStrings) {\n var ret;\n if (n < this.head.data.length) {\n // `slice` is the same for buffers and strings.\n ret = this.head.data.slice(0, n);\n this.head.data = this.head.data.slice(n);\n } else if (n === this.head.data.length) {\n // First chunk is a perfect match.\n ret = this.shift();\n } else {\n // Result spans more than one buffer.\n ret = hasStrings ? this._getString(n) : this._getBuffer(n);\n }\n return ret;\n }\n }, {\n key: \"first\",\n value: function first() {\n return this.head.data;\n }\n\n // Consumes a specified amount of characters from the buffered data.\n }, {\n key: \"_getString\",\n value: function _getString(n) {\n var p = this.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n\n // Consumes a specified amount of bytes from the buffered data.\n }, {\n key: \"_getBuffer\",\n value: function _getBuffer(n) {\n var ret = Buffer.allocUnsafe(n);\n var p = this.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n\n // Make sure the linked list only shows the minimal necessary information.\n }, {\n key: custom,\n value: function value(_, options) {\n return inspect(this, _objectSpread(_objectSpread({}, options), {}, {\n // Only inspect one level.\n depth: 0,\n // It should not recurse.\n customInspect: false\n }));\n }\n }]);\n return BufferList;\n}();","'use strict';\n\n// undocumented cb() API, needed for core, not for public API\nfunction destroy(err, cb) {\n var _this = this;\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n process.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n process.nextTick(emitErrorNT, this, err);\n }\n }\n return this;\n }\n\n // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n\n // if this is a duplex stream mark the writable part as destroyed as well\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n if (!_this._writableState) {\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, _this);\n cb(err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n });\n return this;\n}\nfunction emitErrorAndCloseNT(self, err) {\n emitErrorNT(self, err);\n emitCloseNT(self);\n}\nfunction emitCloseNT(self) {\n if (self._writableState && !self._writableState.emitClose) return;\n if (self._readableState && !self._readableState.emitClose) return;\n self.emit('close');\n}\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\nfunction errorOrDestroy(stream, err) {\n // We have tests that rely on errors being emitted\n // in the same tick, so changing this is semver major.\n // For now when you opt-in to autoDestroy we allow\n // the error to be emitted nextTick. In a future\n // semver major update we should change the default to this.\n\n var rState = stream._readableState;\n var wState = stream._writableState;\n if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);\n}\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy,\n errorOrDestroy: errorOrDestroy\n};","'use strict';\n\nconst codes = {};\n\nfunction createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error\n }\n\n function getMessage (arg1, arg2, arg3) {\n if (typeof message === 'string') {\n return message\n } else {\n return message(arg1, arg2, arg3)\n }\n }\n\n class NodeError extends Base {\n constructor (arg1, arg2, arg3) {\n super(getMessage(arg1, arg2, arg3));\n }\n }\n\n NodeError.prototype.name = Base.name;\n NodeError.prototype.code = code;\n\n codes[code] = NodeError;\n}\n\n// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js\nfunction oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n const len = expected.length;\n expected = expected.map((i) => String(i));\n if (len > 2) {\n return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` +\n expected[len - 1];\n } else if (len === 2) {\n return `one of ${thing} ${expected[0]} or ${expected[1]}`;\n } else {\n return `of ${thing} ${expected[0]}`;\n }\n } else {\n return `of ${thing} ${String(expected)}`;\n }\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith\nfunction startsWith(str, search, pos) {\n\treturn str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\nfunction endsWith(str, search, this_len) {\n\tif (this_len === undefined || this_len > str.length) {\n\t\tthis_len = str.length;\n\t}\n\treturn str.substring(this_len - search.length, this_len) === search;\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes\nfunction includes(str, search, start) {\n if (typeof start !== 'number') {\n start = 0;\n }\n\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n}\n\ncreateErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {\n return 'The value \"' + value + '\" is invalid for option \"' + name + '\"'\n}, TypeError);\ncreateErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {\n // determiner: 'must be' or 'must not be'\n let determiner;\n if (typeof expected === 'string' && startsWith(expected, 'not ')) {\n determiner = 'must not be';\n expected = expected.replace(/^not /, '');\n } else {\n determiner = 'must be';\n }\n\n let msg;\n if (endsWith(name, ' argument')) {\n // For cases like 'first argument'\n msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`;\n } else {\n const type = includes(name, '.') ? 'property' : 'argument';\n msg = `The \"${name}\" ${type} ${determiner} ${oneOf(expected, 'type')}`;\n }\n\n msg += `. Received type ${typeof actual}`;\n return msg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');\ncreateErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {\n return 'The ' + name + ' method is not implemented'\n});\ncreateErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');\ncreateErrorType('ERR_STREAM_DESTROYED', function (name) {\n return 'Cannot call ' + name + ' after a stream was destroyed';\n});\ncreateErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');\ncreateErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');\ncreateErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');\ncreateErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);\ncreateErrorType('ERR_UNKNOWN_ENCODING', function (arg) {\n return 'Unknown encoding: ' + arg\n}, TypeError);\ncreateErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');\n\nmodule.exports.codes = codes;\n","'use strict';\n\nvar ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;\nfunction highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n}\nfunction getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name = isDuplex ? duplexKey : 'highWaterMark';\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n return Math.floor(hwm);\n }\n\n // Default value\n return state.objectMode ? 16 : 16 * 1024;\n}\nmodule.exports = {\n getHighWaterMark: getHighWaterMark\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n'use strict';\n\nmodule.exports = Writable;\n\n/* */\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n}\n\n// It seems a linked list but it is not\n// there will be only 2 of these for each stream\nfunction CorkedRequest(state) {\n var _this = this;\n this.next = null;\n this.entry = null;\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* */\n\n/**/\nvar Duplex;\n/**/\n\nWritable.WritableState = WritableState;\n\n/**/\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n/**/\nvar Stream = require('./internal/streams/stream');\n/**/\n\nvar Buffer = require('buffer').Buffer;\nvar OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\nvar destroyImpl = require('./internal/streams/destroy');\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,\n ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\nrequire('inherits')(Writable, Stream);\nfunction nop() {}\nfunction WritableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream,\n // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex);\n\n // if _final has been called\n this.finalCalled = false;\n\n // drain event flag.\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function (er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n\n // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n\n // Should close be emitted on destroy. Defaults to true.\n this.emitClose = options.emitClose !== false;\n\n // Should .destroy() be called after 'finish' (and potentially 'end')\n this.autoDestroy = !!options.autoDestroy;\n\n // count buffered requests\n this.bufferedRequestCount = 0;\n\n // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n this.corkedRequestsFree = new CorkedRequest(this);\n}\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n};\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})();\n\n// Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\nvar realHasInstance;\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function realHasInstance(object) {\n return object instanceof this;\n };\n}\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n\n // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the WritableState constructor, at least with V8 6.5\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex);\n\n // legacy.\n this.writable = true;\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n if (typeof options.writev === 'function') this._writev = options.writev;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n if (typeof options.final === 'function') this._final = options.final;\n }\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function () {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n};\nfunction writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END();\n // TODO: defer error events consistently everywhere, not just the cb\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n}\n\n// Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\nfunction validChunk(stream, state, chunk, cb) {\n var er;\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== 'string' && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);\n }\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n return true;\n}\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n if (typeof cb !== 'function') cb = nop;\n if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n};\nWritable.prototype.cork = function () {\n this._writableState.corked++;\n};\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\nObject.defineProperty(Writable.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n return chunk;\n}\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n});\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret) state.needDrain = true;\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n return ret;\n}\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n process.nextTick(cb, er);\n // this can emit finish, and it will always happen\n // after error\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n // this can emit finish, but finish must\n // always follow error\n finishMaybe(stream, state);\n }\n}\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state) || stream.destroyed;\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, '', holder.finish);\n\n // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n break;\n }\n }\n if (entry === null) state.lastBufferedRequest = null;\n }\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));\n};\nWritable.prototype._writev = null;\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending) endWritable(this, state, cb);\n return this;\n};\nObject.defineProperty(Writable.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n if (err) {\n errorOrDestroy(stream, err);\n }\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function' && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the readable side is ready for autoDestroy as well\n var rState = stream._readableState;\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n return need;\n}\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished) process.nextTick(cb);else stream.once('finish', cb);\n }\n state.ended = true;\n stream.writable = false;\n}\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n\n // reuse the free corkReq.\n state.corkedRequestsFree.next = corkReq;\n}\nObject.defineProperty(Writable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._writableState === undefined) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._writableState.destroyed = value;\n }\n});\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\nWritable.prototype._destroy = function (err, cb) {\n cb(err);\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n'use strict';\n\n/**/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n};\n/**/\n\nmodule.exports = Duplex;\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\nrequire('inherits')(Duplex, Readable);\n{\n // Allow the keys array to be GC'ed.\n var keys = objectKeys(Writable.prototype);\n for (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n}\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n Readable.call(this, options);\n Writable.call(this, options);\n this.allowHalfOpen = true;\n if (options) {\n if (options.readable === false) this.readable = false;\n if (options.writable === false) this.writable = false;\n if (options.allowHalfOpen === false) {\n this.allowHalfOpen = false;\n this.once('end', onend);\n }\n }\n}\nObject.defineProperty(Duplex.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\n\n// the no-half-open enforcer\nfunction onend() {\n // If the writable side ended, then we're ok.\n if (this._writableState.ended) return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n process.nextTick(onEndNT, this);\n}\nfunction onEndNT(self) {\n self.end();\n}\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});","// Ported from https://github.com/mafintosh/end-of-stream with\n// permission from the author, Mathias Buus (@mafintosh).\n\n'use strict';\n\nvar ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n callback.apply(this, args);\n };\n}\nfunction noop() {}\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\nfunction eos(stream, opts, callback) {\n if (typeof opts === 'function') return eos(stream, null, opts);\n if (!opts) opts = {};\n callback = once(callback || noop);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable = opts.writable || opts.writable !== false && stream.writable;\n var onlegacyfinish = function onlegacyfinish() {\n if (!stream.writable) onfinish();\n };\n var writableEnded = stream._writableState && stream._writableState.finished;\n var onfinish = function onfinish() {\n writable = false;\n writableEnded = true;\n if (!readable) callback.call(stream);\n };\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n var onend = function onend() {\n readable = false;\n readableEnded = true;\n if (!writable) callback.call(stream);\n };\n var onerror = function onerror(err) {\n callback.call(stream, err);\n };\n var onclose = function onclose() {\n var err;\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n if (writable && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n var onrequest = function onrequest() {\n stream.req.on('finish', onfinish);\n };\n if (isRequest(stream)) {\n stream.on('complete', onfinish);\n stream.on('abort', onclose);\n if (stream.req) onrequest();else stream.on('request', onrequest);\n } else if (writable && !stream._writableState) {\n // legacy streams\n stream.on('end', onlegacyfinish);\n stream.on('close', onlegacyfinish);\n }\n stream.on('end', onend);\n stream.on('finish', onfinish);\n if (opts.error !== false) stream.on('error', onerror);\n stream.on('close', onclose);\n return function () {\n stream.removeListener('complete', onfinish);\n stream.removeListener('abort', onclose);\n stream.removeListener('request', onrequest);\n if (stream.req) stream.req.removeListener('finish', onfinish);\n stream.removeListener('end', onlegacyfinish);\n stream.removeListener('close', onlegacyfinish);\n stream.removeListener('finish', onfinish);\n stream.removeListener('end', onend);\n stream.removeListener('error', onerror);\n stream.removeListener('close', onclose);\n };\n}\nmodule.exports = eos;","'use strict';\n\nvar _Object$setPrototypeO;\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar finished = require('./end-of-stream');\nvar kLastResolve = Symbol('lastResolve');\nvar kLastReject = Symbol('lastReject');\nvar kError = Symbol('error');\nvar kEnded = Symbol('ended');\nvar kLastPromise = Symbol('lastPromise');\nvar kHandlePromise = Symbol('handlePromise');\nvar kStream = Symbol('stream');\nfunction createIterResult(value, done) {\n return {\n value: value,\n done: done\n };\n}\nfunction readAndResolve(iter) {\n var resolve = iter[kLastResolve];\n if (resolve !== null) {\n var data = iter[kStream].read();\n // we defer if data is null\n // we can be expecting either 'end' or\n // 'error'\n if (data !== null) {\n iter[kLastPromise] = null;\n iter[kLastResolve] = null;\n iter[kLastReject] = null;\n resolve(createIterResult(data, false));\n }\n }\n}\nfunction onReadable(iter) {\n // we wait for the next tick, because it might\n // emit an error with process.nextTick\n process.nextTick(readAndResolve, iter);\n}\nfunction wrapForNext(lastPromise, iter) {\n return function (resolve, reject) {\n lastPromise.then(function () {\n if (iter[kEnded]) {\n resolve(createIterResult(undefined, true));\n return;\n }\n iter[kHandlePromise](resolve, reject);\n }, reject);\n };\n}\nvar AsyncIteratorPrototype = Object.getPrototypeOf(function () {});\nvar ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {\n get stream() {\n return this[kStream];\n },\n next: function next() {\n var _this = this;\n // if we have detected an error in the meanwhile\n // reject straight away\n var error = this[kError];\n if (error !== null) {\n return Promise.reject(error);\n }\n if (this[kEnded]) {\n return Promise.resolve(createIterResult(undefined, true));\n }\n if (this[kStream].destroyed) {\n // We need to defer via nextTick because if .destroy(err) is\n // called, the error will be emitted via nextTick, and\n // we cannot guarantee that there is no error lingering around\n // waiting to be emitted.\n return new Promise(function (resolve, reject) {\n process.nextTick(function () {\n if (_this[kError]) {\n reject(_this[kError]);\n } else {\n resolve(createIterResult(undefined, true));\n }\n });\n });\n }\n\n // if we have multiple next() calls\n // we will wait for the previous Promise to finish\n // this logic is optimized to support for await loops,\n // where next() is only called once at a time\n var lastPromise = this[kLastPromise];\n var promise;\n if (lastPromise) {\n promise = new Promise(wrapForNext(lastPromise, this));\n } else {\n // fast path needed to support multiple this.push()\n // without triggering the next() queue\n var data = this[kStream].read();\n if (data !== null) {\n return Promise.resolve(createIterResult(data, false));\n }\n promise = new Promise(this[kHandlePromise]);\n }\n this[kLastPromise] = promise;\n return promise;\n }\n}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {\n return this;\n}), _defineProperty(_Object$setPrototypeO, \"return\", function _return() {\n var _this2 = this;\n // destroy(err, cb) is a private API\n // we can guarantee we have that here, because we control the\n // Readable class this is attached to\n return new Promise(function (resolve, reject) {\n _this2[kStream].destroy(null, function (err) {\n if (err) {\n reject(err);\n return;\n }\n resolve(createIterResult(undefined, true));\n });\n });\n}), _Object$setPrototypeO), AsyncIteratorPrototype);\nvar createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {\n var _Object$create;\n var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {\n value: stream,\n writable: true\n }), _defineProperty(_Object$create, kLastResolve, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kLastReject, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kError, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kEnded, {\n value: stream._readableState.endEmitted,\n writable: true\n }), _defineProperty(_Object$create, kHandlePromise, {\n value: function value(resolve, reject) {\n var data = iterator[kStream].read();\n if (data) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(data, false));\n } else {\n iterator[kLastResolve] = resolve;\n iterator[kLastReject] = reject;\n }\n },\n writable: true\n }), _Object$create));\n iterator[kLastPromise] = null;\n finished(stream, function (err) {\n if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {\n var reject = iterator[kLastReject];\n // reject if we are waiting for data in the Promise\n // returned by next() and store the error\n if (reject !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n reject(err);\n }\n iterator[kError] = err;\n return;\n }\n var resolve = iterator[kLastResolve];\n if (resolve !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(undefined, true));\n }\n iterator[kEnded] = true;\n });\n stream.on('readable', onReadable.bind(null, iterator));\n return iterator;\n};\nmodule.exports = createReadableStreamAsyncIterator;","'use strict';\n\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar ERR_INVALID_ARG_TYPE = require('../../../errors').codes.ERR_INVALID_ARG_TYPE;\nfunction from(Readable, iterable, opts) {\n var iterator;\n if (iterable && typeof iterable.next === 'function') {\n iterator = iterable;\n } else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();else throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable);\n var readable = new Readable(_objectSpread({\n objectMode: true\n }, opts));\n // Reading boolean to protect against _read\n // being called before last iteration completion.\n var reading = false;\n readable._read = function () {\n if (!reading) {\n reading = true;\n next();\n }\n };\n function next() {\n return _next2.apply(this, arguments);\n }\n function _next2() {\n _next2 = _asyncToGenerator(function* () {\n try {\n var _yield$iterator$next = yield iterator.next(),\n value = _yield$iterator$next.value,\n done = _yield$iterator$next.done;\n if (done) {\n readable.push(null);\n } else if (readable.push(yield value)) {\n next();\n } else {\n reading = false;\n }\n } catch (err) {\n readable.destroy(err);\n }\n });\n return _next2.apply(this, arguments);\n }\n return readable;\n}\nmodule.exports = from;\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nmodule.exports = Readable;\n\n/**/\nvar Duplex;\n/**/\n\nReadable.ReadableState = ReadableState;\n\n/**/\nvar EE = require('events').EventEmitter;\nvar EElistenerCount = function EElistenerCount(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n/**/\nvar Stream = require('./internal/streams/stream');\n/**/\n\nvar Buffer = require('buffer').Buffer;\nvar OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/**/\nvar debugUtil = require('util');\nvar debug;\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function debug() {};\n}\n/**/\n\nvar BufferList = require('./internal/streams/buffer_list');\nvar destroyImpl = require('./internal/streams/destroy');\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;\n\n// Lazy loaded to improve the startup performance.\nvar StringDecoder;\nvar createReadableStreamAsyncIterator;\nvar from;\nrequire('inherits')(Readable, Stream);\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);\n\n // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\nfunction ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex);\n\n // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true;\n\n // Should close be emitted on destroy. Defaults to true.\n this.emitClose = options.emitClose !== false;\n\n // Should .destroy() be called after 'end' (and potentially 'finish')\n this.autoDestroy = !!options.autoDestroy;\n\n // has it been destroyed\n this.destroyed = false;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n if (!(this instanceof Readable)) return new Readable(options);\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the ReadableState constructor, at least with V8 6.5\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex);\n\n // legacy\n this.readable = true;\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n Stream.call(this);\n}\nObject.defineProperty(Readable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n }\n});\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\nReadable.prototype._destroy = function (err, cb) {\n cb(err);\n};\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug('readableAddChunk', chunk);\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (addToFront) {\n if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n }\n\n // We can push more data if we are below the highWaterMark.\n // Also, if we have no data yet, we can stand some more bytes.\n // This is to work around cases where hwm=0, such as the repl.\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n}\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit('data', chunk);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n if (state.needReadable) emitReadable(stream);\n }\n maybeReadMore(stream, state);\n}\nfunction chunkInvalid(state, chunk) {\n var er;\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);\n }\n return er;\n}\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n};\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder;\n // If setEncoding(null), decoder.encoding equals utf8\n this._readableState.encoding = this._readableState.decoder.encoding;\n\n // Iterate over current buffer to convert already stored Buffers:\n var p = this._readableState.buffer.head;\n var content = '';\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n this._readableState.buffer.clear();\n if (content !== '') this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n};\n\n// Don't raise the hwm > 1GB\nvar MAX_HWM = 0x40000000;\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n}\n\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n }\n // If we're asking for more than the current hwm, then raise the hwm.\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n;\n // Don't have enough\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0) state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug('need readable', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0) state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended) endReadable(this);\n }\n if (ret !== null) this.emit('data', ret);\n return ret;\n};\nfunction onEofChunk(stream, state) {\n debug('onEofChunk');\n if (state.ended) return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n if (state.sync) {\n // if we are sync, wait until next tick to emit the data.\n // Otherwise we risk emitting data in the flow()\n // the readable code triggers during a read() call\n emitReadable(stream);\n } else {\n // emit 'readable' now to make sure it gets picked up.\n state.needReadable = false;\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}\nfunction emitReadable_(stream) {\n var state = stream._readableState;\n debug('emitReadable_', state.destroyed, state.length, state.ended);\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit('readable');\n state.emittedReadable = false;\n }\n\n // The stream needs another readable event if\n // 1. It is not flowing, as the flow mechanism will take\n // care of it.\n // 2. It is not ended.\n // 3. It is below the highWaterMark, so we can schedule\n // another readable later.\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n}\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n}\nfunction maybeReadMore_(stream, state) {\n // Attempt to read more data if we should.\n //\n // The conditions for reading more data are (one of):\n // - Not enough data buffered (state.length < state.highWaterMark). The loop\n // is responsible for filling the buffer with enough data if such data\n // is available. If highWaterMark is 0 and we are not in the flowing mode\n // we should _not_ attempt to buffer any extra data. We'll get more data\n // when the stream consumer calls read() instead.\n // - No data in the buffer, and the stream is in flowing mode. In this mode\n // the loop below is responsible for ensuring read() is called. Failing to\n // call read here would abort the flow and there's no other mechanism for\n // continuing the flow if the stream consumer has just subscribed to the\n // 'data' event.\n //\n // In addition to the above conditions to keep reading data, the following\n // conditions prevent the data from being read:\n // - The stream has ended (state.ended).\n // - There is already a pending 'read' operation (state.reading). This is a\n // case where the the stream has called the implementation defined _read()\n // method, but they are processing the call asynchronously and have _not_\n // called push() with new data. In this case we skip performing more\n // read()s. The execution ends in this method again after the _read() ends\n // up calling push() with more data.\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function (n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));\n};\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);\n dest.on('unpipe', onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n function onend() {\n debug('onend');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n var cleanedUp = false;\n function cleanup() {\n debug('cleanup');\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n cleanedUp = true;\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n debug('dest.write', ret);\n if (ret === false) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', state.awaitDrain);\n state.awaitDrain++;\n }\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);\n }\n\n // Make sure our error handler is attached before userland ones.\n prependListener(dest, 'error', onerror);\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n return dest;\n};\nfunction pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n };\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0) return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n if (!dest) dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, {\n hasUnpiped: false\n });\n return this;\n }\n\n // try to find the right one.\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n dest.emit('unpipe', this, unpipeInfo);\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n if (ev === 'data') {\n // update readableListening so that resume() may be a no-op\n // a few lines down. This is needed to support once('readable').\n state.readableListening = this.listenerCount('readable') > 0;\n\n // Try start flowing on next tick if stream isn't explicitly paused\n if (state.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug('on readable', state.length, state.reading);\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\nReadable.prototype.removeListener = function (ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n if (ev === 'readable') {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n return res;\n};\nReadable.prototype.removeAllListeners = function (ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n if (ev === 'readable' || ev === undefined) {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n return res;\n};\nfunction updateReadableListening(self) {\n var state = self._readableState;\n state.readableListening = self.listenerCount('readable') > 0;\n if (state.resumeScheduled && !state.paused) {\n // flowing needs to be set to true now, otherwise\n // the upcoming resume will not flow.\n state.flowing = true;\n\n // crude way to check if we should resume\n } else if (self.listenerCount('data') > 0) {\n self.resume();\n }\n}\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function () {\n var state = this._readableState;\n if (!state.flowing) {\n debug('resume');\n // we flow only if there is no one listening\n // for readable, but we still have to call\n // resume()\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n state.paused = false;\n return this;\n};\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n}\nfunction resume_(stream, state) {\n debug('resume', state.reading);\n if (!state.reading) {\n stream.read(0);\n }\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n if (this._readableState.flowing !== false) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n this._readableState.paused = true;\n return this;\n};\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n while (state.flowing && stream.read() !== null);\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n var state = this._readableState;\n var paused = false;\n stream.on('end', function () {\n debug('wrapped end');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n _this.push(null);\n });\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk);\n\n // don't skip over falsy values in objectMode\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n var ret = _this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n\n // proxy certain important events.\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n this._read = function (n) {\n debug('wrapped _read', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n return this;\n};\nif (typeof Symbol === 'function') {\n Readable.prototype[Symbol.asyncIterator] = function () {\n if (createReadableStreamAsyncIterator === undefined) {\n createReadableStreamAsyncIterator = require('./internal/streams/async_iterator');\n }\n return createReadableStreamAsyncIterator(this);\n };\n}\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableFlowing', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n});\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\nObject.defineProperty(Readable.prototype, 'readableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n});\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n}\nfunction endReadable(stream) {\n var state = stream._readableState;\n debug('endReadable', state.endEmitted);\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n}\nfunction endReadableNT(state, stream) {\n debug('endReadableNT', state.endEmitted, state.length);\n\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the writable side is ready for autoDestroy as well\n var wState = stream._writableState;\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n}\nif (typeof Symbol === 'function') {\n Readable.from = function (iterable, opts) {\n if (from === undefined) {\n from = require('./internal/streams/from');\n }\n return from(Readable, iterable, opts);\n };\n}\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n'use strict';\n\nmodule.exports = Transform;\nvar _require$codes = require('../errors').codes,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,\n ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\nvar Duplex = require('./_stream_duplex');\nrequire('inherits')(Transform, Duplex);\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n if (cb === null) {\n return this.emit('error', new ERR_MULTIPLE_CALLBACK());\n }\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null)\n // single equals check for both `null` and `undefined`\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n if (typeof options.flush === 'function') this._flush = options.flush;\n }\n\n // When the writable side finishes, then flush out anything remaining.\n this.on('prefinish', prefinish);\n}\nfunction prefinish() {\n var _this = this;\n if (typeof this._flush === 'function' && !this._readableState.destroyed) {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));\n};\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\nTransform.prototype._destroy = function (err, cb) {\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n });\n};\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n if (data != null)\n // single equals check for both `null` and `undefined`\n stream.push(data);\n\n // TODO(BridgeAR): Write a test for these two error cases\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n}","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n'use strict';\n\nmodule.exports = PassThrough;\nvar Transform = require('./_stream_transform');\nrequire('inherits')(PassThrough, Transform);\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options);\n Transform.call(this, options);\n}\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk);\n};","// Ported from https://github.com/mafintosh/pump with\n// permission from the author, Mathias Buus (@mafintosh).\n\n'use strict';\n\nvar eos;\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n callback.apply(void 0, arguments);\n };\n}\nvar _require$codes = require('../../../errors').codes,\n ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\nfunction noop(err) {\n // Rethrow the error if it exists to avoid swallowing it\n if (err) throw err;\n}\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\nfunction destroyer(stream, reading, writing, callback) {\n callback = once(callback);\n var closed = false;\n stream.on('close', function () {\n closed = true;\n });\n if (eos === undefined) eos = require('./end-of-stream');\n eos(stream, {\n readable: reading,\n writable: writing\n }, function (err) {\n if (err) return callback(err);\n closed = true;\n callback();\n });\n var destroyed = false;\n return function (err) {\n if (closed) return;\n if (destroyed) return;\n destroyed = true;\n\n // request.destroy just do .end - .abort is what we want\n if (isRequest(stream)) return stream.abort();\n if (typeof stream.destroy === 'function') return stream.destroy();\n callback(err || new ERR_STREAM_DESTROYED('pipe'));\n };\n}\nfunction call(fn) {\n fn();\n}\nfunction pipe(from, to) {\n return from.pipe(to);\n}\nfunction popCallback(streams) {\n if (!streams.length) return noop;\n if (typeof streams[streams.length - 1] !== 'function') return noop;\n return streams.pop();\n}\nfunction pipeline() {\n for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {\n streams[_key] = arguments[_key];\n }\n var callback = popCallback(streams);\n if (Array.isArray(streams[0])) streams = streams[0];\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS('streams');\n }\n var error;\n var destroys = streams.map(function (stream, i) {\n var reading = i < streams.length - 1;\n var writing = i > 0;\n return destroyer(stream, reading, writing, function (err) {\n if (!error) error = err;\n if (err) destroys.forEach(call);\n if (reading) return;\n destroys.forEach(call);\n callback(error);\n });\n });\n return streams.reduce(pipe);\n}\nmodule.exports = pipeline;","var Stream = require('stream');\nif (process.env.READABLE_STREAM === 'disable' && Stream) {\n module.exports = Stream.Readable;\n Object.assign(module.exports, Stream);\n module.exports.Stream = Stream;\n} else {\n exports = module.exports = require('./lib/_stream_readable.js');\n exports.Stream = Stream || exports;\n exports.Readable = exports;\n exports.Writable = require('./lib/_stream_writable.js');\n exports.Duplex = require('./lib/_stream_duplex.js');\n exports.Transform = require('./lib/_stream_transform.js');\n exports.PassThrough = require('./lib/_stream_passthrough.js');\n exports.finished = require('./lib/internal/streams/end-of-stream.js');\n exports.pipeline = require('./lib/internal/streams/pipeline.js');\n}\n","'use strict'\nvar Buffer = require('safe-buffer').Buffer\nvar Transform = require('readable-stream').Transform\nvar inherits = require('inherits')\n\nfunction throwIfNotStringOrBuffer (val, prefix) {\n if (!Buffer.isBuffer(val) && typeof val !== 'string') {\n throw new TypeError(prefix + ' must be a string or a buffer')\n }\n}\n\nfunction HashBase (blockSize) {\n Transform.call(this)\n\n this._block = Buffer.allocUnsafe(blockSize)\n this._blockSize = blockSize\n this._blockOffset = 0\n this._length = [0, 0, 0, 0]\n\n this._finalized = false\n}\n\ninherits(HashBase, Transform)\n\nHashBase.prototype._transform = function (chunk, encoding, callback) {\n var error = null\n try {\n this.update(chunk, encoding)\n } catch (err) {\n error = err\n }\n\n callback(error)\n}\n\nHashBase.prototype._flush = function (callback) {\n var error = null\n try {\n this.push(this.digest())\n } catch (err) {\n error = err\n }\n\n callback(error)\n}\n\nHashBase.prototype.update = function (data, encoding) {\n throwIfNotStringOrBuffer(data, 'Data')\n if (this._finalized) throw new Error('Digest already called')\n if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding)\n\n // consume data\n var block = this._block\n var offset = 0\n while (this._blockOffset + data.length - offset >= this._blockSize) {\n for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++]\n this._update()\n this._blockOffset = 0\n }\n while (offset < data.length) block[this._blockOffset++] = data[offset++]\n\n // update length\n for (var j = 0, carry = data.length * 8; carry > 0; ++j) {\n this._length[j] += carry\n carry = (this._length[j] / 0x0100000000) | 0\n if (carry > 0) this._length[j] -= 0x0100000000 * carry\n }\n\n return this\n}\n\nHashBase.prototype._update = function () {\n throw new Error('_update is not implemented')\n}\n\nHashBase.prototype.digest = function (encoding) {\n if (this._finalized) throw new Error('Digest already called')\n this._finalized = true\n\n var digest = this._digest()\n if (encoding !== undefined) digest = digest.toString(encoding)\n\n // reset state\n this._block.fill(0)\n this._blockOffset = 0\n for (var i = 0; i < 4; ++i) this._length[i] = 0\n\n return digest\n}\n\nHashBase.prototype._digest = function () {\n throw new Error('_digest is not implemented')\n}\n\nmodule.exports = HashBase\n","'use strict'\nvar Buffer = require('buffer').Buffer\nvar inherits = require('inherits')\nvar HashBase = require('hash-base')\n\nvar ARRAY16 = new Array(16)\n\nvar zl = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,\n 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,\n 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,\n 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13\n]\n\nvar zr = [\n 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,\n 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,\n 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,\n 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,\n 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11\n]\n\nvar sl = [\n 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,\n 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,\n 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,\n 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,\n 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6\n]\n\nvar sr = [\n 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,\n 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,\n 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,\n 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,\n 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11\n]\n\nvar hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]\nvar hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]\n\nfunction RIPEMD160 () {\n HashBase.call(this, 64)\n\n // state\n this._a = 0x67452301\n this._b = 0xefcdab89\n this._c = 0x98badcfe\n this._d = 0x10325476\n this._e = 0xc3d2e1f0\n}\n\ninherits(RIPEMD160, HashBase)\n\nRIPEMD160.prototype._update = function () {\n var words = ARRAY16\n for (var j = 0; j < 16; ++j) words[j] = this._block.readInt32LE(j * 4)\n\n var al = this._a | 0\n var bl = this._b | 0\n var cl = this._c | 0\n var dl = this._d | 0\n var el = this._e | 0\n\n var ar = this._a | 0\n var br = this._b | 0\n var cr = this._c | 0\n var dr = this._d | 0\n var er = this._e | 0\n\n // computation\n for (var i = 0; i < 80; i += 1) {\n var tl\n var tr\n if (i < 16) {\n tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i])\n tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i])\n } else if (i < 32) {\n tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i])\n tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i])\n } else if (i < 48) {\n tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i])\n tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i])\n } else if (i < 64) {\n tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i])\n tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i])\n } else { // if (i<80) {\n tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i])\n tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i])\n }\n\n al = el\n el = dl\n dl = rotl(cl, 10)\n cl = bl\n bl = tl\n\n ar = er\n er = dr\n dr = rotl(cr, 10)\n cr = br\n br = tr\n }\n\n // update state\n var t = (this._b + cl + dr) | 0\n this._b = (this._c + dl + er) | 0\n this._c = (this._d + el + ar) | 0\n this._d = (this._e + al + br) | 0\n this._e = (this._a + bl + cr) | 0\n this._a = t\n}\n\nRIPEMD160.prototype._digest = function () {\n // create padding and handle blocks\n this._block[this._blockOffset++] = 0x80\n if (this._blockOffset > 56) {\n this._block.fill(0, this._blockOffset, 64)\n this._update()\n this._blockOffset = 0\n }\n\n this._block.fill(0, this._blockOffset, 56)\n this._block.writeUInt32LE(this._length[0], 56)\n this._block.writeUInt32LE(this._length[1], 60)\n this._update()\n\n // produce result\n var buffer = Buffer.alloc ? Buffer.alloc(20) : new Buffer(20)\n buffer.writeInt32LE(this._a, 0)\n buffer.writeInt32LE(this._b, 4)\n buffer.writeInt32LE(this._c, 8)\n buffer.writeInt32LE(this._d, 12)\n buffer.writeInt32LE(this._e, 16)\n return buffer\n}\n\nfunction rotl (x, n) {\n return (x << n) | (x >>> (32 - n))\n}\n\nfunction fn1 (a, b, c, d, e, m, k, s) {\n return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + e) | 0\n}\n\nfunction fn2 (a, b, c, d, e, m, k, s) {\n return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + e) | 0\n}\n\nfunction fn3 (a, b, c, d, e, m, k, s) {\n return (rotl((a + ((b | (~c)) ^ d) + m + k) | 0, s) + e) | 0\n}\n\nfunction fn4 (a, b, c, d, e, m, k, s) {\n return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + e) | 0\n}\n\nfunction fn5 (a, b, c, d, e, m, k, s) {\n return (rotl((a + (b ^ (c | (~d))) + m + k) | 0, s) + e) | 0\n}\n\nmodule.exports = RIPEMD160\n","var Buffer = require('safe-buffer').Buffer\n\n// prototype class for hash functions\nfunction Hash (blockSize, finalSize) {\n this._block = Buffer.alloc(blockSize)\n this._finalSize = finalSize\n this._blockSize = blockSize\n this._len = 0\n}\n\nHash.prototype.update = function (data, enc) {\n if (typeof data === 'string') {\n enc = enc || 'utf8'\n data = Buffer.from(data, enc)\n }\n\n var block = this._block\n var blockSize = this._blockSize\n var length = data.length\n var accum = this._len\n\n for (var offset = 0; offset < length;) {\n var assigned = accum % blockSize\n var remainder = Math.min(length - offset, blockSize - assigned)\n\n for (var i = 0; i < remainder; i++) {\n block[assigned + i] = data[offset + i]\n }\n\n accum += remainder\n offset += remainder\n\n if ((accum % blockSize) === 0) {\n this._update(block)\n }\n }\n\n this._len += length\n return this\n}\n\nHash.prototype.digest = function (enc) {\n var rem = this._len % this._blockSize\n\n this._block[rem] = 0x80\n\n // zero (rem + 1) trailing bits, where (rem + 1) is the smallest\n // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize\n this._block.fill(0, rem + 1)\n\n if (rem >= this._finalSize) {\n this._update(this._block)\n this._block.fill(0)\n }\n\n var bits = this._len * 8\n\n // uint32\n if (bits <= 0xffffffff) {\n this._block.writeUInt32BE(bits, this._blockSize - 4)\n\n // uint64\n } else {\n var lowBits = (bits & 0xffffffff) >>> 0\n var highBits = (bits - lowBits) / 0x100000000\n\n this._block.writeUInt32BE(highBits, this._blockSize - 8)\n this._block.writeUInt32BE(lowBits, this._blockSize - 4)\n }\n\n this._update(this._block)\n var hash = this._hash()\n\n return enc ? hash.toString(enc) : hash\n}\n\nHash.prototype._update = function () {\n throw new Error('_update must be implemented by subclass')\n}\n\nmodule.exports = Hash\n","/*\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined\n * in FIPS PUB 180-1\n * This source code is derived from sha1.js of the same repository.\n * The difference between SHA-0 and SHA-1 is just a bitwise rotate left\n * operation was added.\n */\n\nvar inherits = require('inherits')\nvar Hash = require('./hash')\nvar Buffer = require('safe-buffer').Buffer\n\nvar K = [\n 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0\n]\n\nvar W = new Array(80)\n\nfunction Sha () {\n this.init()\n this._w = W\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha, Hash)\n\nSha.prototype.init = function () {\n this._a = 0x67452301\n this._b = 0xefcdab89\n this._c = 0x98badcfe\n this._d = 0x10325476\n this._e = 0xc3d2e1f0\n\n return this\n}\n\nfunction rotl5 (num) {\n return (num << 5) | (num >>> 27)\n}\n\nfunction rotl30 (num) {\n return (num << 30) | (num >>> 2)\n}\n\nfunction ft (s, b, c, d) {\n if (s === 0) return (b & c) | ((~b) & d)\n if (s === 2) return (b & c) | (b & d) | (c & d)\n return b ^ c ^ d\n}\n\nSha.prototype._update = function (M) {\n var W = this._w\n\n var a = this._a | 0\n var b = this._b | 0\n var c = this._c | 0\n var d = this._d | 0\n var e = this._e | 0\n\n for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)\n for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]\n\n for (var j = 0; j < 80; ++j) {\n var s = ~~(j / 20)\n var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0\n\n e = d\n d = c\n c = rotl30(b)\n b = a\n a = t\n }\n\n this._a = (a + this._a) | 0\n this._b = (b + this._b) | 0\n this._c = (c + this._c) | 0\n this._d = (d + this._d) | 0\n this._e = (e + this._e) | 0\n}\n\nSha.prototype._hash = function () {\n var H = Buffer.allocUnsafe(20)\n\n H.writeInt32BE(this._a | 0, 0)\n H.writeInt32BE(this._b | 0, 4)\n H.writeInt32BE(this._c | 0, 8)\n H.writeInt32BE(this._d | 0, 12)\n H.writeInt32BE(this._e | 0, 16)\n\n return H\n}\n\nmodule.exports = Sha\n","/*\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined\n * in FIPS PUB 180-1\n * Version 2.1a Copyright Paul Johnston 2000 - 2002.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for details.\n */\n\nvar inherits = require('inherits')\nvar Hash = require('./hash')\nvar Buffer = require('safe-buffer').Buffer\n\nvar K = [\n 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0\n]\n\nvar W = new Array(80)\n\nfunction Sha1 () {\n this.init()\n this._w = W\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha1, Hash)\n\nSha1.prototype.init = function () {\n this._a = 0x67452301\n this._b = 0xefcdab89\n this._c = 0x98badcfe\n this._d = 0x10325476\n this._e = 0xc3d2e1f0\n\n return this\n}\n\nfunction rotl1 (num) {\n return (num << 1) | (num >>> 31)\n}\n\nfunction rotl5 (num) {\n return (num << 5) | (num >>> 27)\n}\n\nfunction rotl30 (num) {\n return (num << 30) | (num >>> 2)\n}\n\nfunction ft (s, b, c, d) {\n if (s === 0) return (b & c) | ((~b) & d)\n if (s === 2) return (b & c) | (b & d) | (c & d)\n return b ^ c ^ d\n}\n\nSha1.prototype._update = function (M) {\n var W = this._w\n\n var a = this._a | 0\n var b = this._b | 0\n var c = this._c | 0\n var d = this._d | 0\n var e = this._e | 0\n\n for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)\n for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16])\n\n for (var j = 0; j < 80; ++j) {\n var s = ~~(j / 20)\n var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0\n\n e = d\n d = c\n c = rotl30(b)\n b = a\n a = t\n }\n\n this._a = (a + this._a) | 0\n this._b = (b + this._b) | 0\n this._c = (c + this._c) | 0\n this._d = (d + this._d) | 0\n this._e = (e + this._e) | 0\n}\n\nSha1.prototype._hash = function () {\n var H = Buffer.allocUnsafe(20)\n\n H.writeInt32BE(this._a | 0, 0)\n H.writeInt32BE(this._b | 0, 4)\n H.writeInt32BE(this._c | 0, 8)\n H.writeInt32BE(this._d | 0, 12)\n H.writeInt32BE(this._e | 0, 16)\n\n return H\n}\n\nmodule.exports = Sha1\n","/**\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined\n * in FIPS 180-2\n * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n *\n */\n\nvar inherits = require('inherits')\nvar Hash = require('./hash')\nvar Buffer = require('safe-buffer').Buffer\n\nvar K = [\n 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,\n 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,\n 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,\n 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,\n 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,\n 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,\n 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,\n 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,\n 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,\n 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,\n 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,\n 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,\n 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,\n 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,\n 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,\n 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2\n]\n\nvar W = new Array(64)\n\nfunction Sha256 () {\n this.init()\n\n this._w = W // new Array(64)\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha256, Hash)\n\nSha256.prototype.init = function () {\n this._a = 0x6a09e667\n this._b = 0xbb67ae85\n this._c = 0x3c6ef372\n this._d = 0xa54ff53a\n this._e = 0x510e527f\n this._f = 0x9b05688c\n this._g = 0x1f83d9ab\n this._h = 0x5be0cd19\n\n return this\n}\n\nfunction ch (x, y, z) {\n return z ^ (x & (y ^ z))\n}\n\nfunction maj (x, y, z) {\n return (x & y) | (z & (x | y))\n}\n\nfunction sigma0 (x) {\n return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10)\n}\n\nfunction sigma1 (x) {\n return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7)\n}\n\nfunction gamma0 (x) {\n return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3)\n}\n\nfunction gamma1 (x) {\n return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10)\n}\n\nSha256.prototype._update = function (M) {\n var W = this._w\n\n var a = this._a | 0\n var b = this._b | 0\n var c = this._c | 0\n var d = this._d | 0\n var e = this._e | 0\n var f = this._f | 0\n var g = this._g | 0\n var h = this._h | 0\n\n for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)\n for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0\n\n for (var j = 0; j < 64; ++j) {\n var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0\n var T2 = (sigma0(a) + maj(a, b, c)) | 0\n\n h = g\n g = f\n f = e\n e = (d + T1) | 0\n d = c\n c = b\n b = a\n a = (T1 + T2) | 0\n }\n\n this._a = (a + this._a) | 0\n this._b = (b + this._b) | 0\n this._c = (c + this._c) | 0\n this._d = (d + this._d) | 0\n this._e = (e + this._e) | 0\n this._f = (f + this._f) | 0\n this._g = (g + this._g) | 0\n this._h = (h + this._h) | 0\n}\n\nSha256.prototype._hash = function () {\n var H = Buffer.allocUnsafe(32)\n\n H.writeInt32BE(this._a, 0)\n H.writeInt32BE(this._b, 4)\n H.writeInt32BE(this._c, 8)\n H.writeInt32BE(this._d, 12)\n H.writeInt32BE(this._e, 16)\n H.writeInt32BE(this._f, 20)\n H.writeInt32BE(this._g, 24)\n H.writeInt32BE(this._h, 28)\n\n return H\n}\n\nmodule.exports = Sha256\n","/**\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined\n * in FIPS 180-2\n * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n *\n */\n\nvar inherits = require('inherits')\nvar Sha256 = require('./sha256')\nvar Hash = require('./hash')\nvar Buffer = require('safe-buffer').Buffer\n\nvar W = new Array(64)\n\nfunction Sha224 () {\n this.init()\n\n this._w = W // new Array(64)\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha224, Sha256)\n\nSha224.prototype.init = function () {\n this._a = 0xc1059ed8\n this._b = 0x367cd507\n this._c = 0x3070dd17\n this._d = 0xf70e5939\n this._e = 0xffc00b31\n this._f = 0x68581511\n this._g = 0x64f98fa7\n this._h = 0xbefa4fa4\n\n return this\n}\n\nSha224.prototype._hash = function () {\n var H = Buffer.allocUnsafe(28)\n\n H.writeInt32BE(this._a, 0)\n H.writeInt32BE(this._b, 4)\n H.writeInt32BE(this._c, 8)\n H.writeInt32BE(this._d, 12)\n H.writeInt32BE(this._e, 16)\n H.writeInt32BE(this._f, 20)\n H.writeInt32BE(this._g, 24)\n\n return H\n}\n\nmodule.exports = Sha224\n","var inherits = require('inherits')\nvar Hash = require('./hash')\nvar Buffer = require('safe-buffer').Buffer\n\nvar K = [\n 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,\n 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,\n 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,\n 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,\n 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,\n 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,\n 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,\n 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,\n 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,\n 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,\n 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,\n 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,\n 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,\n 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,\n 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,\n 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,\n 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,\n 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,\n 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,\n 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,\n 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,\n 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,\n 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,\n 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,\n 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,\n 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,\n 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,\n 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,\n 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,\n 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,\n 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,\n 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,\n 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,\n 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,\n 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,\n 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,\n 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,\n 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,\n 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,\n 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817\n]\n\nvar W = new Array(160)\n\nfunction Sha512 () {\n this.init()\n this._w = W\n\n Hash.call(this, 128, 112)\n}\n\ninherits(Sha512, Hash)\n\nSha512.prototype.init = function () {\n this._ah = 0x6a09e667\n this._bh = 0xbb67ae85\n this._ch = 0x3c6ef372\n this._dh = 0xa54ff53a\n this._eh = 0x510e527f\n this._fh = 0x9b05688c\n this._gh = 0x1f83d9ab\n this._hh = 0x5be0cd19\n\n this._al = 0xf3bcc908\n this._bl = 0x84caa73b\n this._cl = 0xfe94f82b\n this._dl = 0x5f1d36f1\n this._el = 0xade682d1\n this._fl = 0x2b3e6c1f\n this._gl = 0xfb41bd6b\n this._hl = 0x137e2179\n\n return this\n}\n\nfunction Ch (x, y, z) {\n return z ^ (x & (y ^ z))\n}\n\nfunction maj (x, y, z) {\n return (x & y) | (z & (x | y))\n}\n\nfunction sigma0 (x, xl) {\n return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25)\n}\n\nfunction sigma1 (x, xl) {\n return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23)\n}\n\nfunction Gamma0 (x, xl) {\n return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7)\n}\n\nfunction Gamma0l (x, xl) {\n return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25)\n}\n\nfunction Gamma1 (x, xl) {\n return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6)\n}\n\nfunction Gamma1l (x, xl) {\n return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26)\n}\n\nfunction getCarry (a, b) {\n return (a >>> 0) < (b >>> 0) ? 1 : 0\n}\n\nSha512.prototype._update = function (M) {\n var W = this._w\n\n var ah = this._ah | 0\n var bh = this._bh | 0\n var ch = this._ch | 0\n var dh = this._dh | 0\n var eh = this._eh | 0\n var fh = this._fh | 0\n var gh = this._gh | 0\n var hh = this._hh | 0\n\n var al = this._al | 0\n var bl = this._bl | 0\n var cl = this._cl | 0\n var dl = this._dl | 0\n var el = this._el | 0\n var fl = this._fl | 0\n var gl = this._gl | 0\n var hl = this._hl | 0\n\n for (var i = 0; i < 32; i += 2) {\n W[i] = M.readInt32BE(i * 4)\n W[i + 1] = M.readInt32BE(i * 4 + 4)\n }\n for (; i < 160; i += 2) {\n var xh = W[i - 15 * 2]\n var xl = W[i - 15 * 2 + 1]\n var gamma0 = Gamma0(xh, xl)\n var gamma0l = Gamma0l(xl, xh)\n\n xh = W[i - 2 * 2]\n xl = W[i - 2 * 2 + 1]\n var gamma1 = Gamma1(xh, xl)\n var gamma1l = Gamma1l(xl, xh)\n\n // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]\n var Wi7h = W[i - 7 * 2]\n var Wi7l = W[i - 7 * 2 + 1]\n\n var Wi16h = W[i - 16 * 2]\n var Wi16l = W[i - 16 * 2 + 1]\n\n var Wil = (gamma0l + Wi7l) | 0\n var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0\n Wil = (Wil + gamma1l) | 0\n Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0\n Wil = (Wil + Wi16l) | 0\n Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0\n\n W[i] = Wih\n W[i + 1] = Wil\n }\n\n for (var j = 0; j < 160; j += 2) {\n Wih = W[j]\n Wil = W[j + 1]\n\n var majh = maj(ah, bh, ch)\n var majl = maj(al, bl, cl)\n\n var sigma0h = sigma0(ah, al)\n var sigma0l = sigma0(al, ah)\n var sigma1h = sigma1(eh, el)\n var sigma1l = sigma1(el, eh)\n\n // t1 = h + sigma1 + ch + K[j] + W[j]\n var Kih = K[j]\n var Kil = K[j + 1]\n\n var chh = Ch(eh, fh, gh)\n var chl = Ch(el, fl, gl)\n\n var t1l = (hl + sigma1l) | 0\n var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0\n t1l = (t1l + chl) | 0\n t1h = (t1h + chh + getCarry(t1l, chl)) | 0\n t1l = (t1l + Kil) | 0\n t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0\n t1l = (t1l + Wil) | 0\n t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0\n\n // t2 = sigma0 + maj\n var t2l = (sigma0l + majl) | 0\n var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0\n\n hh = gh\n hl = gl\n gh = fh\n gl = fl\n fh = eh\n fl = el\n el = (dl + t1l) | 0\n eh = (dh + t1h + getCarry(el, dl)) | 0\n dh = ch\n dl = cl\n ch = bh\n cl = bl\n bh = ah\n bl = al\n al = (t1l + t2l) | 0\n ah = (t1h + t2h + getCarry(al, t1l)) | 0\n }\n\n this._al = (this._al + al) | 0\n this._bl = (this._bl + bl) | 0\n this._cl = (this._cl + cl) | 0\n this._dl = (this._dl + dl) | 0\n this._el = (this._el + el) | 0\n this._fl = (this._fl + fl) | 0\n this._gl = (this._gl + gl) | 0\n this._hl = (this._hl + hl) | 0\n\n this._ah = (this._ah + ah + getCarry(this._al, al)) | 0\n this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0\n this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0\n this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0\n this._eh = (this._eh + eh + getCarry(this._el, el)) | 0\n this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0\n this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0\n this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0\n}\n\nSha512.prototype._hash = function () {\n var H = Buffer.allocUnsafe(64)\n\n function writeInt64BE (h, l, offset) {\n H.writeInt32BE(h, offset)\n H.writeInt32BE(l, offset + 4)\n }\n\n writeInt64BE(this._ah, this._al, 0)\n writeInt64BE(this._bh, this._bl, 8)\n writeInt64BE(this._ch, this._cl, 16)\n writeInt64BE(this._dh, this._dl, 24)\n writeInt64BE(this._eh, this._el, 32)\n writeInt64BE(this._fh, this._fl, 40)\n writeInt64BE(this._gh, this._gl, 48)\n writeInt64BE(this._hh, this._hl, 56)\n\n return H\n}\n\nmodule.exports = Sha512\n","var inherits = require('inherits')\nvar SHA512 = require('./sha512')\nvar Hash = require('./hash')\nvar Buffer = require('safe-buffer').Buffer\n\nvar W = new Array(160)\n\nfunction Sha384 () {\n this.init()\n this._w = W\n\n Hash.call(this, 128, 112)\n}\n\ninherits(Sha384, SHA512)\n\nSha384.prototype.init = function () {\n this._ah = 0xcbbb9d5d\n this._bh = 0x629a292a\n this._ch = 0x9159015a\n this._dh = 0x152fecd8\n this._eh = 0x67332667\n this._fh = 0x8eb44a87\n this._gh = 0xdb0c2e0d\n this._hh = 0x47b5481d\n\n this._al = 0xc1059ed8\n this._bl = 0x367cd507\n this._cl = 0x3070dd17\n this._dl = 0xf70e5939\n this._el = 0xffc00b31\n this._fl = 0x68581511\n this._gl = 0x64f98fa7\n this._hl = 0xbefa4fa4\n\n return this\n}\n\nSha384.prototype._hash = function () {\n var H = Buffer.allocUnsafe(48)\n\n function writeInt64BE (h, l, offset) {\n H.writeInt32BE(h, offset)\n H.writeInt32BE(l, offset + 4)\n }\n\n writeInt64BE(this._ah, this._al, 0)\n writeInt64BE(this._bh, this._bl, 8)\n writeInt64BE(this._ch, this._cl, 16)\n writeInt64BE(this._dh, this._dl, 24)\n writeInt64BE(this._eh, this._el, 32)\n writeInt64BE(this._fh, this._fl, 40)\n\n return H\n}\n\nmodule.exports = Sha384\n","var exports = module.exports = function SHA (algorithm) {\n algorithm = algorithm.toLowerCase()\n\n var Algorithm = exports[algorithm]\n if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)')\n\n return new Algorithm()\n}\n\nexports.sha = require('./sha')\nexports.sha1 = require('./sha1')\nexports.sha224 = require('./sha224')\nexports.sha256 = require('./sha256')\nexports.sha384 = require('./sha384')\nexports.sha512 = require('./sha512')\n","var Buffer = require('safe-buffer').Buffer\nvar Transform = require('stream').Transform\nvar StringDecoder = require('string_decoder').StringDecoder\nvar inherits = require('inherits')\n\nfunction CipherBase (hashMode) {\n Transform.call(this)\n this.hashMode = typeof hashMode === 'string'\n if (this.hashMode) {\n this[hashMode] = this._finalOrDigest\n } else {\n this.final = this._finalOrDigest\n }\n if (this._final) {\n this.__final = this._final\n this._final = null\n }\n this._decoder = null\n this._encoding = null\n}\ninherits(CipherBase, Transform)\n\nCipherBase.prototype.update = function (data, inputEnc, outputEnc) {\n if (typeof data === 'string') {\n data = Buffer.from(data, inputEnc)\n }\n\n var outData = this._update(data)\n if (this.hashMode) return this\n\n if (outputEnc) {\n outData = this._toString(outData, outputEnc)\n }\n\n return outData\n}\n\nCipherBase.prototype.setAutoPadding = function () {}\nCipherBase.prototype.getAuthTag = function () {\n throw new Error('trying to get auth tag in unsupported state')\n}\n\nCipherBase.prototype.setAuthTag = function () {\n throw new Error('trying to set auth tag in unsupported state')\n}\n\nCipherBase.prototype.setAAD = function () {\n throw new Error('trying to set aad in unsupported state')\n}\n\nCipherBase.prototype._transform = function (data, _, next) {\n var err\n try {\n if (this.hashMode) {\n this._update(data)\n } else {\n this.push(this._update(data))\n }\n } catch (e) {\n err = e\n } finally {\n next(err)\n }\n}\nCipherBase.prototype._flush = function (done) {\n var err\n try {\n this.push(this.__final())\n } catch (e) {\n err = e\n }\n\n done(err)\n}\nCipherBase.prototype._finalOrDigest = function (outputEnc) {\n var outData = this.__final() || Buffer.alloc(0)\n if (outputEnc) {\n outData = this._toString(outData, outputEnc, true)\n }\n return outData\n}\n\nCipherBase.prototype._toString = function (value, enc, fin) {\n if (!this._decoder) {\n this._decoder = new StringDecoder(enc)\n this._encoding = enc\n }\n\n if (this._encoding !== enc) throw new Error('can\\'t switch encodings')\n\n var out = this._decoder.write(value)\n if (fin) {\n out += this._decoder.end()\n }\n\n return out\n}\n\nmodule.exports = CipherBase\n","'use strict'\nvar inherits = require('inherits')\nvar MD5 = require('md5.js')\nvar RIPEMD160 = require('ripemd160')\nvar sha = require('sha.js')\nvar Base = require('cipher-base')\n\nfunction Hash (hash) {\n Base.call(this, 'digest')\n\n this._hash = hash\n}\n\ninherits(Hash, Base)\n\nHash.prototype._update = function (data) {\n this._hash.update(data)\n}\n\nHash.prototype._final = function () {\n return this._hash.digest()\n}\n\nmodule.exports = function createHash (alg) {\n alg = alg.toLowerCase()\n if (alg === 'md5') return new MD5()\n if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160()\n\n return new Hash(sha(alg))\n}\n","'use strict'\nvar inherits = require('inherits')\nvar Buffer = require('safe-buffer').Buffer\n\nvar Base = require('cipher-base')\n\nvar ZEROS = Buffer.alloc(128)\nvar blocksize = 64\n\nfunction Hmac (alg, key) {\n Base.call(this, 'digest')\n if (typeof key === 'string') {\n key = Buffer.from(key)\n }\n\n this._alg = alg\n this._key = key\n\n if (key.length > blocksize) {\n key = alg(key)\n } else if (key.length < blocksize) {\n key = Buffer.concat([key, ZEROS], blocksize)\n }\n\n var ipad = this._ipad = Buffer.allocUnsafe(blocksize)\n var opad = this._opad = Buffer.allocUnsafe(blocksize)\n\n for (var i = 0; i < blocksize; i++) {\n ipad[i] = key[i] ^ 0x36\n opad[i] = key[i] ^ 0x5C\n }\n\n this._hash = [ipad]\n}\n\ninherits(Hmac, Base)\n\nHmac.prototype._update = function (data) {\n this._hash.push(data)\n}\n\nHmac.prototype._final = function () {\n var h = this._alg(Buffer.concat(this._hash))\n return this._alg(Buffer.concat([this._opad, h]))\n}\nmodule.exports = Hmac\n","var MD5 = require('md5.js')\n\nmodule.exports = function (buffer) {\n return new MD5().update(buffer).digest()\n}\n","'use strict'\nvar inherits = require('inherits')\nvar Legacy = require('./legacy')\nvar Base = require('cipher-base')\nvar Buffer = require('safe-buffer').Buffer\nvar md5 = require('create-hash/md5')\nvar RIPEMD160 = require('ripemd160')\n\nvar sha = require('sha.js')\n\nvar ZEROS = Buffer.alloc(128)\n\nfunction Hmac (alg, key) {\n Base.call(this, 'digest')\n if (typeof key === 'string') {\n key = Buffer.from(key)\n }\n\n var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64\n\n this._alg = alg\n this._key = key\n if (key.length > blocksize) {\n var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)\n key = hash.update(key).digest()\n } else if (key.length < blocksize) {\n key = Buffer.concat([key, ZEROS], blocksize)\n }\n\n var ipad = this._ipad = Buffer.allocUnsafe(blocksize)\n var opad = this._opad = Buffer.allocUnsafe(blocksize)\n\n for (var i = 0; i < blocksize; i++) {\n ipad[i] = key[i] ^ 0x36\n opad[i] = key[i] ^ 0x5C\n }\n this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)\n this._hash.update(ipad)\n}\n\ninherits(Hmac, Base)\n\nHmac.prototype._update = function (data) {\n this._hash.update(data)\n}\n\nHmac.prototype._final = function () {\n var h = this._hash.digest()\n var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg)\n return hash.update(this._opad).update(h).digest()\n}\n\nmodule.exports = function createHmac (alg, key) {\n alg = alg.toLowerCase()\n if (alg === 'rmd160' || alg === 'ripemd160') {\n return new Hmac('rmd160', key)\n }\n if (alg === 'md5') {\n return new Legacy(md5, key)\n }\n return new Hmac(alg, key)\n}\n","{\n \"sha224WithRSAEncryption\": {\n \"sign\": \"rsa\",\n \"hash\": \"sha224\",\n \"id\": \"302d300d06096086480165030402040500041c\"\n },\n \"RSA-SHA224\": {\n \"sign\": \"ecdsa/rsa\",\n \"hash\": \"sha224\",\n \"id\": \"302d300d06096086480165030402040500041c\"\n },\n \"sha256WithRSAEncryption\": {\n \"sign\": \"rsa\",\n \"hash\": \"sha256\",\n \"id\": \"3031300d060960864801650304020105000420\"\n },\n \"RSA-SHA256\": {\n \"sign\": \"ecdsa/rsa\",\n \"hash\": \"sha256\",\n \"id\": \"3031300d060960864801650304020105000420\"\n },\n \"sha384WithRSAEncryption\": {\n \"sign\": \"rsa\",\n \"hash\": \"sha384\",\n \"id\": \"3041300d060960864801650304020205000430\"\n },\n \"RSA-SHA384\": {\n \"sign\": \"ecdsa/rsa\",\n \"hash\": \"sha384\",\n \"id\": \"3041300d060960864801650304020205000430\"\n },\n \"sha512WithRSAEncryption\": {\n \"sign\": \"rsa\",\n \"hash\": \"sha512\",\n \"id\": \"3051300d060960864801650304020305000440\"\n },\n \"RSA-SHA512\": {\n \"sign\": \"ecdsa/rsa\",\n \"hash\": \"sha512\",\n \"id\": \"3051300d060960864801650304020305000440\"\n },\n \"RSA-SHA1\": {\n \"sign\": \"rsa\",\n \"hash\": \"sha1\",\n \"id\": \"3021300906052b0e03021a05000414\"\n },\n \"ecdsa-with-SHA1\": {\n \"sign\": \"ecdsa\",\n \"hash\": \"sha1\",\n \"id\": \"\"\n },\n \"sha256\": {\n \"sign\": \"ecdsa\",\n \"hash\": \"sha256\",\n \"id\": \"\"\n },\n \"sha224\": {\n \"sign\": \"ecdsa\",\n \"hash\": \"sha224\",\n \"id\": \"\"\n },\n \"sha384\": {\n \"sign\": \"ecdsa\",\n \"hash\": \"sha384\",\n \"id\": \"\"\n },\n \"sha512\": {\n \"sign\": \"ecdsa\",\n \"hash\": \"sha512\",\n \"id\": \"\"\n },\n \"DSA-SHA\": {\n \"sign\": \"dsa\",\n \"hash\": \"sha1\",\n \"id\": \"\"\n },\n \"DSA-SHA1\": {\n \"sign\": \"dsa\",\n \"hash\": \"sha1\",\n \"id\": \"\"\n },\n \"DSA\": {\n \"sign\": \"dsa\",\n \"hash\": \"sha1\",\n \"id\": \"\"\n },\n \"DSA-WITH-SHA224\": {\n \"sign\": \"dsa\",\n \"hash\": \"sha224\",\n \"id\": \"\"\n },\n \"DSA-SHA224\": {\n \"sign\": \"dsa\",\n \"hash\": \"sha224\",\n \"id\": \"\"\n },\n \"DSA-WITH-SHA256\": {\n \"sign\": \"dsa\",\n \"hash\": \"sha256\",\n \"id\": \"\"\n },\n \"DSA-SHA256\": {\n \"sign\": \"dsa\",\n \"hash\": \"sha256\",\n \"id\": \"\"\n },\n \"DSA-WITH-SHA384\": {\n \"sign\": \"dsa\",\n \"hash\": \"sha384\",\n \"id\": \"\"\n },\n \"DSA-SHA384\": {\n \"sign\": \"dsa\",\n \"hash\": \"sha384\",\n \"id\": \"\"\n },\n \"DSA-WITH-SHA512\": {\n \"sign\": \"dsa\",\n \"hash\": \"sha512\",\n \"id\": \"\"\n },\n \"DSA-SHA512\": {\n \"sign\": \"dsa\",\n \"hash\": \"sha512\",\n \"id\": \"\"\n },\n \"DSA-RIPEMD160\": {\n \"sign\": \"dsa\",\n \"hash\": \"rmd160\",\n \"id\": \"\"\n },\n \"ripemd160WithRSA\": {\n \"sign\": \"rsa\",\n \"hash\": \"rmd160\",\n \"id\": \"3021300906052b2403020105000414\"\n },\n \"RSA-RIPEMD160\": {\n \"sign\": \"rsa\",\n \"hash\": \"rmd160\",\n \"id\": \"3021300906052b2403020105000414\"\n },\n \"md5WithRSAEncryption\": {\n \"sign\": \"rsa\",\n \"hash\": \"md5\",\n \"id\": \"3020300c06082a864886f70d020505000410\"\n },\n \"RSA-MD5\": {\n \"sign\": \"rsa\",\n \"hash\": \"md5\",\n \"id\": \"3020300c06082a864886f70d020505000410\"\n }\n}\n","'use strict';\n\nmodule.exports = require('./browser/algorithms.json');\n","var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs\n\nmodule.exports = function (iterations, keylen) {\n if (typeof iterations !== 'number') {\n throw new TypeError('Iterations not a number')\n }\n\n if (iterations < 0) {\n throw new TypeError('Bad iterations')\n }\n\n if (typeof keylen !== 'number') {\n throw new TypeError('Key length not a number')\n }\n\n if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */\n throw new TypeError('Bad key length')\n }\n}\n","var defaultEncoding\n/* istanbul ignore next */\nif (global.process && global.process.browser) {\n defaultEncoding = 'utf-8'\n} else if (global.process && global.process.version) {\n var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10)\n\n defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary'\n} else {\n defaultEncoding = 'utf-8'\n}\nmodule.exports = defaultEncoding\n","var Buffer = require('safe-buffer').Buffer\n\nmodule.exports = function (thing, encoding, name) {\n if (Buffer.isBuffer(thing)) {\n return thing\n } else if (typeof thing === 'string') {\n return Buffer.from(thing, encoding)\n } else if (ArrayBuffer.isView(thing)) {\n return Buffer.from(thing.buffer)\n } else {\n throw new TypeError(name + ' must be a string, a Buffer, a typed array or a DataView')\n }\n}\n","var sizes = {\n md5: 16,\n sha1: 20,\n sha224: 28,\n sha256: 32,\n sha384: 48,\n sha512: 64,\n rmd160: 20,\n ripemd160: 20\n}\n\nvar createHmac = require('create-hmac')\nvar Buffer = require('safe-buffer').Buffer\n\nvar checkParameters = require('./precondition')\nvar defaultEncoding = require('./default-encoding')\nvar toBuffer = require('./to-buffer')\n\nfunction pbkdf2 (password, salt, iterations, keylen, digest) {\n checkParameters(iterations, keylen)\n password = toBuffer(password, defaultEncoding, 'Password')\n salt = toBuffer(salt, defaultEncoding, 'Salt')\n\n digest = digest || 'sha1'\n\n var DK = Buffer.allocUnsafe(keylen)\n var block1 = Buffer.allocUnsafe(salt.length + 4)\n salt.copy(block1, 0, 0, salt.length)\n\n var destPos = 0\n var hLen = sizes[digest]\n var l = Math.ceil(keylen / hLen)\n\n for (var i = 1; i <= l; i++) {\n block1.writeUInt32BE(i, salt.length)\n\n var T = createHmac(digest, password).update(block1).digest()\n var U = T\n\n for (var j = 1; j < iterations; j++) {\n U = createHmac(digest, password).update(U).digest()\n for (var k = 0; k < hLen; k++) T[k] ^= U[k]\n }\n\n T.copy(DK, destPos)\n destPos += hLen\n }\n\n return DK\n}\n\nmodule.exports = pbkdf2\n","var Buffer = require('safe-buffer').Buffer\n\nvar checkParameters = require('./precondition')\nvar defaultEncoding = require('./default-encoding')\nvar sync = require('./sync')\nvar toBuffer = require('./to-buffer')\n\nvar ZERO_BUF\nvar subtle = global.crypto && global.crypto.subtle\nvar toBrowser = {\n sha: 'SHA-1',\n 'sha-1': 'SHA-1',\n sha1: 'SHA-1',\n sha256: 'SHA-256',\n 'sha-256': 'SHA-256',\n sha384: 'SHA-384',\n 'sha-384': 'SHA-384',\n 'sha-512': 'SHA-512',\n sha512: 'SHA-512'\n}\nvar checks = []\nfunction checkNative (algo) {\n if (global.process && !global.process.browser) {\n return Promise.resolve(false)\n }\n if (!subtle || !subtle.importKey || !subtle.deriveBits) {\n return Promise.resolve(false)\n }\n if (checks[algo] !== undefined) {\n return checks[algo]\n }\n ZERO_BUF = ZERO_BUF || Buffer.alloc(8)\n var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo)\n .then(function () {\n return true\n }).catch(function () {\n return false\n })\n checks[algo] = prom\n return prom\n}\nvar nextTick\nfunction getNextTick () {\n if (nextTick) {\n return nextTick\n }\n if (global.process && global.process.nextTick) {\n nextTick = global.process.nextTick\n } else if (global.queueMicrotask) {\n nextTick = global.queueMicrotask\n } else if (global.setImmediate) {\n nextTick = global.setImmediate\n } else {\n nextTick = global.setTimeout\n }\n return nextTick\n}\nfunction browserPbkdf2 (password, salt, iterations, length, algo) {\n return subtle.importKey(\n 'raw', password, { name: 'PBKDF2' }, false, ['deriveBits']\n ).then(function (key) {\n return subtle.deriveBits({\n name: 'PBKDF2',\n salt: salt,\n iterations: iterations,\n hash: {\n name: algo\n }\n }, key, length << 3)\n }).then(function (res) {\n return Buffer.from(res)\n })\n}\n\nfunction resolvePromise (promise, callback) {\n promise.then(function (out) {\n getNextTick()(function () {\n callback(null, out)\n })\n }, function (e) {\n getNextTick()(function () {\n callback(e)\n })\n })\n}\nmodule.exports = function (password, salt, iterations, keylen, digest, callback) {\n if (typeof digest === 'function') {\n callback = digest\n digest = undefined\n }\n\n digest = digest || 'sha1'\n var algo = toBrowser[digest.toLowerCase()]\n\n if (!algo || typeof global.Promise !== 'function') {\n getNextTick()(function () {\n var out\n try {\n out = sync(password, salt, iterations, keylen, digest)\n } catch (e) {\n return callback(e)\n }\n callback(null, out)\n })\n return\n }\n\n checkParameters(iterations, keylen)\n password = toBuffer(password, defaultEncoding, 'Password')\n salt = toBuffer(salt, defaultEncoding, 'Salt')\n if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2')\n\n resolvePromise(checkNative(algo).then(function (resp) {\n if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo)\n\n return sync(password, salt, iterations, keylen, digest)\n }), callback)\n}\n","var native = require('crypto')\n\nvar checkParameters = require('./lib/precondition')\nvar defaultEncoding = require('./lib/default-encoding')\nvar toBuffer = require('./lib/to-buffer')\n\nfunction nativePBKDF2 (password, salt, iterations, keylen, digest, callback) {\n checkParameters(iterations, keylen)\n password = toBuffer(password, defaultEncoding, 'Password')\n salt = toBuffer(salt, defaultEncoding, 'Salt')\n\n if (typeof digest === 'function') {\n callback = digest\n digest = 'sha1'\n }\n if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2')\n\n return native.pbkdf2(password, salt, iterations, keylen, digest, callback)\n}\n\nfunction nativePBKDF2Sync (password, salt, iterations, keylen, digest) {\n checkParameters(iterations, keylen)\n password = toBuffer(password, defaultEncoding, 'Password')\n salt = toBuffer(salt, defaultEncoding, 'Salt')\n digest = digest || 'sha1'\n return native.pbkdf2Sync(password, salt, iterations, keylen, digest)\n}\n\n/* istanbul ignore next */\nif (!native.pbkdf2Sync || native.pbkdf2Sync.toString().indexOf('keylen, digest') === -1) {\n exports.pbkdf2Sync = require('./lib/sync')\n exports.pbkdf2 = require('./lib/async')\n\n// native\n} else {\n exports.pbkdf2Sync = nativePBKDF2Sync\n exports.pbkdf2 = nativePBKDF2\n}\n","'use strict';\n\nexports.readUInt32BE = function readUInt32BE(bytes, off) {\n var res = (bytes[0 + off] << 24) |\n (bytes[1 + off] << 16) |\n (bytes[2 + off] << 8) |\n bytes[3 + off];\n return res >>> 0;\n};\n\nexports.writeUInt32BE = function writeUInt32BE(bytes, value, off) {\n bytes[0 + off] = value >>> 24;\n bytes[1 + off] = (value >>> 16) & 0xff;\n bytes[2 + off] = (value >>> 8) & 0xff;\n bytes[3 + off] = value & 0xff;\n};\n\nexports.ip = function ip(inL, inR, out, off) {\n var outL = 0;\n var outR = 0;\n\n for (var i = 6; i >= 0; i -= 2) {\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= (inR >>> (j + i)) & 1;\n }\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= (inL >>> (j + i)) & 1;\n }\n }\n\n for (var i = 6; i >= 0; i -= 2) {\n for (var j = 1; j <= 25; j += 8) {\n outR <<= 1;\n outR |= (inR >>> (j + i)) & 1;\n }\n for (var j = 1; j <= 25; j += 8) {\n outR <<= 1;\n outR |= (inL >>> (j + i)) & 1;\n }\n }\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nexports.rip = function rip(inL, inR, out, off) {\n var outL = 0;\n var outR = 0;\n\n for (var i = 0; i < 4; i++) {\n for (var j = 24; j >= 0; j -= 8) {\n outL <<= 1;\n outL |= (inR >>> (j + i)) & 1;\n outL <<= 1;\n outL |= (inL >>> (j + i)) & 1;\n }\n }\n for (var i = 4; i < 8; i++) {\n for (var j = 24; j >= 0; j -= 8) {\n outR <<= 1;\n outR |= (inR >>> (j + i)) & 1;\n outR <<= 1;\n outR |= (inL >>> (j + i)) & 1;\n }\n }\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nexports.pc1 = function pc1(inL, inR, out, off) {\n var outL = 0;\n var outR = 0;\n\n // 7, 15, 23, 31, 39, 47, 55, 63\n // 6, 14, 22, 30, 39, 47, 55, 63\n // 5, 13, 21, 29, 39, 47, 55, 63\n // 4, 12, 20, 28\n for (var i = 7; i >= 5; i--) {\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= (inR >> (j + i)) & 1;\n }\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= (inL >> (j + i)) & 1;\n }\n }\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= (inR >> (j + i)) & 1;\n }\n\n // 1, 9, 17, 25, 33, 41, 49, 57\n // 2, 10, 18, 26, 34, 42, 50, 58\n // 3, 11, 19, 27, 35, 43, 51, 59\n // 36, 44, 52, 60\n for (var i = 1; i <= 3; i++) {\n for (var j = 0; j <= 24; j += 8) {\n outR <<= 1;\n outR |= (inR >> (j + i)) & 1;\n }\n for (var j = 0; j <= 24; j += 8) {\n outR <<= 1;\n outR |= (inL >> (j + i)) & 1;\n }\n }\n for (var j = 0; j <= 24; j += 8) {\n outR <<= 1;\n outR |= (inL >> (j + i)) & 1;\n }\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nexports.r28shl = function r28shl(num, shift) {\n return ((num << shift) & 0xfffffff) | (num >>> (28 - shift));\n};\n\nvar pc2table = [\n // inL => outL\n 14, 11, 17, 4, 27, 23, 25, 0,\n 13, 22, 7, 18, 5, 9, 16, 24,\n 2, 20, 12, 21, 1, 8, 15, 26,\n\n // inR => outR\n 15, 4, 25, 19, 9, 1, 26, 16,\n 5, 11, 23, 8, 12, 7, 17, 0,\n 22, 3, 10, 14, 6, 20, 27, 24\n];\n\nexports.pc2 = function pc2(inL, inR, out, off) {\n var outL = 0;\n var outR = 0;\n\n var len = pc2table.length >>> 1;\n for (var i = 0; i < len; i++) {\n outL <<= 1;\n outL |= (inL >>> pc2table[i]) & 0x1;\n }\n for (var i = len; i < pc2table.length; i++) {\n outR <<= 1;\n outR |= (inR >>> pc2table[i]) & 0x1;\n }\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nexports.expand = function expand(r, out, off) {\n var outL = 0;\n var outR = 0;\n\n outL = ((r & 1) << 5) | (r >>> 27);\n for (var i = 23; i >= 15; i -= 4) {\n outL <<= 6;\n outL |= (r >>> i) & 0x3f;\n }\n for (var i = 11; i >= 3; i -= 4) {\n outR |= (r >>> i) & 0x3f;\n outR <<= 6;\n }\n outR |= ((r & 0x1f) << 1) | (r >>> 31);\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nvar sTable = [\n 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1,\n 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8,\n 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7,\n 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13,\n\n 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14,\n 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5,\n 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2,\n 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9,\n\n 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10,\n 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1,\n 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7,\n 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12,\n\n 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3,\n 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9,\n 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8,\n 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14,\n\n 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1,\n 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6,\n 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13,\n 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3,\n\n 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5,\n 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8,\n 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10,\n 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13,\n\n 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10,\n 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6,\n 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7,\n 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12,\n\n 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4,\n 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2,\n 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13,\n 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11\n];\n\nexports.substitute = function substitute(inL, inR) {\n var out = 0;\n for (var i = 0; i < 4; i++) {\n var b = (inL >>> (18 - i * 6)) & 0x3f;\n var sb = sTable[i * 0x40 + b];\n\n out <<= 4;\n out |= sb;\n }\n for (var i = 0; i < 4; i++) {\n var b = (inR >>> (18 - i * 6)) & 0x3f;\n var sb = sTable[4 * 0x40 + i * 0x40 + b];\n\n out <<= 4;\n out |= sb;\n }\n return out >>> 0;\n};\n\nvar permuteTable = [\n 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22,\n 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7\n];\n\nexports.permute = function permute(num) {\n var out = 0;\n for (var i = 0; i < permuteTable.length; i++) {\n out <<= 1;\n out |= (num >>> permuteTable[i]) & 0x1;\n }\n return out >>> 0;\n};\n\nexports.padSplit = function padSplit(num, size, group) {\n var str = num.toString(2);\n while (str.length < size)\n str = '0' + str;\n\n var out = [];\n for (var i = 0; i < size; i += group)\n out.push(str.slice(i, i + group));\n return out.join(' ');\n};\n","module.exports = assert;\n\nfunction assert(val, msg) {\n if (!val)\n throw new Error(msg || 'Assertion failed');\n}\n\nassert.equal = function assertEqual(l, r, msg) {\n if (l != r)\n throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));\n};\n","'use strict';\n\nvar assert = require('minimalistic-assert');\n\nfunction Cipher(options) {\n this.options = options;\n\n this.type = this.options.type;\n this.blockSize = 8;\n this._init();\n\n this.buffer = new Array(this.blockSize);\n this.bufferOff = 0;\n this.padding = options.padding !== false\n}\nmodule.exports = Cipher;\n\nCipher.prototype._init = function _init() {\n // Might be overrided\n};\n\nCipher.prototype.update = function update(data) {\n if (data.length === 0)\n return [];\n\n if (this.type === 'decrypt')\n return this._updateDecrypt(data);\n else\n return this._updateEncrypt(data);\n};\n\nCipher.prototype._buffer = function _buffer(data, off) {\n // Append data to buffer\n var min = Math.min(this.buffer.length - this.bufferOff, data.length - off);\n for (var i = 0; i < min; i++)\n this.buffer[this.bufferOff + i] = data[off + i];\n this.bufferOff += min;\n\n // Shift next\n return min;\n};\n\nCipher.prototype._flushBuffer = function _flushBuffer(out, off) {\n this._update(this.buffer, 0, out, off);\n this.bufferOff = 0;\n return this.blockSize;\n};\n\nCipher.prototype._updateEncrypt = function _updateEncrypt(data) {\n var inputOff = 0;\n var outputOff = 0;\n\n var count = ((this.bufferOff + data.length) / this.blockSize) | 0;\n var out = new Array(count * this.blockSize);\n\n if (this.bufferOff !== 0) {\n inputOff += this._buffer(data, inputOff);\n\n if (this.bufferOff === this.buffer.length)\n outputOff += this._flushBuffer(out, outputOff);\n }\n\n // Write blocks\n var max = data.length - ((data.length - inputOff) % this.blockSize);\n for (; inputOff < max; inputOff += this.blockSize) {\n this._update(data, inputOff, out, outputOff);\n outputOff += this.blockSize;\n }\n\n // Queue rest\n for (; inputOff < data.length; inputOff++, this.bufferOff++)\n this.buffer[this.bufferOff] = data[inputOff];\n\n return out;\n};\n\nCipher.prototype._updateDecrypt = function _updateDecrypt(data) {\n var inputOff = 0;\n var outputOff = 0;\n\n var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1;\n var out = new Array(count * this.blockSize);\n\n // TODO(indutny): optimize it, this is far from optimal\n for (; count > 0; count--) {\n inputOff += this._buffer(data, inputOff);\n outputOff += this._flushBuffer(out, outputOff);\n }\n\n // Buffer rest of the input\n inputOff += this._buffer(data, inputOff);\n\n return out;\n};\n\nCipher.prototype.final = function final(buffer) {\n var first;\n if (buffer)\n first = this.update(buffer);\n\n var last;\n if (this.type === 'encrypt')\n last = this._finalEncrypt();\n else\n last = this._finalDecrypt();\n\n if (first)\n return first.concat(last);\n else\n return last;\n};\n\nCipher.prototype._pad = function _pad(buffer, off) {\n if (off === 0)\n return false;\n\n while (off < buffer.length)\n buffer[off++] = 0;\n\n return true;\n};\n\nCipher.prototype._finalEncrypt = function _finalEncrypt() {\n if (!this._pad(this.buffer, this.bufferOff))\n return [];\n\n var out = new Array(this.blockSize);\n this._update(this.buffer, 0, out, 0);\n return out;\n};\n\nCipher.prototype._unpad = function _unpad(buffer) {\n return buffer;\n};\n\nCipher.prototype._finalDecrypt = function _finalDecrypt() {\n assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt');\n var out = new Array(this.blockSize);\n this._flushBuffer(out, 0);\n\n return this._unpad(out);\n};\n","'use strict';\n\nvar assert = require('minimalistic-assert');\nvar inherits = require('inherits');\n\nvar utils = require('./utils');\nvar Cipher = require('./cipher');\n\nfunction DESState() {\n this.tmp = new Array(2);\n this.keys = null;\n}\n\nfunction DES(options) {\n Cipher.call(this, options);\n\n var state = new DESState();\n this._desState = state;\n\n this.deriveKeys(state, options.key);\n}\ninherits(DES, Cipher);\nmodule.exports = DES;\n\nDES.create = function create(options) {\n return new DES(options);\n};\n\nvar shiftTable = [\n 1, 1, 2, 2, 2, 2, 2, 2,\n 1, 2, 2, 2, 2, 2, 2, 1\n];\n\nDES.prototype.deriveKeys = function deriveKeys(state, key) {\n state.keys = new Array(16 * 2);\n\n assert.equal(key.length, this.blockSize, 'Invalid key length');\n\n var kL = utils.readUInt32BE(key, 0);\n var kR = utils.readUInt32BE(key, 4);\n\n utils.pc1(kL, kR, state.tmp, 0);\n kL = state.tmp[0];\n kR = state.tmp[1];\n for (var i = 0; i < state.keys.length; i += 2) {\n var shift = shiftTable[i >>> 1];\n kL = utils.r28shl(kL, shift);\n kR = utils.r28shl(kR, shift);\n utils.pc2(kL, kR, state.keys, i);\n }\n};\n\nDES.prototype._update = function _update(inp, inOff, out, outOff) {\n var state = this._desState;\n\n var l = utils.readUInt32BE(inp, inOff);\n var r = utils.readUInt32BE(inp, inOff + 4);\n\n // Initial Permutation\n utils.ip(l, r, state.tmp, 0);\n l = state.tmp[0];\n r = state.tmp[1];\n\n if (this.type === 'encrypt')\n this._encrypt(state, l, r, state.tmp, 0);\n else\n this._decrypt(state, l, r, state.tmp, 0);\n\n l = state.tmp[0];\n r = state.tmp[1];\n\n utils.writeUInt32BE(out, l, outOff);\n utils.writeUInt32BE(out, r, outOff + 4);\n};\n\nDES.prototype._pad = function _pad(buffer, off) {\n if (this.padding === false) {\n return false;\n }\n\n var value = buffer.length - off;\n for (var i = off; i < buffer.length; i++)\n buffer[i] = value;\n\n return true;\n};\n\nDES.prototype._unpad = function _unpad(buffer) {\n if (this.padding === false) {\n return buffer;\n }\n\n var pad = buffer[buffer.length - 1];\n for (var i = buffer.length - pad; i < buffer.length; i++)\n assert.equal(buffer[i], pad);\n\n return buffer.slice(0, buffer.length - pad);\n};\n\nDES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) {\n var l = lStart;\n var r = rStart;\n\n // Apply f() x16 times\n for (var i = 0; i < state.keys.length; i += 2) {\n var keyL = state.keys[i];\n var keyR = state.keys[i + 1];\n\n // f(r, k)\n utils.expand(r, state.tmp, 0);\n\n keyL ^= state.tmp[0];\n keyR ^= state.tmp[1];\n var s = utils.substitute(keyL, keyR);\n var f = utils.permute(s);\n\n var t = r;\n r = (l ^ f) >>> 0;\n l = t;\n }\n\n // Reverse Initial Permutation\n utils.rip(r, l, out, off);\n};\n\nDES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) {\n var l = rStart;\n var r = lStart;\n\n // Apply f() x16 times\n for (var i = state.keys.length - 2; i >= 0; i -= 2) {\n var keyL = state.keys[i];\n var keyR = state.keys[i + 1];\n\n // f(r, k)\n utils.expand(l, state.tmp, 0);\n\n keyL ^= state.tmp[0];\n keyR ^= state.tmp[1];\n var s = utils.substitute(keyL, keyR);\n var f = utils.permute(s);\n\n var t = l;\n l = (r ^ f) >>> 0;\n r = t;\n }\n\n // Reverse Initial Permutation\n utils.rip(l, r, out, off);\n};\n","'use strict';\n\nvar assert = require('minimalistic-assert');\nvar inherits = require('inherits');\n\nvar proto = {};\n\nfunction CBCState(iv) {\n assert.equal(iv.length, 8, 'Invalid IV length');\n\n this.iv = new Array(8);\n for (var i = 0; i < this.iv.length; i++)\n this.iv[i] = iv[i];\n}\n\nfunction instantiate(Base) {\n function CBC(options) {\n Base.call(this, options);\n this._cbcInit();\n }\n inherits(CBC, Base);\n\n var keys = Object.keys(proto);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n CBC.prototype[key] = proto[key];\n }\n\n CBC.create = function create(options) {\n return new CBC(options);\n };\n\n return CBC;\n}\n\nexports.instantiate = instantiate;\n\nproto._cbcInit = function _cbcInit() {\n var state = new CBCState(this.options.iv);\n this._cbcState = state;\n};\n\nproto._update = function _update(inp, inOff, out, outOff) {\n var state = this._cbcState;\n var superProto = this.constructor.super_.prototype;\n\n var iv = state.iv;\n if (this.type === 'encrypt') {\n for (var i = 0; i < this.blockSize; i++)\n iv[i] ^= inp[inOff + i];\n\n superProto._update.call(this, iv, 0, out, outOff);\n\n for (var i = 0; i < this.blockSize; i++)\n iv[i] = out[outOff + i];\n } else {\n superProto._update.call(this, inp, inOff, out, outOff);\n\n for (var i = 0; i < this.blockSize; i++)\n out[outOff + i] ^= iv[i];\n\n for (var i = 0; i < this.blockSize; i++)\n iv[i] = inp[inOff + i];\n }\n};\n","'use strict';\n\nvar assert = require('minimalistic-assert');\nvar inherits = require('inherits');\n\nvar Cipher = require('./cipher');\nvar DES = require('./des');\n\nfunction EDEState(type, key) {\n assert.equal(key.length, 24, 'Invalid key length');\n\n var k1 = key.slice(0, 8);\n var k2 = key.slice(8, 16);\n var k3 = key.slice(16, 24);\n\n if (type === 'encrypt') {\n this.ciphers = [\n DES.create({ type: 'encrypt', key: k1 }),\n DES.create({ type: 'decrypt', key: k2 }),\n DES.create({ type: 'encrypt', key: k3 })\n ];\n } else {\n this.ciphers = [\n DES.create({ type: 'decrypt', key: k3 }),\n DES.create({ type: 'encrypt', key: k2 }),\n DES.create({ type: 'decrypt', key: k1 })\n ];\n }\n}\n\nfunction EDE(options) {\n Cipher.call(this, options);\n\n var state = new EDEState(this.type, this.options.key);\n this._edeState = state;\n}\ninherits(EDE, Cipher);\n\nmodule.exports = EDE;\n\nEDE.create = function create(options) {\n return new EDE(options);\n};\n\nEDE.prototype._update = function _update(inp, inOff, out, outOff) {\n var state = this._edeState;\n\n state.ciphers[0]._update(inp, inOff, out, outOff);\n state.ciphers[1]._update(out, outOff, out, outOff);\n state.ciphers[2]._update(out, outOff, out, outOff);\n};\n\nEDE.prototype._pad = DES.prototype._pad;\nEDE.prototype._unpad = DES.prototype._unpad;\n","'use strict';\n\nexports.utils = require('./des/utils');\nexports.Cipher = require('./des/cipher');\nexports.DES = require('./des/des');\nexports.CBC = require('./des/cbc');\nexports.EDE = require('./des/ede');\n","var CipherBase = require('cipher-base')\nvar des = require('des.js')\nvar inherits = require('inherits')\nvar Buffer = require('safe-buffer').Buffer\n\nvar modes = {\n 'des-ede3-cbc': des.CBC.instantiate(des.EDE),\n 'des-ede3': des.EDE,\n 'des-ede-cbc': des.CBC.instantiate(des.EDE),\n 'des-ede': des.EDE,\n 'des-cbc': des.CBC.instantiate(des.DES),\n 'des-ecb': des.DES\n}\nmodes.des = modes['des-cbc']\nmodes.des3 = modes['des-ede3-cbc']\nmodule.exports = DES\ninherits(DES, CipherBase)\nfunction DES (opts) {\n CipherBase.call(this)\n var modeName = opts.mode.toLowerCase()\n var mode = modes[modeName]\n var type\n if (opts.decrypt) {\n type = 'decrypt'\n } else {\n type = 'encrypt'\n }\n var key = opts.key\n if (!Buffer.isBuffer(key)) {\n key = Buffer.from(key)\n }\n if (modeName === 'des-ede' || modeName === 'des-ede-cbc') {\n key = Buffer.concat([key, key.slice(0, 8)])\n }\n var iv = opts.iv\n if (!Buffer.isBuffer(iv)) {\n iv = Buffer.from(iv)\n }\n this._des = mode.create({\n key: key,\n iv: iv,\n type: type\n })\n}\nDES.prototype._update = function (data) {\n return Buffer.from(this._des.update(data))\n}\nDES.prototype._final = function () {\n return Buffer.from(this._des.final())\n}\n","exports.encrypt = function (self, block) {\n return self._cipher.encryptBlock(block)\n}\n\nexports.decrypt = function (self, block) {\n return self._cipher.decryptBlock(block)\n}\n","module.exports = function xor (a, b) {\n var length = Math.min(a.length, b.length)\n var buffer = new Buffer(length)\n\n for (var i = 0; i < length; ++i) {\n buffer[i] = a[i] ^ b[i]\n }\n\n return buffer\n}\n","var xor = require('buffer-xor')\n\nexports.encrypt = function (self, block) {\n var data = xor(block, self._prev)\n\n self._prev = self._cipher.encryptBlock(data)\n return self._prev\n}\n\nexports.decrypt = function (self, block) {\n var pad = self._prev\n\n self._prev = block\n var out = self._cipher.decryptBlock(block)\n\n return xor(out, pad)\n}\n","var Buffer = require('safe-buffer').Buffer\nvar xor = require('buffer-xor')\n\nfunction encryptStart (self, data, decrypt) {\n var len = data.length\n var out = xor(data, self._cache)\n self._cache = self._cache.slice(len)\n self._prev = Buffer.concat([self._prev, decrypt ? data : out])\n return out\n}\n\nexports.encrypt = function (self, data, decrypt) {\n var out = Buffer.allocUnsafe(0)\n var len\n\n while (data.length) {\n if (self._cache.length === 0) {\n self._cache = self._cipher.encryptBlock(self._prev)\n self._prev = Buffer.allocUnsafe(0)\n }\n\n if (self._cache.length <= data.length) {\n len = self._cache.length\n out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)])\n data = data.slice(len)\n } else {\n out = Buffer.concat([out, encryptStart(self, data, decrypt)])\n break\n }\n }\n\n return out\n}\n","var Buffer = require('safe-buffer').Buffer\n\nfunction encryptByte (self, byteParam, decrypt) {\n var pad = self._cipher.encryptBlock(self._prev)\n var out = pad[0] ^ byteParam\n\n self._prev = Buffer.concat([\n self._prev.slice(1),\n Buffer.from([decrypt ? byteParam : out])\n ])\n\n return out\n}\n\nexports.encrypt = function (self, chunk, decrypt) {\n var len = chunk.length\n var out = Buffer.allocUnsafe(len)\n var i = -1\n\n while (++i < len) {\n out[i] = encryptByte(self, chunk[i], decrypt)\n }\n\n return out\n}\n","var Buffer = require('safe-buffer').Buffer\n\nfunction encryptByte (self, byteParam, decrypt) {\n var pad\n var i = -1\n var len = 8\n var out = 0\n var bit, value\n while (++i < len) {\n pad = self._cipher.encryptBlock(self._prev)\n bit = (byteParam & (1 << (7 - i))) ? 0x80 : 0\n value = pad[0] ^ bit\n out += ((value & 0x80) >> (i % 8))\n self._prev = shiftIn(self._prev, decrypt ? bit : value)\n }\n return out\n}\n\nfunction shiftIn (buffer, value) {\n var len = buffer.length\n var i = -1\n var out = Buffer.allocUnsafe(buffer.length)\n buffer = Buffer.concat([buffer, Buffer.from([value])])\n\n while (++i < len) {\n out[i] = buffer[i] << 1 | buffer[i + 1] >> (7)\n }\n\n return out\n}\n\nexports.encrypt = function (self, chunk, decrypt) {\n var len = chunk.length\n var out = Buffer.allocUnsafe(len)\n var i = -1\n\n while (++i < len) {\n out[i] = encryptByte(self, chunk[i], decrypt)\n }\n\n return out\n}\n","var xor = require('buffer-xor')\n\nfunction getBlock (self) {\n self._prev = self._cipher.encryptBlock(self._prev)\n return self._prev\n}\n\nexports.encrypt = function (self, chunk) {\n while (self._cache.length < chunk.length) {\n self._cache = Buffer.concat([self._cache, getBlock(self)])\n }\n\n var pad = self._cache.slice(0, chunk.length)\n self._cache = self._cache.slice(chunk.length)\n return xor(chunk, pad)\n}\n","function incr32 (iv) {\n var len = iv.length\n var item\n while (len--) {\n item = iv.readUInt8(len)\n if (item === 255) {\n iv.writeUInt8(0, len)\n } else {\n item++\n iv.writeUInt8(item, len)\n break\n }\n }\n}\nmodule.exports = incr32\n","var xor = require('buffer-xor')\nvar Buffer = require('safe-buffer').Buffer\nvar incr32 = require('../incr32')\n\nfunction getBlock (self) {\n var out = self._cipher.encryptBlockRaw(self._prev)\n incr32(self._prev)\n return out\n}\n\nvar blockSize = 16\nexports.encrypt = function (self, chunk) {\n var chunkNum = Math.ceil(chunk.length / blockSize)\n var start = self._cache.length\n self._cache = Buffer.concat([\n self._cache,\n Buffer.allocUnsafe(chunkNum * blockSize)\n ])\n for (var i = 0; i < chunkNum; i++) {\n var out = getBlock(self)\n var offset = start + i * blockSize\n self._cache.writeUInt32BE(out[0], offset + 0)\n self._cache.writeUInt32BE(out[1], offset + 4)\n self._cache.writeUInt32BE(out[2], offset + 8)\n self._cache.writeUInt32BE(out[3], offset + 12)\n }\n var pad = self._cache.slice(0, chunk.length)\n self._cache = self._cache.slice(chunk.length)\n return xor(chunk, pad)\n}\n","{\n \"aes-128-ecb\": {\n \"cipher\": \"AES\",\n \"key\": 128,\n \"iv\": 0,\n \"mode\": \"ECB\",\n \"type\": \"block\"\n },\n \"aes-192-ecb\": {\n \"cipher\": \"AES\",\n \"key\": 192,\n \"iv\": 0,\n \"mode\": \"ECB\",\n \"type\": \"block\"\n },\n \"aes-256-ecb\": {\n \"cipher\": \"AES\",\n \"key\": 256,\n \"iv\": 0,\n \"mode\": \"ECB\",\n \"type\": \"block\"\n },\n \"aes-128-cbc\": {\n \"cipher\": \"AES\",\n \"key\": 128,\n \"iv\": 16,\n \"mode\": \"CBC\",\n \"type\": \"block\"\n },\n \"aes-192-cbc\": {\n \"cipher\": \"AES\",\n \"key\": 192,\n \"iv\": 16,\n \"mode\": \"CBC\",\n \"type\": \"block\"\n },\n \"aes-256-cbc\": {\n \"cipher\": \"AES\",\n \"key\": 256,\n \"iv\": 16,\n \"mode\": \"CBC\",\n \"type\": \"block\"\n },\n \"aes128\": {\n \"cipher\": \"AES\",\n \"key\": 128,\n \"iv\": 16,\n \"mode\": \"CBC\",\n \"type\": \"block\"\n },\n \"aes192\": {\n \"cipher\": \"AES\",\n \"key\": 192,\n \"iv\": 16,\n \"mode\": \"CBC\",\n \"type\": \"block\"\n },\n \"aes256\": {\n \"cipher\": \"AES\",\n \"key\": 256,\n \"iv\": 16,\n \"mode\": \"CBC\",\n \"type\": \"block\"\n },\n \"aes-128-cfb\": {\n \"cipher\": \"AES\",\n \"key\": 128,\n \"iv\": 16,\n \"mode\": \"CFB\",\n \"type\": \"stream\"\n },\n \"aes-192-cfb\": {\n \"cipher\": \"AES\",\n \"key\": 192,\n \"iv\": 16,\n \"mode\": \"CFB\",\n \"type\": \"stream\"\n },\n \"aes-256-cfb\": {\n \"cipher\": \"AES\",\n \"key\": 256,\n \"iv\": 16,\n \"mode\": \"CFB\",\n \"type\": \"stream\"\n },\n \"aes-128-cfb8\": {\n \"cipher\": \"AES\",\n \"key\": 128,\n \"iv\": 16,\n \"mode\": \"CFB8\",\n \"type\": \"stream\"\n },\n \"aes-192-cfb8\": {\n \"cipher\": \"AES\",\n \"key\": 192,\n \"iv\": 16,\n \"mode\": \"CFB8\",\n \"type\": \"stream\"\n },\n \"aes-256-cfb8\": {\n \"cipher\": \"AES\",\n \"key\": 256,\n \"iv\": 16,\n \"mode\": \"CFB8\",\n \"type\": \"stream\"\n },\n \"aes-128-cfb1\": {\n \"cipher\": \"AES\",\n \"key\": 128,\n \"iv\": 16,\n \"mode\": \"CFB1\",\n \"type\": \"stream\"\n },\n \"aes-192-cfb1\": {\n \"cipher\": \"AES\",\n \"key\": 192,\n \"iv\": 16,\n \"mode\": \"CFB1\",\n \"type\": \"stream\"\n },\n \"aes-256-cfb1\": {\n \"cipher\": \"AES\",\n \"key\": 256,\n \"iv\": 16,\n \"mode\": \"CFB1\",\n \"type\": \"stream\"\n },\n \"aes-128-ofb\": {\n \"cipher\": \"AES\",\n \"key\": 128,\n \"iv\": 16,\n \"mode\": \"OFB\",\n \"type\": \"stream\"\n },\n \"aes-192-ofb\": {\n \"cipher\": \"AES\",\n \"key\": 192,\n \"iv\": 16,\n \"mode\": \"OFB\",\n \"type\": \"stream\"\n },\n \"aes-256-ofb\": {\n \"cipher\": \"AES\",\n \"key\": 256,\n \"iv\": 16,\n \"mode\": \"OFB\",\n \"type\": \"stream\"\n },\n \"aes-128-ctr\": {\n \"cipher\": \"AES\",\n \"key\": 128,\n \"iv\": 16,\n \"mode\": \"CTR\",\n \"type\": \"stream\"\n },\n \"aes-192-ctr\": {\n \"cipher\": \"AES\",\n \"key\": 192,\n \"iv\": 16,\n \"mode\": \"CTR\",\n \"type\": \"stream\"\n },\n \"aes-256-ctr\": {\n \"cipher\": \"AES\",\n \"key\": 256,\n \"iv\": 16,\n \"mode\": \"CTR\",\n \"type\": \"stream\"\n },\n \"aes-128-gcm\": {\n \"cipher\": \"AES\",\n \"key\": 128,\n \"iv\": 12,\n \"mode\": \"GCM\",\n \"type\": \"auth\"\n },\n \"aes-192-gcm\": {\n \"cipher\": \"AES\",\n \"key\": 192,\n \"iv\": 12,\n \"mode\": \"GCM\",\n \"type\": \"auth\"\n },\n \"aes-256-gcm\": {\n \"cipher\": \"AES\",\n \"key\": 256,\n \"iv\": 12,\n \"mode\": \"GCM\",\n \"type\": \"auth\"\n }\n}\n","var modeModules = {\n ECB: require('./ecb'),\n CBC: require('./cbc'),\n CFB: require('./cfb'),\n CFB8: require('./cfb8'),\n CFB1: require('./cfb1'),\n OFB: require('./ofb'),\n CTR: require('./ctr'),\n GCM: require('./ctr')\n}\n\nvar modes = require('./list.json')\n\nfor (var key in modes) {\n modes[key].module = modeModules[modes[key].mode]\n}\n\nmodule.exports = modes\n","// based on the aes implimentation in triple sec\n// https://github.com/keybase/triplesec\n// which is in turn based on the one from crypto-js\n// https://code.google.com/p/crypto-js/\n\nvar Buffer = require('safe-buffer').Buffer\n\nfunction asUInt32Array (buf) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n\n var len = (buf.length / 4) | 0\n var out = new Array(len)\n\n for (var i = 0; i < len; i++) {\n out[i] = buf.readUInt32BE(i * 4)\n }\n\n return out\n}\n\nfunction scrubVec (v) {\n for (var i = 0; i < v.length; v++) {\n v[i] = 0\n }\n}\n\nfunction cryptBlock (M, keySchedule, SUB_MIX, SBOX, nRounds) {\n var SUB_MIX0 = SUB_MIX[0]\n var SUB_MIX1 = SUB_MIX[1]\n var SUB_MIX2 = SUB_MIX[2]\n var SUB_MIX3 = SUB_MIX[3]\n\n var s0 = M[0] ^ keySchedule[0]\n var s1 = M[1] ^ keySchedule[1]\n var s2 = M[2] ^ keySchedule[2]\n var s3 = M[3] ^ keySchedule[3]\n var t0, t1, t2, t3\n var ksRow = 4\n\n for (var round = 1; round < nRounds; round++) {\n t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[(s1 >>> 16) & 0xff] ^ SUB_MIX2[(s2 >>> 8) & 0xff] ^ SUB_MIX3[s3 & 0xff] ^ keySchedule[ksRow++]\n t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[(s2 >>> 16) & 0xff] ^ SUB_MIX2[(s3 >>> 8) & 0xff] ^ SUB_MIX3[s0 & 0xff] ^ keySchedule[ksRow++]\n t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[(s3 >>> 16) & 0xff] ^ SUB_MIX2[(s0 >>> 8) & 0xff] ^ SUB_MIX3[s1 & 0xff] ^ keySchedule[ksRow++]\n t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[(s0 >>> 16) & 0xff] ^ SUB_MIX2[(s1 >>> 8) & 0xff] ^ SUB_MIX3[s2 & 0xff] ^ keySchedule[ksRow++]\n s0 = t0\n s1 = t1\n s2 = t2\n s3 = t3\n }\n\n t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]\n t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]\n t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]\n t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]\n t0 = t0 >>> 0\n t1 = t1 >>> 0\n t2 = t2 >>> 0\n t3 = t3 >>> 0\n\n return [t0, t1, t2, t3]\n}\n\n// AES constants\nvar RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]\nvar G = (function () {\n // Compute double table\n var d = new Array(256)\n for (var j = 0; j < 256; j++) {\n if (j < 128) {\n d[j] = j << 1\n } else {\n d[j] = (j << 1) ^ 0x11b\n }\n }\n\n var SBOX = []\n var INV_SBOX = []\n var SUB_MIX = [[], [], [], []]\n var INV_SUB_MIX = [[], [], [], []]\n\n // Walk GF(2^8)\n var x = 0\n var xi = 0\n for (var i = 0; i < 256; ++i) {\n // Compute sbox\n var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4)\n sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63\n SBOX[x] = sx\n INV_SBOX[sx] = x\n\n // Compute multiplication\n var x2 = d[x]\n var x4 = d[x2]\n var x8 = d[x4]\n\n // Compute sub bytes, mix columns tables\n var t = (d[sx] * 0x101) ^ (sx * 0x1010100)\n SUB_MIX[0][x] = (t << 24) | (t >>> 8)\n SUB_MIX[1][x] = (t << 16) | (t >>> 16)\n SUB_MIX[2][x] = (t << 8) | (t >>> 24)\n SUB_MIX[3][x] = t\n\n // Compute inv sub bytes, inv mix columns tables\n t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100)\n INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8)\n INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16)\n INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24)\n INV_SUB_MIX[3][sx] = t\n\n if (x === 0) {\n x = xi = 1\n } else {\n x = x2 ^ d[d[d[x8 ^ x2]]]\n xi ^= d[d[xi]]\n }\n }\n\n return {\n SBOX: SBOX,\n INV_SBOX: INV_SBOX,\n SUB_MIX: SUB_MIX,\n INV_SUB_MIX: INV_SUB_MIX\n }\n})()\n\nfunction AES (key) {\n this._key = asUInt32Array(key)\n this._reset()\n}\n\nAES.blockSize = 4 * 4\nAES.keySize = 256 / 8\nAES.prototype.blockSize = AES.blockSize\nAES.prototype.keySize = AES.keySize\nAES.prototype._reset = function () {\n var keyWords = this._key\n var keySize = keyWords.length\n var nRounds = keySize + 6\n var ksRows = (nRounds + 1) * 4\n\n var keySchedule = []\n for (var k = 0; k < keySize; k++) {\n keySchedule[k] = keyWords[k]\n }\n\n for (k = keySize; k < ksRows; k++) {\n var t = keySchedule[k - 1]\n\n if (k % keySize === 0) {\n t = (t << 8) | (t >>> 24)\n t =\n (G.SBOX[t >>> 24] << 24) |\n (G.SBOX[(t >>> 16) & 0xff] << 16) |\n (G.SBOX[(t >>> 8) & 0xff] << 8) |\n (G.SBOX[t & 0xff])\n\n t ^= RCON[(k / keySize) | 0] << 24\n } else if (keySize > 6 && k % keySize === 4) {\n t =\n (G.SBOX[t >>> 24] << 24) |\n (G.SBOX[(t >>> 16) & 0xff] << 16) |\n (G.SBOX[(t >>> 8) & 0xff] << 8) |\n (G.SBOX[t & 0xff])\n }\n\n keySchedule[k] = keySchedule[k - keySize] ^ t\n }\n\n var invKeySchedule = []\n for (var ik = 0; ik < ksRows; ik++) {\n var ksR = ksRows - ik\n var tt = keySchedule[ksR - (ik % 4 ? 0 : 4)]\n\n if (ik < 4 || ksR <= 4) {\n invKeySchedule[ik] = tt\n } else {\n invKeySchedule[ik] =\n G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^\n G.INV_SUB_MIX[1][G.SBOX[(tt >>> 16) & 0xff]] ^\n G.INV_SUB_MIX[2][G.SBOX[(tt >>> 8) & 0xff]] ^\n G.INV_SUB_MIX[3][G.SBOX[tt & 0xff]]\n }\n }\n\n this._nRounds = nRounds\n this._keySchedule = keySchedule\n this._invKeySchedule = invKeySchedule\n}\n\nAES.prototype.encryptBlockRaw = function (M) {\n M = asUInt32Array(M)\n return cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds)\n}\n\nAES.prototype.encryptBlock = function (M) {\n var out = this.encryptBlockRaw(M)\n var buf = Buffer.allocUnsafe(16)\n buf.writeUInt32BE(out[0], 0)\n buf.writeUInt32BE(out[1], 4)\n buf.writeUInt32BE(out[2], 8)\n buf.writeUInt32BE(out[3], 12)\n return buf\n}\n\nAES.prototype.decryptBlock = function (M) {\n M = asUInt32Array(M)\n\n // swap\n var m1 = M[1]\n M[1] = M[3]\n M[3] = m1\n\n var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds)\n var buf = Buffer.allocUnsafe(16)\n buf.writeUInt32BE(out[0], 0)\n buf.writeUInt32BE(out[3], 4)\n buf.writeUInt32BE(out[2], 8)\n buf.writeUInt32BE(out[1], 12)\n return buf\n}\n\nAES.prototype.scrub = function () {\n scrubVec(this._keySchedule)\n scrubVec(this._invKeySchedule)\n scrubVec(this._key)\n}\n\nmodule.exports.AES = AES\n","var Buffer = require('safe-buffer').Buffer\nvar ZEROES = Buffer.alloc(16, 0)\n\nfunction toArray (buf) {\n return [\n buf.readUInt32BE(0),\n buf.readUInt32BE(4),\n buf.readUInt32BE(8),\n buf.readUInt32BE(12)\n ]\n}\n\nfunction fromArray (out) {\n var buf = Buffer.allocUnsafe(16)\n buf.writeUInt32BE(out[0] >>> 0, 0)\n buf.writeUInt32BE(out[1] >>> 0, 4)\n buf.writeUInt32BE(out[2] >>> 0, 8)\n buf.writeUInt32BE(out[3] >>> 0, 12)\n return buf\n}\n\nfunction GHASH (key) {\n this.h = key\n this.state = Buffer.alloc(16, 0)\n this.cache = Buffer.allocUnsafe(0)\n}\n\n// from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html\n// by Juho Vähä-Herttua\nGHASH.prototype.ghash = function (block) {\n var i = -1\n while (++i < block.length) {\n this.state[i] ^= block[i]\n }\n this._multiply()\n}\n\nGHASH.prototype._multiply = function () {\n var Vi = toArray(this.h)\n var Zi = [0, 0, 0, 0]\n var j, xi, lsbVi\n var i = -1\n while (++i < 128) {\n xi = (this.state[~~(i / 8)] & (1 << (7 - (i % 8)))) !== 0\n if (xi) {\n // Z_i+1 = Z_i ^ V_i\n Zi[0] ^= Vi[0]\n Zi[1] ^= Vi[1]\n Zi[2] ^= Vi[2]\n Zi[3] ^= Vi[3]\n }\n\n // Store the value of LSB(V_i)\n lsbVi = (Vi[3] & 1) !== 0\n\n // V_i+1 = V_i >> 1\n for (j = 3; j > 0; j--) {\n Vi[j] = (Vi[j] >>> 1) | ((Vi[j - 1] & 1) << 31)\n }\n Vi[0] = Vi[0] >>> 1\n\n // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R\n if (lsbVi) {\n Vi[0] = Vi[0] ^ (0xe1 << 24)\n }\n }\n this.state = fromArray(Zi)\n}\n\nGHASH.prototype.update = function (buf) {\n this.cache = Buffer.concat([this.cache, buf])\n var chunk\n while (this.cache.length >= 16) {\n chunk = this.cache.slice(0, 16)\n this.cache = this.cache.slice(16)\n this.ghash(chunk)\n }\n}\n\nGHASH.prototype.final = function (abl, bl) {\n if (this.cache.length) {\n this.ghash(Buffer.concat([this.cache, ZEROES], 16))\n }\n\n this.ghash(fromArray([0, abl, 0, bl]))\n return this.state\n}\n\nmodule.exports = GHASH\n","var aes = require('./aes')\nvar Buffer = require('safe-buffer').Buffer\nvar Transform = require('cipher-base')\nvar inherits = require('inherits')\nvar GHASH = require('./ghash')\nvar xor = require('buffer-xor')\nvar incr32 = require('./incr32')\n\nfunction xorTest (a, b) {\n var out = 0\n if (a.length !== b.length) out++\n\n var len = Math.min(a.length, b.length)\n for (var i = 0; i < len; ++i) {\n out += (a[i] ^ b[i])\n }\n\n return out\n}\n\nfunction calcIv (self, iv, ck) {\n if (iv.length === 12) {\n self._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])])\n return Buffer.concat([iv, Buffer.from([0, 0, 0, 2])])\n }\n var ghash = new GHASH(ck)\n var len = iv.length\n var toPad = len % 16\n ghash.update(iv)\n if (toPad) {\n toPad = 16 - toPad\n ghash.update(Buffer.alloc(toPad, 0))\n }\n ghash.update(Buffer.alloc(8, 0))\n var ivBits = len * 8\n var tail = Buffer.alloc(8)\n tail.writeUIntBE(ivBits, 0, 8)\n ghash.update(tail)\n self._finID = ghash.state\n var out = Buffer.from(self._finID)\n incr32(out)\n return out\n}\nfunction StreamCipher (mode, key, iv, decrypt) {\n Transform.call(this)\n\n var h = Buffer.alloc(4, 0)\n\n this._cipher = new aes.AES(key)\n var ck = this._cipher.encryptBlock(h)\n this._ghash = new GHASH(ck)\n iv = calcIv(this, iv, ck)\n\n this._prev = Buffer.from(iv)\n this._cache = Buffer.allocUnsafe(0)\n this._secCache = Buffer.allocUnsafe(0)\n this._decrypt = decrypt\n this._alen = 0\n this._len = 0\n this._mode = mode\n\n this._authTag = null\n this._called = false\n}\n\ninherits(StreamCipher, Transform)\n\nStreamCipher.prototype._update = function (chunk) {\n if (!this._called && this._alen) {\n var rump = 16 - (this._alen % 16)\n if (rump < 16) {\n rump = Buffer.alloc(rump, 0)\n this._ghash.update(rump)\n }\n }\n\n this._called = true\n var out = this._mode.encrypt(this, chunk)\n if (this._decrypt) {\n this._ghash.update(chunk)\n } else {\n this._ghash.update(out)\n }\n this._len += chunk.length\n return out\n}\n\nStreamCipher.prototype._final = function () {\n if (this._decrypt && !this._authTag) throw new Error('Unsupported state or unable to authenticate data')\n\n var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID))\n if (this._decrypt && xorTest(tag, this._authTag)) throw new Error('Unsupported state or unable to authenticate data')\n\n this._authTag = tag\n this._cipher.scrub()\n}\n\nStreamCipher.prototype.getAuthTag = function getAuthTag () {\n if (this._decrypt || !Buffer.isBuffer(this._authTag)) throw new Error('Attempting to get auth tag in unsupported state')\n\n return this._authTag\n}\n\nStreamCipher.prototype.setAuthTag = function setAuthTag (tag) {\n if (!this._decrypt) throw new Error('Attempting to set auth tag in unsupported state')\n\n this._authTag = tag\n}\n\nStreamCipher.prototype.setAAD = function setAAD (buf) {\n if (this._called) throw new Error('Attempting to set AAD in unsupported state')\n\n this._ghash.update(buf)\n this._alen += buf.length\n}\n\nmodule.exports = StreamCipher\n","var aes = require('./aes')\nvar Buffer = require('safe-buffer').Buffer\nvar Transform = require('cipher-base')\nvar inherits = require('inherits')\n\nfunction StreamCipher (mode, key, iv, decrypt) {\n Transform.call(this)\n\n this._cipher = new aes.AES(key)\n this._prev = Buffer.from(iv)\n this._cache = Buffer.allocUnsafe(0)\n this._secCache = Buffer.allocUnsafe(0)\n this._decrypt = decrypt\n this._mode = mode\n}\n\ninherits(StreamCipher, Transform)\n\nStreamCipher.prototype._update = function (chunk) {\n return this._mode.encrypt(this, chunk, this._decrypt)\n}\n\nStreamCipher.prototype._final = function () {\n this._cipher.scrub()\n}\n\nmodule.exports = StreamCipher\n","var Buffer = require('safe-buffer').Buffer\nvar MD5 = require('md5.js')\n\n/* eslint-disable camelcase */\nfunction EVP_BytesToKey (password, salt, keyBits, ivLen) {\n if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary')\n if (salt) {\n if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary')\n if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length')\n }\n\n var keyLen = keyBits / 8\n var key = Buffer.alloc(keyLen)\n var iv = Buffer.alloc(ivLen || 0)\n var tmp = Buffer.alloc(0)\n\n while (keyLen > 0 || ivLen > 0) {\n var hash = new MD5()\n hash.update(tmp)\n hash.update(password)\n if (salt) hash.update(salt)\n tmp = hash.digest()\n\n var used = 0\n\n if (keyLen > 0) {\n var keyStart = key.length - keyLen\n used = Math.min(keyLen, tmp.length)\n tmp.copy(key, keyStart, 0, used)\n keyLen -= used\n }\n\n if (used < tmp.length && ivLen > 0) {\n var ivStart = iv.length - ivLen\n var length = Math.min(ivLen, tmp.length - used)\n tmp.copy(iv, ivStart, used, used + length)\n ivLen -= length\n }\n }\n\n tmp.fill(0)\n return { key: key, iv: iv }\n}\n\nmodule.exports = EVP_BytesToKey\n","var MODES = require('./modes')\nvar AuthCipher = require('./authCipher')\nvar Buffer = require('safe-buffer').Buffer\nvar StreamCipher = require('./streamCipher')\nvar Transform = require('cipher-base')\nvar aes = require('./aes')\nvar ebtk = require('evp_bytestokey')\nvar inherits = require('inherits')\n\nfunction Cipher (mode, key, iv) {\n Transform.call(this)\n\n this._cache = new Splitter()\n this._cipher = new aes.AES(key)\n this._prev = Buffer.from(iv)\n this._mode = mode\n this._autopadding = true\n}\n\ninherits(Cipher, Transform)\n\nCipher.prototype._update = function (data) {\n this._cache.add(data)\n var chunk\n var thing\n var out = []\n\n while ((chunk = this._cache.get())) {\n thing = this._mode.encrypt(this, chunk)\n out.push(thing)\n }\n\n return Buffer.concat(out)\n}\n\nvar PADDING = Buffer.alloc(16, 0x10)\n\nCipher.prototype._final = function () {\n var chunk = this._cache.flush()\n if (this._autopadding) {\n chunk = this._mode.encrypt(this, chunk)\n this._cipher.scrub()\n return chunk\n }\n\n if (!chunk.equals(PADDING)) {\n this._cipher.scrub()\n throw new Error('data not multiple of block length')\n }\n}\n\nCipher.prototype.setAutoPadding = function (setTo) {\n this._autopadding = !!setTo\n return this\n}\n\nfunction Splitter () {\n this.cache = Buffer.allocUnsafe(0)\n}\n\nSplitter.prototype.add = function (data) {\n this.cache = Buffer.concat([this.cache, data])\n}\n\nSplitter.prototype.get = function () {\n if (this.cache.length > 15) {\n var out = this.cache.slice(0, 16)\n this.cache = this.cache.slice(16)\n return out\n }\n return null\n}\n\nSplitter.prototype.flush = function () {\n var len = 16 - this.cache.length\n var padBuff = Buffer.allocUnsafe(len)\n\n var i = -1\n while (++i < len) {\n padBuff.writeUInt8(len, i)\n }\n\n return Buffer.concat([this.cache, padBuff])\n}\n\nfunction createCipheriv (suite, password, iv) {\n var config = MODES[suite.toLowerCase()]\n if (!config) throw new TypeError('invalid suite type')\n\n if (typeof password === 'string') password = Buffer.from(password)\n if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)\n\n if (typeof iv === 'string') iv = Buffer.from(iv)\n if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)\n\n if (config.type === 'stream') {\n return new StreamCipher(config.module, password, iv)\n } else if (config.type === 'auth') {\n return new AuthCipher(config.module, password, iv)\n }\n\n return new Cipher(config.module, password, iv)\n}\n\nfunction createCipher (suite, password) {\n var config = MODES[suite.toLowerCase()]\n if (!config) throw new TypeError('invalid suite type')\n\n var keys = ebtk(password, false, config.key, config.iv)\n return createCipheriv(suite, keys.key, keys.iv)\n}\n\nexports.createCipheriv = createCipheriv\nexports.createCipher = createCipher\n","var AuthCipher = require('./authCipher')\nvar Buffer = require('safe-buffer').Buffer\nvar MODES = require('./modes')\nvar StreamCipher = require('./streamCipher')\nvar Transform = require('cipher-base')\nvar aes = require('./aes')\nvar ebtk = require('evp_bytestokey')\nvar inherits = require('inherits')\n\nfunction Decipher (mode, key, iv) {\n Transform.call(this)\n\n this._cache = new Splitter()\n this._last = void 0\n this._cipher = new aes.AES(key)\n this._prev = Buffer.from(iv)\n this._mode = mode\n this._autopadding = true\n}\n\ninherits(Decipher, Transform)\n\nDecipher.prototype._update = function (data) {\n this._cache.add(data)\n var chunk\n var thing\n var out = []\n while ((chunk = this._cache.get(this._autopadding))) {\n thing = this._mode.decrypt(this, chunk)\n out.push(thing)\n }\n return Buffer.concat(out)\n}\n\nDecipher.prototype._final = function () {\n var chunk = this._cache.flush()\n if (this._autopadding) {\n return unpad(this._mode.decrypt(this, chunk))\n } else if (chunk) {\n throw new Error('data not multiple of block length')\n }\n}\n\nDecipher.prototype.setAutoPadding = function (setTo) {\n this._autopadding = !!setTo\n return this\n}\n\nfunction Splitter () {\n this.cache = Buffer.allocUnsafe(0)\n}\n\nSplitter.prototype.add = function (data) {\n this.cache = Buffer.concat([this.cache, data])\n}\n\nSplitter.prototype.get = function (autoPadding) {\n var out\n if (autoPadding) {\n if (this.cache.length > 16) {\n out = this.cache.slice(0, 16)\n this.cache = this.cache.slice(16)\n return out\n }\n } else {\n if (this.cache.length >= 16) {\n out = this.cache.slice(0, 16)\n this.cache = this.cache.slice(16)\n return out\n }\n }\n\n return null\n}\n\nSplitter.prototype.flush = function () {\n if (this.cache.length) return this.cache\n}\n\nfunction unpad (last) {\n var padded = last[15]\n if (padded < 1 || padded > 16) {\n throw new Error('unable to decrypt data')\n }\n var i = -1\n while (++i < padded) {\n if (last[(i + (16 - padded))] !== padded) {\n throw new Error('unable to decrypt data')\n }\n }\n if (padded === 16) return\n\n return last.slice(0, 16 - padded)\n}\n\nfunction createDecipheriv (suite, password, iv) {\n var config = MODES[suite.toLowerCase()]\n if (!config) throw new TypeError('invalid suite type')\n\n if (typeof iv === 'string') iv = Buffer.from(iv)\n if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)\n\n if (typeof password === 'string') password = Buffer.from(password)\n if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)\n\n if (config.type === 'stream') {\n return new StreamCipher(config.module, password, iv, true)\n } else if (config.type === 'auth') {\n return new AuthCipher(config.module, password, iv, true)\n }\n\n return new Decipher(config.module, password, iv)\n}\n\nfunction createDecipher (suite, password) {\n var config = MODES[suite.toLowerCase()]\n if (!config) throw new TypeError('invalid suite type')\n\n var keys = ebtk(password, false, config.key, config.iv)\n return createDecipheriv(suite, keys.key, keys.iv)\n}\n\nexports.createDecipher = createDecipher\nexports.createDecipheriv = createDecipheriv\n","var ciphers = require('./encrypter')\nvar deciphers = require('./decrypter')\nvar modes = require('./modes/list.json')\n\nfunction getCiphers () {\n return Object.keys(modes)\n}\n\nexports.createCipher = exports.Cipher = ciphers.createCipher\nexports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv\nexports.createDecipher = exports.Decipher = deciphers.createDecipher\nexports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv\nexports.listCiphers = exports.getCiphers = getCiphers\n","exports['des-ecb'] = {\n key: 8,\n iv: 0\n}\nexports['des-cbc'] = exports.des = {\n key: 8,\n iv: 8\n}\nexports['des-ede3-cbc'] = exports.des3 = {\n key: 24,\n iv: 8\n}\nexports['des-ede3'] = {\n key: 24,\n iv: 0\n}\nexports['des-ede-cbc'] = {\n key: 16,\n iv: 8\n}\nexports['des-ede'] = {\n key: 16,\n iv: 0\n}\n","var DES = require('browserify-des')\nvar aes = require('browserify-aes/browser')\nvar aesModes = require('browserify-aes/modes')\nvar desModes = require('browserify-des/modes')\nvar ebtk = require('evp_bytestokey')\n\nfunction createCipher (suite, password) {\n suite = suite.toLowerCase()\n\n var keyLen, ivLen\n if (aesModes[suite]) {\n keyLen = aesModes[suite].key\n ivLen = aesModes[suite].iv\n } else if (desModes[suite]) {\n keyLen = desModes[suite].key * 8\n ivLen = desModes[suite].iv\n } else {\n throw new TypeError('invalid suite type')\n }\n\n var keys = ebtk(password, false, keyLen, ivLen)\n return createCipheriv(suite, keys.key, keys.iv)\n}\n\nfunction createDecipher (suite, password) {\n suite = suite.toLowerCase()\n\n var keyLen, ivLen\n if (aesModes[suite]) {\n keyLen = aesModes[suite].key\n ivLen = aesModes[suite].iv\n } else if (desModes[suite]) {\n keyLen = desModes[suite].key * 8\n ivLen = desModes[suite].iv\n } else {\n throw new TypeError('invalid suite type')\n }\n\n var keys = ebtk(password, false, keyLen, ivLen)\n return createDecipheriv(suite, keys.key, keys.iv)\n}\n\nfunction createCipheriv (suite, key, iv) {\n suite = suite.toLowerCase()\n if (aesModes[suite]) return aes.createCipheriv(suite, key, iv)\n if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite })\n\n throw new TypeError('invalid suite type')\n}\n\nfunction createDecipheriv (suite, key, iv) {\n suite = suite.toLowerCase()\n if (aesModes[suite]) return aes.createDecipheriv(suite, key, iv)\n if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite, decrypt: true })\n\n throw new TypeError('invalid suite type')\n}\n\nfunction getCiphers () {\n return Object.keys(desModes).concat(aes.getCiphers())\n}\n\nexports.createCipher = exports.Cipher = createCipher\nexports.createCipheriv = exports.Cipheriv = createCipheriv\nexports.createDecipher = exports.Decipher = createDecipher\nexports.createDecipheriv = exports.Decipheriv = createDecipheriv\nexports.listCiphers = exports.getCiphers = getCiphers\n","(function (module, exports) {\n 'use strict';\n\n // Utils\n function assert (val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n }\n\n // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n function inherits (ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n\n // BN\n\n function BN (number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0;\n\n // Reduction context\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n\n var Buffer;\n try {\n if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {\n Buffer = window.Buffer;\n } else {\n Buffer = require('buffer').Buffer;\n }\n } catch (e) {\n }\n\n BN.isBN = function isBN (num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' &&\n num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max (left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min (left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init (number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n assert(base === (base | 0) && base >= 2 && base <= 36);\n\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n if (number[0] === '-') {\n start++;\n this.negative = 1;\n }\n\n if (start < number.length) {\n if (base === 16) {\n this._parseHex(number, start, endian);\n } else {\n this._parseBase(number, base, start);\n if (endian === 'le') {\n this._initArray(this.toArray(), base, endian);\n }\n }\n }\n };\n\n BN.prototype._initNumber = function _initNumber (number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n if (number < 0x4000000) {\n this.words = [ number & 0x3ffffff ];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff\n ];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff,\n 1\n ];\n this.length = 3;\n }\n\n if (endian !== 'le') return;\n\n // Reverse the bytes\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray (number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n if (number.length <= 0) {\n this.words = [ 0 ];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this.strip();\n };\n\n function parseHex4Bits (string, index) {\n var c = string.charCodeAt(index);\n // 'A' - 'F'\n if (c >= 65 && c <= 70) {\n return c - 55;\n // 'a' - 'f'\n } else if (c >= 97 && c <= 102) {\n return c - 87;\n // '0' - '9'\n } else {\n return (c - 48) & 0xf;\n }\n }\n\n function parseHexByte (string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n if (index - 1 >= lowerBound) {\n r |= parseHex4Bits(string, index - 1) << 4;\n }\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex (number, start, endian) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n // 24-bits chunks\n var off = 0;\n var j = 0;\n\n var w;\n if (endian === 'be') {\n for (i = number.length - 1; i >= start; i -= 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n } else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n }\n\n this.strip();\n };\n\n function parseBase (str, start, end, mul) {\n var r = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r *= mul;\n\n // 'a'\n if (c >= 49) {\n r += c - 49 + 0xa;\n\n // 'A'\n } else if (c >= 17) {\n r += c - 17 + 0xa;\n\n // '0' - '9'\n } else {\n r += c;\n }\n }\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase (number, base, start) {\n // Initialize as zero\n this.words = [ 0 ];\n this.length = 1;\n\n // Find length of limb in base\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n limbLen--;\n limbPow = (limbPow / base) | 0;\n\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n\n this.imuln(limbPow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n this.strip();\n };\n\n BN.prototype.copy = function copy (dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n BN.prototype.clone = function clone () {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand (size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n return this;\n };\n\n // Remove leading `0` from `this`\n BN.prototype.strip = function strip () {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign () {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n return this;\n };\n\n BN.prototype.inspect = function inspect () {\n return (this.red ? '';\n };\n\n /*\n\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n\n */\n\n var zeros = [\n '',\n '0',\n '00',\n '000',\n '0000',\n '00000',\n '000000',\n '0000000',\n '00000000',\n '000000000',\n '0000000000',\n '00000000000',\n '000000000000',\n '0000000000000',\n '00000000000000',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n '00000000000000000000',\n '000000000000000000000',\n '0000000000000000000000',\n '00000000000000000000000',\n '000000000000000000000000',\n '0000000000000000000000000'\n ];\n\n var groupSizes = [\n 0, 0,\n 25, 16, 12, 11, 10, 9, 8,\n 8, 7, 7, 7, 7, 6, 6,\n 6, 6, 6, 6, 6, 5, 5,\n 5, 5, 5, 5, 5, 5, 5,\n 5, 5, 5, 5, 5, 5, 5\n ];\n\n var groupBases = [\n 0, 0,\n 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,\n 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,\n 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,\n 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,\n 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176\n ];\n\n BN.prototype.toString = function toString (base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n\n var out;\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = (((w << off) | carry) & 0xffffff).toString(16);\n carry = (w >>> (24 - off)) & 0xffffff;\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n }\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base];\n // var groupBase = Math.pow(base, groupSize);\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n while (!c.isZero()) {\n var r = c.modn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n if (this.isZero()) {\n out = '0' + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber () {\n var ret = this.words[0];\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + (this.words[1] * 0x4000000);\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n return (this.negative !== 0) ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON () {\n return this.toString(16);\n };\n\n BN.prototype.toBuffer = function toBuffer (endian, length) {\n assert(typeof Buffer !== 'undefined');\n return this.toArrayLike(Buffer, endian, length);\n };\n\n BN.prototype.toArray = function toArray (endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n\n this.strip();\n var littleEndian = endian === 'le';\n var res = new ArrayType(reqLength);\n\n var b, i;\n var q = this.clone();\n if (!littleEndian) {\n // Assume big-endian\n for (i = 0; i < reqLength - byteLength; i++) {\n res[i] = 0;\n }\n\n for (i = 0; !q.isZero(); i++) {\n b = q.andln(0xff);\n q.iushrn(8);\n\n res[reqLength - i - 1] = b;\n }\n } else {\n for (i = 0; !q.isZero(); i++) {\n b = q.andln(0xff);\n q.iushrn(8);\n\n res[i] = b;\n }\n\n for (; i < reqLength; i++) {\n res[i] = 0;\n }\n }\n\n return res;\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits (w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits (w) {\n var t = w;\n var r = 0;\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits (w) {\n // Short-cut\n if (w === 0) return 26;\n\n var t = w;\n var r = 0;\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n if ((t & 0x1) === 0) {\n r++;\n }\n return r;\n };\n\n // Return number of used bits in a BN\n BN.prototype.bitLength = function bitLength () {\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray (num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;\n }\n\n return w;\n }\n\n // Number of trailing zero bits\n BN.prototype.zeroBits = function zeroBits () {\n if (this.isZero()) return 0;\n\n var r = 0;\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n r += b;\n if (b !== 26) break;\n }\n return r;\n };\n\n BN.prototype.byteLength = function byteLength () {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos (width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos (width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg () {\n return this.negative !== 0;\n };\n\n // Return negative clone of `this`\n BN.prototype.neg = function neg () {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg () {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n };\n\n // Or `num` with `this` in-place\n BN.prototype.iuor = function iuor (num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this.strip();\n };\n\n BN.prototype.ior = function ior (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n };\n\n // Or `num` with `this`\n BN.prototype.or = function or (num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor (num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n };\n\n // And `num` with `this` in-place\n BN.prototype.iuand = function iuand (num) {\n // b = min-length(num, this)\n var b;\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n\n return this.strip();\n };\n\n BN.prototype.iand = function iand (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n };\n\n // And `num` with `this`\n BN.prototype.and = function and (num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand (num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n };\n\n // Xor `num` with `this` in-place\n BN.prototype.iuxor = function iuxor (num) {\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n\n return this.strip();\n };\n\n BN.prototype.ixor = function ixor (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n };\n\n // Xor `num` with `this`\n BN.prototype.xor = function xor (num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor (num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n };\n\n // Not ``this`` with ``width`` bitwidth\n BN.prototype.inotn = function inotn (width) {\n assert(typeof width === 'number' && width >= 0);\n\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26;\n\n // Extend the buffer with leading zeroes\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n }\n\n // Handle complete words\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n }\n\n // Handle the residue\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));\n }\n\n // And remove leading zeroes\n return this.strip();\n };\n\n BN.prototype.notn = function notn (width) {\n return this.clone().inotn(width);\n };\n\n // Set `bit` of `this`\n BN.prototype.setn = function setn (bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | (1 << wbit);\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this.strip();\n };\n\n // Add `num` to `this` in-place\n BN.prototype.iadd = function iadd (num) {\n var r;\n\n // negative + positive\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign();\n\n // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n }\n\n // a.length > b.length\n var a, b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n };\n\n // Add `num` to `this`\n BN.prototype.add = function add (num) {\n var res;\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n\n return num.clone().iadd(this);\n };\n\n // Subtract `num` from `this` in-place\n BN.prototype.isub = function isub (num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign();\n\n // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n }\n\n // At this point both numbers are positive\n var cmp = this.cmp(num);\n\n // Optimization - zeroify\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n\n // a > b\n var a, b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n // Copy rest of the words\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this.strip();\n };\n\n // Subtract `num` from `this`\n BN.prototype.sub = function sub (num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = (self.length + num.length) | 0;\n out.length = len;\n len = (len - 1) | 0;\n\n // Peel one iteration (compiler can't do it, because of code complexity)\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n var carry = (r / 0x4000000) | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = (k - j) | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += (r / 0x4000000) | 0;\n rword = r & 0x3ffffff;\n }\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out.strip();\n }\n\n // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n var comb10MulTo = function comb10MulTo (self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = (mid + Math.imul(ah0, bl0)) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = (mid + Math.imul(ah1, bl0)) | 0;\n hi = Math.imul(ah1, bh0);\n lo = (lo + Math.imul(al0, bl1)) | 0;\n mid = (mid + Math.imul(al0, bh1)) | 0;\n mid = (mid + Math.imul(ah0, bl1)) | 0;\n hi = (hi + Math.imul(ah0, bh1)) | 0;\n var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = (mid + Math.imul(ah2, bl0)) | 0;\n hi = Math.imul(ah2, bh0);\n lo = (lo + Math.imul(al1, bl1)) | 0;\n mid = (mid + Math.imul(al1, bh1)) | 0;\n mid = (mid + Math.imul(ah1, bl1)) | 0;\n hi = (hi + Math.imul(ah1, bh1)) | 0;\n lo = (lo + Math.imul(al0, bl2)) | 0;\n mid = (mid + Math.imul(al0, bh2)) | 0;\n mid = (mid + Math.imul(ah0, bl2)) | 0;\n hi = (hi + Math.imul(ah0, bh2)) | 0;\n var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = (mid + Math.imul(ah3, bl0)) | 0;\n hi = Math.imul(ah3, bh0);\n lo = (lo + Math.imul(al2, bl1)) | 0;\n mid = (mid + Math.imul(al2, bh1)) | 0;\n mid = (mid + Math.imul(ah2, bl1)) | 0;\n hi = (hi + Math.imul(ah2, bh1)) | 0;\n lo = (lo + Math.imul(al1, bl2)) | 0;\n mid = (mid + Math.imul(al1, bh2)) | 0;\n mid = (mid + Math.imul(ah1, bl2)) | 0;\n hi = (hi + Math.imul(ah1, bh2)) | 0;\n lo = (lo + Math.imul(al0, bl3)) | 0;\n mid = (mid + Math.imul(al0, bh3)) | 0;\n mid = (mid + Math.imul(ah0, bl3)) | 0;\n hi = (hi + Math.imul(ah0, bh3)) | 0;\n var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = (mid + Math.imul(ah4, bl0)) | 0;\n hi = Math.imul(ah4, bh0);\n lo = (lo + Math.imul(al3, bl1)) | 0;\n mid = (mid + Math.imul(al3, bh1)) | 0;\n mid = (mid + Math.imul(ah3, bl1)) | 0;\n hi = (hi + Math.imul(ah3, bh1)) | 0;\n lo = (lo + Math.imul(al2, bl2)) | 0;\n mid = (mid + Math.imul(al2, bh2)) | 0;\n mid = (mid + Math.imul(ah2, bl2)) | 0;\n hi = (hi + Math.imul(ah2, bh2)) | 0;\n lo = (lo + Math.imul(al1, bl3)) | 0;\n mid = (mid + Math.imul(al1, bh3)) | 0;\n mid = (mid + Math.imul(ah1, bl3)) | 0;\n hi = (hi + Math.imul(ah1, bh3)) | 0;\n lo = (lo + Math.imul(al0, bl4)) | 0;\n mid = (mid + Math.imul(al0, bh4)) | 0;\n mid = (mid + Math.imul(ah0, bl4)) | 0;\n hi = (hi + Math.imul(ah0, bh4)) | 0;\n var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = (mid + Math.imul(ah5, bl0)) | 0;\n hi = Math.imul(ah5, bh0);\n lo = (lo + Math.imul(al4, bl1)) | 0;\n mid = (mid + Math.imul(al4, bh1)) | 0;\n mid = (mid + Math.imul(ah4, bl1)) | 0;\n hi = (hi + Math.imul(ah4, bh1)) | 0;\n lo = (lo + Math.imul(al3, bl2)) | 0;\n mid = (mid + Math.imul(al3, bh2)) | 0;\n mid = (mid + Math.imul(ah3, bl2)) | 0;\n hi = (hi + Math.imul(ah3, bh2)) | 0;\n lo = (lo + Math.imul(al2, bl3)) | 0;\n mid = (mid + Math.imul(al2, bh3)) | 0;\n mid = (mid + Math.imul(ah2, bl3)) | 0;\n hi = (hi + Math.imul(ah2, bh3)) | 0;\n lo = (lo + Math.imul(al1, bl4)) | 0;\n mid = (mid + Math.imul(al1, bh4)) | 0;\n mid = (mid + Math.imul(ah1, bl4)) | 0;\n hi = (hi + Math.imul(ah1, bh4)) | 0;\n lo = (lo + Math.imul(al0, bl5)) | 0;\n mid = (mid + Math.imul(al0, bh5)) | 0;\n mid = (mid + Math.imul(ah0, bl5)) | 0;\n hi = (hi + Math.imul(ah0, bh5)) | 0;\n var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = (mid + Math.imul(ah6, bl0)) | 0;\n hi = Math.imul(ah6, bh0);\n lo = (lo + Math.imul(al5, bl1)) | 0;\n mid = (mid + Math.imul(al5, bh1)) | 0;\n mid = (mid + Math.imul(ah5, bl1)) | 0;\n hi = (hi + Math.imul(ah5, bh1)) | 0;\n lo = (lo + Math.imul(al4, bl2)) | 0;\n mid = (mid + Math.imul(al4, bh2)) | 0;\n mid = (mid + Math.imul(ah4, bl2)) | 0;\n hi = (hi + Math.imul(ah4, bh2)) | 0;\n lo = (lo + Math.imul(al3, bl3)) | 0;\n mid = (mid + Math.imul(al3, bh3)) | 0;\n mid = (mid + Math.imul(ah3, bl3)) | 0;\n hi = (hi + Math.imul(ah3, bh3)) | 0;\n lo = (lo + Math.imul(al2, bl4)) | 0;\n mid = (mid + Math.imul(al2, bh4)) | 0;\n mid = (mid + Math.imul(ah2, bl4)) | 0;\n hi = (hi + Math.imul(ah2, bh4)) | 0;\n lo = (lo + Math.imul(al1, bl5)) | 0;\n mid = (mid + Math.imul(al1, bh5)) | 0;\n mid = (mid + Math.imul(ah1, bl5)) | 0;\n hi = (hi + Math.imul(ah1, bh5)) | 0;\n lo = (lo + Math.imul(al0, bl6)) | 0;\n mid = (mid + Math.imul(al0, bh6)) | 0;\n mid = (mid + Math.imul(ah0, bl6)) | 0;\n hi = (hi + Math.imul(ah0, bh6)) | 0;\n var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = (mid + Math.imul(ah7, bl0)) | 0;\n hi = Math.imul(ah7, bh0);\n lo = (lo + Math.imul(al6, bl1)) | 0;\n mid = (mid + Math.imul(al6, bh1)) | 0;\n mid = (mid + Math.imul(ah6, bl1)) | 0;\n hi = (hi + Math.imul(ah6, bh1)) | 0;\n lo = (lo + Math.imul(al5, bl2)) | 0;\n mid = (mid + Math.imul(al5, bh2)) | 0;\n mid = (mid + Math.imul(ah5, bl2)) | 0;\n hi = (hi + Math.imul(ah5, bh2)) | 0;\n lo = (lo + Math.imul(al4, bl3)) | 0;\n mid = (mid + Math.imul(al4, bh3)) | 0;\n mid = (mid + Math.imul(ah4, bl3)) | 0;\n hi = (hi + Math.imul(ah4, bh3)) | 0;\n lo = (lo + Math.imul(al3, bl4)) | 0;\n mid = (mid + Math.imul(al3, bh4)) | 0;\n mid = (mid + Math.imul(ah3, bl4)) | 0;\n hi = (hi + Math.imul(ah3, bh4)) | 0;\n lo = (lo + Math.imul(al2, bl5)) | 0;\n mid = (mid + Math.imul(al2, bh5)) | 0;\n mid = (mid + Math.imul(ah2, bl5)) | 0;\n hi = (hi + Math.imul(ah2, bh5)) | 0;\n lo = (lo + Math.imul(al1, bl6)) | 0;\n mid = (mid + Math.imul(al1, bh6)) | 0;\n mid = (mid + Math.imul(ah1, bl6)) | 0;\n hi = (hi + Math.imul(ah1, bh6)) | 0;\n lo = (lo + Math.imul(al0, bl7)) | 0;\n mid = (mid + Math.imul(al0, bh7)) | 0;\n mid = (mid + Math.imul(ah0, bl7)) | 0;\n hi = (hi + Math.imul(ah0, bh7)) | 0;\n var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = (mid + Math.imul(ah8, bl0)) | 0;\n hi = Math.imul(ah8, bh0);\n lo = (lo + Math.imul(al7, bl1)) | 0;\n mid = (mid + Math.imul(al7, bh1)) | 0;\n mid = (mid + Math.imul(ah7, bl1)) | 0;\n hi = (hi + Math.imul(ah7, bh1)) | 0;\n lo = (lo + Math.imul(al6, bl2)) | 0;\n mid = (mid + Math.imul(al6, bh2)) | 0;\n mid = (mid + Math.imul(ah6, bl2)) | 0;\n hi = (hi + Math.imul(ah6, bh2)) | 0;\n lo = (lo + Math.imul(al5, bl3)) | 0;\n mid = (mid + Math.imul(al5, bh3)) | 0;\n mid = (mid + Math.imul(ah5, bl3)) | 0;\n hi = (hi + Math.imul(ah5, bh3)) | 0;\n lo = (lo + Math.imul(al4, bl4)) | 0;\n mid = (mid + Math.imul(al4, bh4)) | 0;\n mid = (mid + Math.imul(ah4, bl4)) | 0;\n hi = (hi + Math.imul(ah4, bh4)) | 0;\n lo = (lo + Math.imul(al3, bl5)) | 0;\n mid = (mid + Math.imul(al3, bh5)) | 0;\n mid = (mid + Math.imul(ah3, bl5)) | 0;\n hi = (hi + Math.imul(ah3, bh5)) | 0;\n lo = (lo + Math.imul(al2, bl6)) | 0;\n mid = (mid + Math.imul(al2, bh6)) | 0;\n mid = (mid + Math.imul(ah2, bl6)) | 0;\n hi = (hi + Math.imul(ah2, bh6)) | 0;\n lo = (lo + Math.imul(al1, bl7)) | 0;\n mid = (mid + Math.imul(al1, bh7)) | 0;\n mid = (mid + Math.imul(ah1, bl7)) | 0;\n hi = (hi + Math.imul(ah1, bh7)) | 0;\n lo = (lo + Math.imul(al0, bl8)) | 0;\n mid = (mid + Math.imul(al0, bh8)) | 0;\n mid = (mid + Math.imul(ah0, bl8)) | 0;\n hi = (hi + Math.imul(ah0, bh8)) | 0;\n var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = (mid + Math.imul(ah9, bl0)) | 0;\n hi = Math.imul(ah9, bh0);\n lo = (lo + Math.imul(al8, bl1)) | 0;\n mid = (mid + Math.imul(al8, bh1)) | 0;\n mid = (mid + Math.imul(ah8, bl1)) | 0;\n hi = (hi + Math.imul(ah8, bh1)) | 0;\n lo = (lo + Math.imul(al7, bl2)) | 0;\n mid = (mid + Math.imul(al7, bh2)) | 0;\n mid = (mid + Math.imul(ah7, bl2)) | 0;\n hi = (hi + Math.imul(ah7, bh2)) | 0;\n lo = (lo + Math.imul(al6, bl3)) | 0;\n mid = (mid + Math.imul(al6, bh3)) | 0;\n mid = (mid + Math.imul(ah6, bl3)) | 0;\n hi = (hi + Math.imul(ah6, bh3)) | 0;\n lo = (lo + Math.imul(al5, bl4)) | 0;\n mid = (mid + Math.imul(al5, bh4)) | 0;\n mid = (mid + Math.imul(ah5, bl4)) | 0;\n hi = (hi + Math.imul(ah5, bh4)) | 0;\n lo = (lo + Math.imul(al4, bl5)) | 0;\n mid = (mid + Math.imul(al4, bh5)) | 0;\n mid = (mid + Math.imul(ah4, bl5)) | 0;\n hi = (hi + Math.imul(ah4, bh5)) | 0;\n lo = (lo + Math.imul(al3, bl6)) | 0;\n mid = (mid + Math.imul(al3, bh6)) | 0;\n mid = (mid + Math.imul(ah3, bl6)) | 0;\n hi = (hi + Math.imul(ah3, bh6)) | 0;\n lo = (lo + Math.imul(al2, bl7)) | 0;\n mid = (mid + Math.imul(al2, bh7)) | 0;\n mid = (mid + Math.imul(ah2, bl7)) | 0;\n hi = (hi + Math.imul(ah2, bh7)) | 0;\n lo = (lo + Math.imul(al1, bl8)) | 0;\n mid = (mid + Math.imul(al1, bh8)) | 0;\n mid = (mid + Math.imul(ah1, bl8)) | 0;\n hi = (hi + Math.imul(ah1, bh8)) | 0;\n lo = (lo + Math.imul(al0, bl9)) | 0;\n mid = (mid + Math.imul(al0, bh9)) | 0;\n mid = (mid + Math.imul(ah0, bl9)) | 0;\n hi = (hi + Math.imul(ah0, bh9)) | 0;\n var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = (mid + Math.imul(ah9, bl1)) | 0;\n hi = Math.imul(ah9, bh1);\n lo = (lo + Math.imul(al8, bl2)) | 0;\n mid = (mid + Math.imul(al8, bh2)) | 0;\n mid = (mid + Math.imul(ah8, bl2)) | 0;\n hi = (hi + Math.imul(ah8, bh2)) | 0;\n lo = (lo + Math.imul(al7, bl3)) | 0;\n mid = (mid + Math.imul(al7, bh3)) | 0;\n mid = (mid + Math.imul(ah7, bl3)) | 0;\n hi = (hi + Math.imul(ah7, bh3)) | 0;\n lo = (lo + Math.imul(al6, bl4)) | 0;\n mid = (mid + Math.imul(al6, bh4)) | 0;\n mid = (mid + Math.imul(ah6, bl4)) | 0;\n hi = (hi + Math.imul(ah6, bh4)) | 0;\n lo = (lo + Math.imul(al5, bl5)) | 0;\n mid = (mid + Math.imul(al5, bh5)) | 0;\n mid = (mid + Math.imul(ah5, bl5)) | 0;\n hi = (hi + Math.imul(ah5, bh5)) | 0;\n lo = (lo + Math.imul(al4, bl6)) | 0;\n mid = (mid + Math.imul(al4, bh6)) | 0;\n mid = (mid + Math.imul(ah4, bl6)) | 0;\n hi = (hi + Math.imul(ah4, bh6)) | 0;\n lo = (lo + Math.imul(al3, bl7)) | 0;\n mid = (mid + Math.imul(al3, bh7)) | 0;\n mid = (mid + Math.imul(ah3, bl7)) | 0;\n hi = (hi + Math.imul(ah3, bh7)) | 0;\n lo = (lo + Math.imul(al2, bl8)) | 0;\n mid = (mid + Math.imul(al2, bh8)) | 0;\n mid = (mid + Math.imul(ah2, bl8)) | 0;\n hi = (hi + Math.imul(ah2, bh8)) | 0;\n lo = (lo + Math.imul(al1, bl9)) | 0;\n mid = (mid + Math.imul(al1, bh9)) | 0;\n mid = (mid + Math.imul(ah1, bl9)) | 0;\n hi = (hi + Math.imul(ah1, bh9)) | 0;\n var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = (mid + Math.imul(ah9, bl2)) | 0;\n hi = Math.imul(ah9, bh2);\n lo = (lo + Math.imul(al8, bl3)) | 0;\n mid = (mid + Math.imul(al8, bh3)) | 0;\n mid = (mid + Math.imul(ah8, bl3)) | 0;\n hi = (hi + Math.imul(ah8, bh3)) | 0;\n lo = (lo + Math.imul(al7, bl4)) | 0;\n mid = (mid + Math.imul(al7, bh4)) | 0;\n mid = (mid + Math.imul(ah7, bl4)) | 0;\n hi = (hi + Math.imul(ah7, bh4)) | 0;\n lo = (lo + Math.imul(al6, bl5)) | 0;\n mid = (mid + Math.imul(al6, bh5)) | 0;\n mid = (mid + Math.imul(ah6, bl5)) | 0;\n hi = (hi + Math.imul(ah6, bh5)) | 0;\n lo = (lo + Math.imul(al5, bl6)) | 0;\n mid = (mid + Math.imul(al5, bh6)) | 0;\n mid = (mid + Math.imul(ah5, bl6)) | 0;\n hi = (hi + Math.imul(ah5, bh6)) | 0;\n lo = (lo + Math.imul(al4, bl7)) | 0;\n mid = (mid + Math.imul(al4, bh7)) | 0;\n mid = (mid + Math.imul(ah4, bl7)) | 0;\n hi = (hi + Math.imul(ah4, bh7)) | 0;\n lo = (lo + Math.imul(al3, bl8)) | 0;\n mid = (mid + Math.imul(al3, bh8)) | 0;\n mid = (mid + Math.imul(ah3, bl8)) | 0;\n hi = (hi + Math.imul(ah3, bh8)) | 0;\n lo = (lo + Math.imul(al2, bl9)) | 0;\n mid = (mid + Math.imul(al2, bh9)) | 0;\n mid = (mid + Math.imul(ah2, bl9)) | 0;\n hi = (hi + Math.imul(ah2, bh9)) | 0;\n var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = (mid + Math.imul(ah9, bl3)) | 0;\n hi = Math.imul(ah9, bh3);\n lo = (lo + Math.imul(al8, bl4)) | 0;\n mid = (mid + Math.imul(al8, bh4)) | 0;\n mid = (mid + Math.imul(ah8, bl4)) | 0;\n hi = (hi + Math.imul(ah8, bh4)) | 0;\n lo = (lo + Math.imul(al7, bl5)) | 0;\n mid = (mid + Math.imul(al7, bh5)) | 0;\n mid = (mid + Math.imul(ah7, bl5)) | 0;\n hi = (hi + Math.imul(ah7, bh5)) | 0;\n lo = (lo + Math.imul(al6, bl6)) | 0;\n mid = (mid + Math.imul(al6, bh6)) | 0;\n mid = (mid + Math.imul(ah6, bl6)) | 0;\n hi = (hi + Math.imul(ah6, bh6)) | 0;\n lo = (lo + Math.imul(al5, bl7)) | 0;\n mid = (mid + Math.imul(al5, bh7)) | 0;\n mid = (mid + Math.imul(ah5, bl7)) | 0;\n hi = (hi + Math.imul(ah5, bh7)) | 0;\n lo = (lo + Math.imul(al4, bl8)) | 0;\n mid = (mid + Math.imul(al4, bh8)) | 0;\n mid = (mid + Math.imul(ah4, bl8)) | 0;\n hi = (hi + Math.imul(ah4, bh8)) | 0;\n lo = (lo + Math.imul(al3, bl9)) | 0;\n mid = (mid + Math.imul(al3, bh9)) | 0;\n mid = (mid + Math.imul(ah3, bl9)) | 0;\n hi = (hi + Math.imul(ah3, bh9)) | 0;\n var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = (mid + Math.imul(ah9, bl4)) | 0;\n hi = Math.imul(ah9, bh4);\n lo = (lo + Math.imul(al8, bl5)) | 0;\n mid = (mid + Math.imul(al8, bh5)) | 0;\n mid = (mid + Math.imul(ah8, bl5)) | 0;\n hi = (hi + Math.imul(ah8, bh5)) | 0;\n lo = (lo + Math.imul(al7, bl6)) | 0;\n mid = (mid + Math.imul(al7, bh6)) | 0;\n mid = (mid + Math.imul(ah7, bl6)) | 0;\n hi = (hi + Math.imul(ah7, bh6)) | 0;\n lo = (lo + Math.imul(al6, bl7)) | 0;\n mid = (mid + Math.imul(al6, bh7)) | 0;\n mid = (mid + Math.imul(ah6, bl7)) | 0;\n hi = (hi + Math.imul(ah6, bh7)) | 0;\n lo = (lo + Math.imul(al5, bl8)) | 0;\n mid = (mid + Math.imul(al5, bh8)) | 0;\n mid = (mid + Math.imul(ah5, bl8)) | 0;\n hi = (hi + Math.imul(ah5, bh8)) | 0;\n lo = (lo + Math.imul(al4, bl9)) | 0;\n mid = (mid + Math.imul(al4, bh9)) | 0;\n mid = (mid + Math.imul(ah4, bl9)) | 0;\n hi = (hi + Math.imul(ah4, bh9)) | 0;\n var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = (mid + Math.imul(ah9, bl5)) | 0;\n hi = Math.imul(ah9, bh5);\n lo = (lo + Math.imul(al8, bl6)) | 0;\n mid = (mid + Math.imul(al8, bh6)) | 0;\n mid = (mid + Math.imul(ah8, bl6)) | 0;\n hi = (hi + Math.imul(ah8, bh6)) | 0;\n lo = (lo + Math.imul(al7, bl7)) | 0;\n mid = (mid + Math.imul(al7, bh7)) | 0;\n mid = (mid + Math.imul(ah7, bl7)) | 0;\n hi = (hi + Math.imul(ah7, bh7)) | 0;\n lo = (lo + Math.imul(al6, bl8)) | 0;\n mid = (mid + Math.imul(al6, bh8)) | 0;\n mid = (mid + Math.imul(ah6, bl8)) | 0;\n hi = (hi + Math.imul(ah6, bh8)) | 0;\n lo = (lo + Math.imul(al5, bl9)) | 0;\n mid = (mid + Math.imul(al5, bh9)) | 0;\n mid = (mid + Math.imul(ah5, bl9)) | 0;\n hi = (hi + Math.imul(ah5, bh9)) | 0;\n var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = (mid + Math.imul(ah9, bl6)) | 0;\n hi = Math.imul(ah9, bh6);\n lo = (lo + Math.imul(al8, bl7)) | 0;\n mid = (mid + Math.imul(al8, bh7)) | 0;\n mid = (mid + Math.imul(ah8, bl7)) | 0;\n hi = (hi + Math.imul(ah8, bh7)) | 0;\n lo = (lo + Math.imul(al7, bl8)) | 0;\n mid = (mid + Math.imul(al7, bh8)) | 0;\n mid = (mid + Math.imul(ah7, bl8)) | 0;\n hi = (hi + Math.imul(ah7, bh8)) | 0;\n lo = (lo + Math.imul(al6, bl9)) | 0;\n mid = (mid + Math.imul(al6, bh9)) | 0;\n mid = (mid + Math.imul(ah6, bl9)) | 0;\n hi = (hi + Math.imul(ah6, bh9)) | 0;\n var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = (mid + Math.imul(ah9, bl7)) | 0;\n hi = Math.imul(ah9, bh7);\n lo = (lo + Math.imul(al8, bl8)) | 0;\n mid = (mid + Math.imul(al8, bh8)) | 0;\n mid = (mid + Math.imul(ah8, bl8)) | 0;\n hi = (hi + Math.imul(ah8, bh8)) | 0;\n lo = (lo + Math.imul(al7, bl9)) | 0;\n mid = (mid + Math.imul(al7, bh9)) | 0;\n mid = (mid + Math.imul(ah7, bl9)) | 0;\n hi = (hi + Math.imul(ah7, bh9)) | 0;\n var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = (mid + Math.imul(ah9, bl8)) | 0;\n hi = Math.imul(ah9, bh8);\n lo = (lo + Math.imul(al8, bl9)) | 0;\n mid = (mid + Math.imul(al8, bh9)) | 0;\n mid = (mid + Math.imul(ah8, bl9)) | 0;\n hi = (hi + Math.imul(ah8, bh9)) | 0;\n var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = (mid + Math.imul(ah9, bl9)) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n return out;\n };\n\n // Polyfill comb\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out.strip();\n }\n\n function jumboMulTo (self, num, out) {\n var fftm = new FFTM();\n return fftm.mulp(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo (num, out) {\n var res;\n var len = this.length + num.length;\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n };\n\n // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT (N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n };\n\n // Returns binary-reversed representation of `x`\n FFTM.prototype.revBin = function revBin (x, l, N) {\n if (x === 0 || x === N - 1) return x;\n\n var rb = 0;\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << (l - i - 1);\n x >>= 1;\n }\n\n return rb;\n };\n\n // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n\n var rx = rtwdf_ * ro - itwdf_ * io;\n\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n\n /* jshint maxdepth : false */\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b (n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate (rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n\n t = iws[i];\n\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b (ws, N) {\n var carry = 0;\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +\n Math.round(ws[2 * i] / N) +\n carry;\n\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {\n var carry = 0;\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n\n rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;\n }\n\n // Pad with zeroes\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub (N) {\n var ph = new Array(N);\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp (x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n\n var rmws = out.words;\n rmws.length = N;\n\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out.strip();\n };\n\n // Multiply `this` by `num`\n BN.prototype.mul = function mul (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n };\n\n // Multiply employing FFT\n BN.prototype.mulf = function mulf (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n };\n\n // In-place Multiplication\n BN.prototype.imul = function imul (num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n\n // Carry\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += (w / 0x4000000) | 0;\n // NOTE: lo is 27bit maximum\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return this;\n };\n\n BN.prototype.muln = function muln (num) {\n return this.clone().imuln(num);\n };\n\n // `this` * `this`\n BN.prototype.sqr = function sqr () {\n return this.mul(this);\n };\n\n // `this` * `this` in-place\n BN.prototype.isqr = function isqr () {\n return this.imul(this.clone());\n };\n\n // Math.pow(`this`, `num`)\n BN.prototype.pow = function pow (num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1);\n\n // Skip leading zeroes\n var res = this;\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n\n res = res.mul(q);\n }\n }\n\n return res;\n };\n\n // Shift-left in-place\n BN.prototype.iushln = function iushln (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = ((this.words[i] | 0) - newCarry) << r;\n this.words[i] = c | carry;\n carry = newCarry >>> (26 - r);\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this.strip();\n };\n\n BN.prototype.ishln = function ishln (bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n };\n\n // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n BN.prototype.iushrn = function iushrn (bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n if (hint) {\n h = (hint - (hint % 26)) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n var maskedWords = extended;\n\n h -= s;\n h = Math.max(0, h);\n\n // Extended mode, copy masked part\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n maskedWords.length = s;\n }\n\n if (s === 0) {\n // No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = (carry << (26 - r)) | (word >>> r);\n carry = word & mask;\n }\n\n // Push carried bits as a mask\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this.strip();\n };\n\n BN.prototype.ishrn = function ishrn (bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n };\n\n // Shift-left\n BN.prototype.shln = function shln (bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln (bits) {\n return this.clone().iushln(bits);\n };\n\n // Shift-right\n BN.prototype.shrn = function shrn (bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn (bits) {\n return this.clone().iushrn(bits);\n };\n\n // Test if n bit is set\n BN.prototype.testn = function testn (bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) return false;\n\n // Check bit and return\n var w = this.words[s];\n\n return !!(w & q);\n };\n\n // Return only lowers bits of number (in-place)\n BN.prototype.imaskn = function imaskn (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n this.words[this.length - 1] &= mask;\n }\n\n return this.strip();\n };\n\n // Return only lowers bits of number\n BN.prototype.maskn = function maskn (bits) {\n return this.clone().imaskn(bits);\n };\n\n // Add plain number `num` to `this`\n BN.prototype.iaddn = function iaddn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num);\n\n // Possible sign change\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) < num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n }\n\n // Add without checks\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn (num) {\n this.words[0] += num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n this.length = Math.max(this.length, i + 1);\n\n return this;\n };\n\n // Subtract plain number `num` from `this`\n BN.prototype.isubn = function isubn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this.strip();\n };\n\n BN.prototype.addn = function addn (num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn (num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs () {\n this.negative = 0;\n\n return this;\n };\n\n BN.prototype.abs = function abs () {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - ((right / 0x4000000) | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this.strip();\n\n // Subtraction overflow\n assert(carry === -1);\n carry = 0;\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n this.negative = 1;\n\n return this.strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv (num, mode) {\n var shift = this.length - num.length;\n\n var a = this.clone();\n var b = num;\n\n // Normalize\n var bhi = b.words[b.length - 1] | 0;\n var bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits;\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n }\n\n // Initialize quotient\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (diff.negative === 0) {\n a = diff;\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 +\n (a.words[b.length + j - 1] | 0);\n\n // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n qj = Math.min((qj / bhi) | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n a._ishlnsubmul(b, 1, j);\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n if (q) {\n q.words[j] = qj;\n }\n }\n if (q) {\n q.strip();\n }\n a.strip();\n\n // Denormalize\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n };\n\n // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n BN.prototype.divmod = function divmod (num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n }\n\n // Both numbers are positive at this point\n\n // Strip both numbers to approximate shift value\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n }\n\n // Very short reduction\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n };\n\n // Find `this` / `num`\n BN.prototype.div = function div (num) {\n return this.divmod(num, 'div', false).div;\n };\n\n // Find `this` % `num`\n BN.prototype.mod = function mod (num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod (num) {\n return this.divmod(num, 'mod', true).mod;\n };\n\n // Find Round(`this` / `num`)\n BN.prototype.divRound = function divRound (num) {\n var dm = this.divmod(num);\n\n // Fast case - exact division\n if (dm.mod.isZero()) return dm.div;\n\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n\n // Round down\n if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;\n\n // Round up\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modn = function modn (num) {\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return acc;\n };\n\n // In-place division by number\n BN.prototype.idivn = function idivn (num) {\n assert(num <= 0x3ffffff);\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = (w / num) | 0;\n carry = w % num;\n }\n\n return this.strip();\n };\n\n BN.prototype.divn = function divn (num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n }\n\n // A * x + B * y = x\n var A = new BN(1);\n var B = new BN(0);\n\n // C * x + D * y = y\n var C = new BN(0);\n var D = new BN(1);\n\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n x.iushrn(i);\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n y.iushrn(j);\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n };\n\n // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n BN.prototype._invmp = function _invmp (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n a.iushrn(i);\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n b.iushrn(j);\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd (num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0;\n\n // Remove common factor of two\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n };\n\n // Invert number in the field F(num)\n BN.prototype.invm = function invm (num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven () {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd () {\n return (this.words[0] & 1) === 1;\n };\n\n // And first word and num\n BN.prototype.andln = function andln (num) {\n return this.words[0] & num;\n };\n\n // Increment at the bit position in-line\n BN.prototype.bincn = function bincn (bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n this._expand(s + 1);\n this.words[s] |= q;\n return this;\n }\n\n // Add bit and propagate, if needed\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n };\n\n BN.prototype.isZero = function isZero () {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn (num) {\n var negative = num < 0;\n\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n\n this.strip();\n\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n BN.prototype.cmp = function cmp (num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Unsigned comparison\n BN.prototype.ucmp = function ucmp (num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n\n if (a === b) continue;\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n break;\n }\n return res;\n };\n\n BN.prototype.gtn = function gtn (num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt (num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten (num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte (num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn (num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt (num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten (num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte (num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn (num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq (num) {\n return this.cmp(num) === 0;\n };\n\n //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n BN.red = function red (num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed () {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed (ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd (num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd (num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub (num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub (num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl (num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr () {\n assert(this.red, 'redSqr works only with red numbers');\n this.red._verify1(this);\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr () {\n assert(this.red, 'redISqr works only with red numbers');\n this.red._verify1(this);\n return this.red.isqr(this);\n };\n\n // Square root over p\n BN.prototype.redSqrt = function redSqrt () {\n assert(this.red, 'redSqrt works only with red numbers');\n this.red._verify1(this);\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm () {\n assert(this.red, 'redInvm works only with red numbers');\n this.red._verify1(this);\n return this.red.invm(this);\n };\n\n // Return negative clone of `this` % `red modulo`\n BN.prototype.redNeg = function redNeg () {\n assert(this.red, 'redNeg works only with red numbers');\n this.red._verify1(this);\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow (num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n this.red._verify1(this);\n return this.red.pow(this, num);\n };\n\n // Prime numbers with efficient reduction\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n\n // Pseudo-Mersenne prime\n function MPrime (name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp () {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce (num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== undefined) {\n // r is BN v4 instance\n r.strip();\n } else {\n // r is BN v5 instance\n r._strip();\n }\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split (input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK (num) {\n return num.imul(this.k);\n };\n\n function K256 () {\n MPrime.call(\n this,\n 'k256',\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n inherits(K256, MPrime);\n\n K256.prototype.split = function split (input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n\n var outLen = Math.min(input.length, 9);\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n }\n\n // Shift by 9 limbs\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);\n prev = next;\n }\n prev >>>= 22;\n input.words[i - 10] = prev;\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK (num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n\n // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + ((lo / 0x4000000) | 0);\n }\n\n // Fast length reduction\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n return num;\n };\n\n function P224 () {\n MPrime.call(\n this,\n 'p224',\n 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n inherits(P224, MPrime);\n\n function P192 () {\n MPrime.call(\n this,\n 'p192',\n 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n inherits(P192, MPrime);\n\n function P25519 () {\n // 2 ^ 255 - 19\n MPrime.call(\n this,\n '25519',\n '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK (num) {\n // K = 0x13\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n return num;\n };\n\n // Exported mostly for testing purposes, use plain name instead\n BN._prime = function prime (name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n\n var prime;\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n primes[name] = prime;\n\n return prime;\n };\n\n //\n // Base reduction engine\n //\n function Red (m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1 (a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2 (a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red,\n 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod (a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n return a.umod(this.m)._forceRed(this);\n };\n\n Red.prototype.neg = function neg (a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add (a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd (a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res;\n };\n\n Red.prototype.sub = function sub (a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub (a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res;\n };\n\n Red.prototype.shl = function shl (a, num) {\n this._verify1(a);\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul (a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul (a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr (a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr (a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt (a) {\n if (a.isZero()) return a.clone();\n\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n\n // Fast case\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n\n // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n var q = this.m.subn(1);\n var s = 0;\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n assert(!q.isZero());\n\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg();\n\n // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm (a) {\n var inv = a._invmp(this.m);\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow (a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n for (var j = start - 1; j >= 0; j--) {\n var bit = (word >> j) & 1;\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo (num) {\n var r = num.umod(this.m);\n\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom (num) {\n var res = num.clone();\n res.red = null;\n return res;\n };\n\n //\n // Montgomery method engine\n //\n\n BN.mont = function mont (num) {\n return new Mont(num);\n };\n\n function Mont (m) {\n Red.call(this, m);\n\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0) {\n this.shift += 26 - (this.shift % 26);\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo (num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom (num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul (a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul (a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm (a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})(typeof module === 'undefined' || module, this);\n","var r;\n\nmodule.exports = function rand(len) {\n if (!r)\n r = new Rand(null);\n\n return r.generate(len);\n};\n\nfunction Rand(rand) {\n this.rand = rand;\n}\nmodule.exports.Rand = Rand;\n\nRand.prototype.generate = function generate(len) {\n return this._rand(len);\n};\n\n// Emulate crypto API using randy\nRand.prototype._rand = function _rand(n) {\n if (this.rand.getBytes)\n return this.rand.getBytes(n);\n\n var res = new Uint8Array(n);\n for (var i = 0; i < res.length; i++)\n res[i] = this.rand.getByte();\n return res;\n};\n\nif (typeof self === 'object') {\n if (self.crypto && self.crypto.getRandomValues) {\n // Modern browsers\n Rand.prototype._rand = function _rand(n) {\n var arr = new Uint8Array(n);\n self.crypto.getRandomValues(arr);\n return arr;\n };\n } else if (self.msCrypto && self.msCrypto.getRandomValues) {\n // IE\n Rand.prototype._rand = function _rand(n) {\n var arr = new Uint8Array(n);\n self.msCrypto.getRandomValues(arr);\n return arr;\n };\n\n // Safari's WebWorkers do not have `crypto`\n } else if (typeof window === 'object') {\n // Old junk\n Rand.prototype._rand = function() {\n throw new Error('Not implemented yet');\n };\n }\n} else {\n // Node.js or Web worker with no crypto support\n try {\n var crypto = require('crypto');\n if (typeof crypto.randomBytes !== 'function')\n throw new Error('Not supported');\n\n Rand.prototype._rand = function _rand(n) {\n return crypto.randomBytes(n);\n };\n } catch (e) {\n }\n}\n","var bn = require('bn.js');\nvar brorand = require('brorand');\n\nfunction MillerRabin(rand) {\n this.rand = rand || new brorand.Rand();\n}\nmodule.exports = MillerRabin;\n\nMillerRabin.create = function create(rand) {\n return new MillerRabin(rand);\n};\n\nMillerRabin.prototype._randbelow = function _randbelow(n) {\n var len = n.bitLength();\n var min_bytes = Math.ceil(len / 8);\n\n // Generage random bytes until a number less than n is found.\n // This ensures that 0..n-1 have an equal probability of being selected.\n do\n var a = new bn(this.rand.generate(min_bytes));\n while (a.cmp(n) >= 0);\n\n return a;\n};\n\nMillerRabin.prototype._randrange = function _randrange(start, stop) {\n // Generate a random number greater than or equal to start and less than stop.\n var size = stop.sub(start);\n return start.add(this._randbelow(size));\n};\n\nMillerRabin.prototype.test = function test(n, k, cb) {\n var len = n.bitLength();\n var red = bn.mont(n);\n var rone = new bn(1).toRed(red);\n\n if (!k)\n k = Math.max(1, (len / 48) | 0);\n\n // Find d and s, (n - 1) = (2 ^ s) * d;\n var n1 = n.subn(1);\n for (var s = 0; !n1.testn(s); s++) {}\n var d = n.shrn(s);\n\n var rn1 = n1.toRed(red);\n\n var prime = true;\n for (; k > 0; k--) {\n var a = this._randrange(new bn(2), n1);\n if (cb)\n cb(a);\n\n var x = a.toRed(red).redPow(d);\n if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)\n continue;\n\n for (var i = 1; i < s; i++) {\n x = x.redSqr();\n\n if (x.cmp(rone) === 0)\n return false;\n if (x.cmp(rn1) === 0)\n break;\n }\n\n if (i === s)\n return false;\n }\n\n return prime;\n};\n\nMillerRabin.prototype.getDivisor = function getDivisor(n, k) {\n var len = n.bitLength();\n var red = bn.mont(n);\n var rone = new bn(1).toRed(red);\n\n if (!k)\n k = Math.max(1, (len / 48) | 0);\n\n // Find d and s, (n - 1) = (2 ^ s) * d;\n var n1 = n.subn(1);\n for (var s = 0; !n1.testn(s); s++) {}\n var d = n.shrn(s);\n\n var rn1 = n1.toRed(red);\n\n for (; k > 0; k--) {\n var a = this._randrange(new bn(2), n1);\n\n var g = n.gcd(a);\n if (g.cmpn(1) !== 0)\n return g;\n\n var x = a.toRed(red).redPow(d);\n if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)\n continue;\n\n for (var i = 1; i < s; i++) {\n x = x.redSqr();\n\n if (x.cmp(rone) === 0)\n return x.fromRed().subn(1).gcd(n);\n if (x.cmp(rn1) === 0)\n break;\n }\n\n if (i === s) {\n x = x.redSqr();\n return x.fromRed().subn(1).gcd(n);\n }\n }\n\n return false;\n};\n","var randomBytes = require('randombytes');\nmodule.exports = findPrime;\nfindPrime.simpleSieve = simpleSieve;\nfindPrime.fermatTest = fermatTest;\nvar BN = require('bn.js');\nvar TWENTYFOUR = new BN(24);\nvar MillerRabin = require('miller-rabin');\nvar millerRabin = new MillerRabin();\nvar ONE = new BN(1);\nvar TWO = new BN(2);\nvar FIVE = new BN(5);\nvar SIXTEEN = new BN(16);\nvar EIGHT = new BN(8);\nvar TEN = new BN(10);\nvar THREE = new BN(3);\nvar SEVEN = new BN(7);\nvar ELEVEN = new BN(11);\nvar FOUR = new BN(4);\nvar TWELVE = new BN(12);\nvar primes = null;\n\nfunction _getPrimes() {\n if (primes !== null)\n return primes;\n\n var limit = 0x100000;\n var res = [];\n res[0] = 2;\n for (var i = 1, k = 3; k < limit; k += 2) {\n var sqrt = Math.ceil(Math.sqrt(k));\n for (var j = 0; j < i && res[j] <= sqrt; j++)\n if (k % res[j] === 0)\n break;\n\n if (i !== j && res[j] <= sqrt)\n continue;\n\n res[i++] = k;\n }\n primes = res;\n return res;\n}\n\nfunction simpleSieve(p) {\n var primes = _getPrimes();\n\n for (var i = 0; i < primes.length; i++)\n if (p.modn(primes[i]) === 0) {\n if (p.cmpn(primes[i]) === 0) {\n return true;\n } else {\n return false;\n }\n }\n\n return true;\n}\n\nfunction fermatTest(p) {\n var red = BN.mont(p);\n return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;\n}\n\nfunction findPrime(bits, gen) {\n if (bits < 16) {\n // this is what openssl does\n if (gen === 2 || gen === 5) {\n return new BN([0x8c, 0x7b]);\n } else {\n return new BN([0x8c, 0x27]);\n }\n }\n gen = new BN(gen);\n\n var num, n2;\n\n while (true) {\n num = new BN(randomBytes(Math.ceil(bits / 8)));\n while (num.bitLength() > bits) {\n num.ishrn(1);\n }\n if (num.isEven()) {\n num.iadd(ONE);\n }\n if (!num.testn(1)) {\n num.iadd(TWO);\n }\n if (!gen.cmp(TWO)) {\n while (num.mod(TWENTYFOUR).cmp(ELEVEN)) {\n num.iadd(FOUR);\n }\n } else if (!gen.cmp(FIVE)) {\n while (num.mod(TEN).cmp(THREE)) {\n num.iadd(FOUR);\n }\n }\n n2 = num.shrn(1);\n if (simpleSieve(n2) && simpleSieve(num) &&\n fermatTest(n2) && fermatTest(num) &&\n millerRabin.test(n2) && millerRabin.test(num)) {\n return num;\n }\n }\n\n}\n","{\n \"modp1\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff\"\n },\n \"modp2\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff\"\n },\n \"modp5\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff\"\n },\n \"modp14\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff\"\n },\n \"modp15\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff\"\n },\n \"modp16\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff\"\n },\n \"modp17\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff\"\n },\n \"modp18\": {\n \"gen\": \"02\",\n \"prime\": \"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff\"\n }\n}","var BN = require('bn.js');\nvar MillerRabin = require('miller-rabin');\nvar millerRabin = new MillerRabin();\nvar TWENTYFOUR = new BN(24);\nvar ELEVEN = new BN(11);\nvar TEN = new BN(10);\nvar THREE = new BN(3);\nvar SEVEN = new BN(7);\nvar primes = require('./generatePrime');\nvar randomBytes = require('randombytes');\nmodule.exports = DH;\n\nfunction setPublicKey(pub, enc) {\n enc = enc || 'utf8';\n if (!Buffer.isBuffer(pub)) {\n pub = new Buffer(pub, enc);\n }\n this._pub = new BN(pub);\n return this;\n}\n\nfunction setPrivateKey(priv, enc) {\n enc = enc || 'utf8';\n if (!Buffer.isBuffer(priv)) {\n priv = new Buffer(priv, enc);\n }\n this._priv = new BN(priv);\n return this;\n}\n\nvar primeCache = {};\nfunction checkPrime(prime, generator) {\n var gen = generator.toString('hex');\n var hex = [gen, prime.toString(16)].join('_');\n if (hex in primeCache) {\n return primeCache[hex];\n }\n var error = 0;\n\n if (prime.isEven() ||\n !primes.simpleSieve ||\n !primes.fermatTest(prime) ||\n !millerRabin.test(prime)) {\n //not a prime so +1\n error += 1;\n\n if (gen === '02' || gen === '05') {\n // we'd be able to check the generator\n // it would fail so +8\n error += 8;\n } else {\n //we wouldn't be able to test the generator\n // so +4\n error += 4;\n }\n primeCache[hex] = error;\n return error;\n }\n if (!millerRabin.test(prime.shrn(1))) {\n //not a safe prime\n error += 2;\n }\n var rem;\n switch (gen) {\n case '02':\n if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) {\n // unsuidable generator\n error += 8;\n }\n break;\n case '05':\n rem = prime.mod(TEN);\n if (rem.cmp(THREE) && rem.cmp(SEVEN)) {\n // prime mod 10 needs to equal 3 or 7\n error += 8;\n }\n break;\n default:\n error += 4;\n }\n primeCache[hex] = error;\n return error;\n}\n\nfunction DH(prime, generator, malleable) {\n this.setGenerator(generator);\n this.__prime = new BN(prime);\n this._prime = BN.mont(this.__prime);\n this._primeLen = prime.length;\n this._pub = undefined;\n this._priv = undefined;\n this._primeCode = undefined;\n if (malleable) {\n this.setPublicKey = setPublicKey;\n this.setPrivateKey = setPrivateKey;\n } else {\n this._primeCode = 8;\n }\n}\nObject.defineProperty(DH.prototype, 'verifyError', {\n enumerable: true,\n get: function () {\n if (typeof this._primeCode !== 'number') {\n this._primeCode = checkPrime(this.__prime, this.__gen);\n }\n return this._primeCode;\n }\n});\nDH.prototype.generateKeys = function () {\n if (!this._priv) {\n this._priv = new BN(randomBytes(this._primeLen));\n }\n this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed();\n return this.getPublicKey();\n};\n\nDH.prototype.computeSecret = function (other) {\n other = new BN(other);\n other = other.toRed(this._prime);\n var secret = other.redPow(this._priv).fromRed();\n var out = new Buffer(secret.toArray());\n var prime = this.getPrime();\n if (out.length < prime.length) {\n var front = new Buffer(prime.length - out.length);\n front.fill(0);\n out = Buffer.concat([front, out]);\n }\n return out;\n};\n\nDH.prototype.getPublicKey = function getPublicKey(enc) {\n return formatReturnValue(this._pub, enc);\n};\n\nDH.prototype.getPrivateKey = function getPrivateKey(enc) {\n return formatReturnValue(this._priv, enc);\n};\n\nDH.prototype.getPrime = function (enc) {\n return formatReturnValue(this.__prime, enc);\n};\n\nDH.prototype.getGenerator = function (enc) {\n return formatReturnValue(this._gen, enc);\n};\n\nDH.prototype.setGenerator = function (gen, enc) {\n enc = enc || 'utf8';\n if (!Buffer.isBuffer(gen)) {\n gen = new Buffer(gen, enc);\n }\n this.__gen = gen;\n this._gen = new BN(gen);\n return this;\n};\n\nfunction formatReturnValue(bn, enc) {\n var buf = new Buffer(bn.toArray());\n if (!enc) {\n return buf;\n } else {\n return buf.toString(enc);\n }\n}\n","var generatePrime = require('./lib/generatePrime')\nvar primes = require('./lib/primes.json')\n\nvar DH = require('./lib/dh')\n\nfunction getDiffieHellman (mod) {\n var prime = new Buffer(primes[mod].prime, 'hex')\n var gen = new Buffer(primes[mod].gen, 'hex')\n\n return new DH(prime, gen)\n}\n\nvar ENCODINGS = {\n 'binary': true, 'hex': true, 'base64': true\n}\n\nfunction createDiffieHellman (prime, enc, generator, genc) {\n if (Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) {\n return createDiffieHellman(prime, 'binary', enc, generator)\n }\n\n enc = enc || 'binary'\n genc = genc || 'binary'\n generator = generator || new Buffer([2])\n\n if (!Buffer.isBuffer(generator)) {\n generator = new Buffer(generator, genc)\n }\n\n if (typeof prime === 'number') {\n return new DH(generatePrime(prime, generator), generator, true)\n }\n\n if (!Buffer.isBuffer(prime)) {\n prime = new Buffer(prime, enc)\n }\n\n return new DH(prime, generator, true)\n}\n\nexports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman\nexports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman\n","(function (module, exports) {\n 'use strict';\n\n // Utils\n function assert (val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n }\n\n // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n function inherits (ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n\n // BN\n\n function BN (number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0;\n\n // Reduction context\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n\n var Buffer;\n try {\n if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {\n Buffer = window.Buffer;\n } else {\n Buffer = require('buffer').Buffer;\n }\n } catch (e) {\n }\n\n BN.isBN = function isBN (num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' &&\n num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max (left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min (left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init (number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n assert(base === (base | 0) && base >= 2 && base <= 36);\n\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n if (number[0] === '-') {\n start++;\n this.negative = 1;\n }\n\n if (start < number.length) {\n if (base === 16) {\n this._parseHex(number, start, endian);\n } else {\n this._parseBase(number, base, start);\n if (endian === 'le') {\n this._initArray(this.toArray(), base, endian);\n }\n }\n }\n };\n\n BN.prototype._initNumber = function _initNumber (number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n if (number < 0x4000000) {\n this.words = [number & 0x3ffffff];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff\n ];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff,\n 1\n ];\n this.length = 3;\n }\n\n if (endian !== 'le') return;\n\n // Reverse the bytes\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray (number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n if (number.length <= 0) {\n this.words = [0];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this._strip();\n };\n\n function parseHex4Bits (string, index) {\n var c = string.charCodeAt(index);\n // '0' - '9'\n if (c >= 48 && c <= 57) {\n return c - 48;\n // 'A' - 'F'\n } else if (c >= 65 && c <= 70) {\n return c - 55;\n // 'a' - 'f'\n } else if (c >= 97 && c <= 102) {\n return c - 87;\n } else {\n assert(false, 'Invalid character in ' + string);\n }\n }\n\n function parseHexByte (string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n if (index - 1 >= lowerBound) {\n r |= parseHex4Bits(string, index - 1) << 4;\n }\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex (number, start, endian) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n // 24-bits chunks\n var off = 0;\n var j = 0;\n\n var w;\n if (endian === 'be') {\n for (i = number.length - 1; i >= start; i -= 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n } else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n }\n\n this._strip();\n };\n\n function parseBase (str, start, end, mul) {\n var r = 0;\n var b = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r *= mul;\n\n // 'a'\n if (c >= 49) {\n b = c - 49 + 0xa;\n\n // 'A'\n } else if (c >= 17) {\n b = c - 17 + 0xa;\n\n // '0' - '9'\n } else {\n b = c;\n }\n assert(c >= 0 && b < mul, 'Invalid character');\n r += b;\n }\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase (number, base, start) {\n // Initialize as zero\n this.words = [0];\n this.length = 1;\n\n // Find length of limb in base\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n limbLen--;\n limbPow = (limbPow / base) | 0;\n\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n\n this.imuln(limbPow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n this._strip();\n };\n\n BN.prototype.copy = function copy (dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n function move (dest, src) {\n dest.words = src.words;\n dest.length = src.length;\n dest.negative = src.negative;\n dest.red = src.red;\n }\n\n BN.prototype._move = function _move (dest) {\n move(dest, this);\n };\n\n BN.prototype.clone = function clone () {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand (size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n return this;\n };\n\n // Remove leading `0` from `this`\n BN.prototype._strip = function strip () {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign () {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n return this;\n };\n\n // Check Symbol.for because not everywhere where Symbol defined\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility\n if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {\n try {\n BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect;\n } catch (e) {\n BN.prototype.inspect = inspect;\n }\n } else {\n BN.prototype.inspect = inspect;\n }\n\n function inspect () {\n return (this.red ? '';\n }\n\n /*\n\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n\n */\n\n var zeros = [\n '',\n '0',\n '00',\n '000',\n '0000',\n '00000',\n '000000',\n '0000000',\n '00000000',\n '000000000',\n '0000000000',\n '00000000000',\n '000000000000',\n '0000000000000',\n '00000000000000',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n '00000000000000000000',\n '000000000000000000000',\n '0000000000000000000000',\n '00000000000000000000000',\n '000000000000000000000000',\n '0000000000000000000000000'\n ];\n\n var groupSizes = [\n 0, 0,\n 25, 16, 12, 11, 10, 9, 8,\n 8, 7, 7, 7, 7, 6, 6,\n 6, 6, 6, 6, 6, 5, 5,\n 5, 5, 5, 5, 5, 5, 5,\n 5, 5, 5, 5, 5, 5, 5\n ];\n\n var groupBases = [\n 0, 0,\n 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,\n 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,\n 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,\n 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,\n 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176\n ];\n\n BN.prototype.toString = function toString (base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n\n var out;\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = (((w << off) | carry) & 0xffffff).toString(16);\n carry = (w >>> (24 - off)) & 0xffffff;\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n }\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base];\n // var groupBase = Math.pow(base, groupSize);\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n while (!c.isZero()) {\n var r = c.modrn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n if (this.isZero()) {\n out = '0' + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber () {\n var ret = this.words[0];\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + (this.words[1] * 0x4000000);\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n return (this.negative !== 0) ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON () {\n return this.toString(16, 2);\n };\n\n if (Buffer) {\n BN.prototype.toBuffer = function toBuffer (endian, length) {\n return this.toArrayLike(Buffer, endian, length);\n };\n }\n\n BN.prototype.toArray = function toArray (endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n var allocate = function allocate (ArrayType, size) {\n if (ArrayType.allocUnsafe) {\n return ArrayType.allocUnsafe(size);\n }\n return new ArrayType(size);\n };\n\n BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {\n this._strip();\n\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n\n var res = allocate(ArrayType, reqLength);\n var postfix = endian === 'le' ? 'LE' : 'BE';\n this['_toArrayLike' + postfix](res, byteLength);\n return res;\n };\n\n BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) {\n var position = 0;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position++] = word & 0xff;\n if (position < res.length) {\n res[position++] = (word >> 8) & 0xff;\n }\n if (position < res.length) {\n res[position++] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position < res.length) {\n res[position++] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position < res.length) {\n res[position++] = carry;\n\n while (position < res.length) {\n res[position++] = 0;\n }\n }\n };\n\n BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) {\n var position = res.length - 1;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position--] = word & 0xff;\n if (position >= 0) {\n res[position--] = (word >> 8) & 0xff;\n }\n if (position >= 0) {\n res[position--] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position >= 0) {\n res[position--] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position >= 0) {\n res[position--] = carry;\n\n while (position >= 0) {\n res[position--] = 0;\n }\n }\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits (w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits (w) {\n var t = w;\n var r = 0;\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits (w) {\n // Short-cut\n if (w === 0) return 26;\n\n var t = w;\n var r = 0;\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n if ((t & 0x1) === 0) {\n r++;\n }\n return r;\n };\n\n // Return number of used bits in a BN\n BN.prototype.bitLength = function bitLength () {\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray (num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n w[bit] = (num.words[off] >>> wbit) & 0x01;\n }\n\n return w;\n }\n\n // Number of trailing zero bits\n BN.prototype.zeroBits = function zeroBits () {\n if (this.isZero()) return 0;\n\n var r = 0;\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n r += b;\n if (b !== 26) break;\n }\n return r;\n };\n\n BN.prototype.byteLength = function byteLength () {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos (width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos (width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg () {\n return this.negative !== 0;\n };\n\n // Return negative clone of `this`\n BN.prototype.neg = function neg () {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg () {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n };\n\n // Or `num` with `this` in-place\n BN.prototype.iuor = function iuor (num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this._strip();\n };\n\n BN.prototype.ior = function ior (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n };\n\n // Or `num` with `this`\n BN.prototype.or = function or (num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor (num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n };\n\n // And `num` with `this` in-place\n BN.prototype.iuand = function iuand (num) {\n // b = min-length(num, this)\n var b;\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n\n return this._strip();\n };\n\n BN.prototype.iand = function iand (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n };\n\n // And `num` with `this`\n BN.prototype.and = function and (num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand (num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n };\n\n // Xor `num` with `this` in-place\n BN.prototype.iuxor = function iuxor (num) {\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n\n return this._strip();\n };\n\n BN.prototype.ixor = function ixor (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n };\n\n // Xor `num` with `this`\n BN.prototype.xor = function xor (num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor (num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n };\n\n // Not ``this`` with ``width`` bitwidth\n BN.prototype.inotn = function inotn (width) {\n assert(typeof width === 'number' && width >= 0);\n\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26;\n\n // Extend the buffer with leading zeroes\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n }\n\n // Handle complete words\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n }\n\n // Handle the residue\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));\n }\n\n // And remove leading zeroes\n return this._strip();\n };\n\n BN.prototype.notn = function notn (width) {\n return this.clone().inotn(width);\n };\n\n // Set `bit` of `this`\n BN.prototype.setn = function setn (bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | (1 << wbit);\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this._strip();\n };\n\n // Add `num` to `this` in-place\n BN.prototype.iadd = function iadd (num) {\n var r;\n\n // negative + positive\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign();\n\n // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n }\n\n // a.length > b.length\n var a, b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n };\n\n // Add `num` to `this`\n BN.prototype.add = function add (num) {\n var res;\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n\n return num.clone().iadd(this);\n };\n\n // Subtract `num` from `this` in-place\n BN.prototype.isub = function isub (num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign();\n\n // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n }\n\n // At this point both numbers are positive\n var cmp = this.cmp(num);\n\n // Optimization - zeroify\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n\n // a > b\n var a, b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n // Copy rest of the words\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this._strip();\n };\n\n // Subtract `num` from `this`\n BN.prototype.sub = function sub (num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = (self.length + num.length) | 0;\n out.length = len;\n len = (len - 1) | 0;\n\n // Peel one iteration (compiler can't do it, because of code complexity)\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n var carry = (r / 0x4000000) | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = (k - j) | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += (r / 0x4000000) | 0;\n rword = r & 0x3ffffff;\n }\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n var comb10MulTo = function comb10MulTo (self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = (mid + Math.imul(ah0, bl0)) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = (mid + Math.imul(ah1, bl0)) | 0;\n hi = Math.imul(ah1, bh0);\n lo = (lo + Math.imul(al0, bl1)) | 0;\n mid = (mid + Math.imul(al0, bh1)) | 0;\n mid = (mid + Math.imul(ah0, bl1)) | 0;\n hi = (hi + Math.imul(ah0, bh1)) | 0;\n var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = (mid + Math.imul(ah2, bl0)) | 0;\n hi = Math.imul(ah2, bh0);\n lo = (lo + Math.imul(al1, bl1)) | 0;\n mid = (mid + Math.imul(al1, bh1)) | 0;\n mid = (mid + Math.imul(ah1, bl1)) | 0;\n hi = (hi + Math.imul(ah1, bh1)) | 0;\n lo = (lo + Math.imul(al0, bl2)) | 0;\n mid = (mid + Math.imul(al0, bh2)) | 0;\n mid = (mid + Math.imul(ah0, bl2)) | 0;\n hi = (hi + Math.imul(ah0, bh2)) | 0;\n var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = (mid + Math.imul(ah3, bl0)) | 0;\n hi = Math.imul(ah3, bh0);\n lo = (lo + Math.imul(al2, bl1)) | 0;\n mid = (mid + Math.imul(al2, bh1)) | 0;\n mid = (mid + Math.imul(ah2, bl1)) | 0;\n hi = (hi + Math.imul(ah2, bh1)) | 0;\n lo = (lo + Math.imul(al1, bl2)) | 0;\n mid = (mid + Math.imul(al1, bh2)) | 0;\n mid = (mid + Math.imul(ah1, bl2)) | 0;\n hi = (hi + Math.imul(ah1, bh2)) | 0;\n lo = (lo + Math.imul(al0, bl3)) | 0;\n mid = (mid + Math.imul(al0, bh3)) | 0;\n mid = (mid + Math.imul(ah0, bl3)) | 0;\n hi = (hi + Math.imul(ah0, bh3)) | 0;\n var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = (mid + Math.imul(ah4, bl0)) | 0;\n hi = Math.imul(ah4, bh0);\n lo = (lo + Math.imul(al3, bl1)) | 0;\n mid = (mid + Math.imul(al3, bh1)) | 0;\n mid = (mid + Math.imul(ah3, bl1)) | 0;\n hi = (hi + Math.imul(ah3, bh1)) | 0;\n lo = (lo + Math.imul(al2, bl2)) | 0;\n mid = (mid + Math.imul(al2, bh2)) | 0;\n mid = (mid + Math.imul(ah2, bl2)) | 0;\n hi = (hi + Math.imul(ah2, bh2)) | 0;\n lo = (lo + Math.imul(al1, bl3)) | 0;\n mid = (mid + Math.imul(al1, bh3)) | 0;\n mid = (mid + Math.imul(ah1, bl3)) | 0;\n hi = (hi + Math.imul(ah1, bh3)) | 0;\n lo = (lo + Math.imul(al0, bl4)) | 0;\n mid = (mid + Math.imul(al0, bh4)) | 0;\n mid = (mid + Math.imul(ah0, bl4)) | 0;\n hi = (hi + Math.imul(ah0, bh4)) | 0;\n var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = (mid + Math.imul(ah5, bl0)) | 0;\n hi = Math.imul(ah5, bh0);\n lo = (lo + Math.imul(al4, bl1)) | 0;\n mid = (mid + Math.imul(al4, bh1)) | 0;\n mid = (mid + Math.imul(ah4, bl1)) | 0;\n hi = (hi + Math.imul(ah4, bh1)) | 0;\n lo = (lo + Math.imul(al3, bl2)) | 0;\n mid = (mid + Math.imul(al3, bh2)) | 0;\n mid = (mid + Math.imul(ah3, bl2)) | 0;\n hi = (hi + Math.imul(ah3, bh2)) | 0;\n lo = (lo + Math.imul(al2, bl3)) | 0;\n mid = (mid + Math.imul(al2, bh3)) | 0;\n mid = (mid + Math.imul(ah2, bl3)) | 0;\n hi = (hi + Math.imul(ah2, bh3)) | 0;\n lo = (lo + Math.imul(al1, bl4)) | 0;\n mid = (mid + Math.imul(al1, bh4)) | 0;\n mid = (mid + Math.imul(ah1, bl4)) | 0;\n hi = (hi + Math.imul(ah1, bh4)) | 0;\n lo = (lo + Math.imul(al0, bl5)) | 0;\n mid = (mid + Math.imul(al0, bh5)) | 0;\n mid = (mid + Math.imul(ah0, bl5)) | 0;\n hi = (hi + Math.imul(ah0, bh5)) | 0;\n var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = (mid + Math.imul(ah6, bl0)) | 0;\n hi = Math.imul(ah6, bh0);\n lo = (lo + Math.imul(al5, bl1)) | 0;\n mid = (mid + Math.imul(al5, bh1)) | 0;\n mid = (mid + Math.imul(ah5, bl1)) | 0;\n hi = (hi + Math.imul(ah5, bh1)) | 0;\n lo = (lo + Math.imul(al4, bl2)) | 0;\n mid = (mid + Math.imul(al4, bh2)) | 0;\n mid = (mid + Math.imul(ah4, bl2)) | 0;\n hi = (hi + Math.imul(ah4, bh2)) | 0;\n lo = (lo + Math.imul(al3, bl3)) | 0;\n mid = (mid + Math.imul(al3, bh3)) | 0;\n mid = (mid + Math.imul(ah3, bl3)) | 0;\n hi = (hi + Math.imul(ah3, bh3)) | 0;\n lo = (lo + Math.imul(al2, bl4)) | 0;\n mid = (mid + Math.imul(al2, bh4)) | 0;\n mid = (mid + Math.imul(ah2, bl4)) | 0;\n hi = (hi + Math.imul(ah2, bh4)) | 0;\n lo = (lo + Math.imul(al1, bl5)) | 0;\n mid = (mid + Math.imul(al1, bh5)) | 0;\n mid = (mid + Math.imul(ah1, bl5)) | 0;\n hi = (hi + Math.imul(ah1, bh5)) | 0;\n lo = (lo + Math.imul(al0, bl6)) | 0;\n mid = (mid + Math.imul(al0, bh6)) | 0;\n mid = (mid + Math.imul(ah0, bl6)) | 0;\n hi = (hi + Math.imul(ah0, bh6)) | 0;\n var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = (mid + Math.imul(ah7, bl0)) | 0;\n hi = Math.imul(ah7, bh0);\n lo = (lo + Math.imul(al6, bl1)) | 0;\n mid = (mid + Math.imul(al6, bh1)) | 0;\n mid = (mid + Math.imul(ah6, bl1)) | 0;\n hi = (hi + Math.imul(ah6, bh1)) | 0;\n lo = (lo + Math.imul(al5, bl2)) | 0;\n mid = (mid + Math.imul(al5, bh2)) | 0;\n mid = (mid + Math.imul(ah5, bl2)) | 0;\n hi = (hi + Math.imul(ah5, bh2)) | 0;\n lo = (lo + Math.imul(al4, bl3)) | 0;\n mid = (mid + Math.imul(al4, bh3)) | 0;\n mid = (mid + Math.imul(ah4, bl3)) | 0;\n hi = (hi + Math.imul(ah4, bh3)) | 0;\n lo = (lo + Math.imul(al3, bl4)) | 0;\n mid = (mid + Math.imul(al3, bh4)) | 0;\n mid = (mid + Math.imul(ah3, bl4)) | 0;\n hi = (hi + Math.imul(ah3, bh4)) | 0;\n lo = (lo + Math.imul(al2, bl5)) | 0;\n mid = (mid + Math.imul(al2, bh5)) | 0;\n mid = (mid + Math.imul(ah2, bl5)) | 0;\n hi = (hi + Math.imul(ah2, bh5)) | 0;\n lo = (lo + Math.imul(al1, bl6)) | 0;\n mid = (mid + Math.imul(al1, bh6)) | 0;\n mid = (mid + Math.imul(ah1, bl6)) | 0;\n hi = (hi + Math.imul(ah1, bh6)) | 0;\n lo = (lo + Math.imul(al0, bl7)) | 0;\n mid = (mid + Math.imul(al0, bh7)) | 0;\n mid = (mid + Math.imul(ah0, bl7)) | 0;\n hi = (hi + Math.imul(ah0, bh7)) | 0;\n var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = (mid + Math.imul(ah8, bl0)) | 0;\n hi = Math.imul(ah8, bh0);\n lo = (lo + Math.imul(al7, bl1)) | 0;\n mid = (mid + Math.imul(al7, bh1)) | 0;\n mid = (mid + Math.imul(ah7, bl1)) | 0;\n hi = (hi + Math.imul(ah7, bh1)) | 0;\n lo = (lo + Math.imul(al6, bl2)) | 0;\n mid = (mid + Math.imul(al6, bh2)) | 0;\n mid = (mid + Math.imul(ah6, bl2)) | 0;\n hi = (hi + Math.imul(ah6, bh2)) | 0;\n lo = (lo + Math.imul(al5, bl3)) | 0;\n mid = (mid + Math.imul(al5, bh3)) | 0;\n mid = (mid + Math.imul(ah5, bl3)) | 0;\n hi = (hi + Math.imul(ah5, bh3)) | 0;\n lo = (lo + Math.imul(al4, bl4)) | 0;\n mid = (mid + Math.imul(al4, bh4)) | 0;\n mid = (mid + Math.imul(ah4, bl4)) | 0;\n hi = (hi + Math.imul(ah4, bh4)) | 0;\n lo = (lo + Math.imul(al3, bl5)) | 0;\n mid = (mid + Math.imul(al3, bh5)) | 0;\n mid = (mid + Math.imul(ah3, bl5)) | 0;\n hi = (hi + Math.imul(ah3, bh5)) | 0;\n lo = (lo + Math.imul(al2, bl6)) | 0;\n mid = (mid + Math.imul(al2, bh6)) | 0;\n mid = (mid + Math.imul(ah2, bl6)) | 0;\n hi = (hi + Math.imul(ah2, bh6)) | 0;\n lo = (lo + Math.imul(al1, bl7)) | 0;\n mid = (mid + Math.imul(al1, bh7)) | 0;\n mid = (mid + Math.imul(ah1, bl7)) | 0;\n hi = (hi + Math.imul(ah1, bh7)) | 0;\n lo = (lo + Math.imul(al0, bl8)) | 0;\n mid = (mid + Math.imul(al0, bh8)) | 0;\n mid = (mid + Math.imul(ah0, bl8)) | 0;\n hi = (hi + Math.imul(ah0, bh8)) | 0;\n var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = (mid + Math.imul(ah9, bl0)) | 0;\n hi = Math.imul(ah9, bh0);\n lo = (lo + Math.imul(al8, bl1)) | 0;\n mid = (mid + Math.imul(al8, bh1)) | 0;\n mid = (mid + Math.imul(ah8, bl1)) | 0;\n hi = (hi + Math.imul(ah8, bh1)) | 0;\n lo = (lo + Math.imul(al7, bl2)) | 0;\n mid = (mid + Math.imul(al7, bh2)) | 0;\n mid = (mid + Math.imul(ah7, bl2)) | 0;\n hi = (hi + Math.imul(ah7, bh2)) | 0;\n lo = (lo + Math.imul(al6, bl3)) | 0;\n mid = (mid + Math.imul(al6, bh3)) | 0;\n mid = (mid + Math.imul(ah6, bl3)) | 0;\n hi = (hi + Math.imul(ah6, bh3)) | 0;\n lo = (lo + Math.imul(al5, bl4)) | 0;\n mid = (mid + Math.imul(al5, bh4)) | 0;\n mid = (mid + Math.imul(ah5, bl4)) | 0;\n hi = (hi + Math.imul(ah5, bh4)) | 0;\n lo = (lo + Math.imul(al4, bl5)) | 0;\n mid = (mid + Math.imul(al4, bh5)) | 0;\n mid = (mid + Math.imul(ah4, bl5)) | 0;\n hi = (hi + Math.imul(ah4, bh5)) | 0;\n lo = (lo + Math.imul(al3, bl6)) | 0;\n mid = (mid + Math.imul(al3, bh6)) | 0;\n mid = (mid + Math.imul(ah3, bl6)) | 0;\n hi = (hi + Math.imul(ah3, bh6)) | 0;\n lo = (lo + Math.imul(al2, bl7)) | 0;\n mid = (mid + Math.imul(al2, bh7)) | 0;\n mid = (mid + Math.imul(ah2, bl7)) | 0;\n hi = (hi + Math.imul(ah2, bh7)) | 0;\n lo = (lo + Math.imul(al1, bl8)) | 0;\n mid = (mid + Math.imul(al1, bh8)) | 0;\n mid = (mid + Math.imul(ah1, bl8)) | 0;\n hi = (hi + Math.imul(ah1, bh8)) | 0;\n lo = (lo + Math.imul(al0, bl9)) | 0;\n mid = (mid + Math.imul(al0, bh9)) | 0;\n mid = (mid + Math.imul(ah0, bl9)) | 0;\n hi = (hi + Math.imul(ah0, bh9)) | 0;\n var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = (mid + Math.imul(ah9, bl1)) | 0;\n hi = Math.imul(ah9, bh1);\n lo = (lo + Math.imul(al8, bl2)) | 0;\n mid = (mid + Math.imul(al8, bh2)) | 0;\n mid = (mid + Math.imul(ah8, bl2)) | 0;\n hi = (hi + Math.imul(ah8, bh2)) | 0;\n lo = (lo + Math.imul(al7, bl3)) | 0;\n mid = (mid + Math.imul(al7, bh3)) | 0;\n mid = (mid + Math.imul(ah7, bl3)) | 0;\n hi = (hi + Math.imul(ah7, bh3)) | 0;\n lo = (lo + Math.imul(al6, bl4)) | 0;\n mid = (mid + Math.imul(al6, bh4)) | 0;\n mid = (mid + Math.imul(ah6, bl4)) | 0;\n hi = (hi + Math.imul(ah6, bh4)) | 0;\n lo = (lo + Math.imul(al5, bl5)) | 0;\n mid = (mid + Math.imul(al5, bh5)) | 0;\n mid = (mid + Math.imul(ah5, bl5)) | 0;\n hi = (hi + Math.imul(ah5, bh5)) | 0;\n lo = (lo + Math.imul(al4, bl6)) | 0;\n mid = (mid + Math.imul(al4, bh6)) | 0;\n mid = (mid + Math.imul(ah4, bl6)) | 0;\n hi = (hi + Math.imul(ah4, bh6)) | 0;\n lo = (lo + Math.imul(al3, bl7)) | 0;\n mid = (mid + Math.imul(al3, bh7)) | 0;\n mid = (mid + Math.imul(ah3, bl7)) | 0;\n hi = (hi + Math.imul(ah3, bh7)) | 0;\n lo = (lo + Math.imul(al2, bl8)) | 0;\n mid = (mid + Math.imul(al2, bh8)) | 0;\n mid = (mid + Math.imul(ah2, bl8)) | 0;\n hi = (hi + Math.imul(ah2, bh8)) | 0;\n lo = (lo + Math.imul(al1, bl9)) | 0;\n mid = (mid + Math.imul(al1, bh9)) | 0;\n mid = (mid + Math.imul(ah1, bl9)) | 0;\n hi = (hi + Math.imul(ah1, bh9)) | 0;\n var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = (mid + Math.imul(ah9, bl2)) | 0;\n hi = Math.imul(ah9, bh2);\n lo = (lo + Math.imul(al8, bl3)) | 0;\n mid = (mid + Math.imul(al8, bh3)) | 0;\n mid = (mid + Math.imul(ah8, bl3)) | 0;\n hi = (hi + Math.imul(ah8, bh3)) | 0;\n lo = (lo + Math.imul(al7, bl4)) | 0;\n mid = (mid + Math.imul(al7, bh4)) | 0;\n mid = (mid + Math.imul(ah7, bl4)) | 0;\n hi = (hi + Math.imul(ah7, bh4)) | 0;\n lo = (lo + Math.imul(al6, bl5)) | 0;\n mid = (mid + Math.imul(al6, bh5)) | 0;\n mid = (mid + Math.imul(ah6, bl5)) | 0;\n hi = (hi + Math.imul(ah6, bh5)) | 0;\n lo = (lo + Math.imul(al5, bl6)) | 0;\n mid = (mid + Math.imul(al5, bh6)) | 0;\n mid = (mid + Math.imul(ah5, bl6)) | 0;\n hi = (hi + Math.imul(ah5, bh6)) | 0;\n lo = (lo + Math.imul(al4, bl7)) | 0;\n mid = (mid + Math.imul(al4, bh7)) | 0;\n mid = (mid + Math.imul(ah4, bl7)) | 0;\n hi = (hi + Math.imul(ah4, bh7)) | 0;\n lo = (lo + Math.imul(al3, bl8)) | 0;\n mid = (mid + Math.imul(al3, bh8)) | 0;\n mid = (mid + Math.imul(ah3, bl8)) | 0;\n hi = (hi + Math.imul(ah3, bh8)) | 0;\n lo = (lo + Math.imul(al2, bl9)) | 0;\n mid = (mid + Math.imul(al2, bh9)) | 0;\n mid = (mid + Math.imul(ah2, bl9)) | 0;\n hi = (hi + Math.imul(ah2, bh9)) | 0;\n var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = (mid + Math.imul(ah9, bl3)) | 0;\n hi = Math.imul(ah9, bh3);\n lo = (lo + Math.imul(al8, bl4)) | 0;\n mid = (mid + Math.imul(al8, bh4)) | 0;\n mid = (mid + Math.imul(ah8, bl4)) | 0;\n hi = (hi + Math.imul(ah8, bh4)) | 0;\n lo = (lo + Math.imul(al7, bl5)) | 0;\n mid = (mid + Math.imul(al7, bh5)) | 0;\n mid = (mid + Math.imul(ah7, bl5)) | 0;\n hi = (hi + Math.imul(ah7, bh5)) | 0;\n lo = (lo + Math.imul(al6, bl6)) | 0;\n mid = (mid + Math.imul(al6, bh6)) | 0;\n mid = (mid + Math.imul(ah6, bl6)) | 0;\n hi = (hi + Math.imul(ah6, bh6)) | 0;\n lo = (lo + Math.imul(al5, bl7)) | 0;\n mid = (mid + Math.imul(al5, bh7)) | 0;\n mid = (mid + Math.imul(ah5, bl7)) | 0;\n hi = (hi + Math.imul(ah5, bh7)) | 0;\n lo = (lo + Math.imul(al4, bl8)) | 0;\n mid = (mid + Math.imul(al4, bh8)) | 0;\n mid = (mid + Math.imul(ah4, bl8)) | 0;\n hi = (hi + Math.imul(ah4, bh8)) | 0;\n lo = (lo + Math.imul(al3, bl9)) | 0;\n mid = (mid + Math.imul(al3, bh9)) | 0;\n mid = (mid + Math.imul(ah3, bl9)) | 0;\n hi = (hi + Math.imul(ah3, bh9)) | 0;\n var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = (mid + Math.imul(ah9, bl4)) | 0;\n hi = Math.imul(ah9, bh4);\n lo = (lo + Math.imul(al8, bl5)) | 0;\n mid = (mid + Math.imul(al8, bh5)) | 0;\n mid = (mid + Math.imul(ah8, bl5)) | 0;\n hi = (hi + Math.imul(ah8, bh5)) | 0;\n lo = (lo + Math.imul(al7, bl6)) | 0;\n mid = (mid + Math.imul(al7, bh6)) | 0;\n mid = (mid + Math.imul(ah7, bl6)) | 0;\n hi = (hi + Math.imul(ah7, bh6)) | 0;\n lo = (lo + Math.imul(al6, bl7)) | 0;\n mid = (mid + Math.imul(al6, bh7)) | 0;\n mid = (mid + Math.imul(ah6, bl7)) | 0;\n hi = (hi + Math.imul(ah6, bh7)) | 0;\n lo = (lo + Math.imul(al5, bl8)) | 0;\n mid = (mid + Math.imul(al5, bh8)) | 0;\n mid = (mid + Math.imul(ah5, bl8)) | 0;\n hi = (hi + Math.imul(ah5, bh8)) | 0;\n lo = (lo + Math.imul(al4, bl9)) | 0;\n mid = (mid + Math.imul(al4, bh9)) | 0;\n mid = (mid + Math.imul(ah4, bl9)) | 0;\n hi = (hi + Math.imul(ah4, bh9)) | 0;\n var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = (mid + Math.imul(ah9, bl5)) | 0;\n hi = Math.imul(ah9, bh5);\n lo = (lo + Math.imul(al8, bl6)) | 0;\n mid = (mid + Math.imul(al8, bh6)) | 0;\n mid = (mid + Math.imul(ah8, bl6)) | 0;\n hi = (hi + Math.imul(ah8, bh6)) | 0;\n lo = (lo + Math.imul(al7, bl7)) | 0;\n mid = (mid + Math.imul(al7, bh7)) | 0;\n mid = (mid + Math.imul(ah7, bl7)) | 0;\n hi = (hi + Math.imul(ah7, bh7)) | 0;\n lo = (lo + Math.imul(al6, bl8)) | 0;\n mid = (mid + Math.imul(al6, bh8)) | 0;\n mid = (mid + Math.imul(ah6, bl8)) | 0;\n hi = (hi + Math.imul(ah6, bh8)) | 0;\n lo = (lo + Math.imul(al5, bl9)) | 0;\n mid = (mid + Math.imul(al5, bh9)) | 0;\n mid = (mid + Math.imul(ah5, bl9)) | 0;\n hi = (hi + Math.imul(ah5, bh9)) | 0;\n var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = (mid + Math.imul(ah9, bl6)) | 0;\n hi = Math.imul(ah9, bh6);\n lo = (lo + Math.imul(al8, bl7)) | 0;\n mid = (mid + Math.imul(al8, bh7)) | 0;\n mid = (mid + Math.imul(ah8, bl7)) | 0;\n hi = (hi + Math.imul(ah8, bh7)) | 0;\n lo = (lo + Math.imul(al7, bl8)) | 0;\n mid = (mid + Math.imul(al7, bh8)) | 0;\n mid = (mid + Math.imul(ah7, bl8)) | 0;\n hi = (hi + Math.imul(ah7, bh8)) | 0;\n lo = (lo + Math.imul(al6, bl9)) | 0;\n mid = (mid + Math.imul(al6, bh9)) | 0;\n mid = (mid + Math.imul(ah6, bl9)) | 0;\n hi = (hi + Math.imul(ah6, bh9)) | 0;\n var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = (mid + Math.imul(ah9, bl7)) | 0;\n hi = Math.imul(ah9, bh7);\n lo = (lo + Math.imul(al8, bl8)) | 0;\n mid = (mid + Math.imul(al8, bh8)) | 0;\n mid = (mid + Math.imul(ah8, bl8)) | 0;\n hi = (hi + Math.imul(ah8, bh8)) | 0;\n lo = (lo + Math.imul(al7, bl9)) | 0;\n mid = (mid + Math.imul(al7, bh9)) | 0;\n mid = (mid + Math.imul(ah7, bl9)) | 0;\n hi = (hi + Math.imul(ah7, bh9)) | 0;\n var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = (mid + Math.imul(ah9, bl8)) | 0;\n hi = Math.imul(ah9, bh8);\n lo = (lo + Math.imul(al8, bl9)) | 0;\n mid = (mid + Math.imul(al8, bh9)) | 0;\n mid = (mid + Math.imul(ah8, bl9)) | 0;\n hi = (hi + Math.imul(ah8, bh9)) | 0;\n var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = (mid + Math.imul(ah9, bl9)) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n return out;\n };\n\n // Polyfill comb\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n function jumboMulTo (self, num, out) {\n // Temporary disable, see https://github.com/indutny/bn.js/issues/211\n // var fftm = new FFTM();\n // return fftm.mulp(self, num, out);\n return bigMulTo(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo (num, out) {\n var res;\n var len = this.length + num.length;\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n };\n\n // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT (N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n };\n\n // Returns binary-reversed representation of `x`\n FFTM.prototype.revBin = function revBin (x, l, N) {\n if (x === 0 || x === N - 1) return x;\n\n var rb = 0;\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << (l - i - 1);\n x >>= 1;\n }\n\n return rb;\n };\n\n // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n\n var rx = rtwdf_ * ro - itwdf_ * io;\n\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n\n /* jshint maxdepth : false */\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b (n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate (rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n\n t = iws[i];\n\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b (ws, N) {\n var carry = 0;\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +\n Math.round(ws[2 * i] / N) +\n carry;\n\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {\n var carry = 0;\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n\n rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;\n }\n\n // Pad with zeroes\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub (N) {\n var ph = new Array(N);\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp (x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n\n var rmws = out.words;\n rmws.length = N;\n\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out._strip();\n };\n\n // Multiply `this` by `num`\n BN.prototype.mul = function mul (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n };\n\n // Multiply employing FFT\n BN.prototype.mulf = function mulf (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n };\n\n // In-place Multiplication\n BN.prototype.imul = function imul (num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n\n // Carry\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += (w / 0x4000000) | 0;\n // NOTE: lo is 27bit maximum\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.muln = function muln (num) {\n return this.clone().imuln(num);\n };\n\n // `this` * `this`\n BN.prototype.sqr = function sqr () {\n return this.mul(this);\n };\n\n // `this` * `this` in-place\n BN.prototype.isqr = function isqr () {\n return this.imul(this.clone());\n };\n\n // Math.pow(`this`, `num`)\n BN.prototype.pow = function pow (num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1);\n\n // Skip leading zeroes\n var res = this;\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n\n res = res.mul(q);\n }\n }\n\n return res;\n };\n\n // Shift-left in-place\n BN.prototype.iushln = function iushln (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = ((this.words[i] | 0) - newCarry) << r;\n this.words[i] = c | carry;\n carry = newCarry >>> (26 - r);\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishln = function ishln (bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n };\n\n // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n BN.prototype.iushrn = function iushrn (bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n if (hint) {\n h = (hint - (hint % 26)) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n var maskedWords = extended;\n\n h -= s;\n h = Math.max(0, h);\n\n // Extended mode, copy masked part\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n maskedWords.length = s;\n }\n\n if (s === 0) {\n // No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = (carry << (26 - r)) | (word >>> r);\n carry = word & mask;\n }\n\n // Push carried bits as a mask\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishrn = function ishrn (bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n };\n\n // Shift-left\n BN.prototype.shln = function shln (bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln (bits) {\n return this.clone().iushln(bits);\n };\n\n // Shift-right\n BN.prototype.shrn = function shrn (bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn (bits) {\n return this.clone().iushrn(bits);\n };\n\n // Test if n bit is set\n BN.prototype.testn = function testn (bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) return false;\n\n // Check bit and return\n var w = this.words[s];\n\n return !!(w & q);\n };\n\n // Return only lowers bits of number (in-place)\n BN.prototype.imaskn = function imaskn (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n this.words[this.length - 1] &= mask;\n }\n\n return this._strip();\n };\n\n // Return only lowers bits of number\n BN.prototype.maskn = function maskn (bits) {\n return this.clone().imaskn(bits);\n };\n\n // Add plain number `num` to `this`\n BN.prototype.iaddn = function iaddn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num);\n\n // Possible sign change\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) <= num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n }\n\n // Add without checks\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn (num) {\n this.words[0] += num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n this.length = Math.max(this.length, i + 1);\n\n return this;\n };\n\n // Subtract plain number `num` from `this`\n BN.prototype.isubn = function isubn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this._strip();\n };\n\n BN.prototype.addn = function addn (num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn (num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs () {\n this.negative = 0;\n\n return this;\n };\n\n BN.prototype.abs = function abs () {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - ((right / 0x4000000) | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this._strip();\n\n // Subtraction overflow\n assert(carry === -1);\n carry = 0;\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n this.negative = 1;\n\n return this._strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv (num, mode) {\n var shift = this.length - num.length;\n\n var a = this.clone();\n var b = num;\n\n // Normalize\n var bhi = b.words[b.length - 1] | 0;\n var bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits;\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n }\n\n // Initialize quotient\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (diff.negative === 0) {\n a = diff;\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 +\n (a.words[b.length + j - 1] | 0);\n\n // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n qj = Math.min((qj / bhi) | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n a._ishlnsubmul(b, 1, j);\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n if (q) {\n q.words[j] = qj;\n }\n }\n if (q) {\n q._strip();\n }\n a._strip();\n\n // Denormalize\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n };\n\n // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n BN.prototype.divmod = function divmod (num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n }\n\n // Both numbers are positive at this point\n\n // Strip both numbers to approximate shift value\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n }\n\n // Very short reduction\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n };\n\n // Find `this` / `num`\n BN.prototype.div = function div (num) {\n return this.divmod(num, 'div', false).div;\n };\n\n // Find `this` % `num`\n BN.prototype.mod = function mod (num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod (num) {\n return this.divmod(num, 'mod', true).mod;\n };\n\n // Find Round(`this` / `num`)\n BN.prototype.divRound = function divRound (num) {\n var dm = this.divmod(num);\n\n // Fast case - exact division\n if (dm.mod.isZero()) return dm.div;\n\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n\n // Round down\n if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div;\n\n // Round up\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modrn = function modrn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return isNegNum ? -acc : acc;\n };\n\n // WARNING: DEPRECATED\n BN.prototype.modn = function modn (num) {\n return this.modrn(num);\n };\n\n // In-place division by number\n BN.prototype.idivn = function idivn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = (w / num) | 0;\n carry = w % num;\n }\n\n this._strip();\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.divn = function divn (num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n }\n\n // A * x + B * y = x\n var A = new BN(1);\n var B = new BN(0);\n\n // C * x + D * y = y\n var C = new BN(0);\n var D = new BN(1);\n\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n x.iushrn(i);\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n y.iushrn(j);\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n };\n\n // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n BN.prototype._invmp = function _invmp (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n a.iushrn(i);\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n b.iushrn(j);\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd (num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0;\n\n // Remove common factor of two\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n };\n\n // Invert number in the field F(num)\n BN.prototype.invm = function invm (num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven () {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd () {\n return (this.words[0] & 1) === 1;\n };\n\n // And first word and num\n BN.prototype.andln = function andln (num) {\n return this.words[0] & num;\n };\n\n // Increment at the bit position in-line\n BN.prototype.bincn = function bincn (bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n this._expand(s + 1);\n this.words[s] |= q;\n return this;\n }\n\n // Add bit and propagate, if needed\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n };\n\n BN.prototype.isZero = function isZero () {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn (num) {\n var negative = num < 0;\n\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n\n this._strip();\n\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n BN.prototype.cmp = function cmp (num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Unsigned comparison\n BN.prototype.ucmp = function ucmp (num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n\n if (a === b) continue;\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n break;\n }\n return res;\n };\n\n BN.prototype.gtn = function gtn (num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt (num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten (num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte (num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn (num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt (num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten (num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte (num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn (num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq (num) {\n return this.cmp(num) === 0;\n };\n\n //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n BN.red = function red (num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed () {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed (ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd (num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd (num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub (num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub (num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl (num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr () {\n assert(this.red, 'redSqr works only with red numbers');\n this.red._verify1(this);\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr () {\n assert(this.red, 'redISqr works only with red numbers');\n this.red._verify1(this);\n return this.red.isqr(this);\n };\n\n // Square root over p\n BN.prototype.redSqrt = function redSqrt () {\n assert(this.red, 'redSqrt works only with red numbers');\n this.red._verify1(this);\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm () {\n assert(this.red, 'redInvm works only with red numbers');\n this.red._verify1(this);\n return this.red.invm(this);\n };\n\n // Return negative clone of `this` % `red modulo`\n BN.prototype.redNeg = function redNeg () {\n assert(this.red, 'redNeg works only with red numbers');\n this.red._verify1(this);\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow (num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n this.red._verify1(this);\n return this.red.pow(this, num);\n };\n\n // Prime numbers with efficient reduction\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n\n // Pseudo-Mersenne prime\n function MPrime (name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp () {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce (num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== undefined) {\n // r is a BN v4 instance\n r.strip();\n } else {\n // r is a BN v5 instance\n r._strip();\n }\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split (input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK (num) {\n return num.imul(this.k);\n };\n\n function K256 () {\n MPrime.call(\n this,\n 'k256',\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n inherits(K256, MPrime);\n\n K256.prototype.split = function split (input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n\n var outLen = Math.min(input.length, 9);\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n }\n\n // Shift by 9 limbs\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);\n prev = next;\n }\n prev >>>= 22;\n input.words[i - 10] = prev;\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK (num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n\n // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + ((lo / 0x4000000) | 0);\n }\n\n // Fast length reduction\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n return num;\n };\n\n function P224 () {\n MPrime.call(\n this,\n 'p224',\n 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n inherits(P224, MPrime);\n\n function P192 () {\n MPrime.call(\n this,\n 'p192',\n 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n inherits(P192, MPrime);\n\n function P25519 () {\n // 2 ^ 255 - 19\n MPrime.call(\n this,\n '25519',\n '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK (num) {\n // K = 0x13\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n return num;\n };\n\n // Exported mostly for testing purposes, use plain name instead\n BN._prime = function prime (name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n\n var prime;\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n primes[name] = prime;\n\n return prime;\n };\n\n //\n // Base reduction engine\n //\n function Red (m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1 (a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2 (a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red,\n 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod (a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n\n move(a, a.umod(this.m)._forceRed(this));\n return a;\n };\n\n Red.prototype.neg = function neg (a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add (a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd (a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res;\n };\n\n Red.prototype.sub = function sub (a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub (a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res;\n };\n\n Red.prototype.shl = function shl (a, num) {\n this._verify1(a);\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul (a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul (a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr (a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr (a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt (a) {\n if (a.isZero()) return a.clone();\n\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n\n // Fast case\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n\n // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n var q = this.m.subn(1);\n var s = 0;\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n assert(!q.isZero());\n\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg();\n\n // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm (a) {\n var inv = a._invmp(this.m);\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow (a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n for (var j = start - 1; j >= 0; j--) {\n var bit = (word >> j) & 1;\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo (num) {\n var r = num.umod(this.m);\n\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom (num) {\n var res = num.clone();\n res.red = null;\n return res;\n };\n\n //\n // Montgomery method engine\n //\n\n BN.mont = function mont (num) {\n return new Mont(num);\n };\n\n function Mont (m) {\n Red.call(this, m);\n\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0) {\n this.shift += 26 - (this.shift % 26);\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo (num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom (num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul (a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul (a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm (a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})(typeof module === 'undefined' || module, this);\n","var BN = require('bn.js')\nvar randomBytes = require('randombytes')\n\nfunction blind (priv) {\n var r = getr(priv)\n var blinder = r.toRed(BN.mont(priv.modulus)).redPow(new BN(priv.publicExponent)).fromRed()\n return { blinder: blinder, unblinder: r.invm(priv.modulus) }\n}\n\nfunction getr (priv) {\n var len = priv.modulus.byteLength()\n var r\n do {\n r = new BN(randomBytes(len))\n } while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2))\n return r\n}\n\nfunction crt (msg, priv) {\n var blinds = blind(priv)\n var len = priv.modulus.byteLength()\n var blinded = new BN(msg).mul(blinds.blinder).umod(priv.modulus)\n var c1 = blinded.toRed(BN.mont(priv.prime1))\n var c2 = blinded.toRed(BN.mont(priv.prime2))\n var qinv = priv.coefficient\n var p = priv.prime1\n var q = priv.prime2\n var m1 = c1.redPow(priv.exponent1).fromRed()\n var m2 = c2.redPow(priv.exponent2).fromRed()\n var h = m1.isub(m2).imul(qinv).umod(p).imul(q)\n return m2.iadd(h).imul(blinds.unblinder).umod(priv.modulus).toArrayLike(Buffer, 'be', len)\n}\ncrt.getr = getr\n\nmodule.exports = crt\n","{\n \"name\": \"elliptic\",\n \"version\": \"6.5.7\",\n \"description\": \"EC cryptography\",\n \"main\": \"lib/elliptic.js\",\n \"files\": [\n \"lib\"\n ],\n \"scripts\": {\n \"lint\": \"eslint lib test\",\n \"lint:fix\": \"npm run lint -- --fix\",\n \"unit\": \"istanbul test _mocha --reporter=spec test/index.js\",\n \"test\": \"npm run lint && npm run unit\",\n \"version\": \"grunt dist && git add dist/\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git@github.com:indutny/elliptic\"\n },\n \"keywords\": [\n \"EC\",\n \"Elliptic\",\n \"curve\",\n \"Cryptography\"\n ],\n \"author\": \"Fedor Indutny \",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/indutny/elliptic/issues\"\n },\n \"homepage\": \"https://github.com/indutny/elliptic\",\n \"devDependencies\": {\n \"brfs\": \"^2.0.2\",\n \"coveralls\": \"^3.1.0\",\n \"eslint\": \"^7.6.0\",\n \"grunt\": \"^1.2.1\",\n \"grunt-browserify\": \"^5.3.0\",\n \"grunt-cli\": \"^1.3.2\",\n \"grunt-contrib-connect\": \"^3.0.0\",\n \"grunt-contrib-copy\": \"^1.0.0\",\n \"grunt-contrib-uglify\": \"^5.0.0\",\n \"grunt-mocha-istanbul\": \"^5.0.2\",\n \"grunt-saucelabs\": \"^9.0.1\",\n \"istanbul\": \"^0.4.5\",\n \"mocha\": \"^8.0.1\"\n },\n \"dependencies\": {\n \"bn.js\": \"^4.11.9\",\n \"brorand\": \"^1.1.0\",\n \"hash.js\": \"^1.0.0\",\n \"hmac-drbg\": \"^1.0.1\",\n \"inherits\": \"^2.0.4\",\n \"minimalistic-assert\": \"^1.0.1\",\n \"minimalistic-crypto-utils\": \"^1.0.1\"\n }\n}\n","'use strict';\n\nvar utils = exports;\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg !== 'string') {\n for (var i = 0; i < msg.length; i++)\n res[i] = msg[i] | 0;\n return res;\n }\n if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0)\n msg = '0' + msg;\n for (var i = 0; i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n } else {\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n var hi = c >> 8;\n var lo = c & 0xff;\n if (hi)\n res.push(hi, lo);\n else\n res.push(lo);\n }\n }\n return res;\n}\nutils.toArray = toArray;\n\nfunction zero2(word) {\n if (word.length === 1)\n return '0' + word;\n else\n return word;\n}\nutils.zero2 = zero2;\n\nfunction toHex(msg) {\n var res = '';\n for (var i = 0; i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n}\nutils.toHex = toHex;\n\nutils.encode = function encode(arr, enc) {\n if (enc === 'hex')\n return toHex(arr);\n else\n return arr;\n};\n","'use strict';\n\nvar utils = exports;\nvar BN = require('bn.js');\nvar minAssert = require('minimalistic-assert');\nvar minUtils = require('minimalistic-crypto-utils');\n\nutils.assert = minAssert;\nutils.toArray = minUtils.toArray;\nutils.zero2 = minUtils.zero2;\nutils.toHex = minUtils.toHex;\nutils.encode = minUtils.encode;\n\n// Represent num in a w-NAF form\nfunction getNAF(num, w, bits) {\n var naf = new Array(Math.max(num.bitLength(), bits) + 1);\n var i;\n for (i = 0; i < naf.length; i += 1) {\n naf[i] = 0;\n }\n\n var ws = 1 << (w + 1);\n var k = num.clone();\n\n for (i = 0; i < naf.length; i++) {\n var z;\n var mod = k.andln(ws - 1);\n if (k.isOdd()) {\n if (mod > (ws >> 1) - 1)\n z = (ws >> 1) - mod;\n else\n z = mod;\n k.isubn(z);\n } else {\n z = 0;\n }\n\n naf[i] = z;\n k.iushrn(1);\n }\n\n return naf;\n}\nutils.getNAF = getNAF;\n\n// Represent k1, k2 in a Joint Sparse Form\nfunction getJSF(k1, k2) {\n var jsf = [\n [],\n [],\n ];\n\n k1 = k1.clone();\n k2 = k2.clone();\n var d1 = 0;\n var d2 = 0;\n var m8;\n while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {\n // First phase\n var m14 = (k1.andln(3) + d1) & 3;\n var m24 = (k2.andln(3) + d2) & 3;\n if (m14 === 3)\n m14 = -1;\n if (m24 === 3)\n m24 = -1;\n var u1;\n if ((m14 & 1) === 0) {\n u1 = 0;\n } else {\n m8 = (k1.andln(7) + d1) & 7;\n if ((m8 === 3 || m8 === 5) && m24 === 2)\n u1 = -m14;\n else\n u1 = m14;\n }\n jsf[0].push(u1);\n\n var u2;\n if ((m24 & 1) === 0) {\n u2 = 0;\n } else {\n m8 = (k2.andln(7) + d2) & 7;\n if ((m8 === 3 || m8 === 5) && m14 === 2)\n u2 = -m24;\n else\n u2 = m24;\n }\n jsf[1].push(u2);\n\n // Second phase\n if (2 * d1 === u1 + 1)\n d1 = 1 - d1;\n if (2 * d2 === u2 + 1)\n d2 = 1 - d2;\n k1.iushrn(1);\n k2.iushrn(1);\n }\n\n return jsf;\n}\nutils.getJSF = getJSF;\n\nfunction cachedProperty(obj, name, computer) {\n var key = '_' + name;\n obj.prototype[name] = function cachedProperty() {\n return this[key] !== undefined ? this[key] :\n this[key] = computer.call(this);\n };\n}\nutils.cachedProperty = cachedProperty;\n\nfunction parseBytes(bytes) {\n return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') :\n bytes;\n}\nutils.parseBytes = parseBytes;\n\nfunction intFromLE(bytes) {\n return new BN(bytes, 'hex', 'le');\n}\nutils.intFromLE = intFromLE;\n\n","'use strict';\n\nvar BN = require('bn.js');\nvar utils = require('../utils');\nvar getNAF = utils.getNAF;\nvar getJSF = utils.getJSF;\nvar assert = utils.assert;\n\nfunction BaseCurve(type, conf) {\n this.type = type;\n this.p = new BN(conf.p, 16);\n\n // Use Montgomery, when there is no fast reduction for the prime\n this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p);\n\n // Useful for many curves\n this.zero = new BN(0).toRed(this.red);\n this.one = new BN(1).toRed(this.red);\n this.two = new BN(2).toRed(this.red);\n\n // Curve configuration, optional\n this.n = conf.n && new BN(conf.n, 16);\n this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);\n\n // Temporary arrays\n this._wnafT1 = new Array(4);\n this._wnafT2 = new Array(4);\n this._wnafT3 = new Array(4);\n this._wnafT4 = new Array(4);\n\n this._bitLength = this.n ? this.n.bitLength() : 0;\n\n // Generalized Greg Maxwell's trick\n var adjustCount = this.n && this.p.div(this.n);\n if (!adjustCount || adjustCount.cmpn(100) > 0) {\n this.redN = null;\n } else {\n this._maxwellTrick = true;\n this.redN = this.n.toRed(this.red);\n }\n}\nmodule.exports = BaseCurve;\n\nBaseCurve.prototype.point = function point() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype.validate = function validate() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {\n assert(p.precomputed);\n var doubles = p._getDoubles();\n\n var naf = getNAF(k, 1, this._bitLength);\n var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);\n I /= 3;\n\n // Translate into more windowed form\n var repr = [];\n var j;\n var nafW;\n for (j = 0; j < naf.length; j += doubles.step) {\n nafW = 0;\n for (var l = j + doubles.step - 1; l >= j; l--)\n nafW = (nafW << 1) + naf[l];\n repr.push(nafW);\n }\n\n var a = this.jpoint(null, null, null);\n var b = this.jpoint(null, null, null);\n for (var i = I; i > 0; i--) {\n for (j = 0; j < repr.length; j++) {\n nafW = repr[j];\n if (nafW === i)\n b = b.mixedAdd(doubles.points[j]);\n else if (nafW === -i)\n b = b.mixedAdd(doubles.points[j].neg());\n }\n a = a.add(b);\n }\n return a.toP();\n};\n\nBaseCurve.prototype._wnafMul = function _wnafMul(p, k) {\n var w = 4;\n\n // Precompute window\n var nafPoints = p._getNAFPoints(w);\n w = nafPoints.wnd;\n var wnd = nafPoints.points;\n\n // Get NAF form\n var naf = getNAF(k, w, this._bitLength);\n\n // Add `this`*(N+1) for every w-NAF index\n var acc = this.jpoint(null, null, null);\n for (var i = naf.length - 1; i >= 0; i--) {\n // Count zeroes\n for (var l = 0; i >= 0 && naf[i] === 0; i--)\n l++;\n if (i >= 0)\n l++;\n acc = acc.dblp(l);\n\n if (i < 0)\n break;\n var z = naf[i];\n assert(z !== 0);\n if (p.type === 'affine') {\n // J +- P\n if (z > 0)\n acc = acc.mixedAdd(wnd[(z - 1) >> 1]);\n else\n acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());\n } else {\n // J +- J\n if (z > 0)\n acc = acc.add(wnd[(z - 1) >> 1]);\n else\n acc = acc.add(wnd[(-z - 1) >> 1].neg());\n }\n }\n return p.type === 'affine' ? acc.toP() : acc;\n};\n\nBaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,\n points,\n coeffs,\n len,\n jacobianResult) {\n var wndWidth = this._wnafT1;\n var wnd = this._wnafT2;\n var naf = this._wnafT3;\n\n // Fill all arrays\n var max = 0;\n var i;\n var j;\n var p;\n for (i = 0; i < len; i++) {\n p = points[i];\n var nafPoints = p._getNAFPoints(defW);\n wndWidth[i] = nafPoints.wnd;\n wnd[i] = nafPoints.points;\n }\n\n // Comb small window NAFs\n for (i = len - 1; i >= 1; i -= 2) {\n var a = i - 1;\n var b = i;\n if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {\n naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength);\n naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength);\n max = Math.max(naf[a].length, max);\n max = Math.max(naf[b].length, max);\n continue;\n }\n\n var comb = [\n points[a], /* 1 */\n null, /* 3 */\n null, /* 5 */\n points[b], /* 7 */\n ];\n\n // Try to avoid Projective points, if possible\n if (points[a].y.cmp(points[b].y) === 0) {\n comb[1] = points[a].add(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].add(points[b].neg());\n } else {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n }\n\n var index = [\n -3, /* -1 -1 */\n -1, /* -1 0 */\n -5, /* -1 1 */\n -7, /* 0 -1 */\n 0, /* 0 0 */\n 7, /* 0 1 */\n 5, /* 1 -1 */\n 1, /* 1 0 */\n 3, /* 1 1 */\n ];\n\n var jsf = getJSF(coeffs[a], coeffs[b]);\n max = Math.max(jsf[0].length, max);\n naf[a] = new Array(max);\n naf[b] = new Array(max);\n for (j = 0; j < max; j++) {\n var ja = jsf[0][j] | 0;\n var jb = jsf[1][j] | 0;\n\n naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];\n naf[b][j] = 0;\n wnd[a] = comb;\n }\n }\n\n var acc = this.jpoint(null, null, null);\n var tmp = this._wnafT4;\n for (i = max; i >= 0; i--) {\n var k = 0;\n\n while (i >= 0) {\n var zero = true;\n for (j = 0; j < len; j++) {\n tmp[j] = naf[j][i] | 0;\n if (tmp[j] !== 0)\n zero = false;\n }\n if (!zero)\n break;\n k++;\n i--;\n }\n if (i >= 0)\n k++;\n acc = acc.dblp(k);\n if (i < 0)\n break;\n\n for (j = 0; j < len; j++) {\n var z = tmp[j];\n p;\n if (z === 0)\n continue;\n else if (z > 0)\n p = wnd[j][(z - 1) >> 1];\n else if (z < 0)\n p = wnd[j][(-z - 1) >> 1].neg();\n\n if (p.type === 'affine')\n acc = acc.mixedAdd(p);\n else\n acc = acc.add(p);\n }\n }\n // Zeroify references\n for (i = 0; i < len; i++)\n wnd[i] = null;\n\n if (jacobianResult)\n return acc;\n else\n return acc.toP();\n};\n\nfunction BasePoint(curve, type) {\n this.curve = curve;\n this.type = type;\n this.precomputed = null;\n}\nBaseCurve.BasePoint = BasePoint;\n\nBasePoint.prototype.eq = function eq(/*other*/) {\n throw new Error('Not implemented');\n};\n\nBasePoint.prototype.validate = function validate() {\n return this.curve.validate(this);\n};\n\nBaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {\n bytes = utils.toArray(bytes, enc);\n\n var len = this.p.byteLength();\n\n // uncompressed, hybrid-odd, hybrid-even\n if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&\n bytes.length - 1 === 2 * len) {\n if (bytes[0] === 0x06)\n assert(bytes[bytes.length - 1] % 2 === 0);\n else if (bytes[0] === 0x07)\n assert(bytes[bytes.length - 1] % 2 === 1);\n\n var res = this.point(bytes.slice(1, 1 + len),\n bytes.slice(1 + len, 1 + 2 * len));\n\n return res;\n } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) &&\n bytes.length - 1 === len) {\n return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);\n }\n throw new Error('Unknown point format');\n};\n\nBasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {\n return this.encode(enc, true);\n};\n\nBasePoint.prototype._encode = function _encode(compact) {\n var len = this.curve.p.byteLength();\n var x = this.getX().toArray('be', len);\n\n if (compact)\n return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);\n\n return [ 0x04 ].concat(x, this.getY().toArray('be', len));\n};\n\nBasePoint.prototype.encode = function encode(enc, compact) {\n return utils.encode(this._encode(compact), enc);\n};\n\nBasePoint.prototype.precompute = function precompute(power) {\n if (this.precomputed)\n return this;\n\n var precomputed = {\n doubles: null,\n naf: null,\n beta: null,\n };\n precomputed.naf = this._getNAFPoints(8);\n precomputed.doubles = this._getDoubles(4, power);\n precomputed.beta = this._getBeta();\n this.precomputed = precomputed;\n\n return this;\n};\n\nBasePoint.prototype._hasDoubles = function _hasDoubles(k) {\n if (!this.precomputed)\n return false;\n\n var doubles = this.precomputed.doubles;\n if (!doubles)\n return false;\n\n return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);\n};\n\nBasePoint.prototype._getDoubles = function _getDoubles(step, power) {\n if (this.precomputed && this.precomputed.doubles)\n return this.precomputed.doubles;\n\n var doubles = [ this ];\n var acc = this;\n for (var i = 0; i < power; i += step) {\n for (var j = 0; j < step; j++)\n acc = acc.dbl();\n doubles.push(acc);\n }\n return {\n step: step,\n points: doubles,\n };\n};\n\nBasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {\n if (this.precomputed && this.precomputed.naf)\n return this.precomputed.naf;\n\n var res = [ this ];\n var max = (1 << wnd) - 1;\n var dbl = max === 1 ? null : this.dbl();\n for (var i = 1; i < max; i++)\n res[i] = res[i - 1].add(dbl);\n return {\n wnd: wnd,\n points: res,\n };\n};\n\nBasePoint.prototype._getBeta = function _getBeta() {\n return null;\n};\n\nBasePoint.prototype.dblp = function dblp(k) {\n var r = this;\n for (var i = 0; i < k; i++)\n r = r.dbl();\n return r;\n};\n","'use strict';\n\nvar utils = require('../utils');\nvar BN = require('bn.js');\nvar inherits = require('inherits');\nvar Base = require('./base');\n\nvar assert = utils.assert;\n\nfunction ShortCurve(conf) {\n Base.call(this, 'short', conf);\n\n this.a = new BN(conf.a, 16).toRed(this.red);\n this.b = new BN(conf.b, 16).toRed(this.red);\n this.tinv = this.two.redInvm();\n\n this.zeroA = this.a.fromRed().cmpn(0) === 0;\n this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;\n\n // If the curve is endomorphic, precalculate beta and lambda\n this.endo = this._getEndomorphism(conf);\n this._endoWnafT1 = new Array(4);\n this._endoWnafT2 = new Array(4);\n}\ninherits(ShortCurve, Base);\nmodule.exports = ShortCurve;\n\nShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {\n // No efficient endomorphism\n if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)\n return;\n\n // Compute beta and lambda, that lambda * P = (beta * Px; Py)\n var beta;\n var lambda;\n if (conf.beta) {\n beta = new BN(conf.beta, 16).toRed(this.red);\n } else {\n var betas = this._getEndoRoots(this.p);\n // Choose the smallest beta\n beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];\n beta = beta.toRed(this.red);\n }\n if (conf.lambda) {\n lambda = new BN(conf.lambda, 16);\n } else {\n // Choose the lambda that is matching selected beta\n var lambdas = this._getEndoRoots(this.n);\n if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {\n lambda = lambdas[0];\n } else {\n lambda = lambdas[1];\n assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);\n }\n }\n\n // Get basis vectors, used for balanced length-two representation\n var basis;\n if (conf.basis) {\n basis = conf.basis.map(function(vec) {\n return {\n a: new BN(vec.a, 16),\n b: new BN(vec.b, 16),\n };\n });\n } else {\n basis = this._getEndoBasis(lambda);\n }\n\n return {\n beta: beta,\n lambda: lambda,\n basis: basis,\n };\n};\n\nShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {\n // Find roots of for x^2 + x + 1 in F\n // Root = (-1 +- Sqrt(-3)) / 2\n //\n var red = num === this.p ? this.red : BN.mont(num);\n var tinv = new BN(2).toRed(red).redInvm();\n var ntinv = tinv.redNeg();\n\n var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);\n\n var l1 = ntinv.redAdd(s).fromRed();\n var l2 = ntinv.redSub(s).fromRed();\n return [ l1, l2 ];\n};\n\nShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {\n // aprxSqrt >= sqrt(this.n)\n var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));\n\n // 3.74\n // Run EGCD, until r(L + 1) < aprxSqrt\n var u = lambda;\n var v = this.n.clone();\n var x1 = new BN(1);\n var y1 = new BN(0);\n var x2 = new BN(0);\n var y2 = new BN(1);\n\n // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)\n var a0;\n var b0;\n // First vector\n var a1;\n var b1;\n // Second vector\n var a2;\n var b2;\n\n var prevR;\n var i = 0;\n var r;\n var x;\n while (u.cmpn(0) !== 0) {\n var q = v.div(u);\n r = v.sub(q.mul(u));\n x = x2.sub(q.mul(x1));\n var y = y2.sub(q.mul(y1));\n\n if (!a1 && r.cmp(aprxSqrt) < 0) {\n a0 = prevR.neg();\n b0 = x1;\n a1 = r.neg();\n b1 = x;\n } else if (a1 && ++i === 2) {\n break;\n }\n prevR = r;\n\n v = u;\n u = r;\n x2 = x1;\n x1 = x;\n y2 = y1;\n y1 = y;\n }\n a2 = r.neg();\n b2 = x;\n\n var len1 = a1.sqr().add(b1.sqr());\n var len2 = a2.sqr().add(b2.sqr());\n if (len2.cmp(len1) >= 0) {\n a2 = a0;\n b2 = b0;\n }\n\n // Normalize signs\n if (a1.negative) {\n a1 = a1.neg();\n b1 = b1.neg();\n }\n if (a2.negative) {\n a2 = a2.neg();\n b2 = b2.neg();\n }\n\n return [\n { a: a1, b: b1 },\n { a: a2, b: b2 },\n ];\n};\n\nShortCurve.prototype._endoSplit = function _endoSplit(k) {\n var basis = this.endo.basis;\n var v1 = basis[0];\n var v2 = basis[1];\n\n var c1 = v2.b.mul(k).divRound(this.n);\n var c2 = v1.b.neg().mul(k).divRound(this.n);\n\n var p1 = c1.mul(v1.a);\n var p2 = c2.mul(v2.a);\n var q1 = c1.mul(v1.b);\n var q2 = c2.mul(v2.b);\n\n // Calculate answer\n var k1 = k.sub(p1).sub(p2);\n var k2 = q1.add(q2).neg();\n return { k1: k1, k2: k2 };\n};\n\nShortCurve.prototype.pointFromX = function pointFromX(x, odd) {\n x = new BN(x, 16);\n if (!x.red)\n x = x.toRed(this.red);\n\n var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);\n var y = y2.redSqrt();\n if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)\n throw new Error('invalid point');\n\n // XXX Is there any way to tell if the number is odd without converting it\n // to non-red form?\n var isOdd = y.fromRed().isOdd();\n if (odd && !isOdd || !odd && isOdd)\n y = y.redNeg();\n\n return this.point(x, y);\n};\n\nShortCurve.prototype.validate = function validate(point) {\n if (point.inf)\n return true;\n\n var x = point.x;\n var y = point.y;\n\n var ax = this.a.redMul(x);\n var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);\n return y.redSqr().redISub(rhs).cmpn(0) === 0;\n};\n\nShortCurve.prototype._endoWnafMulAdd =\n function _endoWnafMulAdd(points, coeffs, jacobianResult) {\n var npoints = this._endoWnafT1;\n var ncoeffs = this._endoWnafT2;\n for (var i = 0; i < points.length; i++) {\n var split = this._endoSplit(coeffs[i]);\n var p = points[i];\n var beta = p._getBeta();\n\n if (split.k1.negative) {\n split.k1.ineg();\n p = p.neg(true);\n }\n if (split.k2.negative) {\n split.k2.ineg();\n beta = beta.neg(true);\n }\n\n npoints[i * 2] = p;\n npoints[i * 2 + 1] = beta;\n ncoeffs[i * 2] = split.k1;\n ncoeffs[i * 2 + 1] = split.k2;\n }\n var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult);\n\n // Clean-up references to points and coefficients\n for (var j = 0; j < i * 2; j++) {\n npoints[j] = null;\n ncoeffs[j] = null;\n }\n return res;\n };\n\nfunction Point(curve, x, y, isRed) {\n Base.BasePoint.call(this, curve, 'affine');\n if (x === null && y === null) {\n this.x = null;\n this.y = null;\n this.inf = true;\n } else {\n this.x = new BN(x, 16);\n this.y = new BN(y, 16);\n // Force redgomery representation when loading from JSON\n if (isRed) {\n this.x.forceRed(this.curve.red);\n this.y.forceRed(this.curve.red);\n }\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n this.inf = false;\n }\n}\ninherits(Point, Base.BasePoint);\n\nShortCurve.prototype.point = function point(x, y, isRed) {\n return new Point(this, x, y, isRed);\n};\n\nShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {\n return Point.fromJSON(this, obj, red);\n};\n\nPoint.prototype._getBeta = function _getBeta() {\n if (!this.curve.endo)\n return;\n\n var pre = this.precomputed;\n if (pre && pre.beta)\n return pre.beta;\n\n var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);\n if (pre) {\n var curve = this.curve;\n var endoMul = function(p) {\n return curve.point(p.x.redMul(curve.endo.beta), p.y);\n };\n pre.beta = beta;\n beta.precomputed = {\n beta: null,\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(endoMul),\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(endoMul),\n },\n };\n }\n return beta;\n};\n\nPoint.prototype.toJSON = function toJSON() {\n if (!this.precomputed)\n return [ this.x, this.y ];\n\n return [ this.x, this.y, this.precomputed && {\n doubles: this.precomputed.doubles && {\n step: this.precomputed.doubles.step,\n points: this.precomputed.doubles.points.slice(1),\n },\n naf: this.precomputed.naf && {\n wnd: this.precomputed.naf.wnd,\n points: this.precomputed.naf.points.slice(1),\n },\n } ];\n};\n\nPoint.fromJSON = function fromJSON(curve, obj, red) {\n if (typeof obj === 'string')\n obj = JSON.parse(obj);\n var res = curve.point(obj[0], obj[1], red);\n if (!obj[2])\n return res;\n\n function obj2point(obj) {\n return curve.point(obj[0], obj[1], red);\n }\n\n var pre = obj[2];\n res.precomputed = {\n beta: null,\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: [ res ].concat(pre.doubles.points.map(obj2point)),\n },\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: [ res ].concat(pre.naf.points.map(obj2point)),\n },\n };\n return res;\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n return this.inf;\n};\n\nPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.inf)\n return p;\n\n // P + O = P\n if (p.inf)\n return this;\n\n // P + P = 2P\n if (this.eq(p))\n return this.dbl();\n\n // P + (-P) = O\n if (this.neg().eq(p))\n return this.curve.point(null, null);\n\n // P + Q = O\n if (this.x.cmp(p.x) === 0)\n return this.curve.point(null, null);\n\n var c = this.y.redSub(p.y);\n if (c.cmpn(0) !== 0)\n c = c.redMul(this.x.redSub(p.x).redInvm());\n var nx = c.redSqr().redISub(this.x).redISub(p.x);\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.dbl = function dbl() {\n if (this.inf)\n return this;\n\n // 2P = O\n var ys1 = this.y.redAdd(this.y);\n if (ys1.cmpn(0) === 0)\n return this.curve.point(null, null);\n\n var a = this.curve.a;\n\n var x2 = this.x.redSqr();\n var dyinv = ys1.redInvm();\n var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);\n\n var nx = c.redSqr().redISub(this.x.redAdd(this.x));\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.getX = function getX() {\n return this.x.fromRed();\n};\n\nPoint.prototype.getY = function getY() {\n return this.y.fromRed();\n};\n\nPoint.prototype.mul = function mul(k) {\n k = new BN(k, 16);\n if (this.isInfinity())\n return this;\n else if (this._hasDoubles(k))\n return this.curve._fixedNafMul(this, k);\n else if (this.curve.endo)\n return this.curve._endoWnafMulAdd([ this ], [ k ]);\n else\n return this.curve._wnafMul(this, k);\n};\n\nPoint.prototype.mulAdd = function mulAdd(k1, p2, k2) {\n var points = [ this, p2 ];\n var coeffs = [ k1, k2 ];\n if (this.curve.endo)\n return this.curve._endoWnafMulAdd(points, coeffs);\n else\n return this.curve._wnafMulAdd(1, points, coeffs, 2);\n};\n\nPoint.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {\n var points = [ this, p2 ];\n var coeffs = [ k1, k2 ];\n if (this.curve.endo)\n return this.curve._endoWnafMulAdd(points, coeffs, true);\n else\n return this.curve._wnafMulAdd(1, points, coeffs, 2, true);\n};\n\nPoint.prototype.eq = function eq(p) {\n return this === p ||\n this.inf === p.inf &&\n (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);\n};\n\nPoint.prototype.neg = function neg(_precompute) {\n if (this.inf)\n return this;\n\n var res = this.curve.point(this.x, this.y.redNeg());\n if (_precompute && this.precomputed) {\n var pre = this.precomputed;\n var negate = function(p) {\n return p.neg();\n };\n res.precomputed = {\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(negate),\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(negate),\n },\n };\n }\n return res;\n};\n\nPoint.prototype.toJ = function toJ() {\n if (this.inf)\n return this.curve.jpoint(null, null, null);\n\n var res = this.curve.jpoint(this.x, this.y, this.curve.one);\n return res;\n};\n\nfunction JPoint(curve, x, y, z) {\n Base.BasePoint.call(this, curve, 'jacobian');\n if (x === null && y === null && z === null) {\n this.x = this.curve.one;\n this.y = this.curve.one;\n this.z = new BN(0);\n } else {\n this.x = new BN(x, 16);\n this.y = new BN(y, 16);\n this.z = new BN(z, 16);\n }\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n if (!this.z.red)\n this.z = this.z.toRed(this.curve.red);\n\n this.zOne = this.z === this.curve.one;\n}\ninherits(JPoint, Base.BasePoint);\n\nShortCurve.prototype.jpoint = function jpoint(x, y, z) {\n return new JPoint(this, x, y, z);\n};\n\nJPoint.prototype.toP = function toP() {\n if (this.isInfinity())\n return this.curve.point(null, null);\n\n var zinv = this.z.redInvm();\n var zinv2 = zinv.redSqr();\n var ax = this.x.redMul(zinv2);\n var ay = this.y.redMul(zinv2).redMul(zinv);\n\n return this.curve.point(ax, ay);\n};\n\nJPoint.prototype.neg = function neg() {\n return this.curve.jpoint(this.x, this.y.redNeg(), this.z);\n};\n\nJPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.isInfinity())\n return p;\n\n // P + O = P\n if (p.isInfinity())\n return this;\n\n // 12M + 4S + 7A\n var pz2 = p.z.redSqr();\n var z2 = this.z.redSqr();\n var u1 = this.x.redMul(pz2);\n var u2 = p.x.redMul(z2);\n var s1 = this.y.redMul(pz2.redMul(p.z));\n var s2 = p.y.redMul(z2.redMul(this.z));\n\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0)\n return this.curve.jpoint(null, null, null);\n else\n return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(p.z).redMul(h);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mixedAdd = function mixedAdd(p) {\n // O + P = P\n if (this.isInfinity())\n return p.toJ();\n\n // P + O = P\n if (p.isInfinity())\n return this;\n\n // 8M + 3S + 7A\n var z2 = this.z.redSqr();\n var u1 = this.x;\n var u2 = p.x.redMul(z2);\n var s1 = this.y;\n var s2 = p.y.redMul(z2).redMul(this.z);\n\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0)\n return this.curve.jpoint(null, null, null);\n else\n return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(h);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.dblp = function dblp(pow) {\n if (pow === 0)\n return this;\n if (this.isInfinity())\n return this;\n if (!pow)\n return this.dbl();\n\n var i;\n if (this.curve.zeroA || this.curve.threeA) {\n var r = this;\n for (i = 0; i < pow; i++)\n r = r.dbl();\n return r;\n }\n\n // 1M + 2S + 1A + N * (4S + 5M + 8A)\n // N = 1 => 6M + 6S + 9A\n var a = this.curve.a;\n var tinv = this.curve.tinv;\n\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr();\n\n // Reuse results\n var jyd = jy.redAdd(jy);\n for (i = 0; i < pow; i++) {\n var jx2 = jx.redSqr();\n var jyd2 = jyd.redSqr();\n var jyd4 = jyd2.redSqr();\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n\n var t1 = jx.redMul(jyd2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n var dny = c.redMul(t2);\n dny = dny.redIAdd(dny).redISub(jyd4);\n var nz = jyd.redMul(jz);\n if (i + 1 < pow)\n jz4 = jz4.redMul(jyd4);\n\n jx = nx;\n jz = nz;\n jyd = dny;\n }\n\n return this.curve.jpoint(jx, jyd.redMul(tinv), jz);\n};\n\nJPoint.prototype.dbl = function dbl() {\n if (this.isInfinity())\n return this;\n\n if (this.curve.zeroA)\n return this._zeroDbl();\n else if (this.curve.threeA)\n return this._threeDbl();\n else\n return this._dbl();\n};\n\nJPoint.prototype._zeroDbl = function _zeroDbl() {\n var nx;\n var ny;\n var nz;\n // Z = 1\n if (this.zOne) {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html\n // #doubling-mdbl-2007-bl\n // 1M + 5S + 14A\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n // M = 3 * XX + a; a = 0\n var m = xx.redAdd(xx).redIAdd(xx);\n // T = M ^ 2 - 2*S\n var t = m.redSqr().redISub(s).redISub(s);\n\n // 8 * YYYY\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n\n // X3 = T\n nx = t;\n // Y3 = M * (S - T) - 8 * YYYY\n ny = m.redMul(s.redISub(t)).redISub(yyyy8);\n // Z3 = 2*Y1\n nz = this.y.redAdd(this.y);\n } else {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html\n // #doubling-dbl-2009-l\n // 2M + 5S + 13A\n\n // A = X1^2\n var a = this.x.redSqr();\n // B = Y1^2\n var b = this.y.redSqr();\n // C = B^2\n var c = b.redSqr();\n // D = 2 * ((X1 + B)^2 - A - C)\n var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);\n d = d.redIAdd(d);\n // E = 3 * A\n var e = a.redAdd(a).redIAdd(a);\n // F = E^2\n var f = e.redSqr();\n\n // 8 * C\n var c8 = c.redIAdd(c);\n c8 = c8.redIAdd(c8);\n c8 = c8.redIAdd(c8);\n\n // X3 = F - 2 * D\n nx = f.redISub(d).redISub(d);\n // Y3 = E * (D - X3) - 8 * C\n ny = e.redMul(d.redISub(nx)).redISub(c8);\n // Z3 = 2 * Y1 * Z1\n nz = this.y.redMul(this.z);\n nz = nz.redIAdd(nz);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._threeDbl = function _threeDbl() {\n var nx;\n var ny;\n var nz;\n // Z = 1\n if (this.zOne) {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html\n // #doubling-mdbl-2007-bl\n // 1M + 5S + 15A\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n // M = 3 * XX + a\n var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);\n // T = M^2 - 2 * S\n var t = m.redSqr().redISub(s).redISub(s);\n // X3 = T\n nx = t;\n // Y3 = M * (S - T) - 8 * YYYY\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n ny = m.redMul(s.redISub(t)).redISub(yyyy8);\n // Z3 = 2 * Y1\n nz = this.y.redAdd(this.y);\n } else {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b\n // 3M + 5S\n\n // delta = Z1^2\n var delta = this.z.redSqr();\n // gamma = Y1^2\n var gamma = this.y.redSqr();\n // beta = X1 * gamma\n var beta = this.x.redMul(gamma);\n // alpha = 3 * (X1 - delta) * (X1 + delta)\n var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));\n alpha = alpha.redAdd(alpha).redIAdd(alpha);\n // X3 = alpha^2 - 8 * beta\n var beta4 = beta.redIAdd(beta);\n beta4 = beta4.redIAdd(beta4);\n var beta8 = beta4.redAdd(beta4);\n nx = alpha.redSqr().redISub(beta8);\n // Z3 = (Y1 + Z1)^2 - gamma - delta\n nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);\n // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2\n var ggamma8 = gamma.redSqr();\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._dbl = function _dbl() {\n var a = this.curve.a;\n\n // 4M + 6S + 10A\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr();\n\n var jx2 = jx.redSqr();\n var jy2 = jy.redSqr();\n\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n\n var jxd4 = jx.redAdd(jx);\n jxd4 = jxd4.redIAdd(jxd4);\n var t1 = jxd4.redMul(jy2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n\n var jyd8 = jy2.redSqr();\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n var ny = c.redMul(t2).redISub(jyd8);\n var nz = jy.redAdd(jy).redMul(jz);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.trpl = function trpl() {\n if (!this.curve.zeroA)\n return this.dbl().add(this);\n\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl\n // 5M + 10S + ...\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // ZZ = Z1^2\n var zz = this.z.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // M = 3 * XX + a * ZZ2; a = 0\n var m = xx.redAdd(xx).redIAdd(xx);\n // MM = M^2\n var mm = m.redSqr();\n // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM\n var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n e = e.redIAdd(e);\n e = e.redAdd(e).redIAdd(e);\n e = e.redISub(mm);\n // EE = E^2\n var ee = e.redSqr();\n // T = 16*YYYY\n var t = yyyy.redIAdd(yyyy);\n t = t.redIAdd(t);\n t = t.redIAdd(t);\n t = t.redIAdd(t);\n // U = (M + E)^2 - MM - EE - T\n var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);\n // X3 = 4 * (X1 * EE - 4 * YY * U)\n var yyu4 = yy.redMul(u);\n yyu4 = yyu4.redIAdd(yyu4);\n yyu4 = yyu4.redIAdd(yyu4);\n var nx = this.x.redMul(ee).redISub(yyu4);\n nx = nx.redIAdd(nx);\n nx = nx.redIAdd(nx);\n // Y3 = 8 * Y1 * (U * (T - U) - E * EE)\n var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny);\n // Z3 = (Z1 + E)^2 - ZZ - EE\n var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mul = function mul(k, kbase) {\n k = new BN(k, kbase);\n\n return this.curve._wnafMul(this, k);\n};\n\nJPoint.prototype.eq = function eq(p) {\n if (p.type === 'affine')\n return this.eq(p.toJ());\n\n if (this === p)\n return true;\n\n // x1 * z2^2 == x2 * z1^2\n var z2 = this.z.redSqr();\n var pz2 = p.z.redSqr();\n if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)\n return false;\n\n // y1 * z2^3 == y2 * z1^3\n var z3 = z2.redMul(this.z);\n var pz3 = pz2.redMul(p.z);\n return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;\n};\n\nJPoint.prototype.eqXToP = function eqXToP(x) {\n var zs = this.z.redSqr();\n var rx = x.toRed(this.curve.red).redMul(zs);\n if (this.x.cmp(rx) === 0)\n return true;\n\n var xc = x.clone();\n var t = this.curve.redN.redMul(zs);\n for (;;) {\n xc.iadd(this.curve.n);\n if (xc.cmp(this.curve.p) >= 0)\n return false;\n\n rx.redIAdd(t);\n if (this.x.cmp(rx) === 0)\n return true;\n }\n};\n\nJPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nJPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.z.cmpn(0) === 0;\n};\n","'use strict';\n\nvar BN = require('bn.js');\nvar inherits = require('inherits');\nvar Base = require('./base');\n\nvar utils = require('../utils');\n\nfunction MontCurve(conf) {\n Base.call(this, 'mont', conf);\n\n this.a = new BN(conf.a, 16).toRed(this.red);\n this.b = new BN(conf.b, 16).toRed(this.red);\n this.i4 = new BN(4).toRed(this.red).redInvm();\n this.two = new BN(2).toRed(this.red);\n this.a24 = this.i4.redMul(this.a.redAdd(this.two));\n}\ninherits(MontCurve, Base);\nmodule.exports = MontCurve;\n\nMontCurve.prototype.validate = function validate(point) {\n var x = point.normalize().x;\n var x2 = x.redSqr();\n var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);\n var y = rhs.redSqrt();\n\n return y.redSqr().cmp(rhs) === 0;\n};\n\nfunction Point(curve, x, z) {\n Base.BasePoint.call(this, curve, 'projective');\n if (x === null && z === null) {\n this.x = this.curve.one;\n this.z = this.curve.zero;\n } else {\n this.x = new BN(x, 16);\n this.z = new BN(z, 16);\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.z.red)\n this.z = this.z.toRed(this.curve.red);\n }\n}\ninherits(Point, Base.BasePoint);\n\nMontCurve.prototype.decodePoint = function decodePoint(bytes, enc) {\n return this.point(utils.toArray(bytes, enc), 1);\n};\n\nMontCurve.prototype.point = function point(x, z) {\n return new Point(this, x, z);\n};\n\nMontCurve.prototype.pointFromJSON = function pointFromJSON(obj) {\n return Point.fromJSON(this, obj);\n};\n\nPoint.prototype.precompute = function precompute() {\n // No-op\n};\n\nPoint.prototype._encode = function _encode() {\n return this.getX().toArray('be', this.curve.p.byteLength());\n};\n\nPoint.fromJSON = function fromJSON(curve, obj) {\n return new Point(curve, obj[0], obj[1] || curve.one);\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.z.cmpn(0) === 0;\n};\n\nPoint.prototype.dbl = function dbl() {\n // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3\n // 2M + 2S + 4A\n\n // A = X1 + Z1\n var a = this.x.redAdd(this.z);\n // AA = A^2\n var aa = a.redSqr();\n // B = X1 - Z1\n var b = this.x.redSub(this.z);\n // BB = B^2\n var bb = b.redSqr();\n // C = AA - BB\n var c = aa.redSub(bb);\n // X3 = AA * BB\n var nx = aa.redMul(bb);\n // Z3 = C * (BB + A24 * C)\n var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));\n return this.curve.point(nx, nz);\n};\n\nPoint.prototype.add = function add() {\n throw new Error('Not supported on Montgomery curve');\n};\n\nPoint.prototype.diffAdd = function diffAdd(p, diff) {\n // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3\n // 4M + 2S + 6A\n\n // A = X2 + Z2\n var a = this.x.redAdd(this.z);\n // B = X2 - Z2\n var b = this.x.redSub(this.z);\n // C = X3 + Z3\n var c = p.x.redAdd(p.z);\n // D = X3 - Z3\n var d = p.x.redSub(p.z);\n // DA = D * A\n var da = d.redMul(a);\n // CB = C * B\n var cb = c.redMul(b);\n // X5 = Z1 * (DA + CB)^2\n var nx = diff.z.redMul(da.redAdd(cb).redSqr());\n // Z5 = X1 * (DA - CB)^2\n var nz = diff.x.redMul(da.redISub(cb).redSqr());\n return this.curve.point(nx, nz);\n};\n\nPoint.prototype.mul = function mul(k) {\n var t = k.clone();\n var a = this; // (N / 2) * Q + Q\n var b = this.curve.point(null, null); // (N / 2) * Q\n var c = this; // Q\n\n for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1))\n bits.push(t.andln(1));\n\n for (var i = bits.length - 1; i >= 0; i--) {\n if (bits[i] === 0) {\n // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q\n a = a.diffAdd(b, c);\n // N * Q = 2 * ((N / 2) * Q + Q))\n b = b.dbl();\n } else {\n // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q)\n b = a.diffAdd(b, c);\n // N * Q + Q = 2 * ((N / 2) * Q + Q)\n a = a.dbl();\n }\n }\n return b;\n};\n\nPoint.prototype.mulAdd = function mulAdd() {\n throw new Error('Not supported on Montgomery curve');\n};\n\nPoint.prototype.jumlAdd = function jumlAdd() {\n throw new Error('Not supported on Montgomery curve');\n};\n\nPoint.prototype.eq = function eq(other) {\n return this.getX().cmp(other.getX()) === 0;\n};\n\nPoint.prototype.normalize = function normalize() {\n this.x = this.x.redMul(this.z.redInvm());\n this.z = this.curve.one;\n return this;\n};\n\nPoint.prototype.getX = function getX() {\n // Normalize coordinates\n this.normalize();\n\n return this.x.fromRed();\n};\n","'use strict';\n\nvar utils = require('../utils');\nvar BN = require('bn.js');\nvar inherits = require('inherits');\nvar Base = require('./base');\n\nvar assert = utils.assert;\n\nfunction EdwardsCurve(conf) {\n // NOTE: Important as we are creating point in Base.call()\n this.twisted = (conf.a | 0) !== 1;\n this.mOneA = this.twisted && (conf.a | 0) === -1;\n this.extended = this.mOneA;\n\n Base.call(this, 'edwards', conf);\n\n this.a = new BN(conf.a, 16).umod(this.red.m);\n this.a = this.a.toRed(this.red);\n this.c = new BN(conf.c, 16).toRed(this.red);\n this.c2 = this.c.redSqr();\n this.d = new BN(conf.d, 16).toRed(this.red);\n this.dd = this.d.redAdd(this.d);\n\n assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);\n this.oneC = (conf.c | 0) === 1;\n}\ninherits(EdwardsCurve, Base);\nmodule.exports = EdwardsCurve;\n\nEdwardsCurve.prototype._mulA = function _mulA(num) {\n if (this.mOneA)\n return num.redNeg();\n else\n return this.a.redMul(num);\n};\n\nEdwardsCurve.prototype._mulC = function _mulC(num) {\n if (this.oneC)\n return num;\n else\n return this.c.redMul(num);\n};\n\n// Just for compatibility with Short curve\nEdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {\n return this.point(x, y, z, t);\n};\n\nEdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) {\n x = new BN(x, 16);\n if (!x.red)\n x = x.toRed(this.red);\n\n var x2 = x.redSqr();\n var rhs = this.c2.redSub(this.a.redMul(x2));\n var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));\n\n var y2 = rhs.redMul(lhs.redInvm());\n var y = y2.redSqrt();\n if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)\n throw new Error('invalid point');\n\n var isOdd = y.fromRed().isOdd();\n if (odd && !isOdd || !odd && isOdd)\n y = y.redNeg();\n\n return this.point(x, y);\n};\n\nEdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) {\n y = new BN(y, 16);\n if (!y.red)\n y = y.toRed(this.red);\n\n // x^2 = (y^2 - c^2) / (c^2 d y^2 - a)\n var y2 = y.redSqr();\n var lhs = y2.redSub(this.c2);\n var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a);\n var x2 = lhs.redMul(rhs.redInvm());\n\n if (x2.cmp(this.zero) === 0) {\n if (odd)\n throw new Error('invalid point');\n else\n return this.point(this.zero, y);\n }\n\n var x = x2.redSqrt();\n if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)\n throw new Error('invalid point');\n\n if (x.fromRed().isOdd() !== odd)\n x = x.redNeg();\n\n return this.point(x, y);\n};\n\nEdwardsCurve.prototype.validate = function validate(point) {\n if (point.isInfinity())\n return true;\n\n // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)\n point.normalize();\n\n var x2 = point.x.redSqr();\n var y2 = point.y.redSqr();\n var lhs = x2.redMul(this.a).redAdd(y2);\n var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));\n\n return lhs.cmp(rhs) === 0;\n};\n\nfunction Point(curve, x, y, z, t) {\n Base.BasePoint.call(this, curve, 'projective');\n if (x === null && y === null && z === null) {\n this.x = this.curve.zero;\n this.y = this.curve.one;\n this.z = this.curve.one;\n this.t = this.curve.zero;\n this.zOne = true;\n } else {\n this.x = new BN(x, 16);\n this.y = new BN(y, 16);\n this.z = z ? new BN(z, 16) : this.curve.one;\n this.t = t && new BN(t, 16);\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n if (!this.z.red)\n this.z = this.z.toRed(this.curve.red);\n if (this.t && !this.t.red)\n this.t = this.t.toRed(this.curve.red);\n this.zOne = this.z === this.curve.one;\n\n // Use extended coordinates\n if (this.curve.extended && !this.t) {\n this.t = this.x.redMul(this.y);\n if (!this.zOne)\n this.t = this.t.redMul(this.z.redInvm());\n }\n }\n}\ninherits(Point, Base.BasePoint);\n\nEdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {\n return Point.fromJSON(this, obj);\n};\n\nEdwardsCurve.prototype.point = function point(x, y, z, t) {\n return new Point(this, x, y, z, t);\n};\n\nPoint.fromJSON = function fromJSON(curve, obj) {\n return new Point(curve, obj[0], obj[1], obj[2]);\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.x.cmpn(0) === 0 &&\n (this.y.cmp(this.z) === 0 ||\n (this.zOne && this.y.cmp(this.curve.c) === 0));\n};\n\nPoint.prototype._extDbl = function _extDbl() {\n // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html\n // #doubling-dbl-2008-hwcd\n // 4M + 4S\n\n // A = X1^2\n var a = this.x.redSqr();\n // B = Y1^2\n var b = this.y.redSqr();\n // C = 2 * Z1^2\n var c = this.z.redSqr();\n c = c.redIAdd(c);\n // D = a * A\n var d = this.curve._mulA(a);\n // E = (X1 + Y1)^2 - A - B\n var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);\n // G = D + B\n var g = d.redAdd(b);\n // F = G - C\n var f = g.redSub(c);\n // H = D - B\n var h = d.redSub(b);\n // X3 = E * F\n var nx = e.redMul(f);\n // Y3 = G * H\n var ny = g.redMul(h);\n // T3 = E * H\n var nt = e.redMul(h);\n // Z3 = F * G\n var nz = f.redMul(g);\n return this.curve.point(nx, ny, nz, nt);\n};\n\nPoint.prototype._projDbl = function _projDbl() {\n // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html\n // #doubling-dbl-2008-bbjlp\n // #doubling-dbl-2007-bl\n // and others\n // Generally 3M + 4S or 2M + 4S\n\n // B = (X1 + Y1)^2\n var b = this.x.redAdd(this.y).redSqr();\n // C = X1^2\n var c = this.x.redSqr();\n // D = Y1^2\n var d = this.y.redSqr();\n\n var nx;\n var ny;\n var nz;\n var e;\n var h;\n var j;\n if (this.curve.twisted) {\n // E = a * C\n e = this.curve._mulA(c);\n // F = E + D\n var f = e.redAdd(d);\n if (this.zOne) {\n // X3 = (B - C - D) * (F - 2)\n nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));\n // Y3 = F * (E - D)\n ny = f.redMul(e.redSub(d));\n // Z3 = F^2 - 2 * F\n nz = f.redSqr().redSub(f).redSub(f);\n } else {\n // H = Z1^2\n h = this.z.redSqr();\n // J = F - 2 * H\n j = f.redSub(h).redISub(h);\n // X3 = (B-C-D)*J\n nx = b.redSub(c).redISub(d).redMul(j);\n // Y3 = F * (E - D)\n ny = f.redMul(e.redSub(d));\n // Z3 = F * J\n nz = f.redMul(j);\n }\n } else {\n // E = C + D\n e = c.redAdd(d);\n // H = (c * Z1)^2\n h = this.curve._mulC(this.z).redSqr();\n // J = E - 2 * H\n j = e.redSub(h).redSub(h);\n // X3 = c * (B - E) * J\n nx = this.curve._mulC(b.redISub(e)).redMul(j);\n // Y3 = c * E * (C - D)\n ny = this.curve._mulC(e).redMul(c.redISub(d));\n // Z3 = E * J\n nz = e.redMul(j);\n }\n return this.curve.point(nx, ny, nz);\n};\n\nPoint.prototype.dbl = function dbl() {\n if (this.isInfinity())\n return this;\n\n // Double in extended coordinates\n if (this.curve.extended)\n return this._extDbl();\n else\n return this._projDbl();\n};\n\nPoint.prototype._extAdd = function _extAdd(p) {\n // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html\n // #addition-add-2008-hwcd-3\n // 8M\n\n // A = (Y1 - X1) * (Y2 - X2)\n var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x));\n // B = (Y1 + X1) * (Y2 + X2)\n var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));\n // C = T1 * k * T2\n var c = this.t.redMul(this.curve.dd).redMul(p.t);\n // D = Z1 * 2 * Z2\n var d = this.z.redMul(p.z.redAdd(p.z));\n // E = B - A\n var e = b.redSub(a);\n // F = D - C\n var f = d.redSub(c);\n // G = D + C\n var g = d.redAdd(c);\n // H = B + A\n var h = b.redAdd(a);\n // X3 = E * F\n var nx = e.redMul(f);\n // Y3 = G * H\n var ny = g.redMul(h);\n // T3 = E * H\n var nt = e.redMul(h);\n // Z3 = F * G\n var nz = f.redMul(g);\n return this.curve.point(nx, ny, nz, nt);\n};\n\nPoint.prototype._projAdd = function _projAdd(p) {\n // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html\n // #addition-add-2008-bbjlp\n // #addition-add-2007-bl\n // 10M + 1S\n\n // A = Z1 * Z2\n var a = this.z.redMul(p.z);\n // B = A^2\n var b = a.redSqr();\n // C = X1 * X2\n var c = this.x.redMul(p.x);\n // D = Y1 * Y2\n var d = this.y.redMul(p.y);\n // E = d * C * D\n var e = this.curve.d.redMul(c).redMul(d);\n // F = B - E\n var f = b.redSub(e);\n // G = B + E\n var g = b.redAdd(e);\n // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)\n var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);\n var nx = a.redMul(f).redMul(tmp);\n var ny;\n var nz;\n if (this.curve.twisted) {\n // Y3 = A * G * (D - a * C)\n ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));\n // Z3 = F * G\n nz = f.redMul(g);\n } else {\n // Y3 = A * G * (D - C)\n ny = a.redMul(g).redMul(d.redSub(c));\n // Z3 = c * F * G\n nz = this.curve._mulC(f).redMul(g);\n }\n return this.curve.point(nx, ny, nz);\n};\n\nPoint.prototype.add = function add(p) {\n if (this.isInfinity())\n return p;\n if (p.isInfinity())\n return this;\n\n if (this.curve.extended)\n return this._extAdd(p);\n else\n return this._projAdd(p);\n};\n\nPoint.prototype.mul = function mul(k) {\n if (this._hasDoubles(k))\n return this.curve._fixedNafMul(this, k);\n else\n return this.curve._wnafMul(this, k);\n};\n\nPoint.prototype.mulAdd = function mulAdd(k1, p, k2) {\n return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false);\n};\n\nPoint.prototype.jmulAdd = function jmulAdd(k1, p, k2) {\n return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true);\n};\n\nPoint.prototype.normalize = function normalize() {\n if (this.zOne)\n return this;\n\n // Normalize coordinates\n var zi = this.z.redInvm();\n this.x = this.x.redMul(zi);\n this.y = this.y.redMul(zi);\n if (this.t)\n this.t = this.t.redMul(zi);\n this.z = this.curve.one;\n this.zOne = true;\n return this;\n};\n\nPoint.prototype.neg = function neg() {\n return this.curve.point(this.x.redNeg(),\n this.y,\n this.z,\n this.t && this.t.redNeg());\n};\n\nPoint.prototype.getX = function getX() {\n this.normalize();\n return this.x.fromRed();\n};\n\nPoint.prototype.getY = function getY() {\n this.normalize();\n return this.y.fromRed();\n};\n\nPoint.prototype.eq = function eq(other) {\n return this === other ||\n this.getX().cmp(other.getX()) === 0 &&\n this.getY().cmp(other.getY()) === 0;\n};\n\nPoint.prototype.eqXToP = function eqXToP(x) {\n var rx = x.toRed(this.curve.red).redMul(this.z);\n if (this.x.cmp(rx) === 0)\n return true;\n\n var xc = x.clone();\n var t = this.curve.redN.redMul(this.z);\n for (;;) {\n xc.iadd(this.curve.n);\n if (xc.cmp(this.curve.p) >= 0)\n return false;\n\n rx.redIAdd(t);\n if (this.x.cmp(rx) === 0)\n return true;\n }\n};\n\n// Compatibility with BaseCurve\nPoint.prototype.toP = Point.prototype.normalize;\nPoint.prototype.mixedAdd = Point.prototype.add;\n","'use strict';\n\nvar curve = exports;\n\ncurve.base = require('./base');\ncurve.short = require('./short');\ncurve.mont = require('./mont');\ncurve.edwards = require('./edwards');\n","'use strict';\n\nvar assert = require('minimalistic-assert');\nvar inherits = require('inherits');\n\nexports.inherits = inherits;\n\nfunction isSurrogatePair(msg, i) {\n if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) {\n return false;\n }\n if (i < 0 || i + 1 >= msg.length) {\n return false;\n }\n return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00;\n}\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg === 'string') {\n if (!enc) {\n // Inspired by stringToUtf8ByteArray() in closure-library by Google\n // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143\n // Apache License 2.0\n // https://github.com/google/closure-library/blob/master/LICENSE\n var p = 0;\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n if (c < 128) {\n res[p++] = c;\n } else if (c < 2048) {\n res[p++] = (c >> 6) | 192;\n res[p++] = (c & 63) | 128;\n } else if (isSurrogatePair(msg, i)) {\n c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF);\n res[p++] = (c >> 18) | 240;\n res[p++] = ((c >> 12) & 63) | 128;\n res[p++] = ((c >> 6) & 63) | 128;\n res[p++] = (c & 63) | 128;\n } else {\n res[p++] = (c >> 12) | 224;\n res[p++] = ((c >> 6) & 63) | 128;\n res[p++] = (c & 63) | 128;\n }\n }\n } else if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0)\n msg = '0' + msg;\n for (i = 0; i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n }\n } else {\n for (i = 0; i < msg.length; i++)\n res[i] = msg[i] | 0;\n }\n return res;\n}\nexports.toArray = toArray;\n\nfunction toHex(msg) {\n var res = '';\n for (var i = 0; i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n}\nexports.toHex = toHex;\n\nfunction htonl(w) {\n var res = (w >>> 24) |\n ((w >>> 8) & 0xff00) |\n ((w << 8) & 0xff0000) |\n ((w & 0xff) << 24);\n return res >>> 0;\n}\nexports.htonl = htonl;\n\nfunction toHex32(msg, endian) {\n var res = '';\n for (var i = 0; i < msg.length; i++) {\n var w = msg[i];\n if (endian === 'little')\n w = htonl(w);\n res += zero8(w.toString(16));\n }\n return res;\n}\nexports.toHex32 = toHex32;\n\nfunction zero2(word) {\n if (word.length === 1)\n return '0' + word;\n else\n return word;\n}\nexports.zero2 = zero2;\n\nfunction zero8(word) {\n if (word.length === 7)\n return '0' + word;\n else if (word.length === 6)\n return '00' + word;\n else if (word.length === 5)\n return '000' + word;\n else if (word.length === 4)\n return '0000' + word;\n else if (word.length === 3)\n return '00000' + word;\n else if (word.length === 2)\n return '000000' + word;\n else if (word.length === 1)\n return '0000000' + word;\n else\n return word;\n}\nexports.zero8 = zero8;\n\nfunction join32(msg, start, end, endian) {\n var len = end - start;\n assert(len % 4 === 0);\n var res = new Array(len / 4);\n for (var i = 0, k = start; i < res.length; i++, k += 4) {\n var w;\n if (endian === 'big')\n w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];\n else\n w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];\n res[i] = w >>> 0;\n }\n return res;\n}\nexports.join32 = join32;\n\nfunction split32(msg, endian) {\n var res = new Array(msg.length * 4);\n for (var i = 0, k = 0; i < msg.length; i++, k += 4) {\n var m = msg[i];\n if (endian === 'big') {\n res[k] = m >>> 24;\n res[k + 1] = (m >>> 16) & 0xff;\n res[k + 2] = (m >>> 8) & 0xff;\n res[k + 3] = m & 0xff;\n } else {\n res[k + 3] = m >>> 24;\n res[k + 2] = (m >>> 16) & 0xff;\n res[k + 1] = (m >>> 8) & 0xff;\n res[k] = m & 0xff;\n }\n }\n return res;\n}\nexports.split32 = split32;\n\nfunction rotr32(w, b) {\n return (w >>> b) | (w << (32 - b));\n}\nexports.rotr32 = rotr32;\n\nfunction rotl32(w, b) {\n return (w << b) | (w >>> (32 - b));\n}\nexports.rotl32 = rotl32;\n\nfunction sum32(a, b) {\n return (a + b) >>> 0;\n}\nexports.sum32 = sum32;\n\nfunction sum32_3(a, b, c) {\n return (a + b + c) >>> 0;\n}\nexports.sum32_3 = sum32_3;\n\nfunction sum32_4(a, b, c, d) {\n return (a + b + c + d) >>> 0;\n}\nexports.sum32_4 = sum32_4;\n\nfunction sum32_5(a, b, c, d, e) {\n return (a + b + c + d + e) >>> 0;\n}\nexports.sum32_5 = sum32_5;\n\nfunction sum64(buf, pos, ah, al) {\n var bh = buf[pos];\n var bl = buf[pos + 1];\n\n var lo = (al + bl) >>> 0;\n var hi = (lo < al ? 1 : 0) + ah + bh;\n buf[pos] = hi >>> 0;\n buf[pos + 1] = lo;\n}\nexports.sum64 = sum64;\n\nfunction sum64_hi(ah, al, bh, bl) {\n var lo = (al + bl) >>> 0;\n var hi = (lo < al ? 1 : 0) + ah + bh;\n return hi >>> 0;\n}\nexports.sum64_hi = sum64_hi;\n\nfunction sum64_lo(ah, al, bh, bl) {\n var lo = al + bl;\n return lo >>> 0;\n}\nexports.sum64_lo = sum64_lo;\n\nfunction sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {\n var carry = 0;\n var lo = al;\n lo = (lo + bl) >>> 0;\n carry += lo < al ? 1 : 0;\n lo = (lo + cl) >>> 0;\n carry += lo < cl ? 1 : 0;\n lo = (lo + dl) >>> 0;\n carry += lo < dl ? 1 : 0;\n\n var hi = ah + bh + ch + dh + carry;\n return hi >>> 0;\n}\nexports.sum64_4_hi = sum64_4_hi;\n\nfunction sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {\n var lo = al + bl + cl + dl;\n return lo >>> 0;\n}\nexports.sum64_4_lo = sum64_4_lo;\n\nfunction sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var carry = 0;\n var lo = al;\n lo = (lo + bl) >>> 0;\n carry += lo < al ? 1 : 0;\n lo = (lo + cl) >>> 0;\n carry += lo < cl ? 1 : 0;\n lo = (lo + dl) >>> 0;\n carry += lo < dl ? 1 : 0;\n lo = (lo + el) >>> 0;\n carry += lo < el ? 1 : 0;\n\n var hi = ah + bh + ch + dh + eh + carry;\n return hi >>> 0;\n}\nexports.sum64_5_hi = sum64_5_hi;\n\nfunction sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var lo = al + bl + cl + dl + el;\n\n return lo >>> 0;\n}\nexports.sum64_5_lo = sum64_5_lo;\n\nfunction rotr64_hi(ah, al, num) {\n var r = (al << (32 - num)) | (ah >>> num);\n return r >>> 0;\n}\nexports.rotr64_hi = rotr64_hi;\n\nfunction rotr64_lo(ah, al, num) {\n var r = (ah << (32 - num)) | (al >>> num);\n return r >>> 0;\n}\nexports.rotr64_lo = rotr64_lo;\n\nfunction shr64_hi(ah, al, num) {\n return ah >>> num;\n}\nexports.shr64_hi = shr64_hi;\n\nfunction shr64_lo(ah, al, num) {\n var r = (ah << (32 - num)) | (al >>> num);\n return r >>> 0;\n}\nexports.shr64_lo = shr64_lo;\n","'use strict';\n\nvar utils = require('./utils');\nvar assert = require('minimalistic-assert');\n\nfunction BlockHash() {\n this.pending = null;\n this.pendingTotal = 0;\n this.blockSize = this.constructor.blockSize;\n this.outSize = this.constructor.outSize;\n this.hmacStrength = this.constructor.hmacStrength;\n this.padLength = this.constructor.padLength / 8;\n this.endian = 'big';\n\n this._delta8 = this.blockSize / 8;\n this._delta32 = this.blockSize / 32;\n}\nexports.BlockHash = BlockHash;\n\nBlockHash.prototype.update = function update(msg, enc) {\n // Convert message to array, pad it, and join into 32bit blocks\n msg = utils.toArray(msg, enc);\n if (!this.pending)\n this.pending = msg;\n else\n this.pending = this.pending.concat(msg);\n this.pendingTotal += msg.length;\n\n // Enough data, try updating\n if (this.pending.length >= this._delta8) {\n msg = this.pending;\n\n // Process pending data in blocks\n var r = msg.length % this._delta8;\n this.pending = msg.slice(msg.length - r, msg.length);\n if (this.pending.length === 0)\n this.pending = null;\n\n msg = utils.join32(msg, 0, msg.length - r, this.endian);\n for (var i = 0; i < msg.length; i += this._delta32)\n this._update(msg, i, i + this._delta32);\n }\n\n return this;\n};\n\nBlockHash.prototype.digest = function digest(enc) {\n this.update(this._pad());\n assert(this.pending === null);\n\n return this._digest(enc);\n};\n\nBlockHash.prototype._pad = function pad() {\n var len = this.pendingTotal;\n var bytes = this._delta8;\n var k = bytes - ((len + this.padLength) % bytes);\n var res = new Array(k + this.padLength);\n res[0] = 0x80;\n for (var i = 1; i < k; i++)\n res[i] = 0;\n\n // Append length\n len <<= 3;\n if (this.endian === 'big') {\n for (var t = 8; t < this.padLength; t++)\n res[i++] = 0;\n\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = len & 0xff;\n } else {\n res[i++] = len & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n\n for (t = 8; t < this.padLength; t++)\n res[i++] = 0;\n }\n\n return res;\n};\n","'use strict';\n\nvar utils = require('../utils');\nvar rotr32 = utils.rotr32;\n\nfunction ft_1(s, x, y, z) {\n if (s === 0)\n return ch32(x, y, z);\n if (s === 1 || s === 3)\n return p32(x, y, z);\n if (s === 2)\n return maj32(x, y, z);\n}\nexports.ft_1 = ft_1;\n\nfunction ch32(x, y, z) {\n return (x & y) ^ ((~x) & z);\n}\nexports.ch32 = ch32;\n\nfunction maj32(x, y, z) {\n return (x & y) ^ (x & z) ^ (y & z);\n}\nexports.maj32 = maj32;\n\nfunction p32(x, y, z) {\n return x ^ y ^ z;\n}\nexports.p32 = p32;\n\nfunction s0_256(x) {\n return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);\n}\nexports.s0_256 = s0_256;\n\nfunction s1_256(x) {\n return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);\n}\nexports.s1_256 = s1_256;\n\nfunction g0_256(x) {\n return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);\n}\nexports.g0_256 = g0_256;\n\nfunction g1_256(x) {\n return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);\n}\nexports.g1_256 = g1_256;\n","'use strict';\n\nvar utils = require('../utils');\nvar common = require('../common');\nvar shaCommon = require('./common');\n\nvar rotl32 = utils.rotl32;\nvar sum32 = utils.sum32;\nvar sum32_5 = utils.sum32_5;\nvar ft_1 = shaCommon.ft_1;\nvar BlockHash = common.BlockHash;\n\nvar sha1_K = [\n 0x5A827999, 0x6ED9EBA1,\n 0x8F1BBCDC, 0xCA62C1D6\n];\n\nfunction SHA1() {\n if (!(this instanceof SHA1))\n return new SHA1();\n\n BlockHash.call(this);\n this.h = [\n 0x67452301, 0xefcdab89, 0x98badcfe,\n 0x10325476, 0xc3d2e1f0 ];\n this.W = new Array(80);\n}\n\nutils.inherits(SHA1, BlockHash);\nmodule.exports = SHA1;\n\nSHA1.blockSize = 512;\nSHA1.outSize = 160;\nSHA1.hmacStrength = 80;\nSHA1.padLength = 64;\n\nSHA1.prototype._update = function _update(msg, start) {\n var W = this.W;\n\n for (var i = 0; i < 16; i++)\n W[i] = msg[start + i];\n\n for(; i < W.length; i++)\n W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);\n\n var a = this.h[0];\n var b = this.h[1];\n var c = this.h[2];\n var d = this.h[3];\n var e = this.h[4];\n\n for (i = 0; i < W.length; i++) {\n var s = ~~(i / 20);\n var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);\n e = d;\n d = c;\n c = rotl32(b, 30);\n b = a;\n a = t;\n }\n\n this.h[0] = sum32(this.h[0], a);\n this.h[1] = sum32(this.h[1], b);\n this.h[2] = sum32(this.h[2], c);\n this.h[3] = sum32(this.h[3], d);\n this.h[4] = sum32(this.h[4], e);\n};\n\nSHA1.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n","'use strict';\n\nvar utils = require('../utils');\nvar common = require('../common');\nvar shaCommon = require('./common');\nvar assert = require('minimalistic-assert');\n\nvar sum32 = utils.sum32;\nvar sum32_4 = utils.sum32_4;\nvar sum32_5 = utils.sum32_5;\nvar ch32 = shaCommon.ch32;\nvar maj32 = shaCommon.maj32;\nvar s0_256 = shaCommon.s0_256;\nvar s1_256 = shaCommon.s1_256;\nvar g0_256 = shaCommon.g0_256;\nvar g1_256 = shaCommon.g1_256;\n\nvar BlockHash = common.BlockHash;\n\nvar sha256_K = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,\n 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,\n 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,\n 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,\n 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,\n 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n];\n\nfunction SHA256() {\n if (!(this instanceof SHA256))\n return new SHA256();\n\n BlockHash.call(this);\n this.h = [\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,\n 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n ];\n this.k = sha256_K;\n this.W = new Array(64);\n}\nutils.inherits(SHA256, BlockHash);\nmodule.exports = SHA256;\n\nSHA256.blockSize = 512;\nSHA256.outSize = 256;\nSHA256.hmacStrength = 192;\nSHA256.padLength = 64;\n\nSHA256.prototype._update = function _update(msg, start) {\n var W = this.W;\n\n for (var i = 0; i < 16; i++)\n W[i] = msg[start + i];\n for (; i < W.length; i++)\n W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);\n\n var a = this.h[0];\n var b = this.h[1];\n var c = this.h[2];\n var d = this.h[3];\n var e = this.h[4];\n var f = this.h[5];\n var g = this.h[6];\n var h = this.h[7];\n\n assert(this.k.length === W.length);\n for (i = 0; i < W.length; i++) {\n var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);\n var T2 = sum32(s0_256(a), maj32(a, b, c));\n h = g;\n g = f;\n f = e;\n e = sum32(d, T1);\n d = c;\n c = b;\n b = a;\n a = sum32(T1, T2);\n }\n\n this.h[0] = sum32(this.h[0], a);\n this.h[1] = sum32(this.h[1], b);\n this.h[2] = sum32(this.h[2], c);\n this.h[3] = sum32(this.h[3], d);\n this.h[4] = sum32(this.h[4], e);\n this.h[5] = sum32(this.h[5], f);\n this.h[6] = sum32(this.h[6], g);\n this.h[7] = sum32(this.h[7], h);\n};\n\nSHA256.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n","'use strict';\n\nvar utils = require('../utils');\nvar SHA256 = require('./256');\n\nfunction SHA224() {\n if (!(this instanceof SHA224))\n return new SHA224();\n\n SHA256.call(this);\n this.h = [\n 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,\n 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];\n}\nutils.inherits(SHA224, SHA256);\nmodule.exports = SHA224;\n\nSHA224.blockSize = 512;\nSHA224.outSize = 224;\nSHA224.hmacStrength = 192;\nSHA224.padLength = 64;\n\nSHA224.prototype._digest = function digest(enc) {\n // Just truncate output\n if (enc === 'hex')\n return utils.toHex32(this.h.slice(0, 7), 'big');\n else\n return utils.split32(this.h.slice(0, 7), 'big');\n};\n\n","'use strict';\n\nvar utils = require('../utils');\nvar common = require('../common');\nvar assert = require('minimalistic-assert');\n\nvar rotr64_hi = utils.rotr64_hi;\nvar rotr64_lo = utils.rotr64_lo;\nvar shr64_hi = utils.shr64_hi;\nvar shr64_lo = utils.shr64_lo;\nvar sum64 = utils.sum64;\nvar sum64_hi = utils.sum64_hi;\nvar sum64_lo = utils.sum64_lo;\nvar sum64_4_hi = utils.sum64_4_hi;\nvar sum64_4_lo = utils.sum64_4_lo;\nvar sum64_5_hi = utils.sum64_5_hi;\nvar sum64_5_lo = utils.sum64_5_lo;\n\nvar BlockHash = common.BlockHash;\n\nvar sha512_K = [\n 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,\n 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,\n 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,\n 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,\n 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,\n 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,\n 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,\n 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,\n 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,\n 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,\n 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,\n 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,\n 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,\n 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,\n 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,\n 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,\n 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,\n 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,\n 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,\n 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,\n 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,\n 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,\n 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,\n 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,\n 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,\n 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,\n 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,\n 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,\n 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,\n 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,\n 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,\n 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,\n 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,\n 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,\n 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,\n 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,\n 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,\n 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,\n 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,\n 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817\n];\n\nfunction SHA512() {\n if (!(this instanceof SHA512))\n return new SHA512();\n\n BlockHash.call(this);\n this.h = [\n 0x6a09e667, 0xf3bcc908,\n 0xbb67ae85, 0x84caa73b,\n 0x3c6ef372, 0xfe94f82b,\n 0xa54ff53a, 0x5f1d36f1,\n 0x510e527f, 0xade682d1,\n 0x9b05688c, 0x2b3e6c1f,\n 0x1f83d9ab, 0xfb41bd6b,\n 0x5be0cd19, 0x137e2179 ];\n this.k = sha512_K;\n this.W = new Array(160);\n}\nutils.inherits(SHA512, BlockHash);\nmodule.exports = SHA512;\n\nSHA512.blockSize = 1024;\nSHA512.outSize = 512;\nSHA512.hmacStrength = 192;\nSHA512.padLength = 128;\n\nSHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {\n var W = this.W;\n\n // 32 x 32bit words\n for (var i = 0; i < 32; i++)\n W[i] = msg[start + i];\n for (; i < W.length; i += 2) {\n var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2\n var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);\n var c1_hi = W[i - 14]; // i - 7\n var c1_lo = W[i - 13];\n var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15\n var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);\n var c3_hi = W[i - 32]; // i - 16\n var c3_lo = W[i - 31];\n\n W[i] = sum64_4_hi(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo);\n W[i + 1] = sum64_4_lo(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo);\n }\n};\n\nSHA512.prototype._update = function _update(msg, start) {\n this._prepareBlock(msg, start);\n\n var W = this.W;\n\n var ah = this.h[0];\n var al = this.h[1];\n var bh = this.h[2];\n var bl = this.h[3];\n var ch = this.h[4];\n var cl = this.h[5];\n var dh = this.h[6];\n var dl = this.h[7];\n var eh = this.h[8];\n var el = this.h[9];\n var fh = this.h[10];\n var fl = this.h[11];\n var gh = this.h[12];\n var gl = this.h[13];\n var hh = this.h[14];\n var hl = this.h[15];\n\n assert(this.k.length === W.length);\n for (var i = 0; i < W.length; i += 2) {\n var c0_hi = hh;\n var c0_lo = hl;\n var c1_hi = s1_512_hi(eh, el);\n var c1_lo = s1_512_lo(eh, el);\n var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);\n var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);\n var c3_hi = this.k[i];\n var c3_lo = this.k[i + 1];\n var c4_hi = W[i];\n var c4_lo = W[i + 1];\n\n var T1_hi = sum64_5_hi(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo,\n c4_hi, c4_lo);\n var T1_lo = sum64_5_lo(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo,\n c4_hi, c4_lo);\n\n c0_hi = s0_512_hi(ah, al);\n c0_lo = s0_512_lo(ah, al);\n c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);\n c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);\n\n var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);\n var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);\n\n hh = gh;\n hl = gl;\n\n gh = fh;\n gl = fl;\n\n fh = eh;\n fl = el;\n\n eh = sum64_hi(dh, dl, T1_hi, T1_lo);\n el = sum64_lo(dl, dl, T1_hi, T1_lo);\n\n dh = ch;\n dl = cl;\n\n ch = bh;\n cl = bl;\n\n bh = ah;\n bl = al;\n\n ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);\n al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);\n }\n\n sum64(this.h, 0, ah, al);\n sum64(this.h, 2, bh, bl);\n sum64(this.h, 4, ch, cl);\n sum64(this.h, 6, dh, dl);\n sum64(this.h, 8, eh, el);\n sum64(this.h, 10, fh, fl);\n sum64(this.h, 12, gh, gl);\n sum64(this.h, 14, hh, hl);\n};\n\nSHA512.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\nfunction ch64_hi(xh, xl, yh, yl, zh) {\n var r = (xh & yh) ^ ((~xh) & zh);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction ch64_lo(xh, xl, yh, yl, zh, zl) {\n var r = (xl & yl) ^ ((~xl) & zl);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction maj64_hi(xh, xl, yh, yl, zh) {\n var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction maj64_lo(xh, xl, yh, yl, zh, zl) {\n var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 28);\n var c1_hi = rotr64_hi(xl, xh, 2); // 34\n var c2_hi = rotr64_hi(xl, xh, 7); // 39\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 28);\n var c1_lo = rotr64_lo(xl, xh, 2); // 34\n var c2_lo = rotr64_lo(xl, xh, 7); // 39\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 14);\n var c1_hi = rotr64_hi(xh, xl, 18);\n var c2_hi = rotr64_hi(xl, xh, 9); // 41\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 14);\n var c1_lo = rotr64_lo(xh, xl, 18);\n var c2_lo = rotr64_lo(xl, xh, 9); // 41\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 1);\n var c1_hi = rotr64_hi(xh, xl, 8);\n var c2_hi = shr64_hi(xh, xl, 7);\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 1);\n var c1_lo = rotr64_lo(xh, xl, 8);\n var c2_lo = shr64_lo(xh, xl, 7);\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 19);\n var c1_hi = rotr64_hi(xl, xh, 29); // 61\n var c2_hi = shr64_hi(xh, xl, 6);\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 19);\n var c1_lo = rotr64_lo(xl, xh, 29); // 61\n var c2_lo = shr64_lo(xh, xl, 6);\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n","'use strict';\n\nvar utils = require('../utils');\n\nvar SHA512 = require('./512');\n\nfunction SHA384() {\n if (!(this instanceof SHA384))\n return new SHA384();\n\n SHA512.call(this);\n this.h = [\n 0xcbbb9d5d, 0xc1059ed8,\n 0x629a292a, 0x367cd507,\n 0x9159015a, 0x3070dd17,\n 0x152fecd8, 0xf70e5939,\n 0x67332667, 0xffc00b31,\n 0x8eb44a87, 0x68581511,\n 0xdb0c2e0d, 0x64f98fa7,\n 0x47b5481d, 0xbefa4fa4 ];\n}\nutils.inherits(SHA384, SHA512);\nmodule.exports = SHA384;\n\nSHA384.blockSize = 1024;\nSHA384.outSize = 384;\nSHA384.hmacStrength = 192;\nSHA384.padLength = 128;\n\nSHA384.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h.slice(0, 12), 'big');\n else\n return utils.split32(this.h.slice(0, 12), 'big');\n};\n","'use strict';\n\nexports.sha1 = require('./sha/1');\nexports.sha224 = require('./sha/224');\nexports.sha256 = require('./sha/256');\nexports.sha384 = require('./sha/384');\nexports.sha512 = require('./sha/512');\n","'use strict';\n\nvar utils = require('./utils');\nvar common = require('./common');\n\nvar rotl32 = utils.rotl32;\nvar sum32 = utils.sum32;\nvar sum32_3 = utils.sum32_3;\nvar sum32_4 = utils.sum32_4;\nvar BlockHash = common.BlockHash;\n\nfunction RIPEMD160() {\n if (!(this instanceof RIPEMD160))\n return new RIPEMD160();\n\n BlockHash.call(this);\n\n this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ];\n this.endian = 'little';\n}\nutils.inherits(RIPEMD160, BlockHash);\nexports.ripemd160 = RIPEMD160;\n\nRIPEMD160.blockSize = 512;\nRIPEMD160.outSize = 160;\nRIPEMD160.hmacStrength = 192;\nRIPEMD160.padLength = 64;\n\nRIPEMD160.prototype._update = function update(msg, start) {\n var A = this.h[0];\n var B = this.h[1];\n var C = this.h[2];\n var D = this.h[3];\n var E = this.h[4];\n var Ah = A;\n var Bh = B;\n var Ch = C;\n var Dh = D;\n var Eh = E;\n for (var j = 0; j < 80; j++) {\n var T = sum32(\n rotl32(\n sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)),\n s[j]),\n E);\n A = E;\n E = D;\n D = rotl32(C, 10);\n C = B;\n B = T;\n T = sum32(\n rotl32(\n sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),\n sh[j]),\n Eh);\n Ah = Eh;\n Eh = Dh;\n Dh = rotl32(Ch, 10);\n Ch = Bh;\n Bh = T;\n }\n T = sum32_3(this.h[1], C, Dh);\n this.h[1] = sum32_3(this.h[2], D, Eh);\n this.h[2] = sum32_3(this.h[3], E, Ah);\n this.h[3] = sum32_3(this.h[4], A, Bh);\n this.h[4] = sum32_3(this.h[0], B, Ch);\n this.h[0] = T;\n};\n\nRIPEMD160.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'little');\n else\n return utils.split32(this.h, 'little');\n};\n\nfunction f(j, x, y, z) {\n if (j <= 15)\n return x ^ y ^ z;\n else if (j <= 31)\n return (x & y) | ((~x) & z);\n else if (j <= 47)\n return (x | (~y)) ^ z;\n else if (j <= 63)\n return (x & z) | (y & (~z));\n else\n return x ^ (y | (~z));\n}\n\nfunction K(j) {\n if (j <= 15)\n return 0x00000000;\n else if (j <= 31)\n return 0x5a827999;\n else if (j <= 47)\n return 0x6ed9eba1;\n else if (j <= 63)\n return 0x8f1bbcdc;\n else\n return 0xa953fd4e;\n}\n\nfunction Kh(j) {\n if (j <= 15)\n return 0x50a28be6;\n else if (j <= 31)\n return 0x5c4dd124;\n else if (j <= 47)\n return 0x6d703ef3;\n else if (j <= 63)\n return 0x7a6d76e9;\n else\n return 0x00000000;\n}\n\nvar r = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,\n 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,\n 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,\n 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13\n];\n\nvar rh = [\n 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,\n 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,\n 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,\n 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,\n 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11\n];\n\nvar s = [\n 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,\n 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,\n 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,\n 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,\n 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6\n];\n\nvar sh = [\n 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,\n 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,\n 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,\n 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,\n 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11\n];\n","'use strict';\n\nvar utils = require('./utils');\nvar assert = require('minimalistic-assert');\n\nfunction Hmac(hash, key, enc) {\n if (!(this instanceof Hmac))\n return new Hmac(hash, key, enc);\n this.Hash = hash;\n this.blockSize = hash.blockSize / 8;\n this.outSize = hash.outSize / 8;\n this.inner = null;\n this.outer = null;\n\n this._init(utils.toArray(key, enc));\n}\nmodule.exports = Hmac;\n\nHmac.prototype._init = function init(key) {\n // Shorten key, if needed\n if (key.length > this.blockSize)\n key = new this.Hash().update(key).digest();\n assert(key.length <= this.blockSize);\n\n // Add padding to key\n for (var i = key.length; i < this.blockSize; i++)\n key.push(0);\n\n for (i = 0; i < key.length; i++)\n key[i] ^= 0x36;\n this.inner = new this.Hash().update(key);\n\n // 0x36 ^ 0x5c = 0x6a\n for (i = 0; i < key.length; i++)\n key[i] ^= 0x6a;\n this.outer = new this.Hash().update(key);\n};\n\nHmac.prototype.update = function update(msg, enc) {\n this.inner.update(msg, enc);\n return this;\n};\n\nHmac.prototype.digest = function digest(enc) {\n this.outer.update(this.inner.digest());\n return this.outer.digest(enc);\n};\n","var hash = exports;\n\nhash.utils = require('./hash/utils');\nhash.common = require('./hash/common');\nhash.sha = require('./hash/sha');\nhash.ripemd = require('./hash/ripemd');\nhash.hmac = require('./hash/hmac');\n\n// Proxy hash functions to the main object\nhash.sha1 = hash.sha.sha1;\nhash.sha256 = hash.sha.sha256;\nhash.sha224 = hash.sha.sha224;\nhash.sha384 = hash.sha.sha384;\nhash.sha512 = hash.sha.sha512;\nhash.ripemd160 = hash.ripemd.ripemd160;\n","module.exports = {\n doubles: {\n step: 4,\n points: [\n [\n 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a',\n 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821',\n ],\n [\n '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508',\n '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf',\n ],\n [\n '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739',\n 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695',\n ],\n [\n '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640',\n '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9',\n ],\n [\n '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c',\n '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36',\n ],\n [\n '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda',\n '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f',\n ],\n [\n 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa',\n '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999',\n ],\n [\n '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0',\n 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09',\n ],\n [\n 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d',\n '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d',\n ],\n [\n 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d',\n 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088',\n ],\n [\n 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1',\n '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d',\n ],\n [\n '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0',\n '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8',\n ],\n [\n '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047',\n '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a',\n ],\n [\n '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862',\n '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453',\n ],\n [\n '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7',\n '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160',\n ],\n [\n '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd',\n '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0',\n ],\n [\n '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83',\n '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6',\n ],\n [\n '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a',\n '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589',\n ],\n [\n '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8',\n 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17',\n ],\n [\n 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d',\n '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda',\n ],\n [\n 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725',\n '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd',\n ],\n [\n '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754',\n '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2',\n ],\n [\n '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c',\n '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6',\n ],\n [\n 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6',\n '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f',\n ],\n [\n '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39',\n 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01',\n ],\n [\n 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891',\n '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3',\n ],\n [\n 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b',\n 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f',\n ],\n [\n 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03',\n '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7',\n ],\n [\n 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d',\n 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78',\n ],\n [\n 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070',\n '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1',\n ],\n [\n '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4',\n 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150',\n ],\n [\n '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da',\n '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82',\n ],\n [\n 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11',\n '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc',\n ],\n [\n '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e',\n 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b',\n ],\n [\n 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41',\n '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51',\n ],\n [\n 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef',\n '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45',\n ],\n [\n 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8',\n 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120',\n ],\n [\n '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d',\n '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84',\n ],\n [\n '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96',\n '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d',\n ],\n [\n '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd',\n 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d',\n ],\n [\n '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5',\n '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8',\n ],\n [\n 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266',\n '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8',\n ],\n [\n '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71',\n '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac',\n ],\n [\n '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac',\n 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f',\n ],\n [\n '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751',\n '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962',\n ],\n [\n 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e',\n '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907',\n ],\n [\n '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241',\n 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec',\n ],\n [\n 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3',\n 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d',\n ],\n [\n 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f',\n '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414',\n ],\n [\n '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19',\n 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd',\n ],\n [\n '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be',\n 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0',\n ],\n [\n 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9',\n '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811',\n ],\n [\n 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2',\n '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1',\n ],\n [\n 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13',\n '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c',\n ],\n [\n '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c',\n 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73',\n ],\n [\n '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba',\n '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd',\n ],\n [\n 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151',\n 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405',\n ],\n [\n '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073',\n 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589',\n ],\n [\n '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458',\n '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e',\n ],\n [\n '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b',\n '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27',\n ],\n [\n 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366',\n 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1',\n ],\n [\n '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa',\n '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482',\n ],\n [\n '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0',\n '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945',\n ],\n [\n 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787',\n '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573',\n ],\n [\n 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e',\n 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82',\n ],\n ],\n },\n naf: {\n wnd: 7,\n points: [\n [\n 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9',\n '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672',\n ],\n [\n '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4',\n 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6',\n ],\n [\n '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc',\n '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da',\n ],\n [\n 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe',\n 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37',\n ],\n [\n '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb',\n 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b',\n ],\n [\n 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8',\n 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81',\n ],\n [\n 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e',\n '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58',\n ],\n [\n 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34',\n '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77',\n ],\n [\n '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c',\n '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a',\n ],\n [\n '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5',\n '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c',\n ],\n [\n '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f',\n '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67',\n ],\n [\n '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714',\n '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402',\n ],\n [\n 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729',\n 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55',\n ],\n [\n 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db',\n '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482',\n ],\n [\n '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4',\n 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82',\n ],\n [\n '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5',\n 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396',\n ],\n [\n '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479',\n '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49',\n ],\n [\n '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d',\n '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf',\n ],\n [\n '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f',\n '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a',\n ],\n [\n '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb',\n 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7',\n ],\n [\n 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9',\n 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933',\n ],\n [\n '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963',\n '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a',\n ],\n [\n '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74',\n '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6',\n ],\n [\n 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530',\n 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37',\n ],\n [\n '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b',\n '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e',\n ],\n [\n 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247',\n 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6',\n ],\n [\n 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1',\n 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476',\n ],\n [\n '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120',\n '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40',\n ],\n [\n '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435',\n '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61',\n ],\n [\n '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18',\n '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683',\n ],\n [\n 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8',\n '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5',\n ],\n [\n '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb',\n '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b',\n ],\n [\n 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f',\n '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417',\n ],\n [\n '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143',\n 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868',\n ],\n [\n '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba',\n 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a',\n ],\n [\n 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45',\n 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6',\n ],\n [\n '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a',\n '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996',\n ],\n [\n '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e',\n 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e',\n ],\n [\n 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8',\n 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d',\n ],\n [\n '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c',\n '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2',\n ],\n [\n '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519',\n 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e',\n ],\n [\n '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab',\n '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437',\n ],\n [\n '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca',\n 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311',\n ],\n [\n 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf',\n '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4',\n ],\n [\n '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610',\n '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575',\n ],\n [\n '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4',\n 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d',\n ],\n [\n '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c',\n 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d',\n ],\n [\n 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940',\n 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629',\n ],\n [\n 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980',\n 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06',\n ],\n [\n '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3',\n '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374',\n ],\n [\n '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf',\n '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee',\n ],\n [\n 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63',\n '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1',\n ],\n [\n 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448',\n 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b',\n ],\n [\n '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf',\n '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661',\n ],\n [\n '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5',\n '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6',\n ],\n [\n 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6',\n '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e',\n ],\n [\n '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5',\n '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d',\n ],\n [\n 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99',\n 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc',\n ],\n [\n '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51',\n 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4',\n ],\n [\n '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5',\n '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c',\n ],\n [\n 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5',\n '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b',\n ],\n [\n 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997',\n '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913',\n ],\n [\n '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881',\n '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154',\n ],\n [\n '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5',\n '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865',\n ],\n [\n '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66',\n 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc',\n ],\n [\n '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726',\n 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224',\n ],\n [\n '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede',\n '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e',\n ],\n [\n '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94',\n '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6',\n ],\n [\n '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31',\n '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511',\n ],\n [\n '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51',\n 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b',\n ],\n [\n 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252',\n 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2',\n ],\n [\n '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5',\n 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c',\n ],\n [\n 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b',\n '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3',\n ],\n [\n 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4',\n '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d',\n ],\n [\n 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f',\n '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700',\n ],\n [\n 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889',\n '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4',\n ],\n [\n '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246',\n 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196',\n ],\n [\n '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984',\n '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4',\n ],\n [\n '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a',\n 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257',\n ],\n [\n 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030',\n 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13',\n ],\n [\n 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197',\n '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096',\n ],\n [\n 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593',\n 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38',\n ],\n [\n 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef',\n '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f',\n ],\n [\n '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38',\n '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448',\n ],\n [\n 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a',\n '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a',\n ],\n [\n 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111',\n '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4',\n ],\n [\n '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502',\n '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437',\n ],\n [\n '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea',\n 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7',\n ],\n [\n 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26',\n '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d',\n ],\n [\n 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986',\n '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a',\n ],\n [\n 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e',\n '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54',\n ],\n [\n '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4',\n '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77',\n ],\n [\n 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda',\n 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517',\n ],\n [\n '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859',\n 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10',\n ],\n [\n 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f',\n 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125',\n ],\n [\n 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c',\n '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e',\n ],\n [\n '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942',\n 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1',\n ],\n [\n 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a',\n '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2',\n ],\n [\n 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80',\n '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423',\n ],\n [\n 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d',\n '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8',\n ],\n [\n '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1',\n 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758',\n ],\n [\n '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63',\n 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375',\n ],\n [\n 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352',\n '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d',\n ],\n [\n '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193',\n 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec',\n ],\n [\n '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00',\n '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0',\n ],\n [\n '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58',\n 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c',\n ],\n [\n 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7',\n 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4',\n ],\n [\n '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8',\n 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f',\n ],\n [\n '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e',\n '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649',\n ],\n [\n '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d',\n 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826',\n ],\n [\n '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b',\n '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5',\n ],\n [\n 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f',\n 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87',\n ],\n [\n '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6',\n '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b',\n ],\n [\n 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297',\n '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc',\n ],\n [\n '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a',\n '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c',\n ],\n [\n 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c',\n 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f',\n ],\n [\n 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52',\n '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a',\n ],\n [\n 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb',\n 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46',\n ],\n [\n '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065',\n 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f',\n ],\n [\n '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917',\n '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03',\n ],\n [\n '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9',\n 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08',\n ],\n [\n '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3',\n '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8',\n ],\n [\n '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57',\n '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373',\n ],\n [\n '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66',\n 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3',\n ],\n [\n '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8',\n '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8',\n ],\n [\n '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721',\n '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1',\n ],\n [\n '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180',\n '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9',\n ],\n ],\n },\n};\n","'use strict';\n\nvar curves = exports;\n\nvar hash = require('hash.js');\nvar curve = require('./curve');\nvar utils = require('./utils');\n\nvar assert = utils.assert;\n\nfunction PresetCurve(options) {\n if (options.type === 'short')\n this.curve = new curve.short(options);\n else if (options.type === 'edwards')\n this.curve = new curve.edwards(options);\n else\n this.curve = new curve.mont(options);\n this.g = this.curve.g;\n this.n = this.curve.n;\n this.hash = options.hash;\n\n assert(this.g.validate(), 'Invalid curve');\n assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');\n}\ncurves.PresetCurve = PresetCurve;\n\nfunction defineCurve(name, options) {\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n get: function() {\n var curve = new PresetCurve(options);\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n value: curve,\n });\n return curve;\n },\n });\n}\n\ndefineCurve('p192', {\n type: 'short',\n prime: 'p192',\n p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',\n b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',\n n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',\n hash: hash.sha256,\n gRed: false,\n g: [\n '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',\n '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811',\n ],\n});\n\ndefineCurve('p224', {\n type: 'short',\n prime: 'p224',\n p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',\n b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',\n n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',\n hash: hash.sha256,\n gRed: false,\n g: [\n 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',\n 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34',\n ],\n});\n\ndefineCurve('p256', {\n type: 'short',\n prime: null,\n p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',\n a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',\n b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',\n n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',\n hash: hash.sha256,\n gRed: false,\n g: [\n '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',\n '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5',\n ],\n});\n\ndefineCurve('p384', {\n type: 'short',\n prime: null,\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'fffffffe ffffffff 00000000 00000000 ffffffff',\n a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'fffffffe ffffffff 00000000 00000000 fffffffc',\n b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +\n '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',\n n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +\n 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',\n hash: hash.sha384,\n gRed: false,\n g: [\n 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +\n '5502f25d bf55296c 3a545e38 72760ab7',\n '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +\n '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f',\n ],\n});\n\ndefineCurve('p521', {\n type: 'short',\n prime: null,\n p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff',\n a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff fffffffc',\n b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +\n '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +\n '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',\n n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +\n 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',\n hash: hash.sha512,\n gRed: false,\n g: [\n '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +\n '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +\n 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',\n '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +\n '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +\n '3fad0761 353c7086 a272c240 88be9476 9fd16650',\n ],\n});\n\ndefineCurve('curve25519', {\n type: 'mont',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '76d06',\n b: '1',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: [\n '9',\n ],\n});\n\ndefineCurve('ed25519', {\n type: 'edwards',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '-1',\n c: '1',\n // -121665 * (121666^(-1)) (mod P)\n d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: [\n '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',\n\n // 4/5\n '6666666666666666666666666666666666666666666666666666666666666658',\n ],\n});\n\nvar pre;\ntry {\n pre = require('./precomputed/secp256k1');\n} catch (e) {\n pre = undefined;\n}\n\ndefineCurve('secp256k1', {\n type: 'short',\n prime: 'k256',\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',\n a: '0',\n b: '7',\n n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',\n h: '1',\n hash: hash.sha256,\n\n // Precomputed endomorphism\n beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',\n lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',\n basis: [\n {\n a: '3086d221a7d46bcde86c90e49284eb15',\n b: '-e4437ed6010e88286f547fa90abfe4c3',\n },\n {\n a: '114ca50f7a8e2f3f657c1108d9d44cfd8',\n b: '3086d221a7d46bcde86c90e49284eb15',\n },\n ],\n\n gRed: false,\n g: [\n '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',\n '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',\n pre,\n ],\n});\n","'use strict';\n\nvar hash = require('hash.js');\nvar utils = require('minimalistic-crypto-utils');\nvar assert = require('minimalistic-assert');\n\nfunction HmacDRBG(options) {\n if (!(this instanceof HmacDRBG))\n return new HmacDRBG(options);\n this.hash = options.hash;\n this.predResist = !!options.predResist;\n\n this.outLen = this.hash.outSize;\n this.minEntropy = options.minEntropy || this.hash.hmacStrength;\n\n this._reseed = null;\n this.reseedInterval = null;\n this.K = null;\n this.V = null;\n\n var entropy = utils.toArray(options.entropy, options.entropyEnc || 'hex');\n var nonce = utils.toArray(options.nonce, options.nonceEnc || 'hex');\n var pers = utils.toArray(options.pers, options.persEnc || 'hex');\n assert(entropy.length >= (this.minEntropy / 8),\n 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');\n this._init(entropy, nonce, pers);\n}\nmodule.exports = HmacDRBG;\n\nHmacDRBG.prototype._init = function init(entropy, nonce, pers) {\n var seed = entropy.concat(nonce).concat(pers);\n\n this.K = new Array(this.outLen / 8);\n this.V = new Array(this.outLen / 8);\n for (var i = 0; i < this.V.length; i++) {\n this.K[i] = 0x00;\n this.V[i] = 0x01;\n }\n\n this._update(seed);\n this._reseed = 1;\n this.reseedInterval = 0x1000000000000; // 2^48\n};\n\nHmacDRBG.prototype._hmac = function hmac() {\n return new hash.hmac(this.hash, this.K);\n};\n\nHmacDRBG.prototype._update = function update(seed) {\n var kmac = this._hmac()\n .update(this.V)\n .update([ 0x00 ]);\n if (seed)\n kmac = kmac.update(seed);\n this.K = kmac.digest();\n this.V = this._hmac().update(this.V).digest();\n if (!seed)\n return;\n\n this.K = this._hmac()\n .update(this.V)\n .update([ 0x01 ])\n .update(seed)\n .digest();\n this.V = this._hmac().update(this.V).digest();\n};\n\nHmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {\n // Optional entropy enc\n if (typeof entropyEnc !== 'string') {\n addEnc = add;\n add = entropyEnc;\n entropyEnc = null;\n }\n\n entropy = utils.toArray(entropy, entropyEnc);\n add = utils.toArray(add, addEnc);\n\n assert(entropy.length >= (this.minEntropy / 8),\n 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');\n\n this._update(entropy.concat(add || []));\n this._reseed = 1;\n};\n\nHmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {\n if (this._reseed > this.reseedInterval)\n throw new Error('Reseed is required');\n\n // Optional encoding\n if (typeof enc !== 'string') {\n addEnc = add;\n add = enc;\n enc = null;\n }\n\n // Optional additional data\n if (add) {\n add = utils.toArray(add, addEnc || 'hex');\n this._update(add);\n }\n\n var temp = [];\n while (temp.length < len) {\n this.V = this._hmac().update(this.V).digest();\n temp = temp.concat(this.V);\n }\n\n var res = temp.slice(0, len);\n this._update(add);\n this._reseed++;\n return utils.encode(res, enc);\n};\n","'use strict';\n\nvar BN = require('bn.js');\nvar utils = require('../utils');\nvar assert = utils.assert;\n\nfunction KeyPair(ec, options) {\n this.ec = ec;\n this.priv = null;\n this.pub = null;\n\n // KeyPair(ec, { priv: ..., pub: ... })\n if (options.priv)\n this._importPrivate(options.priv, options.privEnc);\n if (options.pub)\n this._importPublic(options.pub, options.pubEnc);\n}\nmodule.exports = KeyPair;\n\nKeyPair.fromPublic = function fromPublic(ec, pub, enc) {\n if (pub instanceof KeyPair)\n return pub;\n\n return new KeyPair(ec, {\n pub: pub,\n pubEnc: enc,\n });\n};\n\nKeyPair.fromPrivate = function fromPrivate(ec, priv, enc) {\n if (priv instanceof KeyPair)\n return priv;\n\n return new KeyPair(ec, {\n priv: priv,\n privEnc: enc,\n });\n};\n\nKeyPair.prototype.validate = function validate() {\n var pub = this.getPublic();\n\n if (pub.isInfinity())\n return { result: false, reason: 'Invalid public key' };\n if (!pub.validate())\n return { result: false, reason: 'Public key is not a point' };\n if (!pub.mul(this.ec.curve.n).isInfinity())\n return { result: false, reason: 'Public key * N != O' };\n\n return { result: true, reason: null };\n};\n\nKeyPair.prototype.getPublic = function getPublic(compact, enc) {\n // compact is optional argument\n if (typeof compact === 'string') {\n enc = compact;\n compact = null;\n }\n\n if (!this.pub)\n this.pub = this.ec.g.mul(this.priv);\n\n if (!enc)\n return this.pub;\n\n return this.pub.encode(enc, compact);\n};\n\nKeyPair.prototype.getPrivate = function getPrivate(enc) {\n if (enc === 'hex')\n return this.priv.toString(16, 2);\n else\n return this.priv;\n};\n\nKeyPair.prototype._importPrivate = function _importPrivate(key, enc) {\n this.priv = new BN(key, enc || 16);\n\n // Ensure that the priv won't be bigger than n, otherwise we may fail\n // in fixed multiplication method\n this.priv = this.priv.umod(this.ec.curve.n);\n};\n\nKeyPair.prototype._importPublic = function _importPublic(key, enc) {\n if (key.x || key.y) {\n // Montgomery points only have an `x` coordinate.\n // Weierstrass/Edwards points on the other hand have both `x` and\n // `y` coordinates.\n if (this.ec.curve.type === 'mont') {\n assert(key.x, 'Need x coordinate');\n } else if (this.ec.curve.type === 'short' ||\n this.ec.curve.type === 'edwards') {\n assert(key.x && key.y, 'Need both x and y coordinate');\n }\n this.pub = this.ec.curve.point(key.x, key.y);\n return;\n }\n this.pub = this.ec.curve.decodePoint(key, enc);\n};\n\n// ECDH\nKeyPair.prototype.derive = function derive(pub) {\n if(!pub.validate()) {\n assert(pub.validate(), 'public point not validated');\n }\n return pub.mul(this.priv).getX();\n};\n\n// ECDSA\nKeyPair.prototype.sign = function sign(msg, enc, options) {\n return this.ec.sign(msg, this, enc, options);\n};\n\nKeyPair.prototype.verify = function verify(msg, signature) {\n return this.ec.verify(msg, signature, this);\n};\n\nKeyPair.prototype.inspect = function inspect() {\n return '';\n};\n","'use strict';\n\nvar BN = require('bn.js');\n\nvar utils = require('../utils');\nvar assert = utils.assert;\n\nfunction Signature(options, enc) {\n if (options instanceof Signature)\n return options;\n\n if (this._importDER(options, enc))\n return;\n\n assert(options.r && options.s, 'Signature without r or s');\n this.r = new BN(options.r, 16);\n this.s = new BN(options.s, 16);\n if (options.recoveryParam === undefined)\n this.recoveryParam = null;\n else\n this.recoveryParam = options.recoveryParam;\n}\nmodule.exports = Signature;\n\nfunction Position() {\n this.place = 0;\n}\n\nfunction getLength(buf, p) {\n var initial = buf[p.place++];\n if (!(initial & 0x80)) {\n return initial;\n }\n var octetLen = initial & 0xf;\n\n // Indefinite length or overflow\n if (octetLen === 0 || octetLen > 4) {\n return false;\n }\n\n if(buf[p.place] === 0x00) {\n return false;\n }\n\n var val = 0;\n for (var i = 0, off = p.place; i < octetLen; i++, off++) {\n val <<= 8;\n val |= buf[off];\n val >>>= 0;\n }\n\n // Leading zeroes\n if (val <= 0x7f) {\n return false;\n }\n\n p.place = off;\n return val;\n}\n\nfunction rmPadding(buf) {\n var i = 0;\n var len = buf.length - 1;\n while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) {\n i++;\n }\n if (i === 0) {\n return buf;\n }\n return buf.slice(i);\n}\n\nSignature.prototype._importDER = function _importDER(data, enc) {\n data = utils.toArray(data, enc);\n var p = new Position();\n if (data[p.place++] !== 0x30) {\n return false;\n }\n var len = getLength(data, p);\n if (len === false) {\n return false;\n }\n if ((len + p.place) !== data.length) {\n return false;\n }\n if (data[p.place++] !== 0x02) {\n return false;\n }\n var rlen = getLength(data, p);\n if (rlen === false) {\n return false;\n }\n if ((data[p.place] & 128) !== 0) {\n return false;\n }\n var r = data.slice(p.place, rlen + p.place);\n p.place += rlen;\n if (data[p.place++] !== 0x02) {\n return false;\n }\n var slen = getLength(data, p);\n if (slen === false) {\n return false;\n }\n if (data.length !== slen + p.place) {\n return false;\n }\n if ((data[p.place] & 128) !== 0) {\n return false;\n }\n var s = data.slice(p.place, slen + p.place);\n if (r[0] === 0) {\n if (r[1] & 0x80) {\n r = r.slice(1);\n } else {\n // Leading zeroes\n return false;\n }\n }\n if (s[0] === 0) {\n if (s[1] & 0x80) {\n s = s.slice(1);\n } else {\n // Leading zeroes\n return false;\n }\n }\n\n this.r = new BN(r);\n this.s = new BN(s);\n this.recoveryParam = null;\n\n return true;\n};\n\nfunction constructLength(arr, len) {\n if (len < 0x80) {\n arr.push(len);\n return;\n }\n var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);\n arr.push(octets | 0x80);\n while (--octets) {\n arr.push((len >>> (octets << 3)) & 0xff);\n }\n arr.push(len);\n}\n\nSignature.prototype.toDER = function toDER(enc) {\n var r = this.r.toArray();\n var s = this.s.toArray();\n\n // Pad values\n if (r[0] & 0x80)\n r = [ 0 ].concat(r);\n // Pad values\n if (s[0] & 0x80)\n s = [ 0 ].concat(s);\n\n r = rmPadding(r);\n s = rmPadding(s);\n\n while (!s[0] && !(s[1] & 0x80)) {\n s = s.slice(1);\n }\n var arr = [ 0x02 ];\n constructLength(arr, r.length);\n arr = arr.concat(r);\n arr.push(0x02);\n constructLength(arr, s.length);\n var backHalf = arr.concat(s);\n var res = [ 0x30 ];\n constructLength(res, backHalf.length);\n res = res.concat(backHalf);\n return utils.encode(res, enc);\n};\n","'use strict';\n\nvar BN = require('bn.js');\nvar HmacDRBG = require('hmac-drbg');\nvar utils = require('../utils');\nvar curves = require('../curves');\nvar rand = require('brorand');\nvar assert = utils.assert;\n\nvar KeyPair = require('./key');\nvar Signature = require('./signature');\n\nfunction EC(options) {\n if (!(this instanceof EC))\n return new EC(options);\n\n // Shortcut `elliptic.ec(curve-name)`\n if (typeof options === 'string') {\n assert(Object.prototype.hasOwnProperty.call(curves, options),\n 'Unknown curve ' + options);\n\n options = curves[options];\n }\n\n // Shortcut for `elliptic.ec(elliptic.curves.curveName)`\n if (options instanceof curves.PresetCurve)\n options = { curve: options };\n\n this.curve = options.curve.curve;\n this.n = this.curve.n;\n this.nh = this.n.ushrn(1);\n this.g = this.curve.g;\n\n // Point on curve\n this.g = options.curve.g;\n this.g.precompute(options.curve.n.bitLength() + 1);\n\n // Hash for function for DRBG\n this.hash = options.hash || options.curve.hash;\n}\nmodule.exports = EC;\n\nEC.prototype.keyPair = function keyPair(options) {\n return new KeyPair(this, options);\n};\n\nEC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) {\n return KeyPair.fromPrivate(this, priv, enc);\n};\n\nEC.prototype.keyFromPublic = function keyFromPublic(pub, enc) {\n return KeyPair.fromPublic(this, pub, enc);\n};\n\nEC.prototype.genKeyPair = function genKeyPair(options) {\n if (!options)\n options = {};\n\n // Instantiate Hmac_DRBG\n var drbg = new HmacDRBG({\n hash: this.hash,\n pers: options.pers,\n persEnc: options.persEnc || 'utf8',\n entropy: options.entropy || rand(this.hash.hmacStrength),\n entropyEnc: options.entropy && options.entropyEnc || 'utf8',\n nonce: this.n.toArray(),\n });\n\n var bytes = this.n.byteLength();\n var ns2 = this.n.sub(new BN(2));\n for (;;) {\n var priv = new BN(drbg.generate(bytes));\n if (priv.cmp(ns2) > 0)\n continue;\n\n priv.iaddn(1);\n return this.keyFromPrivate(priv);\n }\n};\n\nEC.prototype._truncateToN = function _truncateToN(msg, truncOnly) {\n var delta = msg.byteLength() * 8 - this.n.bitLength();\n if (delta > 0)\n msg = msg.ushrn(delta);\n if (!truncOnly && msg.cmp(this.n) >= 0)\n return msg.sub(this.n);\n else\n return msg;\n};\n\nEC.prototype.sign = function sign(msg, key, enc, options) {\n if (typeof enc === 'object') {\n options = enc;\n enc = null;\n }\n if (!options)\n options = {};\n\n key = this.keyFromPrivate(key, enc);\n msg = this._truncateToN(new BN(msg, 16));\n\n // Zero-extend key to provide enough entropy\n var bytes = this.n.byteLength();\n var bkey = key.getPrivate().toArray('be', bytes);\n\n // Zero-extend nonce to have the same byte size as N\n var nonce = msg.toArray('be', bytes);\n\n // Instantiate Hmac_DRBG\n var drbg = new HmacDRBG({\n hash: this.hash,\n entropy: bkey,\n nonce: nonce,\n pers: options.pers,\n persEnc: options.persEnc || 'utf8',\n });\n\n // Number of bytes to generate\n var ns1 = this.n.sub(new BN(1));\n\n for (var iter = 0; ; iter++) {\n var k = options.k ?\n options.k(iter) :\n new BN(drbg.generate(this.n.byteLength()));\n k = this._truncateToN(k, true);\n if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)\n continue;\n\n var kp = this.g.mul(k);\n if (kp.isInfinity())\n continue;\n\n var kpX = kp.getX();\n var r = kpX.umod(this.n);\n if (r.cmpn(0) === 0)\n continue;\n\n var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));\n s = s.umod(this.n);\n if (s.cmpn(0) === 0)\n continue;\n\n var recoveryParam = (kp.getY().isOdd() ? 1 : 0) |\n (kpX.cmp(r) !== 0 ? 2 : 0);\n\n // Use complement of `s`, if it is > `n / 2`\n if (options.canonical && s.cmp(this.nh) > 0) {\n s = this.n.sub(s);\n recoveryParam ^= 1;\n }\n\n return new Signature({ r: r, s: s, recoveryParam: recoveryParam });\n }\n};\n\nEC.prototype.verify = function verify(msg, signature, key, enc) {\n msg = this._truncateToN(new BN(msg, 16));\n key = this.keyFromPublic(key, enc);\n signature = new Signature(signature, 'hex');\n\n // Perform primitive values validation\n var r = signature.r;\n var s = signature.s;\n if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)\n return false;\n if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)\n return false;\n\n // Validate signature\n var sinv = s.invm(this.n);\n var u1 = sinv.mul(msg).umod(this.n);\n var u2 = sinv.mul(r).umod(this.n);\n var p;\n\n if (!this.curve._maxwellTrick) {\n p = this.g.mulAdd(u1, key.getPublic(), u2);\n if (p.isInfinity())\n return false;\n\n return p.getX().umod(this.n).cmp(r) === 0;\n }\n\n // NOTE: Greg Maxwell's trick, inspired by:\n // https://git.io/vad3K\n\n p = this.g.jmulAdd(u1, key.getPublic(), u2);\n if (p.isInfinity())\n return false;\n\n // Compare `p.x` of Jacobian point with `r`,\n // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the\n // inverse of `p.z^2`\n return p.eqXToP(r);\n};\n\nEC.prototype.recoverPubKey = function(msg, signature, j, enc) {\n assert((3 & j) === j, 'The recovery param is more than two bits');\n signature = new Signature(signature, enc);\n\n var n = this.n;\n var e = new BN(msg);\n var r = signature.r;\n var s = signature.s;\n\n // A set LSB signifies that the y-coordinate is odd\n var isYOdd = j & 1;\n var isSecondKey = j >> 1;\n if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)\n throw new Error('Unable to find sencond key candinate');\n\n // 1.1. Let x = r + jn.\n if (isSecondKey)\n r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);\n else\n r = this.curve.pointFromX(r, isYOdd);\n\n var rInv = signature.r.invm(n);\n var s1 = n.sub(e).mul(rInv).umod(n);\n var s2 = s.mul(rInv).umod(n);\n\n // 1.6.1 Compute Q = r^-1 (sR - eG)\n // Q = r^-1 (sR + -eG)\n return this.g.mulAdd(s1, r, s2);\n};\n\nEC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {\n signature = new Signature(signature, enc);\n if (signature.recoveryParam !== null)\n return signature.recoveryParam;\n\n for (var i = 0; i < 4; i++) {\n var Qprime;\n try {\n Qprime = this.recoverPubKey(e, signature, i);\n } catch (e) {\n continue;\n }\n\n if (Qprime.eq(Q))\n return i;\n }\n throw new Error('Unable to find valid recovery factor');\n};\n","'use strict';\n\nvar utils = require('../utils');\nvar assert = utils.assert;\nvar parseBytes = utils.parseBytes;\nvar cachedProperty = utils.cachedProperty;\n\n/**\n* @param {EDDSA} eddsa - instance\n* @param {Object} params - public/private key parameters\n*\n* @param {Array} [params.secret] - secret seed bytes\n* @param {Point} [params.pub] - public key point (aka `A` in eddsa terms)\n* @param {Array} [params.pub] - public key point encoded as bytes\n*\n*/\nfunction KeyPair(eddsa, params) {\n this.eddsa = eddsa;\n this._secret = parseBytes(params.secret);\n if (eddsa.isPoint(params.pub))\n this._pub = params.pub;\n else\n this._pubBytes = parseBytes(params.pub);\n}\n\nKeyPair.fromPublic = function fromPublic(eddsa, pub) {\n if (pub instanceof KeyPair)\n return pub;\n return new KeyPair(eddsa, { pub: pub });\n};\n\nKeyPair.fromSecret = function fromSecret(eddsa, secret) {\n if (secret instanceof KeyPair)\n return secret;\n return new KeyPair(eddsa, { secret: secret });\n};\n\nKeyPair.prototype.secret = function secret() {\n return this._secret;\n};\n\ncachedProperty(KeyPair, 'pubBytes', function pubBytes() {\n return this.eddsa.encodePoint(this.pub());\n});\n\ncachedProperty(KeyPair, 'pub', function pub() {\n if (this._pubBytes)\n return this.eddsa.decodePoint(this._pubBytes);\n return this.eddsa.g.mul(this.priv());\n});\n\ncachedProperty(KeyPair, 'privBytes', function privBytes() {\n var eddsa = this.eddsa;\n var hash = this.hash();\n var lastIx = eddsa.encodingLength - 1;\n\n var a = hash.slice(0, eddsa.encodingLength);\n a[0] &= 248;\n a[lastIx] &= 127;\n a[lastIx] |= 64;\n\n return a;\n});\n\ncachedProperty(KeyPair, 'priv', function priv() {\n return this.eddsa.decodeInt(this.privBytes());\n});\n\ncachedProperty(KeyPair, 'hash', function hash() {\n return this.eddsa.hash().update(this.secret()).digest();\n});\n\ncachedProperty(KeyPair, 'messagePrefix', function messagePrefix() {\n return this.hash().slice(this.eddsa.encodingLength);\n});\n\nKeyPair.prototype.sign = function sign(message) {\n assert(this._secret, 'KeyPair can only verify');\n return this.eddsa.sign(message, this);\n};\n\nKeyPair.prototype.verify = function verify(message, sig) {\n return this.eddsa.verify(message, sig, this);\n};\n\nKeyPair.prototype.getSecret = function getSecret(enc) {\n assert(this._secret, 'KeyPair is public only');\n return utils.encode(this.secret(), enc);\n};\n\nKeyPair.prototype.getPublic = function getPublic(enc) {\n return utils.encode(this.pubBytes(), enc);\n};\n\nmodule.exports = KeyPair;\n","'use strict';\n\nvar BN = require('bn.js');\nvar utils = require('../utils');\nvar assert = utils.assert;\nvar cachedProperty = utils.cachedProperty;\nvar parseBytes = utils.parseBytes;\n\n/**\n* @param {EDDSA} eddsa - eddsa instance\n* @param {Array|Object} sig -\n* @param {Array|Point} [sig.R] - R point as Point or bytes\n* @param {Array|bn} [sig.S] - S scalar as bn or bytes\n* @param {Array} [sig.Rencoded] - R point encoded\n* @param {Array} [sig.Sencoded] - S scalar encoded\n*/\nfunction Signature(eddsa, sig) {\n this.eddsa = eddsa;\n\n if (typeof sig !== 'object')\n sig = parseBytes(sig);\n\n if (Array.isArray(sig)) {\n assert(sig.length === eddsa.encodingLength * 2, 'Signature has invalid size');\n sig = {\n R: sig.slice(0, eddsa.encodingLength),\n S: sig.slice(eddsa.encodingLength),\n };\n }\n\n assert(sig.R && sig.S, 'Signature without R or S');\n\n if (eddsa.isPoint(sig.R))\n this._R = sig.R;\n if (sig.S instanceof BN)\n this._S = sig.S;\n\n this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded;\n this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded;\n}\n\ncachedProperty(Signature, 'S', function S() {\n return this.eddsa.decodeInt(this.Sencoded());\n});\n\ncachedProperty(Signature, 'R', function R() {\n return this.eddsa.decodePoint(this.Rencoded());\n});\n\ncachedProperty(Signature, 'Rencoded', function Rencoded() {\n return this.eddsa.encodePoint(this.R());\n});\n\ncachedProperty(Signature, 'Sencoded', function Sencoded() {\n return this.eddsa.encodeInt(this.S());\n});\n\nSignature.prototype.toBytes = function toBytes() {\n return this.Rencoded().concat(this.Sencoded());\n};\n\nSignature.prototype.toHex = function toHex() {\n return utils.encode(this.toBytes(), 'hex').toUpperCase();\n};\n\nmodule.exports = Signature;\n","'use strict';\n\nvar hash = require('hash.js');\nvar curves = require('../curves');\nvar utils = require('../utils');\nvar assert = utils.assert;\nvar parseBytes = utils.parseBytes;\nvar KeyPair = require('./key');\nvar Signature = require('./signature');\n\nfunction EDDSA(curve) {\n assert(curve === 'ed25519', 'only tested with ed25519 so far');\n\n if (!(this instanceof EDDSA))\n return new EDDSA(curve);\n\n curve = curves[curve].curve;\n this.curve = curve;\n this.g = curve.g;\n this.g.precompute(curve.n.bitLength() + 1);\n\n this.pointClass = curve.point().constructor;\n this.encodingLength = Math.ceil(curve.n.bitLength() / 8);\n this.hash = hash.sha512;\n}\n\nmodule.exports = EDDSA;\n\n/**\n* @param {Array|String} message - message bytes\n* @param {Array|String|KeyPair} secret - secret bytes or a keypair\n* @returns {Signature} - signature\n*/\nEDDSA.prototype.sign = function sign(message, secret) {\n message = parseBytes(message);\n var key = this.keyFromSecret(secret);\n var r = this.hashInt(key.messagePrefix(), message);\n var R = this.g.mul(r);\n var Rencoded = this.encodePoint(R);\n var s_ = this.hashInt(Rencoded, key.pubBytes(), message)\n .mul(key.priv());\n var S = r.add(s_).umod(this.curve.n);\n return this.makeSignature({ R: R, S: S, Rencoded: Rencoded });\n};\n\n/**\n* @param {Array} message - message bytes\n* @param {Array|String|Signature} sig - sig bytes\n* @param {Array|String|Point|KeyPair} pub - public key\n* @returns {Boolean} - true if public key matches sig of message\n*/\nEDDSA.prototype.verify = function verify(message, sig, pub) {\n message = parseBytes(message);\n sig = this.makeSignature(sig);\n if (sig.S().gte(sig.eddsa.curve.n) || sig.S().isNeg()) {\n return false;\n }\n var key = this.keyFromPublic(pub);\n var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message);\n var SG = this.g.mul(sig.S());\n var RplusAh = sig.R().add(key.pub().mul(h));\n return RplusAh.eq(SG);\n};\n\nEDDSA.prototype.hashInt = function hashInt() {\n var hash = this.hash();\n for (var i = 0; i < arguments.length; i++)\n hash.update(arguments[i]);\n return utils.intFromLE(hash.digest()).umod(this.curve.n);\n};\n\nEDDSA.prototype.keyFromPublic = function keyFromPublic(pub) {\n return KeyPair.fromPublic(this, pub);\n};\n\nEDDSA.prototype.keyFromSecret = function keyFromSecret(secret) {\n return KeyPair.fromSecret(this, secret);\n};\n\nEDDSA.prototype.makeSignature = function makeSignature(sig) {\n if (sig instanceof Signature)\n return sig;\n return new Signature(this, sig);\n};\n\n/**\n* * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2\n*\n* EDDSA defines methods for encoding and decoding points and integers. These are\n* helper convenience methods, that pass along to utility functions implied\n* parameters.\n*\n*/\nEDDSA.prototype.encodePoint = function encodePoint(point) {\n var enc = point.getY().toArray('le', this.encodingLength);\n enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0;\n return enc;\n};\n\nEDDSA.prototype.decodePoint = function decodePoint(bytes) {\n bytes = utils.parseBytes(bytes);\n\n var lastIx = bytes.length - 1;\n var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80);\n var xIsOdd = (bytes[lastIx] & 0x80) !== 0;\n\n var y = utils.intFromLE(normed);\n return this.curve.pointFromY(y, xIsOdd);\n};\n\nEDDSA.prototype.encodeInt = function encodeInt(num) {\n return num.toArray('le', this.encodingLength);\n};\n\nEDDSA.prototype.decodeInt = function decodeInt(bytes) {\n return utils.intFromLE(bytes);\n};\n\nEDDSA.prototype.isPoint = function isPoint(val) {\n return val instanceof this.pointClass;\n};\n","'use strict';\n\nvar elliptic = exports;\n\nelliptic.version = require('../package.json').version;\nelliptic.utils = require('./elliptic/utils');\nelliptic.rand = require('brorand');\nelliptic.curve = require('./elliptic/curve');\nelliptic.curves = require('./elliptic/curves');\n\n// Protocols\nelliptic.ec = require('./elliptic/ec');\nelliptic.eddsa = require('./elliptic/eddsa');\n","(function (module, exports) {\n 'use strict';\n\n // Utils\n function assert (val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n }\n\n // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n function inherits (ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n\n // BN\n\n function BN (number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0;\n\n // Reduction context\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n\n var Buffer;\n try {\n if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {\n Buffer = window.Buffer;\n } else {\n Buffer = require('buffer').Buffer;\n }\n } catch (e) {\n }\n\n BN.isBN = function isBN (num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' &&\n num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max (left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min (left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init (number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n assert(base === (base | 0) && base >= 2 && base <= 36);\n\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n if (number[0] === '-') {\n start++;\n this.negative = 1;\n }\n\n if (start < number.length) {\n if (base === 16) {\n this._parseHex(number, start, endian);\n } else {\n this._parseBase(number, base, start);\n if (endian === 'le') {\n this._initArray(this.toArray(), base, endian);\n }\n }\n }\n };\n\n BN.prototype._initNumber = function _initNumber (number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n if (number < 0x4000000) {\n this.words = [number & 0x3ffffff];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff\n ];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff,\n 1\n ];\n this.length = 3;\n }\n\n if (endian !== 'le') return;\n\n // Reverse the bytes\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray (number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n if (number.length <= 0) {\n this.words = [0];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this._strip();\n };\n\n function parseHex4Bits (string, index) {\n var c = string.charCodeAt(index);\n // '0' - '9'\n if (c >= 48 && c <= 57) {\n return c - 48;\n // 'A' - 'F'\n } else if (c >= 65 && c <= 70) {\n return c - 55;\n // 'a' - 'f'\n } else if (c >= 97 && c <= 102) {\n return c - 87;\n } else {\n assert(false, 'Invalid character in ' + string);\n }\n }\n\n function parseHexByte (string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n if (index - 1 >= lowerBound) {\n r |= parseHex4Bits(string, index - 1) << 4;\n }\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex (number, start, endian) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n // 24-bits chunks\n var off = 0;\n var j = 0;\n\n var w;\n if (endian === 'be') {\n for (i = number.length - 1; i >= start; i -= 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n } else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n }\n\n this._strip();\n };\n\n function parseBase (str, start, end, mul) {\n var r = 0;\n var b = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r *= mul;\n\n // 'a'\n if (c >= 49) {\n b = c - 49 + 0xa;\n\n // 'A'\n } else if (c >= 17) {\n b = c - 17 + 0xa;\n\n // '0' - '9'\n } else {\n b = c;\n }\n assert(c >= 0 && b < mul, 'Invalid character');\n r += b;\n }\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase (number, base, start) {\n // Initialize as zero\n this.words = [0];\n this.length = 1;\n\n // Find length of limb in base\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n limbLen--;\n limbPow = (limbPow / base) | 0;\n\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n\n this.imuln(limbPow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n this._strip();\n };\n\n BN.prototype.copy = function copy (dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n function move (dest, src) {\n dest.words = src.words;\n dest.length = src.length;\n dest.negative = src.negative;\n dest.red = src.red;\n }\n\n BN.prototype._move = function _move (dest) {\n move(dest, this);\n };\n\n BN.prototype.clone = function clone () {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand (size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n return this;\n };\n\n // Remove leading `0` from `this`\n BN.prototype._strip = function strip () {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign () {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n return this;\n };\n\n // Check Symbol.for because not everywhere where Symbol defined\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility\n if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {\n try {\n BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect;\n } catch (e) {\n BN.prototype.inspect = inspect;\n }\n } else {\n BN.prototype.inspect = inspect;\n }\n\n function inspect () {\n return (this.red ? '';\n }\n\n /*\n\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n\n */\n\n var zeros = [\n '',\n '0',\n '00',\n '000',\n '0000',\n '00000',\n '000000',\n '0000000',\n '00000000',\n '000000000',\n '0000000000',\n '00000000000',\n '000000000000',\n '0000000000000',\n '00000000000000',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n '00000000000000000000',\n '000000000000000000000',\n '0000000000000000000000',\n '00000000000000000000000',\n '000000000000000000000000',\n '0000000000000000000000000'\n ];\n\n var groupSizes = [\n 0, 0,\n 25, 16, 12, 11, 10, 9, 8,\n 8, 7, 7, 7, 7, 6, 6,\n 6, 6, 6, 6, 6, 5, 5,\n 5, 5, 5, 5, 5, 5, 5,\n 5, 5, 5, 5, 5, 5, 5\n ];\n\n var groupBases = [\n 0, 0,\n 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,\n 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,\n 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,\n 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,\n 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176\n ];\n\n BN.prototype.toString = function toString (base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n\n var out;\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = (((w << off) | carry) & 0xffffff).toString(16);\n carry = (w >>> (24 - off)) & 0xffffff;\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n }\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base];\n // var groupBase = Math.pow(base, groupSize);\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n while (!c.isZero()) {\n var r = c.modrn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n if (this.isZero()) {\n out = '0' + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber () {\n var ret = this.words[0];\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + (this.words[1] * 0x4000000);\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n return (this.negative !== 0) ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON () {\n return this.toString(16, 2);\n };\n\n if (Buffer) {\n BN.prototype.toBuffer = function toBuffer (endian, length) {\n return this.toArrayLike(Buffer, endian, length);\n };\n }\n\n BN.prototype.toArray = function toArray (endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n var allocate = function allocate (ArrayType, size) {\n if (ArrayType.allocUnsafe) {\n return ArrayType.allocUnsafe(size);\n }\n return new ArrayType(size);\n };\n\n BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {\n this._strip();\n\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n\n var res = allocate(ArrayType, reqLength);\n var postfix = endian === 'le' ? 'LE' : 'BE';\n this['_toArrayLike' + postfix](res, byteLength);\n return res;\n };\n\n BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) {\n var position = 0;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position++] = word & 0xff;\n if (position < res.length) {\n res[position++] = (word >> 8) & 0xff;\n }\n if (position < res.length) {\n res[position++] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position < res.length) {\n res[position++] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position < res.length) {\n res[position++] = carry;\n\n while (position < res.length) {\n res[position++] = 0;\n }\n }\n };\n\n BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) {\n var position = res.length - 1;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position--] = word & 0xff;\n if (position >= 0) {\n res[position--] = (word >> 8) & 0xff;\n }\n if (position >= 0) {\n res[position--] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position >= 0) {\n res[position--] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position >= 0) {\n res[position--] = carry;\n\n while (position >= 0) {\n res[position--] = 0;\n }\n }\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits (w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits (w) {\n var t = w;\n var r = 0;\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits (w) {\n // Short-cut\n if (w === 0) return 26;\n\n var t = w;\n var r = 0;\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n if ((t & 0x1) === 0) {\n r++;\n }\n return r;\n };\n\n // Return number of used bits in a BN\n BN.prototype.bitLength = function bitLength () {\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray (num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n w[bit] = (num.words[off] >>> wbit) & 0x01;\n }\n\n return w;\n }\n\n // Number of trailing zero bits\n BN.prototype.zeroBits = function zeroBits () {\n if (this.isZero()) return 0;\n\n var r = 0;\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n r += b;\n if (b !== 26) break;\n }\n return r;\n };\n\n BN.prototype.byteLength = function byteLength () {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos (width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos (width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg () {\n return this.negative !== 0;\n };\n\n // Return negative clone of `this`\n BN.prototype.neg = function neg () {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg () {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n };\n\n // Or `num` with `this` in-place\n BN.prototype.iuor = function iuor (num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this._strip();\n };\n\n BN.prototype.ior = function ior (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n };\n\n // Or `num` with `this`\n BN.prototype.or = function or (num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor (num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n };\n\n // And `num` with `this` in-place\n BN.prototype.iuand = function iuand (num) {\n // b = min-length(num, this)\n var b;\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n\n return this._strip();\n };\n\n BN.prototype.iand = function iand (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n };\n\n // And `num` with `this`\n BN.prototype.and = function and (num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand (num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n };\n\n // Xor `num` with `this` in-place\n BN.prototype.iuxor = function iuxor (num) {\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n\n return this._strip();\n };\n\n BN.prototype.ixor = function ixor (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n };\n\n // Xor `num` with `this`\n BN.prototype.xor = function xor (num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor (num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n };\n\n // Not ``this`` with ``width`` bitwidth\n BN.prototype.inotn = function inotn (width) {\n assert(typeof width === 'number' && width >= 0);\n\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26;\n\n // Extend the buffer with leading zeroes\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n }\n\n // Handle complete words\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n }\n\n // Handle the residue\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));\n }\n\n // And remove leading zeroes\n return this._strip();\n };\n\n BN.prototype.notn = function notn (width) {\n return this.clone().inotn(width);\n };\n\n // Set `bit` of `this`\n BN.prototype.setn = function setn (bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | (1 << wbit);\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this._strip();\n };\n\n // Add `num` to `this` in-place\n BN.prototype.iadd = function iadd (num) {\n var r;\n\n // negative + positive\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign();\n\n // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n }\n\n // a.length > b.length\n var a, b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n };\n\n // Add `num` to `this`\n BN.prototype.add = function add (num) {\n var res;\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n\n return num.clone().iadd(this);\n };\n\n // Subtract `num` from `this` in-place\n BN.prototype.isub = function isub (num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign();\n\n // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n }\n\n // At this point both numbers are positive\n var cmp = this.cmp(num);\n\n // Optimization - zeroify\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n\n // a > b\n var a, b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n // Copy rest of the words\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this._strip();\n };\n\n // Subtract `num` from `this`\n BN.prototype.sub = function sub (num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = (self.length + num.length) | 0;\n out.length = len;\n len = (len - 1) | 0;\n\n // Peel one iteration (compiler can't do it, because of code complexity)\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n var carry = (r / 0x4000000) | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = (k - j) | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += (r / 0x4000000) | 0;\n rword = r & 0x3ffffff;\n }\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n var comb10MulTo = function comb10MulTo (self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = (mid + Math.imul(ah0, bl0)) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = (mid + Math.imul(ah1, bl0)) | 0;\n hi = Math.imul(ah1, bh0);\n lo = (lo + Math.imul(al0, bl1)) | 0;\n mid = (mid + Math.imul(al0, bh1)) | 0;\n mid = (mid + Math.imul(ah0, bl1)) | 0;\n hi = (hi + Math.imul(ah0, bh1)) | 0;\n var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = (mid + Math.imul(ah2, bl0)) | 0;\n hi = Math.imul(ah2, bh0);\n lo = (lo + Math.imul(al1, bl1)) | 0;\n mid = (mid + Math.imul(al1, bh1)) | 0;\n mid = (mid + Math.imul(ah1, bl1)) | 0;\n hi = (hi + Math.imul(ah1, bh1)) | 0;\n lo = (lo + Math.imul(al0, bl2)) | 0;\n mid = (mid + Math.imul(al0, bh2)) | 0;\n mid = (mid + Math.imul(ah0, bl2)) | 0;\n hi = (hi + Math.imul(ah0, bh2)) | 0;\n var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = (mid + Math.imul(ah3, bl0)) | 0;\n hi = Math.imul(ah3, bh0);\n lo = (lo + Math.imul(al2, bl1)) | 0;\n mid = (mid + Math.imul(al2, bh1)) | 0;\n mid = (mid + Math.imul(ah2, bl1)) | 0;\n hi = (hi + Math.imul(ah2, bh1)) | 0;\n lo = (lo + Math.imul(al1, bl2)) | 0;\n mid = (mid + Math.imul(al1, bh2)) | 0;\n mid = (mid + Math.imul(ah1, bl2)) | 0;\n hi = (hi + Math.imul(ah1, bh2)) | 0;\n lo = (lo + Math.imul(al0, bl3)) | 0;\n mid = (mid + Math.imul(al0, bh3)) | 0;\n mid = (mid + Math.imul(ah0, bl3)) | 0;\n hi = (hi + Math.imul(ah0, bh3)) | 0;\n var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = (mid + Math.imul(ah4, bl0)) | 0;\n hi = Math.imul(ah4, bh0);\n lo = (lo + Math.imul(al3, bl1)) | 0;\n mid = (mid + Math.imul(al3, bh1)) | 0;\n mid = (mid + Math.imul(ah3, bl1)) | 0;\n hi = (hi + Math.imul(ah3, bh1)) | 0;\n lo = (lo + Math.imul(al2, bl2)) | 0;\n mid = (mid + Math.imul(al2, bh2)) | 0;\n mid = (mid + Math.imul(ah2, bl2)) | 0;\n hi = (hi + Math.imul(ah2, bh2)) | 0;\n lo = (lo + Math.imul(al1, bl3)) | 0;\n mid = (mid + Math.imul(al1, bh3)) | 0;\n mid = (mid + Math.imul(ah1, bl3)) | 0;\n hi = (hi + Math.imul(ah1, bh3)) | 0;\n lo = (lo + Math.imul(al0, bl4)) | 0;\n mid = (mid + Math.imul(al0, bh4)) | 0;\n mid = (mid + Math.imul(ah0, bl4)) | 0;\n hi = (hi + Math.imul(ah0, bh4)) | 0;\n var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = (mid + Math.imul(ah5, bl0)) | 0;\n hi = Math.imul(ah5, bh0);\n lo = (lo + Math.imul(al4, bl1)) | 0;\n mid = (mid + Math.imul(al4, bh1)) | 0;\n mid = (mid + Math.imul(ah4, bl1)) | 0;\n hi = (hi + Math.imul(ah4, bh1)) | 0;\n lo = (lo + Math.imul(al3, bl2)) | 0;\n mid = (mid + Math.imul(al3, bh2)) | 0;\n mid = (mid + Math.imul(ah3, bl2)) | 0;\n hi = (hi + Math.imul(ah3, bh2)) | 0;\n lo = (lo + Math.imul(al2, bl3)) | 0;\n mid = (mid + Math.imul(al2, bh3)) | 0;\n mid = (mid + Math.imul(ah2, bl3)) | 0;\n hi = (hi + Math.imul(ah2, bh3)) | 0;\n lo = (lo + Math.imul(al1, bl4)) | 0;\n mid = (mid + Math.imul(al1, bh4)) | 0;\n mid = (mid + Math.imul(ah1, bl4)) | 0;\n hi = (hi + Math.imul(ah1, bh4)) | 0;\n lo = (lo + Math.imul(al0, bl5)) | 0;\n mid = (mid + Math.imul(al0, bh5)) | 0;\n mid = (mid + Math.imul(ah0, bl5)) | 0;\n hi = (hi + Math.imul(ah0, bh5)) | 0;\n var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = (mid + Math.imul(ah6, bl0)) | 0;\n hi = Math.imul(ah6, bh0);\n lo = (lo + Math.imul(al5, bl1)) | 0;\n mid = (mid + Math.imul(al5, bh1)) | 0;\n mid = (mid + Math.imul(ah5, bl1)) | 0;\n hi = (hi + Math.imul(ah5, bh1)) | 0;\n lo = (lo + Math.imul(al4, bl2)) | 0;\n mid = (mid + Math.imul(al4, bh2)) | 0;\n mid = (mid + Math.imul(ah4, bl2)) | 0;\n hi = (hi + Math.imul(ah4, bh2)) | 0;\n lo = (lo + Math.imul(al3, bl3)) | 0;\n mid = (mid + Math.imul(al3, bh3)) | 0;\n mid = (mid + Math.imul(ah3, bl3)) | 0;\n hi = (hi + Math.imul(ah3, bh3)) | 0;\n lo = (lo + Math.imul(al2, bl4)) | 0;\n mid = (mid + Math.imul(al2, bh4)) | 0;\n mid = (mid + Math.imul(ah2, bl4)) | 0;\n hi = (hi + Math.imul(ah2, bh4)) | 0;\n lo = (lo + Math.imul(al1, bl5)) | 0;\n mid = (mid + Math.imul(al1, bh5)) | 0;\n mid = (mid + Math.imul(ah1, bl5)) | 0;\n hi = (hi + Math.imul(ah1, bh5)) | 0;\n lo = (lo + Math.imul(al0, bl6)) | 0;\n mid = (mid + Math.imul(al0, bh6)) | 0;\n mid = (mid + Math.imul(ah0, bl6)) | 0;\n hi = (hi + Math.imul(ah0, bh6)) | 0;\n var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = (mid + Math.imul(ah7, bl0)) | 0;\n hi = Math.imul(ah7, bh0);\n lo = (lo + Math.imul(al6, bl1)) | 0;\n mid = (mid + Math.imul(al6, bh1)) | 0;\n mid = (mid + Math.imul(ah6, bl1)) | 0;\n hi = (hi + Math.imul(ah6, bh1)) | 0;\n lo = (lo + Math.imul(al5, bl2)) | 0;\n mid = (mid + Math.imul(al5, bh2)) | 0;\n mid = (mid + Math.imul(ah5, bl2)) | 0;\n hi = (hi + Math.imul(ah5, bh2)) | 0;\n lo = (lo + Math.imul(al4, bl3)) | 0;\n mid = (mid + Math.imul(al4, bh3)) | 0;\n mid = (mid + Math.imul(ah4, bl3)) | 0;\n hi = (hi + Math.imul(ah4, bh3)) | 0;\n lo = (lo + Math.imul(al3, bl4)) | 0;\n mid = (mid + Math.imul(al3, bh4)) | 0;\n mid = (mid + Math.imul(ah3, bl4)) | 0;\n hi = (hi + Math.imul(ah3, bh4)) | 0;\n lo = (lo + Math.imul(al2, bl5)) | 0;\n mid = (mid + Math.imul(al2, bh5)) | 0;\n mid = (mid + Math.imul(ah2, bl5)) | 0;\n hi = (hi + Math.imul(ah2, bh5)) | 0;\n lo = (lo + Math.imul(al1, bl6)) | 0;\n mid = (mid + Math.imul(al1, bh6)) | 0;\n mid = (mid + Math.imul(ah1, bl6)) | 0;\n hi = (hi + Math.imul(ah1, bh6)) | 0;\n lo = (lo + Math.imul(al0, bl7)) | 0;\n mid = (mid + Math.imul(al0, bh7)) | 0;\n mid = (mid + Math.imul(ah0, bl7)) | 0;\n hi = (hi + Math.imul(ah0, bh7)) | 0;\n var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = (mid + Math.imul(ah8, bl0)) | 0;\n hi = Math.imul(ah8, bh0);\n lo = (lo + Math.imul(al7, bl1)) | 0;\n mid = (mid + Math.imul(al7, bh1)) | 0;\n mid = (mid + Math.imul(ah7, bl1)) | 0;\n hi = (hi + Math.imul(ah7, bh1)) | 0;\n lo = (lo + Math.imul(al6, bl2)) | 0;\n mid = (mid + Math.imul(al6, bh2)) | 0;\n mid = (mid + Math.imul(ah6, bl2)) | 0;\n hi = (hi + Math.imul(ah6, bh2)) | 0;\n lo = (lo + Math.imul(al5, bl3)) | 0;\n mid = (mid + Math.imul(al5, bh3)) | 0;\n mid = (mid + Math.imul(ah5, bl3)) | 0;\n hi = (hi + Math.imul(ah5, bh3)) | 0;\n lo = (lo + Math.imul(al4, bl4)) | 0;\n mid = (mid + Math.imul(al4, bh4)) | 0;\n mid = (mid + Math.imul(ah4, bl4)) | 0;\n hi = (hi + Math.imul(ah4, bh4)) | 0;\n lo = (lo + Math.imul(al3, bl5)) | 0;\n mid = (mid + Math.imul(al3, bh5)) | 0;\n mid = (mid + Math.imul(ah3, bl5)) | 0;\n hi = (hi + Math.imul(ah3, bh5)) | 0;\n lo = (lo + Math.imul(al2, bl6)) | 0;\n mid = (mid + Math.imul(al2, bh6)) | 0;\n mid = (mid + Math.imul(ah2, bl6)) | 0;\n hi = (hi + Math.imul(ah2, bh6)) | 0;\n lo = (lo + Math.imul(al1, bl7)) | 0;\n mid = (mid + Math.imul(al1, bh7)) | 0;\n mid = (mid + Math.imul(ah1, bl7)) | 0;\n hi = (hi + Math.imul(ah1, bh7)) | 0;\n lo = (lo + Math.imul(al0, bl8)) | 0;\n mid = (mid + Math.imul(al0, bh8)) | 0;\n mid = (mid + Math.imul(ah0, bl8)) | 0;\n hi = (hi + Math.imul(ah0, bh8)) | 0;\n var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = (mid + Math.imul(ah9, bl0)) | 0;\n hi = Math.imul(ah9, bh0);\n lo = (lo + Math.imul(al8, bl1)) | 0;\n mid = (mid + Math.imul(al8, bh1)) | 0;\n mid = (mid + Math.imul(ah8, bl1)) | 0;\n hi = (hi + Math.imul(ah8, bh1)) | 0;\n lo = (lo + Math.imul(al7, bl2)) | 0;\n mid = (mid + Math.imul(al7, bh2)) | 0;\n mid = (mid + Math.imul(ah7, bl2)) | 0;\n hi = (hi + Math.imul(ah7, bh2)) | 0;\n lo = (lo + Math.imul(al6, bl3)) | 0;\n mid = (mid + Math.imul(al6, bh3)) | 0;\n mid = (mid + Math.imul(ah6, bl3)) | 0;\n hi = (hi + Math.imul(ah6, bh3)) | 0;\n lo = (lo + Math.imul(al5, bl4)) | 0;\n mid = (mid + Math.imul(al5, bh4)) | 0;\n mid = (mid + Math.imul(ah5, bl4)) | 0;\n hi = (hi + Math.imul(ah5, bh4)) | 0;\n lo = (lo + Math.imul(al4, bl5)) | 0;\n mid = (mid + Math.imul(al4, bh5)) | 0;\n mid = (mid + Math.imul(ah4, bl5)) | 0;\n hi = (hi + Math.imul(ah4, bh5)) | 0;\n lo = (lo + Math.imul(al3, bl6)) | 0;\n mid = (mid + Math.imul(al3, bh6)) | 0;\n mid = (mid + Math.imul(ah3, bl6)) | 0;\n hi = (hi + Math.imul(ah3, bh6)) | 0;\n lo = (lo + Math.imul(al2, bl7)) | 0;\n mid = (mid + Math.imul(al2, bh7)) | 0;\n mid = (mid + Math.imul(ah2, bl7)) | 0;\n hi = (hi + Math.imul(ah2, bh7)) | 0;\n lo = (lo + Math.imul(al1, bl8)) | 0;\n mid = (mid + Math.imul(al1, bh8)) | 0;\n mid = (mid + Math.imul(ah1, bl8)) | 0;\n hi = (hi + Math.imul(ah1, bh8)) | 0;\n lo = (lo + Math.imul(al0, bl9)) | 0;\n mid = (mid + Math.imul(al0, bh9)) | 0;\n mid = (mid + Math.imul(ah0, bl9)) | 0;\n hi = (hi + Math.imul(ah0, bh9)) | 0;\n var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = (mid + Math.imul(ah9, bl1)) | 0;\n hi = Math.imul(ah9, bh1);\n lo = (lo + Math.imul(al8, bl2)) | 0;\n mid = (mid + Math.imul(al8, bh2)) | 0;\n mid = (mid + Math.imul(ah8, bl2)) | 0;\n hi = (hi + Math.imul(ah8, bh2)) | 0;\n lo = (lo + Math.imul(al7, bl3)) | 0;\n mid = (mid + Math.imul(al7, bh3)) | 0;\n mid = (mid + Math.imul(ah7, bl3)) | 0;\n hi = (hi + Math.imul(ah7, bh3)) | 0;\n lo = (lo + Math.imul(al6, bl4)) | 0;\n mid = (mid + Math.imul(al6, bh4)) | 0;\n mid = (mid + Math.imul(ah6, bl4)) | 0;\n hi = (hi + Math.imul(ah6, bh4)) | 0;\n lo = (lo + Math.imul(al5, bl5)) | 0;\n mid = (mid + Math.imul(al5, bh5)) | 0;\n mid = (mid + Math.imul(ah5, bl5)) | 0;\n hi = (hi + Math.imul(ah5, bh5)) | 0;\n lo = (lo + Math.imul(al4, bl6)) | 0;\n mid = (mid + Math.imul(al4, bh6)) | 0;\n mid = (mid + Math.imul(ah4, bl6)) | 0;\n hi = (hi + Math.imul(ah4, bh6)) | 0;\n lo = (lo + Math.imul(al3, bl7)) | 0;\n mid = (mid + Math.imul(al3, bh7)) | 0;\n mid = (mid + Math.imul(ah3, bl7)) | 0;\n hi = (hi + Math.imul(ah3, bh7)) | 0;\n lo = (lo + Math.imul(al2, bl8)) | 0;\n mid = (mid + Math.imul(al2, bh8)) | 0;\n mid = (mid + Math.imul(ah2, bl8)) | 0;\n hi = (hi + Math.imul(ah2, bh8)) | 0;\n lo = (lo + Math.imul(al1, bl9)) | 0;\n mid = (mid + Math.imul(al1, bh9)) | 0;\n mid = (mid + Math.imul(ah1, bl9)) | 0;\n hi = (hi + Math.imul(ah1, bh9)) | 0;\n var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = (mid + Math.imul(ah9, bl2)) | 0;\n hi = Math.imul(ah9, bh2);\n lo = (lo + Math.imul(al8, bl3)) | 0;\n mid = (mid + Math.imul(al8, bh3)) | 0;\n mid = (mid + Math.imul(ah8, bl3)) | 0;\n hi = (hi + Math.imul(ah8, bh3)) | 0;\n lo = (lo + Math.imul(al7, bl4)) | 0;\n mid = (mid + Math.imul(al7, bh4)) | 0;\n mid = (mid + Math.imul(ah7, bl4)) | 0;\n hi = (hi + Math.imul(ah7, bh4)) | 0;\n lo = (lo + Math.imul(al6, bl5)) | 0;\n mid = (mid + Math.imul(al6, bh5)) | 0;\n mid = (mid + Math.imul(ah6, bl5)) | 0;\n hi = (hi + Math.imul(ah6, bh5)) | 0;\n lo = (lo + Math.imul(al5, bl6)) | 0;\n mid = (mid + Math.imul(al5, bh6)) | 0;\n mid = (mid + Math.imul(ah5, bl6)) | 0;\n hi = (hi + Math.imul(ah5, bh6)) | 0;\n lo = (lo + Math.imul(al4, bl7)) | 0;\n mid = (mid + Math.imul(al4, bh7)) | 0;\n mid = (mid + Math.imul(ah4, bl7)) | 0;\n hi = (hi + Math.imul(ah4, bh7)) | 0;\n lo = (lo + Math.imul(al3, bl8)) | 0;\n mid = (mid + Math.imul(al3, bh8)) | 0;\n mid = (mid + Math.imul(ah3, bl8)) | 0;\n hi = (hi + Math.imul(ah3, bh8)) | 0;\n lo = (lo + Math.imul(al2, bl9)) | 0;\n mid = (mid + Math.imul(al2, bh9)) | 0;\n mid = (mid + Math.imul(ah2, bl9)) | 0;\n hi = (hi + Math.imul(ah2, bh9)) | 0;\n var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = (mid + Math.imul(ah9, bl3)) | 0;\n hi = Math.imul(ah9, bh3);\n lo = (lo + Math.imul(al8, bl4)) | 0;\n mid = (mid + Math.imul(al8, bh4)) | 0;\n mid = (mid + Math.imul(ah8, bl4)) | 0;\n hi = (hi + Math.imul(ah8, bh4)) | 0;\n lo = (lo + Math.imul(al7, bl5)) | 0;\n mid = (mid + Math.imul(al7, bh5)) | 0;\n mid = (mid + Math.imul(ah7, bl5)) | 0;\n hi = (hi + Math.imul(ah7, bh5)) | 0;\n lo = (lo + Math.imul(al6, bl6)) | 0;\n mid = (mid + Math.imul(al6, bh6)) | 0;\n mid = (mid + Math.imul(ah6, bl6)) | 0;\n hi = (hi + Math.imul(ah6, bh6)) | 0;\n lo = (lo + Math.imul(al5, bl7)) | 0;\n mid = (mid + Math.imul(al5, bh7)) | 0;\n mid = (mid + Math.imul(ah5, bl7)) | 0;\n hi = (hi + Math.imul(ah5, bh7)) | 0;\n lo = (lo + Math.imul(al4, bl8)) | 0;\n mid = (mid + Math.imul(al4, bh8)) | 0;\n mid = (mid + Math.imul(ah4, bl8)) | 0;\n hi = (hi + Math.imul(ah4, bh8)) | 0;\n lo = (lo + Math.imul(al3, bl9)) | 0;\n mid = (mid + Math.imul(al3, bh9)) | 0;\n mid = (mid + Math.imul(ah3, bl9)) | 0;\n hi = (hi + Math.imul(ah3, bh9)) | 0;\n var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = (mid + Math.imul(ah9, bl4)) | 0;\n hi = Math.imul(ah9, bh4);\n lo = (lo + Math.imul(al8, bl5)) | 0;\n mid = (mid + Math.imul(al8, bh5)) | 0;\n mid = (mid + Math.imul(ah8, bl5)) | 0;\n hi = (hi + Math.imul(ah8, bh5)) | 0;\n lo = (lo + Math.imul(al7, bl6)) | 0;\n mid = (mid + Math.imul(al7, bh6)) | 0;\n mid = (mid + Math.imul(ah7, bl6)) | 0;\n hi = (hi + Math.imul(ah7, bh6)) | 0;\n lo = (lo + Math.imul(al6, bl7)) | 0;\n mid = (mid + Math.imul(al6, bh7)) | 0;\n mid = (mid + Math.imul(ah6, bl7)) | 0;\n hi = (hi + Math.imul(ah6, bh7)) | 0;\n lo = (lo + Math.imul(al5, bl8)) | 0;\n mid = (mid + Math.imul(al5, bh8)) | 0;\n mid = (mid + Math.imul(ah5, bl8)) | 0;\n hi = (hi + Math.imul(ah5, bh8)) | 0;\n lo = (lo + Math.imul(al4, bl9)) | 0;\n mid = (mid + Math.imul(al4, bh9)) | 0;\n mid = (mid + Math.imul(ah4, bl9)) | 0;\n hi = (hi + Math.imul(ah4, bh9)) | 0;\n var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = (mid + Math.imul(ah9, bl5)) | 0;\n hi = Math.imul(ah9, bh5);\n lo = (lo + Math.imul(al8, bl6)) | 0;\n mid = (mid + Math.imul(al8, bh6)) | 0;\n mid = (mid + Math.imul(ah8, bl6)) | 0;\n hi = (hi + Math.imul(ah8, bh6)) | 0;\n lo = (lo + Math.imul(al7, bl7)) | 0;\n mid = (mid + Math.imul(al7, bh7)) | 0;\n mid = (mid + Math.imul(ah7, bl7)) | 0;\n hi = (hi + Math.imul(ah7, bh7)) | 0;\n lo = (lo + Math.imul(al6, bl8)) | 0;\n mid = (mid + Math.imul(al6, bh8)) | 0;\n mid = (mid + Math.imul(ah6, bl8)) | 0;\n hi = (hi + Math.imul(ah6, bh8)) | 0;\n lo = (lo + Math.imul(al5, bl9)) | 0;\n mid = (mid + Math.imul(al5, bh9)) | 0;\n mid = (mid + Math.imul(ah5, bl9)) | 0;\n hi = (hi + Math.imul(ah5, bh9)) | 0;\n var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = (mid + Math.imul(ah9, bl6)) | 0;\n hi = Math.imul(ah9, bh6);\n lo = (lo + Math.imul(al8, bl7)) | 0;\n mid = (mid + Math.imul(al8, bh7)) | 0;\n mid = (mid + Math.imul(ah8, bl7)) | 0;\n hi = (hi + Math.imul(ah8, bh7)) | 0;\n lo = (lo + Math.imul(al7, bl8)) | 0;\n mid = (mid + Math.imul(al7, bh8)) | 0;\n mid = (mid + Math.imul(ah7, bl8)) | 0;\n hi = (hi + Math.imul(ah7, bh8)) | 0;\n lo = (lo + Math.imul(al6, bl9)) | 0;\n mid = (mid + Math.imul(al6, bh9)) | 0;\n mid = (mid + Math.imul(ah6, bl9)) | 0;\n hi = (hi + Math.imul(ah6, bh9)) | 0;\n var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = (mid + Math.imul(ah9, bl7)) | 0;\n hi = Math.imul(ah9, bh7);\n lo = (lo + Math.imul(al8, bl8)) | 0;\n mid = (mid + Math.imul(al8, bh8)) | 0;\n mid = (mid + Math.imul(ah8, bl8)) | 0;\n hi = (hi + Math.imul(ah8, bh8)) | 0;\n lo = (lo + Math.imul(al7, bl9)) | 0;\n mid = (mid + Math.imul(al7, bh9)) | 0;\n mid = (mid + Math.imul(ah7, bl9)) | 0;\n hi = (hi + Math.imul(ah7, bh9)) | 0;\n var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = (mid + Math.imul(ah9, bl8)) | 0;\n hi = Math.imul(ah9, bh8);\n lo = (lo + Math.imul(al8, bl9)) | 0;\n mid = (mid + Math.imul(al8, bh9)) | 0;\n mid = (mid + Math.imul(ah8, bl9)) | 0;\n hi = (hi + Math.imul(ah8, bh9)) | 0;\n var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = (mid + Math.imul(ah9, bl9)) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n return out;\n };\n\n // Polyfill comb\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n function jumboMulTo (self, num, out) {\n // Temporary disable, see https://github.com/indutny/bn.js/issues/211\n // var fftm = new FFTM();\n // return fftm.mulp(self, num, out);\n return bigMulTo(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo (num, out) {\n var res;\n var len = this.length + num.length;\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n };\n\n // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT (N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n };\n\n // Returns binary-reversed representation of `x`\n FFTM.prototype.revBin = function revBin (x, l, N) {\n if (x === 0 || x === N - 1) return x;\n\n var rb = 0;\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << (l - i - 1);\n x >>= 1;\n }\n\n return rb;\n };\n\n // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n\n var rx = rtwdf_ * ro - itwdf_ * io;\n\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n\n /* jshint maxdepth : false */\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b (n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate (rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n\n t = iws[i];\n\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b (ws, N) {\n var carry = 0;\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +\n Math.round(ws[2 * i] / N) +\n carry;\n\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {\n var carry = 0;\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n\n rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;\n }\n\n // Pad with zeroes\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub (N) {\n var ph = new Array(N);\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp (x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n\n var rmws = out.words;\n rmws.length = N;\n\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out._strip();\n };\n\n // Multiply `this` by `num`\n BN.prototype.mul = function mul (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n };\n\n // Multiply employing FFT\n BN.prototype.mulf = function mulf (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n };\n\n // In-place Multiplication\n BN.prototype.imul = function imul (num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n\n // Carry\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += (w / 0x4000000) | 0;\n // NOTE: lo is 27bit maximum\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.muln = function muln (num) {\n return this.clone().imuln(num);\n };\n\n // `this` * `this`\n BN.prototype.sqr = function sqr () {\n return this.mul(this);\n };\n\n // `this` * `this` in-place\n BN.prototype.isqr = function isqr () {\n return this.imul(this.clone());\n };\n\n // Math.pow(`this`, `num`)\n BN.prototype.pow = function pow (num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1);\n\n // Skip leading zeroes\n var res = this;\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n\n res = res.mul(q);\n }\n }\n\n return res;\n };\n\n // Shift-left in-place\n BN.prototype.iushln = function iushln (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = ((this.words[i] | 0) - newCarry) << r;\n this.words[i] = c | carry;\n carry = newCarry >>> (26 - r);\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishln = function ishln (bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n };\n\n // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n BN.prototype.iushrn = function iushrn (bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n if (hint) {\n h = (hint - (hint % 26)) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n var maskedWords = extended;\n\n h -= s;\n h = Math.max(0, h);\n\n // Extended mode, copy masked part\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n maskedWords.length = s;\n }\n\n if (s === 0) {\n // No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = (carry << (26 - r)) | (word >>> r);\n carry = word & mask;\n }\n\n // Push carried bits as a mask\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishrn = function ishrn (bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n };\n\n // Shift-left\n BN.prototype.shln = function shln (bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln (bits) {\n return this.clone().iushln(bits);\n };\n\n // Shift-right\n BN.prototype.shrn = function shrn (bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn (bits) {\n return this.clone().iushrn(bits);\n };\n\n // Test if n bit is set\n BN.prototype.testn = function testn (bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) return false;\n\n // Check bit and return\n var w = this.words[s];\n\n return !!(w & q);\n };\n\n // Return only lowers bits of number (in-place)\n BN.prototype.imaskn = function imaskn (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n this.words[this.length - 1] &= mask;\n }\n\n return this._strip();\n };\n\n // Return only lowers bits of number\n BN.prototype.maskn = function maskn (bits) {\n return this.clone().imaskn(bits);\n };\n\n // Add plain number `num` to `this`\n BN.prototype.iaddn = function iaddn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num);\n\n // Possible sign change\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) <= num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n }\n\n // Add without checks\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn (num) {\n this.words[0] += num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n this.length = Math.max(this.length, i + 1);\n\n return this;\n };\n\n // Subtract plain number `num` from `this`\n BN.prototype.isubn = function isubn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this._strip();\n };\n\n BN.prototype.addn = function addn (num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn (num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs () {\n this.negative = 0;\n\n return this;\n };\n\n BN.prototype.abs = function abs () {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - ((right / 0x4000000) | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this._strip();\n\n // Subtraction overflow\n assert(carry === -1);\n carry = 0;\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n this.negative = 1;\n\n return this._strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv (num, mode) {\n var shift = this.length - num.length;\n\n var a = this.clone();\n var b = num;\n\n // Normalize\n var bhi = b.words[b.length - 1] | 0;\n var bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits;\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n }\n\n // Initialize quotient\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (diff.negative === 0) {\n a = diff;\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 +\n (a.words[b.length + j - 1] | 0);\n\n // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n qj = Math.min((qj / bhi) | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n a._ishlnsubmul(b, 1, j);\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n if (q) {\n q.words[j] = qj;\n }\n }\n if (q) {\n q._strip();\n }\n a._strip();\n\n // Denormalize\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n };\n\n // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n BN.prototype.divmod = function divmod (num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n }\n\n // Both numbers are positive at this point\n\n // Strip both numbers to approximate shift value\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n }\n\n // Very short reduction\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n };\n\n // Find `this` / `num`\n BN.prototype.div = function div (num) {\n return this.divmod(num, 'div', false).div;\n };\n\n // Find `this` % `num`\n BN.prototype.mod = function mod (num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod (num) {\n return this.divmod(num, 'mod', true).mod;\n };\n\n // Find Round(`this` / `num`)\n BN.prototype.divRound = function divRound (num) {\n var dm = this.divmod(num);\n\n // Fast case - exact division\n if (dm.mod.isZero()) return dm.div;\n\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n\n // Round down\n if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div;\n\n // Round up\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modrn = function modrn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return isNegNum ? -acc : acc;\n };\n\n // WARNING: DEPRECATED\n BN.prototype.modn = function modn (num) {\n return this.modrn(num);\n };\n\n // In-place division by number\n BN.prototype.idivn = function idivn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = (w / num) | 0;\n carry = w % num;\n }\n\n this._strip();\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.divn = function divn (num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n }\n\n // A * x + B * y = x\n var A = new BN(1);\n var B = new BN(0);\n\n // C * x + D * y = y\n var C = new BN(0);\n var D = new BN(1);\n\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n x.iushrn(i);\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n y.iushrn(j);\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n };\n\n // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n BN.prototype._invmp = function _invmp (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n a.iushrn(i);\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n b.iushrn(j);\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd (num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0;\n\n // Remove common factor of two\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n };\n\n // Invert number in the field F(num)\n BN.prototype.invm = function invm (num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven () {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd () {\n return (this.words[0] & 1) === 1;\n };\n\n // And first word and num\n BN.prototype.andln = function andln (num) {\n return this.words[0] & num;\n };\n\n // Increment at the bit position in-line\n BN.prototype.bincn = function bincn (bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n this._expand(s + 1);\n this.words[s] |= q;\n return this;\n }\n\n // Add bit and propagate, if needed\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n };\n\n BN.prototype.isZero = function isZero () {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn (num) {\n var negative = num < 0;\n\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n\n this._strip();\n\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n BN.prototype.cmp = function cmp (num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Unsigned comparison\n BN.prototype.ucmp = function ucmp (num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n\n if (a === b) continue;\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n break;\n }\n return res;\n };\n\n BN.prototype.gtn = function gtn (num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt (num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten (num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte (num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn (num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt (num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten (num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte (num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn (num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq (num) {\n return this.cmp(num) === 0;\n };\n\n //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n BN.red = function red (num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed () {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed (ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd (num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd (num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub (num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub (num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl (num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr () {\n assert(this.red, 'redSqr works only with red numbers');\n this.red._verify1(this);\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr () {\n assert(this.red, 'redISqr works only with red numbers');\n this.red._verify1(this);\n return this.red.isqr(this);\n };\n\n // Square root over p\n BN.prototype.redSqrt = function redSqrt () {\n assert(this.red, 'redSqrt works only with red numbers');\n this.red._verify1(this);\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm () {\n assert(this.red, 'redInvm works only with red numbers');\n this.red._verify1(this);\n return this.red.invm(this);\n };\n\n // Return negative clone of `this` % `red modulo`\n BN.prototype.redNeg = function redNeg () {\n assert(this.red, 'redNeg works only with red numbers');\n this.red._verify1(this);\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow (num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n this.red._verify1(this);\n return this.red.pow(this, num);\n };\n\n // Prime numbers with efficient reduction\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n\n // Pseudo-Mersenne prime\n function MPrime (name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp () {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce (num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== undefined) {\n // r is a BN v4 instance\n r.strip();\n } else {\n // r is a BN v5 instance\n r._strip();\n }\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split (input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK (num) {\n return num.imul(this.k);\n };\n\n function K256 () {\n MPrime.call(\n this,\n 'k256',\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n inherits(K256, MPrime);\n\n K256.prototype.split = function split (input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n\n var outLen = Math.min(input.length, 9);\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n }\n\n // Shift by 9 limbs\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);\n prev = next;\n }\n prev >>>= 22;\n input.words[i - 10] = prev;\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK (num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n\n // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + ((lo / 0x4000000) | 0);\n }\n\n // Fast length reduction\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n return num;\n };\n\n function P224 () {\n MPrime.call(\n this,\n 'p224',\n 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n inherits(P224, MPrime);\n\n function P192 () {\n MPrime.call(\n this,\n 'p192',\n 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n inherits(P192, MPrime);\n\n function P25519 () {\n // 2 ^ 255 - 19\n MPrime.call(\n this,\n '25519',\n '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK (num) {\n // K = 0x13\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n return num;\n };\n\n // Exported mostly for testing purposes, use plain name instead\n BN._prime = function prime (name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n\n var prime;\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n primes[name] = prime;\n\n return prime;\n };\n\n //\n // Base reduction engine\n //\n function Red (m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1 (a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2 (a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red,\n 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod (a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n\n move(a, a.umod(this.m)._forceRed(this));\n return a;\n };\n\n Red.prototype.neg = function neg (a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add (a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd (a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res;\n };\n\n Red.prototype.sub = function sub (a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub (a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res;\n };\n\n Red.prototype.shl = function shl (a, num) {\n this._verify1(a);\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul (a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul (a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr (a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr (a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt (a) {\n if (a.isZero()) return a.clone();\n\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n\n // Fast case\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n\n // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n var q = this.m.subn(1);\n var s = 0;\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n assert(!q.isZero());\n\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg();\n\n // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm (a) {\n var inv = a._invmp(this.m);\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow (a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n for (var j = start - 1; j >= 0; j--) {\n var bit = (word >> j) & 1;\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo (num) {\n var r = num.umod(this.m);\n\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom (num) {\n var res = num.clone();\n res.red = null;\n return res;\n };\n\n //\n // Montgomery method engine\n //\n\n BN.mont = function mont (num) {\n return new Mont(num);\n };\n\n function Mont (m) {\n Red.call(this, m);\n\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0) {\n this.shift += 26 - (this.shift % 26);\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo (num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom (num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul (a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul (a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm (a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})(typeof module === 'undefined' || module, this);\n","var indexOf = function (xs, item) {\n if (xs.indexOf) return xs.indexOf(item);\n else for (var i = 0; i < xs.length; i++) {\n if (xs[i] === item) return i;\n }\n return -1;\n};\nvar Object_keys = function (obj) {\n if (Object.keys) return Object.keys(obj)\n else {\n var res = [];\n for (var key in obj) res.push(key)\n return res;\n }\n};\n\nvar forEach = function (xs, fn) {\n if (xs.forEach) return xs.forEach(fn)\n else for (var i = 0; i < xs.length; i++) {\n fn(xs[i], i, xs);\n }\n};\n\nvar defineProp = (function() {\n try {\n Object.defineProperty({}, '_', {});\n return function(obj, name, value) {\n Object.defineProperty(obj, name, {\n writable: true,\n enumerable: false,\n configurable: true,\n value: value\n })\n };\n } catch(e) {\n return function(obj, name, value) {\n obj[name] = value;\n };\n }\n}());\n\nvar globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function',\n'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError',\n'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError',\n'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape',\n'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape'];\n\nfunction Context() {}\nContext.prototype = {};\n\nvar Script = exports.Script = function NodeScript (code) {\n if (!(this instanceof Script)) return new Script(code);\n this.code = code;\n};\n\nScript.prototype.runInContext = function (context) {\n if (!(context instanceof Context)) {\n throw new TypeError(\"needs a 'context' argument.\");\n }\n \n var iframe = document.createElement('iframe');\n if (!iframe.style) iframe.style = {};\n iframe.style.display = 'none';\n \n document.body.appendChild(iframe);\n \n var win = iframe.contentWindow;\n var wEval = win.eval, wExecScript = win.execScript;\n\n if (!wEval && wExecScript) {\n // win.eval() magically appears when this is called in IE:\n wExecScript.call(win, 'null');\n wEval = win.eval;\n }\n \n forEach(Object_keys(context), function (key) {\n win[key] = context[key];\n });\n forEach(globals, function (key) {\n if (context[key]) {\n win[key] = context[key];\n }\n });\n \n var winKeys = Object_keys(win);\n\n var res = wEval.call(win, this.code);\n \n forEach(Object_keys(win), function (key) {\n // Avoid copying circular objects like `top` and `window` by only\n // updating existing context properties or new properties in the `win`\n // that was only introduced after the eval.\n if (key in context || indexOf(winKeys, key) === -1) {\n context[key] = win[key];\n }\n });\n\n forEach(globals, function (key) {\n if (!(key in context)) {\n defineProp(context, key, win[key]);\n }\n });\n \n document.body.removeChild(iframe);\n \n return res;\n};\n\nScript.prototype.runInThisContext = function () {\n return eval(this.code); // maybe...\n};\n\nScript.prototype.runInNewContext = function (context) {\n var ctx = Script.createContext(context);\n var res = this.runInContext(ctx);\n\n if (context) {\n forEach(Object_keys(ctx), function (key) {\n context[key] = ctx[key];\n });\n }\n\n return res;\n};\n\nforEach(Object_keys(Script.prototype), function (name) {\n exports[name] = Script[name] = function (code) {\n var s = Script(code);\n return s[name].apply(s, [].slice.call(arguments, 1));\n };\n});\n\nexports.isContext = function (context) {\n return context instanceof Context;\n};\n\nexports.createScript = function (code) {\n return exports.Script(code);\n};\n\nexports.createContext = Script.createContext = function (context) {\n var copy = new Context();\n if(typeof context === 'object') {\n forEach(Object_keys(context), function (key) {\n copy[key] = context[key];\n });\n }\n return copy;\n};\n","var asn1 = require('../asn1');\nvar inherits = require('inherits');\n\nvar api = exports;\n\napi.define = function define(name, body) {\n return new Entity(name, body);\n};\n\nfunction Entity(name, body) {\n this.name = name;\n this.body = body;\n\n this.decoders = {};\n this.encoders = {};\n};\n\nEntity.prototype._createNamed = function createNamed(base) {\n var named;\n try {\n named = require('vm').runInThisContext(\n '(function ' + this.name + '(entity) {\\n' +\n ' this._initNamed(entity);\\n' +\n '})'\n );\n } catch (e) {\n named = function (entity) {\n this._initNamed(entity);\n };\n }\n inherits(named, base);\n named.prototype._initNamed = function initnamed(entity) {\n base.call(this, entity);\n };\n\n return new named(this);\n};\n\nEntity.prototype._getDecoder = function _getDecoder(enc) {\n enc = enc || 'der';\n // Lazily create decoder\n if (!this.decoders.hasOwnProperty(enc))\n this.decoders[enc] = this._createNamed(asn1.decoders[enc]);\n return this.decoders[enc];\n};\n\nEntity.prototype.decode = function decode(data, enc, options) {\n return this._getDecoder(enc).decode(data, options);\n};\n\nEntity.prototype._getEncoder = function _getEncoder(enc) {\n enc = enc || 'der';\n // Lazily create encoder\n if (!this.encoders.hasOwnProperty(enc))\n this.encoders[enc] = this._createNamed(asn1.encoders[enc]);\n return this.encoders[enc];\n};\n\nEntity.prototype.encode = function encode(data, enc, /* internal */ reporter) {\n return this._getEncoder(enc).encode(data, reporter);\n};\n","var inherits = require('inherits');\n\nfunction Reporter(options) {\n this._reporterState = {\n obj: null,\n path: [],\n options: options || {},\n errors: []\n };\n}\nexports.Reporter = Reporter;\n\nReporter.prototype.isError = function isError(obj) {\n return obj instanceof ReporterError;\n};\n\nReporter.prototype.save = function save() {\n var state = this._reporterState;\n\n return { obj: state.obj, pathLen: state.path.length };\n};\n\nReporter.prototype.restore = function restore(data) {\n var state = this._reporterState;\n\n state.obj = data.obj;\n state.path = state.path.slice(0, data.pathLen);\n};\n\nReporter.prototype.enterKey = function enterKey(key) {\n return this._reporterState.path.push(key);\n};\n\nReporter.prototype.exitKey = function exitKey(index) {\n var state = this._reporterState;\n\n state.path = state.path.slice(0, index - 1);\n};\n\nReporter.prototype.leaveKey = function leaveKey(index, key, value) {\n var state = this._reporterState;\n\n this.exitKey(index);\n if (state.obj !== null)\n state.obj[key] = value;\n};\n\nReporter.prototype.path = function path() {\n return this._reporterState.path.join('/');\n};\n\nReporter.prototype.enterObject = function enterObject() {\n var state = this._reporterState;\n\n var prev = state.obj;\n state.obj = {};\n return prev;\n};\n\nReporter.prototype.leaveObject = function leaveObject(prev) {\n var state = this._reporterState;\n\n var now = state.obj;\n state.obj = prev;\n return now;\n};\n\nReporter.prototype.error = function error(msg) {\n var err;\n var state = this._reporterState;\n\n var inherited = msg instanceof ReporterError;\n if (inherited) {\n err = msg;\n } else {\n err = new ReporterError(state.path.map(function(elem) {\n return '[' + JSON.stringify(elem) + ']';\n }).join(''), msg.message || msg, msg.stack);\n }\n\n if (!state.options.partial)\n throw err;\n\n if (!inherited)\n state.errors.push(err);\n\n return err;\n};\n\nReporter.prototype.wrapResult = function wrapResult(result) {\n var state = this._reporterState;\n if (!state.options.partial)\n return result;\n\n return {\n result: this.isError(result) ? null : result,\n errors: state.errors\n };\n};\n\nfunction ReporterError(path, msg) {\n this.path = path;\n this.rethrow(msg);\n};\ninherits(ReporterError, Error);\n\nReporterError.prototype.rethrow = function rethrow(msg) {\n this.message = msg + ' at: ' + (this.path || '(shallow)');\n if (Error.captureStackTrace)\n Error.captureStackTrace(this, ReporterError);\n\n if (!this.stack) {\n try {\n // IE only adds stack when thrown\n throw new Error(this.message);\n } catch (e) {\n this.stack = e.stack;\n }\n }\n return this;\n};\n","var inherits = require('inherits');\nvar Reporter = require('../base').Reporter;\nvar Buffer = require('buffer').Buffer;\n\nfunction DecoderBuffer(base, options) {\n Reporter.call(this, options);\n if (!Buffer.isBuffer(base)) {\n this.error('Input not Buffer');\n return;\n }\n\n this.base = base;\n this.offset = 0;\n this.length = base.length;\n}\ninherits(DecoderBuffer, Reporter);\nexports.DecoderBuffer = DecoderBuffer;\n\nDecoderBuffer.prototype.save = function save() {\n return { offset: this.offset, reporter: Reporter.prototype.save.call(this) };\n};\n\nDecoderBuffer.prototype.restore = function restore(save) {\n // Return skipped data\n var res = new DecoderBuffer(this.base);\n res.offset = save.offset;\n res.length = this.offset;\n\n this.offset = save.offset;\n Reporter.prototype.restore.call(this, save.reporter);\n\n return res;\n};\n\nDecoderBuffer.prototype.isEmpty = function isEmpty() {\n return this.offset === this.length;\n};\n\nDecoderBuffer.prototype.readUInt8 = function readUInt8(fail) {\n if (this.offset + 1 <= this.length)\n return this.base.readUInt8(this.offset++, true);\n else\n return this.error(fail || 'DecoderBuffer overrun');\n}\n\nDecoderBuffer.prototype.skip = function skip(bytes, fail) {\n if (!(this.offset + bytes <= this.length))\n return this.error(fail || 'DecoderBuffer overrun');\n\n var res = new DecoderBuffer(this.base);\n\n // Share reporter state\n res._reporterState = this._reporterState;\n\n res.offset = this.offset;\n res.length = this.offset + bytes;\n this.offset += bytes;\n return res;\n}\n\nDecoderBuffer.prototype.raw = function raw(save) {\n return this.base.slice(save ? save.offset : this.offset, this.length);\n}\n\nfunction EncoderBuffer(value, reporter) {\n if (Array.isArray(value)) {\n this.length = 0;\n this.value = value.map(function(item) {\n if (!(item instanceof EncoderBuffer))\n item = new EncoderBuffer(item, reporter);\n this.length += item.length;\n return item;\n }, this);\n } else if (typeof value === 'number') {\n if (!(0 <= value && value <= 0xff))\n return reporter.error('non-byte EncoderBuffer value');\n this.value = value;\n this.length = 1;\n } else if (typeof value === 'string') {\n this.value = value;\n this.length = Buffer.byteLength(value);\n } else if (Buffer.isBuffer(value)) {\n this.value = value;\n this.length = value.length;\n } else {\n return reporter.error('Unsupported type: ' + typeof value);\n }\n}\nexports.EncoderBuffer = EncoderBuffer;\n\nEncoderBuffer.prototype.join = function join(out, offset) {\n if (!out)\n out = new Buffer(this.length);\n if (!offset)\n offset = 0;\n\n if (this.length === 0)\n return out;\n\n if (Array.isArray(this.value)) {\n this.value.forEach(function(item) {\n item.join(out, offset);\n offset += item.length;\n });\n } else {\n if (typeof this.value === 'number')\n out[offset] = this.value;\n else if (typeof this.value === 'string')\n out.write(this.value, offset);\n else if (Buffer.isBuffer(this.value))\n this.value.copy(out, offset);\n offset += this.length;\n }\n\n return out;\n};\n","var Reporter = require('../base').Reporter;\nvar EncoderBuffer = require('../base').EncoderBuffer;\nvar DecoderBuffer = require('../base').DecoderBuffer;\nvar assert = require('minimalistic-assert');\n\n// Supported tags\nvar tags = [\n 'seq', 'seqof', 'set', 'setof', 'objid', 'bool',\n 'gentime', 'utctime', 'null_', 'enum', 'int', 'objDesc',\n 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str',\n 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr'\n];\n\n// Public methods list\nvar methods = [\n 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice',\n 'any', 'contains'\n].concat(tags);\n\n// Overrided methods list\nvar overrided = [\n '_peekTag', '_decodeTag', '_use',\n '_decodeStr', '_decodeObjid', '_decodeTime',\n '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList',\n\n '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime',\n '_encodeNull', '_encodeInt', '_encodeBool'\n];\n\nfunction Node(enc, parent) {\n var state = {};\n this._baseState = state;\n\n state.enc = enc;\n\n state.parent = parent || null;\n state.children = null;\n\n // State\n state.tag = null;\n state.args = null;\n state.reverseArgs = null;\n state.choice = null;\n state.optional = false;\n state.any = false;\n state.obj = false;\n state.use = null;\n state.useDecoder = null;\n state.key = null;\n state['default'] = null;\n state.explicit = null;\n state.implicit = null;\n state.contains = null;\n\n // Should create new instance on each method\n if (!state.parent) {\n state.children = [];\n this._wrap();\n }\n}\nmodule.exports = Node;\n\nvar stateProps = [\n 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice',\n 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit',\n 'implicit', 'contains'\n];\n\nNode.prototype.clone = function clone() {\n var state = this._baseState;\n var cstate = {};\n stateProps.forEach(function(prop) {\n cstate[prop] = state[prop];\n });\n var res = new this.constructor(cstate.parent);\n res._baseState = cstate;\n return res;\n};\n\nNode.prototype._wrap = function wrap() {\n var state = this._baseState;\n methods.forEach(function(method) {\n this[method] = function _wrappedMethod() {\n var clone = new this.constructor(this);\n state.children.push(clone);\n return clone[method].apply(clone, arguments);\n };\n }, this);\n};\n\nNode.prototype._init = function init(body) {\n var state = this._baseState;\n\n assert(state.parent === null);\n body.call(this);\n\n // Filter children\n state.children = state.children.filter(function(child) {\n return child._baseState.parent === this;\n }, this);\n assert.equal(state.children.length, 1, 'Root node can have only one child');\n};\n\nNode.prototype._useArgs = function useArgs(args) {\n var state = this._baseState;\n\n // Filter children and args\n var children = args.filter(function(arg) {\n return arg instanceof this.constructor;\n }, this);\n args = args.filter(function(arg) {\n return !(arg instanceof this.constructor);\n }, this);\n\n if (children.length !== 0) {\n assert(state.children === null);\n state.children = children;\n\n // Replace parent to maintain backward link\n children.forEach(function(child) {\n child._baseState.parent = this;\n }, this);\n }\n if (args.length !== 0) {\n assert(state.args === null);\n state.args = args;\n state.reverseArgs = args.map(function(arg) {\n if (typeof arg !== 'object' || arg.constructor !== Object)\n return arg;\n\n var res = {};\n Object.keys(arg).forEach(function(key) {\n if (key == (key | 0))\n key |= 0;\n var value = arg[key];\n res[value] = key;\n });\n return res;\n });\n }\n};\n\n//\n// Overrided methods\n//\n\noverrided.forEach(function(method) {\n Node.prototype[method] = function _overrided() {\n var state = this._baseState;\n throw new Error(method + ' not implemented for encoding: ' + state.enc);\n };\n});\n\n//\n// Public methods\n//\n\ntags.forEach(function(tag) {\n Node.prototype[tag] = function _tagMethod() {\n var state = this._baseState;\n var args = Array.prototype.slice.call(arguments);\n\n assert(state.tag === null);\n state.tag = tag;\n\n this._useArgs(args);\n\n return this;\n };\n});\n\nNode.prototype.use = function use(item) {\n assert(item);\n var state = this._baseState;\n\n assert(state.use === null);\n state.use = item;\n\n return this;\n};\n\nNode.prototype.optional = function optional() {\n var state = this._baseState;\n\n state.optional = true;\n\n return this;\n};\n\nNode.prototype.def = function def(val) {\n var state = this._baseState;\n\n assert(state['default'] === null);\n state['default'] = val;\n state.optional = true;\n\n return this;\n};\n\nNode.prototype.explicit = function explicit(num) {\n var state = this._baseState;\n\n assert(state.explicit === null && state.implicit === null);\n state.explicit = num;\n\n return this;\n};\n\nNode.prototype.implicit = function implicit(num) {\n var state = this._baseState;\n\n assert(state.explicit === null && state.implicit === null);\n state.implicit = num;\n\n return this;\n};\n\nNode.prototype.obj = function obj() {\n var state = this._baseState;\n var args = Array.prototype.slice.call(arguments);\n\n state.obj = true;\n\n if (args.length !== 0)\n this._useArgs(args);\n\n return this;\n};\n\nNode.prototype.key = function key(newKey) {\n var state = this._baseState;\n\n assert(state.key === null);\n state.key = newKey;\n\n return this;\n};\n\nNode.prototype.any = function any() {\n var state = this._baseState;\n\n state.any = true;\n\n return this;\n};\n\nNode.prototype.choice = function choice(obj) {\n var state = this._baseState;\n\n assert(state.choice === null);\n state.choice = obj;\n this._useArgs(Object.keys(obj).map(function(key) {\n return obj[key];\n }));\n\n return this;\n};\n\nNode.prototype.contains = function contains(item) {\n var state = this._baseState;\n\n assert(state.use === null);\n state.contains = item;\n\n return this;\n};\n\n//\n// Decoding\n//\n\nNode.prototype._decode = function decode(input, options) {\n var state = this._baseState;\n\n // Decode root node\n if (state.parent === null)\n return input.wrapResult(state.children[0]._decode(input, options));\n\n var result = state['default'];\n var present = true;\n\n var prevKey = null;\n if (state.key !== null)\n prevKey = input.enterKey(state.key);\n\n // Check if tag is there\n if (state.optional) {\n var tag = null;\n if (state.explicit !== null)\n tag = state.explicit;\n else if (state.implicit !== null)\n tag = state.implicit;\n else if (state.tag !== null)\n tag = state.tag;\n\n if (tag === null && !state.any) {\n // Trial and Error\n var save = input.save();\n try {\n if (state.choice === null)\n this._decodeGeneric(state.tag, input, options);\n else\n this._decodeChoice(input, options);\n present = true;\n } catch (e) {\n present = false;\n }\n input.restore(save);\n } else {\n present = this._peekTag(input, tag, state.any);\n\n if (input.isError(present))\n return present;\n }\n }\n\n // Push object on stack\n var prevObj;\n if (state.obj && present)\n prevObj = input.enterObject();\n\n if (present) {\n // Unwrap explicit values\n if (state.explicit !== null) {\n var explicit = this._decodeTag(input, state.explicit);\n if (input.isError(explicit))\n return explicit;\n input = explicit;\n }\n\n var start = input.offset;\n\n // Unwrap implicit and normal values\n if (state.use === null && state.choice === null) {\n if (state.any)\n var save = input.save();\n var body = this._decodeTag(\n input,\n state.implicit !== null ? state.implicit : state.tag,\n state.any\n );\n if (input.isError(body))\n return body;\n\n if (state.any)\n result = input.raw(save);\n else\n input = body;\n }\n\n if (options && options.track && state.tag !== null)\n options.track(input.path(), start, input.length, 'tagged');\n\n if (options && options.track && state.tag !== null)\n options.track(input.path(), input.offset, input.length, 'content');\n\n // Select proper method for tag\n if (state.any)\n result = result;\n else if (state.choice === null)\n result = this._decodeGeneric(state.tag, input, options);\n else\n result = this._decodeChoice(input, options);\n\n if (input.isError(result))\n return result;\n\n // Decode children\n if (!state.any && state.choice === null && state.children !== null) {\n state.children.forEach(function decodeChildren(child) {\n // NOTE: We are ignoring errors here, to let parser continue with other\n // parts of encoded data\n child._decode(input, options);\n });\n }\n\n // Decode contained/encoded by schema, only in bit or octet strings\n if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) {\n var data = new DecoderBuffer(result);\n result = this._getUse(state.contains, input._reporterState.obj)\n ._decode(data, options);\n }\n }\n\n // Pop object\n if (state.obj && present)\n result = input.leaveObject(prevObj);\n\n // Set key\n if (state.key !== null && (result !== null || present === true))\n input.leaveKey(prevKey, state.key, result);\n else if (prevKey !== null)\n input.exitKey(prevKey);\n\n return result;\n};\n\nNode.prototype._decodeGeneric = function decodeGeneric(tag, input, options) {\n var state = this._baseState;\n\n if (tag === 'seq' || tag === 'set')\n return null;\n if (tag === 'seqof' || tag === 'setof')\n return this._decodeList(input, tag, state.args[0], options);\n else if (/str$/.test(tag))\n return this._decodeStr(input, tag, options);\n else if (tag === 'objid' && state.args)\n return this._decodeObjid(input, state.args[0], state.args[1], options);\n else if (tag === 'objid')\n return this._decodeObjid(input, null, null, options);\n else if (tag === 'gentime' || tag === 'utctime')\n return this._decodeTime(input, tag, options);\n else if (tag === 'null_')\n return this._decodeNull(input, options);\n else if (tag === 'bool')\n return this._decodeBool(input, options);\n else if (tag === 'objDesc')\n return this._decodeStr(input, tag, options);\n else if (tag === 'int' || tag === 'enum')\n return this._decodeInt(input, state.args && state.args[0], options);\n\n if (state.use !== null) {\n return this._getUse(state.use, input._reporterState.obj)\n ._decode(input, options);\n } else {\n return input.error('unknown tag: ' + tag);\n }\n};\n\nNode.prototype._getUse = function _getUse(entity, obj) {\n\n var state = this._baseState;\n // Create altered use decoder if implicit is set\n state.useDecoder = this._use(entity, obj);\n assert(state.useDecoder._baseState.parent === null);\n state.useDecoder = state.useDecoder._baseState.children[0];\n if (state.implicit !== state.useDecoder._baseState.implicit) {\n state.useDecoder = state.useDecoder.clone();\n state.useDecoder._baseState.implicit = state.implicit;\n }\n return state.useDecoder;\n};\n\nNode.prototype._decodeChoice = function decodeChoice(input, options) {\n var state = this._baseState;\n var result = null;\n var match = false;\n\n Object.keys(state.choice).some(function(key) {\n var save = input.save();\n var node = state.choice[key];\n try {\n var value = node._decode(input, options);\n if (input.isError(value))\n return false;\n\n result = { type: key, value: value };\n match = true;\n } catch (e) {\n input.restore(save);\n return false;\n }\n return true;\n }, this);\n\n if (!match)\n return input.error('Choice not matched');\n\n return result;\n};\n\n//\n// Encoding\n//\n\nNode.prototype._createEncoderBuffer = function createEncoderBuffer(data) {\n return new EncoderBuffer(data, this.reporter);\n};\n\nNode.prototype._encode = function encode(data, reporter, parent) {\n var state = this._baseState;\n if (state['default'] !== null && state['default'] === data)\n return;\n\n var result = this._encodeValue(data, reporter, parent);\n if (result === undefined)\n return;\n\n if (this._skipDefault(result, reporter, parent))\n return;\n\n return result;\n};\n\nNode.prototype._encodeValue = function encode(data, reporter, parent) {\n var state = this._baseState;\n\n // Decode root node\n if (state.parent === null)\n return state.children[0]._encode(data, reporter || new Reporter());\n\n var result = null;\n\n // Set reporter to share it with a child class\n this.reporter = reporter;\n\n // Check if data is there\n if (state.optional && data === undefined) {\n if (state['default'] !== null)\n data = state['default']\n else\n return;\n }\n\n // Encode children first\n var content = null;\n var primitive = false;\n if (state.any) {\n // Anything that was given is translated to buffer\n result = this._createEncoderBuffer(data);\n } else if (state.choice) {\n result = this._encodeChoice(data, reporter);\n } else if (state.contains) {\n content = this._getUse(state.contains, parent)._encode(data, reporter);\n primitive = true;\n } else if (state.children) {\n content = state.children.map(function(child) {\n if (child._baseState.tag === 'null_')\n return child._encode(null, reporter, data);\n\n if (child._baseState.key === null)\n return reporter.error('Child should have a key');\n var prevKey = reporter.enterKey(child._baseState.key);\n\n if (typeof data !== 'object')\n return reporter.error('Child expected, but input is not object');\n\n var res = child._encode(data[child._baseState.key], reporter, data);\n reporter.leaveKey(prevKey);\n\n return res;\n }, this).filter(function(child) {\n return child;\n });\n content = this._createEncoderBuffer(content);\n } else {\n if (state.tag === 'seqof' || state.tag === 'setof') {\n // TODO(indutny): this should be thrown on DSL level\n if (!(state.args && state.args.length === 1))\n return reporter.error('Too many args for : ' + state.tag);\n\n if (!Array.isArray(data))\n return reporter.error('seqof/setof, but data is not Array');\n\n var child = this.clone();\n child._baseState.implicit = null;\n content = this._createEncoderBuffer(data.map(function(item) {\n var state = this._baseState;\n\n return this._getUse(state.args[0], data)._encode(item, reporter);\n }, child));\n } else if (state.use !== null) {\n result = this._getUse(state.use, parent)._encode(data, reporter);\n } else {\n content = this._encodePrimitive(state.tag, data);\n primitive = true;\n }\n }\n\n // Encode data itself\n var result;\n if (!state.any && state.choice === null) {\n var tag = state.implicit !== null ? state.implicit : state.tag;\n var cls = state.implicit === null ? 'universal' : 'context';\n\n if (tag === null) {\n if (state.use === null)\n reporter.error('Tag could be omitted only for .use()');\n } else {\n if (state.use === null)\n result = this._encodeComposite(tag, primitive, cls, content);\n }\n }\n\n // Wrap in explicit\n if (state.explicit !== null)\n result = this._encodeComposite(state.explicit, false, 'context', result);\n\n return result;\n};\n\nNode.prototype._encodeChoice = function encodeChoice(data, reporter) {\n var state = this._baseState;\n\n var node = state.choice[data.type];\n if (!node) {\n assert(\n false,\n data.type + ' not found in ' +\n JSON.stringify(Object.keys(state.choice)));\n }\n return node._encode(data.value, reporter);\n};\n\nNode.prototype._encodePrimitive = function encodePrimitive(tag, data) {\n var state = this._baseState;\n\n if (/str$/.test(tag))\n return this._encodeStr(data, tag);\n else if (tag === 'objid' && state.args)\n return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);\n else if (tag === 'objid')\n return this._encodeObjid(data, null, null);\n else if (tag === 'gentime' || tag === 'utctime')\n return this._encodeTime(data, tag);\n else if (tag === 'null_')\n return this._encodeNull();\n else if (tag === 'int' || tag === 'enum')\n return this._encodeInt(data, state.args && state.reverseArgs[0]);\n else if (tag === 'bool')\n return this._encodeBool(data);\n else if (tag === 'objDesc')\n return this._encodeStr(data, tag);\n else\n throw new Error('Unsupported tag: ' + tag);\n};\n\nNode.prototype._isNumstr = function isNumstr(str) {\n return /^[0-9 ]*$/.test(str);\n};\n\nNode.prototype._isPrintstr = function isPrintstr(str) {\n return /^[A-Za-z0-9 '\\(\\)\\+,\\-\\.\\/:=\\?]*$/.test(str);\n};\n","var base = exports;\n\nbase.Reporter = require('./reporter').Reporter;\nbase.DecoderBuffer = require('./buffer').DecoderBuffer;\nbase.EncoderBuffer = require('./buffer').EncoderBuffer;\nbase.Node = require('./node');\n","var constants = require('../constants');\n\nexports.tagClass = {\n 0: 'universal',\n 1: 'application',\n 2: 'context',\n 3: 'private'\n};\nexports.tagClassByName = constants._reverse(exports.tagClass);\n\nexports.tag = {\n 0x00: 'end',\n 0x01: 'bool',\n 0x02: 'int',\n 0x03: 'bitstr',\n 0x04: 'octstr',\n 0x05: 'null_',\n 0x06: 'objid',\n 0x07: 'objDesc',\n 0x08: 'external',\n 0x09: 'real',\n 0x0a: 'enum',\n 0x0b: 'embed',\n 0x0c: 'utf8str',\n 0x0d: 'relativeOid',\n 0x10: 'seq',\n 0x11: 'set',\n 0x12: 'numstr',\n 0x13: 'printstr',\n 0x14: 't61str',\n 0x15: 'videostr',\n 0x16: 'ia5str',\n 0x17: 'utctime',\n 0x18: 'gentime',\n 0x19: 'graphstr',\n 0x1a: 'iso646str',\n 0x1b: 'genstr',\n 0x1c: 'unistr',\n 0x1d: 'charstr',\n 0x1e: 'bmpstr'\n};\nexports.tagByName = constants._reverse(exports.tag);\n","var constants = exports;\n\n// Helper\nconstants._reverse = function reverse(map) {\n var res = {};\n\n Object.keys(map).forEach(function(key) {\n // Convert key to integer if it is stringified\n if ((key | 0) == key)\n key = key | 0;\n\n var value = map[key];\n res[value] = key;\n });\n\n return res;\n};\n\nconstants.der = require('./der');\n","var inherits = require('inherits');\n\nvar asn1 = require('../../asn1');\nvar base = asn1.base;\nvar bignum = asn1.bignum;\n\n// Import DER constants\nvar der = asn1.constants.der;\n\nfunction DERDecoder(entity) {\n this.enc = 'der';\n this.name = entity.name;\n this.entity = entity;\n\n // Construct base tree\n this.tree = new DERNode();\n this.tree._init(entity.body);\n};\nmodule.exports = DERDecoder;\n\nDERDecoder.prototype.decode = function decode(data, options) {\n if (!(data instanceof base.DecoderBuffer))\n data = new base.DecoderBuffer(data, options);\n\n return this.tree._decode(data, options);\n};\n\n// Tree methods\n\nfunction DERNode(parent) {\n base.Node.call(this, 'der', parent);\n}\ninherits(DERNode, base.Node);\n\nDERNode.prototype._peekTag = function peekTag(buffer, tag, any) {\n if (buffer.isEmpty())\n return false;\n\n var state = buffer.save();\n var decodedTag = derDecodeTag(buffer, 'Failed to peek tag: \"' + tag + '\"');\n if (buffer.isError(decodedTag))\n return decodedTag;\n\n buffer.restore(state);\n\n return decodedTag.tag === tag || decodedTag.tagStr === tag ||\n (decodedTag.tagStr + 'of') === tag || any;\n};\n\nDERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) {\n var decodedTag = derDecodeTag(buffer,\n 'Failed to decode tag of \"' + tag + '\"');\n if (buffer.isError(decodedTag))\n return decodedTag;\n\n var len = derDecodeLen(buffer,\n decodedTag.primitive,\n 'Failed to get length of \"' + tag + '\"');\n\n // Failure\n if (buffer.isError(len))\n return len;\n\n if (!any &&\n decodedTag.tag !== tag &&\n decodedTag.tagStr !== tag &&\n decodedTag.tagStr + 'of' !== tag) {\n return buffer.error('Failed to match tag: \"' + tag + '\"');\n }\n\n if (decodedTag.primitive || len !== null)\n return buffer.skip(len, 'Failed to match body of: \"' + tag + '\"');\n\n // Indefinite length... find END tag\n var state = buffer.save();\n var res = this._skipUntilEnd(\n buffer,\n 'Failed to skip indefinite length body: \"' + this.tag + '\"');\n if (buffer.isError(res))\n return res;\n\n len = buffer.offset - state.offset;\n buffer.restore(state);\n return buffer.skip(len, 'Failed to match body of: \"' + tag + '\"');\n};\n\nDERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) {\n while (true) {\n var tag = derDecodeTag(buffer, fail);\n if (buffer.isError(tag))\n return tag;\n var len = derDecodeLen(buffer, tag.primitive, fail);\n if (buffer.isError(len))\n return len;\n\n var res;\n if (tag.primitive || len !== null)\n res = buffer.skip(len)\n else\n res = this._skipUntilEnd(buffer, fail);\n\n // Failure\n if (buffer.isError(res))\n return res;\n\n if (tag.tagStr === 'end')\n break;\n }\n};\n\nDERNode.prototype._decodeList = function decodeList(buffer, tag, decoder,\n options) {\n var result = [];\n while (!buffer.isEmpty()) {\n var possibleEnd = this._peekTag(buffer, 'end');\n if (buffer.isError(possibleEnd))\n return possibleEnd;\n\n var res = decoder.decode(buffer, 'der', options);\n if (buffer.isError(res) && possibleEnd)\n break;\n result.push(res);\n }\n return result;\n};\n\nDERNode.prototype._decodeStr = function decodeStr(buffer, tag) {\n if (tag === 'bitstr') {\n var unused = buffer.readUInt8();\n if (buffer.isError(unused))\n return unused;\n return { unused: unused, data: buffer.raw() };\n } else if (tag === 'bmpstr') {\n var raw = buffer.raw();\n if (raw.length % 2 === 1)\n return buffer.error('Decoding of string type: bmpstr length mismatch');\n\n var str = '';\n for (var i = 0; i < raw.length / 2; i++) {\n str += String.fromCharCode(raw.readUInt16BE(i * 2));\n }\n return str;\n } else if (tag === 'numstr') {\n var numstr = buffer.raw().toString('ascii');\n if (!this._isNumstr(numstr)) {\n return buffer.error('Decoding of string type: ' +\n 'numstr unsupported characters');\n }\n return numstr;\n } else if (tag === 'octstr') {\n return buffer.raw();\n } else if (tag === 'objDesc') {\n return buffer.raw();\n } else if (tag === 'printstr') {\n var printstr = buffer.raw().toString('ascii');\n if (!this._isPrintstr(printstr)) {\n return buffer.error('Decoding of string type: ' +\n 'printstr unsupported characters');\n }\n return printstr;\n } else if (/str$/.test(tag)) {\n return buffer.raw().toString();\n } else {\n return buffer.error('Decoding of string type: ' + tag + ' unsupported');\n }\n};\n\nDERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) {\n var result;\n var identifiers = [];\n var ident = 0;\n while (!buffer.isEmpty()) {\n var subident = buffer.readUInt8();\n ident <<= 7;\n ident |= subident & 0x7f;\n if ((subident & 0x80) === 0) {\n identifiers.push(ident);\n ident = 0;\n }\n }\n if (subident & 0x80)\n identifiers.push(ident);\n\n var first = (identifiers[0] / 40) | 0;\n var second = identifiers[0] % 40;\n\n if (relative)\n result = identifiers;\n else\n result = [first, second].concat(identifiers.slice(1));\n\n if (values) {\n var tmp = values[result.join(' ')];\n if (tmp === undefined)\n tmp = values[result.join('.')];\n if (tmp !== undefined)\n result = tmp;\n }\n\n return result;\n};\n\nDERNode.prototype._decodeTime = function decodeTime(buffer, tag) {\n var str = buffer.raw().toString();\n if (tag === 'gentime') {\n var year = str.slice(0, 4) | 0;\n var mon = str.slice(4, 6) | 0;\n var day = str.slice(6, 8) | 0;\n var hour = str.slice(8, 10) | 0;\n var min = str.slice(10, 12) | 0;\n var sec = str.slice(12, 14) | 0;\n } else if (tag === 'utctime') {\n var year = str.slice(0, 2) | 0;\n var mon = str.slice(2, 4) | 0;\n var day = str.slice(4, 6) | 0;\n var hour = str.slice(6, 8) | 0;\n var min = str.slice(8, 10) | 0;\n var sec = str.slice(10, 12) | 0;\n if (year < 70)\n year = 2000 + year;\n else\n year = 1900 + year;\n } else {\n return buffer.error('Decoding ' + tag + ' time is not supported yet');\n }\n\n return Date.UTC(year, mon - 1, day, hour, min, sec, 0);\n};\n\nDERNode.prototype._decodeNull = function decodeNull(buffer) {\n return null;\n};\n\nDERNode.prototype._decodeBool = function decodeBool(buffer) {\n var res = buffer.readUInt8();\n if (buffer.isError(res))\n return res;\n else\n return res !== 0;\n};\n\nDERNode.prototype._decodeInt = function decodeInt(buffer, values) {\n // Bigint, return as it is (assume big endian)\n var raw = buffer.raw();\n var res = new bignum(raw);\n\n if (values)\n res = values[res.toString(10)] || res;\n\n return res;\n};\n\nDERNode.prototype._use = function use(entity, obj) {\n if (typeof entity === 'function')\n entity = entity(obj);\n return entity._getDecoder('der').tree;\n};\n\n// Utility methods\n\nfunction derDecodeTag(buf, fail) {\n var tag = buf.readUInt8(fail);\n if (buf.isError(tag))\n return tag;\n\n var cls = der.tagClass[tag >> 6];\n var primitive = (tag & 0x20) === 0;\n\n // Multi-octet tag - load\n if ((tag & 0x1f) === 0x1f) {\n var oct = tag;\n tag = 0;\n while ((oct & 0x80) === 0x80) {\n oct = buf.readUInt8(fail);\n if (buf.isError(oct))\n return oct;\n\n tag <<= 7;\n tag |= oct & 0x7f;\n }\n } else {\n tag &= 0x1f;\n }\n var tagStr = der.tag[tag];\n\n return {\n cls: cls,\n primitive: primitive,\n tag: tag,\n tagStr: tagStr\n };\n}\n\nfunction derDecodeLen(buf, primitive, fail) {\n var len = buf.readUInt8(fail);\n if (buf.isError(len))\n return len;\n\n // Indefinite form\n if (!primitive && len === 0x80)\n return null;\n\n // Definite form\n if ((len & 0x80) === 0) {\n // Short form\n return len;\n }\n\n // Long form\n var num = len & 0x7f;\n if (num > 4)\n return buf.error('length octect is too long');\n\n len = 0;\n for (var i = 0; i < num; i++) {\n len <<= 8;\n var j = buf.readUInt8(fail);\n if (buf.isError(j))\n return j;\n len |= j;\n }\n\n return len;\n}\n","var inherits = require('inherits');\nvar Buffer = require('buffer').Buffer;\n\nvar DERDecoder = require('./der');\n\nfunction PEMDecoder(entity) {\n DERDecoder.call(this, entity);\n this.enc = 'pem';\n};\ninherits(PEMDecoder, DERDecoder);\nmodule.exports = PEMDecoder;\n\nPEMDecoder.prototype.decode = function decode(data, options) {\n var lines = data.toString().split(/[\\r\\n]+/g);\n\n var label = options.label.toUpperCase();\n\n var re = /^-----(BEGIN|END) ([^-]+)-----$/;\n var start = -1;\n var end = -1;\n for (var i = 0; i < lines.length; i++) {\n var match = lines[i].match(re);\n if (match === null)\n continue;\n\n if (match[2] !== label)\n continue;\n\n if (start === -1) {\n if (match[1] !== 'BEGIN')\n break;\n start = i;\n } else {\n if (match[1] !== 'END')\n break;\n end = i;\n break;\n }\n }\n if (start === -1 || end === -1)\n throw new Error('PEM section not found for: ' + label);\n\n var base64 = lines.slice(start + 1, end).join('');\n // Remove excessive symbols\n base64.replace(/[^a-z0-9\\+\\/=]+/gi, '');\n\n var input = new Buffer(base64, 'base64');\n return DERDecoder.prototype.decode.call(this, input, options);\n};\n","var decoders = exports;\n\ndecoders.der = require('./der');\ndecoders.pem = require('./pem');\n","var inherits = require('inherits');\nvar Buffer = require('buffer').Buffer;\n\nvar asn1 = require('../../asn1');\nvar base = asn1.base;\n\n// Import DER constants\nvar der = asn1.constants.der;\n\nfunction DEREncoder(entity) {\n this.enc = 'der';\n this.name = entity.name;\n this.entity = entity;\n\n // Construct base tree\n this.tree = new DERNode();\n this.tree._init(entity.body);\n};\nmodule.exports = DEREncoder;\n\nDEREncoder.prototype.encode = function encode(data, reporter) {\n return this.tree._encode(data, reporter).join();\n};\n\n// Tree methods\n\nfunction DERNode(parent) {\n base.Node.call(this, 'der', parent);\n}\ninherits(DERNode, base.Node);\n\nDERNode.prototype._encodeComposite = function encodeComposite(tag,\n primitive,\n cls,\n content) {\n var encodedTag = encodeTag(tag, primitive, cls, this.reporter);\n\n // Short form\n if (content.length < 0x80) {\n var header = new Buffer(2);\n header[0] = encodedTag;\n header[1] = content.length;\n return this._createEncoderBuffer([ header, content ]);\n }\n\n // Long form\n // Count octets required to store length\n var lenOctets = 1;\n for (var i = content.length; i >= 0x100; i >>= 8)\n lenOctets++;\n\n var header = new Buffer(1 + 1 + lenOctets);\n header[0] = encodedTag;\n header[1] = 0x80 | lenOctets;\n\n for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8)\n header[i] = j & 0xff;\n\n return this._createEncoderBuffer([ header, content ]);\n};\n\nDERNode.prototype._encodeStr = function encodeStr(str, tag) {\n if (tag === 'bitstr') {\n return this._createEncoderBuffer([ str.unused | 0, str.data ]);\n } else if (tag === 'bmpstr') {\n var buf = new Buffer(str.length * 2);\n for (var i = 0; i < str.length; i++) {\n buf.writeUInt16BE(str.charCodeAt(i), i * 2);\n }\n return this._createEncoderBuffer(buf);\n } else if (tag === 'numstr') {\n if (!this._isNumstr(str)) {\n return this.reporter.error('Encoding of string type: numstr supports ' +\n 'only digits and space');\n }\n return this._createEncoderBuffer(str);\n } else if (tag === 'printstr') {\n if (!this._isPrintstr(str)) {\n return this.reporter.error('Encoding of string type: printstr supports ' +\n 'only latin upper and lower case letters, ' +\n 'digits, space, apostrophe, left and rigth ' +\n 'parenthesis, plus sign, comma, hyphen, ' +\n 'dot, slash, colon, equal sign, ' +\n 'question mark');\n }\n return this._createEncoderBuffer(str);\n } else if (/str$/.test(tag)) {\n return this._createEncoderBuffer(str);\n } else if (tag === 'objDesc') {\n return this._createEncoderBuffer(str);\n } else {\n return this.reporter.error('Encoding of string type: ' + tag +\n ' unsupported');\n }\n};\n\nDERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {\n if (typeof id === 'string') {\n if (!values)\n return this.reporter.error('string objid given, but no values map found');\n if (!values.hasOwnProperty(id))\n return this.reporter.error('objid not found in values map');\n id = values[id].split(/[\\s\\.]+/g);\n for (var i = 0; i < id.length; i++)\n id[i] |= 0;\n } else if (Array.isArray(id)) {\n id = id.slice();\n for (var i = 0; i < id.length; i++)\n id[i] |= 0;\n }\n\n if (!Array.isArray(id)) {\n return this.reporter.error('objid() should be either array or string, ' +\n 'got: ' + JSON.stringify(id));\n }\n\n if (!relative) {\n if (id[1] >= 40)\n return this.reporter.error('Second objid identifier OOB');\n id.splice(0, 2, id[0] * 40 + id[1]);\n }\n\n // Count number of octets\n var size = 0;\n for (var i = 0; i < id.length; i++) {\n var ident = id[i];\n for (size++; ident >= 0x80; ident >>= 7)\n size++;\n }\n\n var objid = new Buffer(size);\n var offset = objid.length - 1;\n for (var i = id.length - 1; i >= 0; i--) {\n var ident = id[i];\n objid[offset--] = ident & 0x7f;\n while ((ident >>= 7) > 0)\n objid[offset--] = 0x80 | (ident & 0x7f);\n }\n\n return this._createEncoderBuffer(objid);\n};\n\nfunction two(num) {\n if (num < 10)\n return '0' + num;\n else\n return num;\n}\n\nDERNode.prototype._encodeTime = function encodeTime(time, tag) {\n var str;\n var date = new Date(time);\n\n if (tag === 'gentime') {\n str = [\n two(date.getFullYear()),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n 'Z'\n ].join('');\n } else if (tag === 'utctime') {\n str = [\n two(date.getFullYear() % 100),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n 'Z'\n ].join('');\n } else {\n this.reporter.error('Encoding ' + tag + ' time is not supported yet');\n }\n\n return this._encodeStr(str, 'octstr');\n};\n\nDERNode.prototype._encodeNull = function encodeNull() {\n return this._createEncoderBuffer('');\n};\n\nDERNode.prototype._encodeInt = function encodeInt(num, values) {\n if (typeof num === 'string') {\n if (!values)\n return this.reporter.error('String int or enum given, but no values map');\n if (!values.hasOwnProperty(num)) {\n return this.reporter.error('Values map doesn\\'t contain: ' +\n JSON.stringify(num));\n }\n num = values[num];\n }\n\n // Bignum, assume big endian\n if (typeof num !== 'number' && !Buffer.isBuffer(num)) {\n var numArray = num.toArray();\n if (!num.sign && numArray[0] & 0x80) {\n numArray.unshift(0);\n }\n num = new Buffer(numArray);\n }\n\n if (Buffer.isBuffer(num)) {\n var size = num.length;\n if (num.length === 0)\n size++;\n\n var out = new Buffer(size);\n num.copy(out);\n if (num.length === 0)\n out[0] = 0\n return this._createEncoderBuffer(out);\n }\n\n if (num < 0x80)\n return this._createEncoderBuffer(num);\n\n if (num < 0x100)\n return this._createEncoderBuffer([0, num]);\n\n var size = 1;\n for (var i = num; i >= 0x100; i >>= 8)\n size++;\n\n var out = new Array(size);\n for (var i = out.length - 1; i >= 0; i--) {\n out[i] = num & 0xff;\n num >>= 8;\n }\n if(out[0] & 0x80) {\n out.unshift(0);\n }\n\n return this._createEncoderBuffer(new Buffer(out));\n};\n\nDERNode.prototype._encodeBool = function encodeBool(value) {\n return this._createEncoderBuffer(value ? 0xff : 0);\n};\n\nDERNode.prototype._use = function use(entity, obj) {\n if (typeof entity === 'function')\n entity = entity(obj);\n return entity._getEncoder('der').tree;\n};\n\nDERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {\n var state = this._baseState;\n var i;\n if (state['default'] === null)\n return false;\n\n var data = dataBuffer.join();\n if (state.defaultBuffer === undefined)\n state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();\n\n if (data.length !== state.defaultBuffer.length)\n return false;\n\n for (i=0; i < data.length; i++)\n if (data[i] !== state.defaultBuffer[i])\n return false;\n\n return true;\n};\n\n// Utility methods\n\nfunction encodeTag(tag, primitive, cls, reporter) {\n var res;\n\n if (tag === 'seqof')\n tag = 'seq';\n else if (tag === 'setof')\n tag = 'set';\n\n if (der.tagByName.hasOwnProperty(tag))\n res = der.tagByName[tag];\n else if (typeof tag === 'number' && (tag | 0) === tag)\n res = tag;\n else\n return reporter.error('Unknown tag: ' + tag);\n\n if (res >= 0x1f)\n return reporter.error('Multi-octet tag encoding unsupported');\n\n if (!primitive)\n res |= 0x20;\n\n res |= (der.tagClassByName[cls || 'universal'] << 6);\n\n return res;\n}\n","var inherits = require('inherits');\n\nvar DEREncoder = require('./der');\n\nfunction PEMEncoder(entity) {\n DEREncoder.call(this, entity);\n this.enc = 'pem';\n};\ninherits(PEMEncoder, DEREncoder);\nmodule.exports = PEMEncoder;\n\nPEMEncoder.prototype.encode = function encode(data, options) {\n var buf = DEREncoder.prototype.encode.call(this, data);\n\n var p = buf.toString('base64');\n var out = [ '-----BEGIN ' + options.label + '-----' ];\n for (var i = 0; i < p.length; i += 64)\n out.push(p.slice(i, i + 64));\n out.push('-----END ' + options.label + '-----');\n return out.join('\\n');\n};\n","var encoders = exports;\n\nencoders.der = require('./der');\nencoders.pem = require('./pem');\n","var asn1 = exports;\n\nasn1.bignum = require('bn.js');\n\nasn1.define = require('./asn1/api').define;\nasn1.base = require('./asn1/base');\nasn1.constants = require('./asn1/constants');\nasn1.decoders = require('./asn1/decoders');\nasn1.encoders = require('./asn1/encoders');\n","// from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js\n// thanks to @Rantanen\n\n'use strict';\n\nvar asn = require('asn1.js');\n\nvar Time = asn.define('Time', function () {\n\tthis.choice({\n\t\tutcTime: this.utctime(),\n\t\tgeneralTime: this.gentime()\n\t});\n});\n\nvar AttributeTypeValue = asn.define('AttributeTypeValue', function () {\n\tthis.seq().obj(\n\t\tthis.key('type').objid(),\n\t\tthis.key('value').any()\n\t);\n});\n\nvar AlgorithmIdentifier = asn.define('AlgorithmIdentifier', function () {\n\tthis.seq().obj(\n\t\tthis.key('algorithm').objid(),\n\t\tthis.key('parameters').optional(),\n\t\tthis.key('curve').objid().optional()\n\t);\n});\n\nvar SubjectPublicKeyInfo = asn.define('SubjectPublicKeyInfo', function () {\n\tthis.seq().obj(\n\t\tthis.key('algorithm').use(AlgorithmIdentifier),\n\t\tthis.key('subjectPublicKey').bitstr()\n\t);\n});\n\nvar RelativeDistinguishedName = asn.define('RelativeDistinguishedName', function () {\n\tthis.setof(AttributeTypeValue);\n});\n\nvar RDNSequence = asn.define('RDNSequence', function () {\n\tthis.seqof(RelativeDistinguishedName);\n});\n\nvar Name = asn.define('Name', function () {\n\tthis.choice({\n\t\trdnSequence: this.use(RDNSequence)\n\t});\n});\n\nvar Validity = asn.define('Validity', function () {\n\tthis.seq().obj(\n\t\tthis.key('notBefore').use(Time),\n\t\tthis.key('notAfter').use(Time)\n\t);\n});\n\nvar Extension = asn.define('Extension', function () {\n\tthis.seq().obj(\n\t\tthis.key('extnID').objid(),\n\t\tthis.key('critical').bool().def(false),\n\t\tthis.key('extnValue').octstr()\n\t);\n});\n\nvar TBSCertificate = asn.define('TBSCertificate', function () {\n\tthis.seq().obj(\n\t\tthis.key('version').explicit(0)['int']().optional(),\n\t\tthis.key('serialNumber')['int'](),\n\t\tthis.key('signature').use(AlgorithmIdentifier),\n\t\tthis.key('issuer').use(Name),\n\t\tthis.key('validity').use(Validity),\n\t\tthis.key('subject').use(Name),\n\t\tthis.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo),\n\t\tthis.key('issuerUniqueID').implicit(1).bitstr().optional(),\n\t\tthis.key('subjectUniqueID').implicit(2).bitstr().optional(),\n\t\tthis.key('extensions').explicit(3).seqof(Extension).optional()\n\t);\n});\n\nvar X509Certificate = asn.define('X509Certificate', function () {\n\tthis.seq().obj(\n\t\tthis.key('tbsCertificate').use(TBSCertificate),\n\t\tthis.key('signatureAlgorithm').use(AlgorithmIdentifier),\n\t\tthis.key('signatureValue').bitstr()\n\t);\n});\n\nmodule.exports = X509Certificate;\n","// from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js\n// Fedor, you are amazing.\n\n'use strict';\n\nvar asn1 = require('asn1.js');\n\nexports.certificate = require('./certificate');\n\nvar RSAPrivateKey = asn1.define('RSAPrivateKey', function () {\n\tthis.seq().obj(\n\t\tthis.key('version')['int'](),\n\t\tthis.key('modulus')['int'](),\n\t\tthis.key('publicExponent')['int'](),\n\t\tthis.key('privateExponent')['int'](),\n\t\tthis.key('prime1')['int'](),\n\t\tthis.key('prime2')['int'](),\n\t\tthis.key('exponent1')['int'](),\n\t\tthis.key('exponent2')['int'](),\n\t\tthis.key('coefficient')['int']()\n\t);\n});\nexports.RSAPrivateKey = RSAPrivateKey;\n\nvar RSAPublicKey = asn1.define('RSAPublicKey', function () {\n\tthis.seq().obj(\n\t\tthis.key('modulus')['int'](),\n\t\tthis.key('publicExponent')['int']()\n\t);\n});\nexports.RSAPublicKey = RSAPublicKey;\n\nvar AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () {\n\tthis.seq().obj(\n\t\tthis.key('algorithm').objid(),\n\t\tthis.key('none').null_().optional(),\n\t\tthis.key('curve').objid().optional(),\n\t\tthis.key('params').seq().obj(\n\t\t\tthis.key('p')['int'](),\n\t\t\tthis.key('q')['int'](),\n\t\t\tthis.key('g')['int']()\n\t\t).optional()\n\t);\n});\n\nvar PublicKey = asn1.define('SubjectPublicKeyInfo', function () {\n\tthis.seq().obj(\n\t\tthis.key('algorithm').use(AlgorithmIdentifier),\n\t\tthis.key('subjectPublicKey').bitstr()\n\t);\n});\nexports.PublicKey = PublicKey;\n\nvar PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () {\n\tthis.seq().obj(\n\t\tthis.key('version')['int'](),\n\t\tthis.key('algorithm').use(AlgorithmIdentifier),\n\t\tthis.key('subjectPrivateKey').octstr()\n\t);\n});\nexports.PrivateKey = PrivateKeyInfo;\nvar EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () {\n\tthis.seq().obj(\n\t\tthis.key('algorithm').seq().obj(\n\t\t\tthis.key('id').objid(),\n\t\t\tthis.key('decrypt').seq().obj(\n\t\t\t\tthis.key('kde').seq().obj(\n\t\t\t\t\tthis.key('id').objid(),\n\t\t\t\t\tthis.key('kdeparams').seq().obj(\n\t\t\t\t\t\tthis.key('salt').octstr(),\n\t\t\t\t\t\tthis.key('iters')['int']()\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\tthis.key('cipher').seq().obj(\n\t\t\t\t\tthis.key('algo').objid(),\n\t\t\t\t\tthis.key('iv').octstr()\n\t\t\t\t)\n\t\t\t)\n\t\t),\n\t\tthis.key('subjectPrivateKey').octstr()\n\t);\n});\n\nexports.EncryptedPrivateKey = EncryptedPrivateKeyInfo;\n\nvar DSAPrivateKey = asn1.define('DSAPrivateKey', function () {\n\tthis.seq().obj(\n\t\tthis.key('version')['int'](),\n\t\tthis.key('p')['int'](),\n\t\tthis.key('q')['int'](),\n\t\tthis.key('g')['int'](),\n\t\tthis.key('pub_key')['int'](),\n\t\tthis.key('priv_key')['int']()\n\t);\n});\nexports.DSAPrivateKey = DSAPrivateKey;\n\nexports.DSAparam = asn1.define('DSAparam', function () {\n\tthis['int']();\n});\n\nvar ECParameters = asn1.define('ECParameters', function () {\n\tthis.choice({\n\t\tnamedCurve: this.objid()\n\t});\n});\n\nvar ECPrivateKey = asn1.define('ECPrivateKey', function () {\n\tthis.seq().obj(\n\t\tthis.key('version')['int'](),\n\t\tthis.key('privateKey').octstr(),\n\t\tthis.key('parameters').optional().explicit(0).use(ECParameters),\n\t\tthis.key('publicKey').optional().explicit(1).bitstr()\n\t);\n});\nexports.ECPrivateKey = ECPrivateKey;\n\nexports.signature = asn1.define('signature', function () {\n\tthis.seq().obj(\n\t\tthis.key('r')['int'](),\n\t\tthis.key('s')['int']()\n\t);\n});\n","{\"2.16.840.1.101.3.4.1.1\": \"aes-128-ecb\",\n\"2.16.840.1.101.3.4.1.2\": \"aes-128-cbc\",\n\"2.16.840.1.101.3.4.1.3\": \"aes-128-ofb\",\n\"2.16.840.1.101.3.4.1.4\": \"aes-128-cfb\",\n\"2.16.840.1.101.3.4.1.21\": \"aes-192-ecb\",\n\"2.16.840.1.101.3.4.1.22\": \"aes-192-cbc\",\n\"2.16.840.1.101.3.4.1.23\": \"aes-192-ofb\",\n\"2.16.840.1.101.3.4.1.24\": \"aes-192-cfb\",\n\"2.16.840.1.101.3.4.1.41\": \"aes-256-ecb\",\n\"2.16.840.1.101.3.4.1.42\": \"aes-256-cbc\",\n\"2.16.840.1.101.3.4.1.43\": \"aes-256-ofb\",\n\"2.16.840.1.101.3.4.1.44\": \"aes-256-cfb\"\n}","'use strict';\n\n// adapted from https://github.com/apatil/pemstrip\nvar findProc = /Proc-Type: 4,ENCRYPTED[\\n\\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\\n\\r]+([0-9A-z\\n\\r+/=]+)[\\n\\r]+/m;\nvar startRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m;\nvar fullRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\\n\\r+/=]+)-----END \\1-----$/m;\nvar evp = require('evp_bytestokey');\nvar ciphers = require('browserify-aes');\nvar Buffer = require('safe-buffer').Buffer;\nmodule.exports = function (okey, password) {\n\tvar key = okey.toString();\n\tvar match = key.match(findProc);\n\tvar decrypted;\n\tif (!match) {\n\t\tvar match2 = key.match(fullRegex);\n\t\tdecrypted = Buffer.from(match2[2].replace(/[\\r\\n]/g, ''), 'base64');\n\t} else {\n\t\tvar suite = 'aes' + match[1];\n\t\tvar iv = Buffer.from(match[2], 'hex');\n\t\tvar cipherText = Buffer.from(match[3].replace(/[\\r\\n]/g, ''), 'base64');\n\t\tvar cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key;\n\t\tvar out = [];\n\t\tvar cipher = ciphers.createDecipheriv(suite, cipherKey, iv);\n\t\tout.push(cipher.update(cipherText));\n\t\tout.push(cipher['final']());\n\t\tdecrypted = Buffer.concat(out);\n\t}\n\tvar tag = key.match(startRegex)[1];\n\treturn {\n\t\ttag: tag,\n\t\tdata: decrypted\n\t};\n};\n","'use strict';\n\nvar asn1 = require('./asn1');\nvar aesid = require('./aesid.json');\nvar fixProc = require('./fixProc');\nvar ciphers = require('browserify-aes');\nvar compat = require('pbkdf2');\nvar Buffer = require('safe-buffer').Buffer;\n\nfunction decrypt(data, password) {\n\tvar salt = data.algorithm.decrypt.kde.kdeparams.salt;\n\tvar iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10);\n\tvar algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')];\n\tvar iv = data.algorithm.decrypt.cipher.iv;\n\tvar cipherText = data.subjectPrivateKey;\n\tvar keylen = parseInt(algo.split('-')[1], 10) / 8;\n\tvar key = compat.pbkdf2Sync(password, salt, iters, keylen, 'sha1');\n\tvar cipher = ciphers.createDecipheriv(algo, key, iv);\n\tvar out = [];\n\tout.push(cipher.update(cipherText));\n\tout.push(cipher['final']());\n\treturn Buffer.concat(out);\n}\n\nfunction parseKeys(buffer) {\n\tvar password;\n\tif (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) {\n\t\tpassword = buffer.passphrase;\n\t\tbuffer = buffer.key;\n\t}\n\tif (typeof buffer === 'string') {\n\t\tbuffer = Buffer.from(buffer);\n\t}\n\n\tvar stripped = fixProc(buffer, password);\n\n\tvar type = stripped.tag;\n\tvar data = stripped.data;\n\tvar subtype, ndata;\n\tswitch (type) {\n\t\tcase 'CERTIFICATE':\n\t\t\tndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo;\n\t\t\t// falls through\n\t\tcase 'PUBLIC KEY':\n\t\t\tif (!ndata) {\n\t\t\t\tndata = asn1.PublicKey.decode(data, 'der');\n\t\t\t}\n\t\t\tsubtype = ndata.algorithm.algorithm.join('.');\n\t\t\tswitch (subtype) {\n\t\t\t\tcase '1.2.840.113549.1.1.1':\n\t\t\t\t\treturn asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der');\n\t\t\t\tcase '1.2.840.10045.2.1':\n\t\t\t\t\tndata.subjectPrivateKey = ndata.subjectPublicKey;\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: 'ec',\n\t\t\t\t\t\tdata: ndata\n\t\t\t\t\t};\n\t\t\t\tcase '1.2.840.10040.4.1':\n\t\t\t\t\tndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der');\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: 'dsa',\n\t\t\t\t\t\tdata: ndata.algorithm.params\n\t\t\t\t\t};\n\t\t\t\tdefault: throw new Error('unknown key id ' + subtype);\n\t\t\t}\n\t\t\t// throw new Error('unknown key type ' + type)\n\t\tcase 'ENCRYPTED PRIVATE KEY':\n\t\t\tdata = asn1.EncryptedPrivateKey.decode(data, 'der');\n\t\t\tdata = decrypt(data, password);\n\t\t\t// falls through\n\t\tcase 'PRIVATE KEY':\n\t\t\tndata = asn1.PrivateKey.decode(data, 'der');\n\t\t\tsubtype = ndata.algorithm.algorithm.join('.');\n\t\t\tswitch (subtype) {\n\t\t\t\tcase '1.2.840.113549.1.1.1':\n\t\t\t\t\treturn asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der');\n\t\t\t\tcase '1.2.840.10045.2.1':\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcurve: ndata.algorithm.curve,\n\t\t\t\t\t\tprivateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey\n\t\t\t\t\t};\n\t\t\t\tcase '1.2.840.10040.4.1':\n\t\t\t\t\tndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der');\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: 'dsa',\n\t\t\t\t\t\tparams: ndata.algorithm.params\n\t\t\t\t\t};\n\t\t\t\tdefault: throw new Error('unknown key id ' + subtype);\n\t\t\t}\n\t\t\t// throw new Error('unknown key type ' + type)\n\t\tcase 'RSA PUBLIC KEY':\n\t\t\treturn asn1.RSAPublicKey.decode(data, 'der');\n\t\tcase 'RSA PRIVATE KEY':\n\t\t\treturn asn1.RSAPrivateKey.decode(data, 'der');\n\t\tcase 'DSA PRIVATE KEY':\n\t\t\treturn {\n\t\t\t\ttype: 'dsa',\n\t\t\t\tparams: asn1.DSAPrivateKey.decode(data, 'der')\n\t\t\t};\n\t\tcase 'EC PRIVATE KEY':\n\t\t\tdata = asn1.ECPrivateKey.decode(data, 'der');\n\t\t\treturn {\n\t\t\t\tcurve: data.parameters.value,\n\t\t\t\tprivateKey: data.privateKey\n\t\t\t};\n\t\tdefault: throw new Error('unknown key type ' + type);\n\t}\n}\nparseKeys.signature = asn1.signature;\n\nmodule.exports = parseKeys;\n","{\n \"1.3.132.0.10\": \"secp256k1\",\n \"1.3.132.0.33\": \"p224\",\n \"1.2.840.10045.3.1.1\": \"p192\",\n \"1.2.840.10045.3.1.7\": \"p256\",\n \"1.3.132.0.34\": \"p384\",\n \"1.3.132.0.35\": \"p521\"\n}\n","'use strict';\n\n// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js\nvar Buffer = require('safe-buffer').Buffer;\nvar createHmac = require('create-hmac');\nvar crt = require('browserify-rsa');\nvar EC = require('elliptic').ec;\nvar BN = require('bn.js');\nvar parseKeys = require('parse-asn1');\nvar curves = require('./curves.json');\n\nvar RSA_PKCS1_PADDING = 1;\n\nfunction sign(hash, key, hashType, signType, tag) {\n var priv = parseKeys(key);\n if (priv.curve) {\n // rsa keys can be interpreted as ecdsa ones in openssl\n if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') { throw new Error('wrong private key type'); }\n return ecSign(hash, priv);\n } else if (priv.type === 'dsa') {\n if (signType !== 'dsa') { throw new Error('wrong private key type'); }\n return dsaSign(hash, priv, hashType);\n }\n if (signType !== 'rsa' && signType !== 'ecdsa/rsa') { throw new Error('wrong private key type'); }\n if (key.padding !== undefined && key.padding !== RSA_PKCS1_PADDING) { throw new Error('illegal or unsupported padding mode'); }\n\n hash = Buffer.concat([tag, hash]);\n var len = priv.modulus.byteLength();\n var pad = [0, 1];\n while (hash.length + pad.length + 1 < len) { pad.push(0xff); }\n pad.push(0x00);\n var i = -1;\n while (++i < hash.length) { pad.push(hash[i]); }\n\n var out = crt(pad, priv);\n return out;\n}\n\nfunction ecSign(hash, priv) {\n var curveId = curves[priv.curve.join('.')];\n if (!curveId) { throw new Error('unknown curve ' + priv.curve.join('.')); }\n\n var curve = new EC(curveId);\n var key = curve.keyFromPrivate(priv.privateKey);\n var out = key.sign(hash);\n\n return Buffer.from(out.toDER());\n}\n\nfunction dsaSign(hash, priv, algo) {\n var x = priv.params.priv_key;\n var p = priv.params.p;\n var q = priv.params.q;\n var g = priv.params.g;\n var r = new BN(0);\n var k;\n var H = bits2int(hash, q).mod(q);\n var s = false;\n var kv = getKey(x, q, hash, algo);\n while (s === false) {\n k = makeKey(q, kv, algo);\n r = makeR(g, k, p, q);\n s = k.invm(q).imul(H.add(x.mul(r))).mod(q);\n if (s.cmpn(0) === 0) {\n s = false;\n r = new BN(0);\n }\n }\n return toDER(r, s);\n}\n\nfunction toDER(r, s) {\n r = r.toArray();\n s = s.toArray();\n\n // Pad values\n if (r[0] & 0x80) { r = [0].concat(r); }\n if (s[0] & 0x80) { s = [0].concat(s); }\n\n var total = r.length + s.length + 4;\n var res = [\n 0x30, total, 0x02, r.length\n ];\n res = res.concat(r, [0x02, s.length], s);\n return Buffer.from(res);\n}\n\nfunction getKey(x, q, hash, algo) {\n x = Buffer.from(x.toArray());\n if (x.length < q.byteLength()) {\n var zeros = Buffer.alloc(q.byteLength() - x.length);\n x = Buffer.concat([zeros, x]);\n }\n var hlen = hash.length;\n var hbits = bits2octets(hash, q);\n var v = Buffer.alloc(hlen);\n v.fill(1);\n var k = Buffer.alloc(hlen);\n k = createHmac(algo, k).update(v).update(Buffer.from([0])).update(x).update(hbits).digest();\n v = createHmac(algo, k).update(v).digest();\n k = createHmac(algo, k).update(v).update(Buffer.from([1])).update(x).update(hbits).digest();\n v = createHmac(algo, k).update(v).digest();\n return { k: k, v: v };\n}\n\nfunction bits2int(obits, q) {\n var bits = new BN(obits);\n var shift = (obits.length << 3) - q.bitLength();\n if (shift > 0) { bits.ishrn(shift); }\n return bits;\n}\n\nfunction bits2octets(bits, q) {\n bits = bits2int(bits, q);\n bits = bits.mod(q);\n var out = Buffer.from(bits.toArray());\n if (out.length < q.byteLength()) {\n var zeros = Buffer.alloc(q.byteLength() - out.length);\n out = Buffer.concat([zeros, out]);\n }\n return out;\n}\n\nfunction makeKey(q, kv, algo) {\n var t;\n var k;\n\n do {\n t = Buffer.alloc(0);\n\n while (t.length * 8 < q.bitLength()) {\n kv.v = createHmac(algo, kv.k).update(kv.v).digest();\n t = Buffer.concat([t, kv.v]);\n }\n\n k = bits2int(t, q);\n kv.k = createHmac(algo, kv.k).update(kv.v).update(Buffer.from([0])).digest();\n kv.v = createHmac(algo, kv.k).update(kv.v).digest();\n } while (k.cmp(q) !== -1);\n\n return k;\n}\n\nfunction makeR(g, k, p, q) {\n return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q);\n}\n\nmodule.exports = sign;\nmodule.exports.getKey = getKey;\nmodule.exports.makeKey = makeKey;\n","'use strict';\n\n// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js\nvar Buffer = require('safe-buffer').Buffer;\nvar BN = require('bn.js');\nvar EC = require('elliptic').ec;\nvar parseKeys = require('parse-asn1');\nvar curves = require('./curves.json');\n\nfunction verify(sig, hash, key, signType, tag) {\n var pub = parseKeys(key);\n if (pub.type === 'ec') {\n // rsa keys can be interpreted as ecdsa ones in openssl\n if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') { throw new Error('wrong public key type'); }\n return ecVerify(sig, hash, pub);\n } else if (pub.type === 'dsa') {\n if (signType !== 'dsa') { throw new Error('wrong public key type'); }\n return dsaVerify(sig, hash, pub);\n }\n if (signType !== 'rsa' && signType !== 'ecdsa/rsa') { throw new Error('wrong public key type'); }\n\n hash = Buffer.concat([tag, hash]);\n var len = pub.modulus.byteLength();\n var pad = [1];\n var padNum = 0;\n while (hash.length + pad.length + 2 < len) {\n pad.push(0xff);\n padNum += 1;\n }\n pad.push(0x00);\n var i = -1;\n while (++i < hash.length) {\n pad.push(hash[i]);\n }\n pad = Buffer.from(pad);\n var red = BN.mont(pub.modulus);\n sig = new BN(sig).toRed(red);\n\n sig = sig.redPow(new BN(pub.publicExponent));\n sig = Buffer.from(sig.fromRed().toArray());\n var out = padNum < 8 ? 1 : 0;\n len = Math.min(sig.length, pad.length);\n if (sig.length !== pad.length) { out = 1; }\n\n i = -1;\n while (++i < len) { out |= sig[i] ^ pad[i]; }\n return out === 0;\n}\n\nfunction ecVerify(sig, hash, pub) {\n var curveId = curves[pub.data.algorithm.curve.join('.')];\n if (!curveId) { throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.')); }\n\n var curve = new EC(curveId);\n var pubkey = pub.data.subjectPrivateKey.data;\n\n return curve.verify(hash, sig, pubkey);\n}\n\nfunction dsaVerify(sig, hash, pub) {\n var p = pub.data.p;\n var q = pub.data.q;\n var g = pub.data.g;\n var y = pub.data.pub_key;\n var unpacked = parseKeys.signature.decode(sig, 'der');\n var s = unpacked.s;\n var r = unpacked.r;\n checkValue(s, q);\n checkValue(r, q);\n var montp = BN.mont(p);\n var w = s.invm(q);\n var v = g.toRed(montp)\n .redPow(new BN(hash).mul(w).mod(q))\n .fromRed()\n .mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed())\n .mod(p)\n .mod(q);\n return v.cmp(r) === 0;\n}\n\nfunction checkValue(b, q) {\n if (b.cmpn(0) <= 0) { throw new Error('invalid sig'); }\n if (b.cmp(q) >= 0) { throw new Error('invalid sig'); }\n}\n\nmodule.exports = verify;\n","'use strict';\n\nvar Buffer = require('safe-buffer').Buffer;\nvar createHash = require('create-hash');\nvar stream = require('readable-stream');\nvar inherits = require('inherits');\nvar sign = require('./sign');\nvar verify = require('./verify');\n\nvar algorithms = require('./algorithms.json');\nObject.keys(algorithms).forEach(function (key) {\n algorithms[key].id = Buffer.from(algorithms[key].id, 'hex');\n algorithms[key.toLowerCase()] = algorithms[key];\n});\n\nfunction Sign(algorithm) {\n stream.Writable.call(this);\n\n var data = algorithms[algorithm];\n if (!data) { throw new Error('Unknown message digest'); }\n\n this._hashType = data.hash;\n this._hash = createHash(data.hash);\n this._tag = data.id;\n this._signType = data.sign;\n}\ninherits(Sign, stream.Writable);\n\nSign.prototype._write = function _write(data, _, done) {\n this._hash.update(data);\n done();\n};\n\nSign.prototype.update = function update(data, enc) {\n this._hash.update(typeof data === 'string' ? Buffer.from(data, enc) : data);\n\n return this;\n};\n\nSign.prototype.sign = function signMethod(key, enc) {\n this.end();\n var hash = this._hash.digest();\n var sig = sign(hash, key, this._hashType, this._signType, this._tag);\n\n return enc ? sig.toString(enc) : sig;\n};\n\nfunction Verify(algorithm) {\n stream.Writable.call(this);\n\n var data = algorithms[algorithm];\n if (!data) { throw new Error('Unknown message digest'); }\n\n this._hash = createHash(data.hash);\n this._tag = data.id;\n this._signType = data.sign;\n}\ninherits(Verify, stream.Writable);\n\nVerify.prototype._write = function _write(data, _, done) {\n this._hash.update(data);\n done();\n};\n\nVerify.prototype.update = function update(data, enc) {\n this._hash.update(typeof data === 'string' ? Buffer.from(data, enc) : data);\n\n return this;\n};\n\nVerify.prototype.verify = function verifyMethod(key, sig, enc) {\n var sigBuffer = typeof sig === 'string' ? Buffer.from(sig, enc) : sig;\n\n this.end();\n var hash = this._hash.digest();\n return verify(sigBuffer, hash, key, this._signType, this._tag);\n};\n\nfunction createSign(algorithm) {\n return new Sign(algorithm);\n}\n\nfunction createVerify(algorithm) {\n return new Verify(algorithm);\n}\n\nmodule.exports = {\n Sign: createSign,\n Verify: createVerify,\n createSign: createSign,\n createVerify: createVerify\n};\n","var elliptic = require('elliptic')\nvar BN = require('bn.js')\n\nmodule.exports = function createECDH (curve) {\n return new ECDH(curve)\n}\n\nvar aliases = {\n secp256k1: {\n name: 'secp256k1',\n byteLength: 32\n },\n secp224r1: {\n name: 'p224',\n byteLength: 28\n },\n prime256v1: {\n name: 'p256',\n byteLength: 32\n },\n prime192v1: {\n name: 'p192',\n byteLength: 24\n },\n ed25519: {\n name: 'ed25519',\n byteLength: 32\n },\n secp384r1: {\n name: 'p384',\n byteLength: 48\n },\n secp521r1: {\n name: 'p521',\n byteLength: 66\n }\n}\n\naliases.p224 = aliases.secp224r1\naliases.p256 = aliases.secp256r1 = aliases.prime256v1\naliases.p192 = aliases.secp192r1 = aliases.prime192v1\naliases.p384 = aliases.secp384r1\naliases.p521 = aliases.secp521r1\n\nfunction ECDH (curve) {\n this.curveType = aliases[curve]\n if (!this.curveType) {\n this.curveType = {\n name: curve\n }\n }\n this.curve = new elliptic.ec(this.curveType.name) // eslint-disable-line new-cap\n this.keys = void 0\n}\n\nECDH.prototype.generateKeys = function (enc, format) {\n this.keys = this.curve.genKeyPair()\n return this.getPublicKey(enc, format)\n}\n\nECDH.prototype.computeSecret = function (other, inenc, enc) {\n inenc = inenc || 'utf8'\n if (!Buffer.isBuffer(other)) {\n other = new Buffer(other, inenc)\n }\n var otherPub = this.curve.keyFromPublic(other).getPublic()\n var out = otherPub.mul(this.keys.getPrivate()).getX()\n return formatReturnValue(out, enc, this.curveType.byteLength)\n}\n\nECDH.prototype.getPublicKey = function (enc, format) {\n var key = this.keys.getPublic(format === 'compressed', true)\n if (format === 'hybrid') {\n if (key[key.length - 1] % 2) {\n key[0] = 7\n } else {\n key[0] = 6\n }\n }\n return formatReturnValue(key, enc)\n}\n\nECDH.prototype.getPrivateKey = function (enc) {\n return formatReturnValue(this.keys.getPrivate(), enc)\n}\n\nECDH.prototype.setPublicKey = function (pub, enc) {\n enc = enc || 'utf8'\n if (!Buffer.isBuffer(pub)) {\n pub = new Buffer(pub, enc)\n }\n this.keys._importPublic(pub)\n return this\n}\n\nECDH.prototype.setPrivateKey = function (priv, enc) {\n enc = enc || 'utf8'\n if (!Buffer.isBuffer(priv)) {\n priv = new Buffer(priv, enc)\n }\n\n var _priv = new BN(priv)\n _priv = _priv.toString(16)\n this.keys = this.curve.genKeyPair()\n this.keys._importPrivate(_priv)\n return this\n}\n\nfunction formatReturnValue (bn, enc, len) {\n if (!Array.isArray(bn)) {\n bn = bn.toArray()\n }\n var buf = new Buffer(bn)\n if (len && buf.length < len) {\n var zeros = new Buffer(len - buf.length)\n zeros.fill(0)\n buf = Buffer.concat([zeros, buf])\n }\n if (!enc) {\n return buf\n } else {\n return buf.toString(enc)\n }\n}\n","var createHash = require('create-hash')\nvar Buffer = require('safe-buffer').Buffer\n\nmodule.exports = function (seed, len) {\n var t = Buffer.alloc(0)\n var i = 0\n var c\n while (t.length < len) {\n c = i2ops(i++)\n t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()])\n }\n return t.slice(0, len)\n}\n\nfunction i2ops (c) {\n var out = Buffer.allocUnsafe(4)\n out.writeUInt32BE(c, 0)\n return out\n}\n","module.exports = function xor (a, b) {\n var len = a.length\n var i = -1\n while (++i < len) {\n a[i] ^= b[i]\n }\n return a\n}\n","var BN = require('bn.js')\nvar Buffer = require('safe-buffer').Buffer\n\nfunction withPublic (paddedMsg, key) {\n return Buffer.from(paddedMsg\n .toRed(BN.mont(key.modulus))\n .redPow(new BN(key.publicExponent))\n .fromRed()\n .toArray())\n}\n\nmodule.exports = withPublic\n","var parseKeys = require('parse-asn1')\nvar randomBytes = require('randombytes')\nvar createHash = require('create-hash')\nvar mgf = require('./mgf')\nvar xor = require('./xor')\nvar BN = require('bn.js')\nvar withPublic = require('./withPublic')\nvar crt = require('browserify-rsa')\nvar Buffer = require('safe-buffer').Buffer\n\nmodule.exports = function publicEncrypt (publicKey, msg, reverse) {\n var padding\n if (publicKey.padding) {\n padding = publicKey.padding\n } else if (reverse) {\n padding = 1\n } else {\n padding = 4\n }\n var key = parseKeys(publicKey)\n var paddedMsg\n if (padding === 4) {\n paddedMsg = oaep(key, msg)\n } else if (padding === 1) {\n paddedMsg = pkcs1(key, msg, reverse)\n } else if (padding === 3) {\n paddedMsg = new BN(msg)\n if (paddedMsg.cmp(key.modulus) >= 0) {\n throw new Error('data too long for modulus')\n }\n } else {\n throw new Error('unknown padding')\n }\n if (reverse) {\n return crt(paddedMsg, key)\n } else {\n return withPublic(paddedMsg, key)\n }\n}\n\nfunction oaep (key, msg) {\n var k = key.modulus.byteLength()\n var mLen = msg.length\n var iHash = createHash('sha1').update(Buffer.alloc(0)).digest()\n var hLen = iHash.length\n var hLen2 = 2 * hLen\n if (mLen > k - hLen2 - 2) {\n throw new Error('message too long')\n }\n var ps = Buffer.alloc(k - mLen - hLen2 - 2)\n var dblen = k - hLen - 1\n var seed = randomBytes(hLen)\n var maskedDb = xor(Buffer.concat([iHash, ps, Buffer.alloc(1, 1), msg], dblen), mgf(seed, dblen))\n var maskedSeed = xor(seed, mgf(maskedDb, hLen))\n return new BN(Buffer.concat([Buffer.alloc(1), maskedSeed, maskedDb], k))\n}\nfunction pkcs1 (key, msg, reverse) {\n var mLen = msg.length\n var k = key.modulus.byteLength()\n if (mLen > k - 11) {\n throw new Error('message too long')\n }\n var ps\n if (reverse) {\n ps = Buffer.alloc(k - mLen - 3, 0xff)\n } else {\n ps = nonZero(k - mLen - 3)\n }\n return new BN(Buffer.concat([Buffer.from([0, reverse ? 1 : 2]), ps, Buffer.alloc(1), msg], k))\n}\nfunction nonZero (len) {\n var out = Buffer.allocUnsafe(len)\n var i = 0\n var cache = randomBytes(len * 2)\n var cur = 0\n var num\n while (i < len) {\n if (cur === cache.length) {\n cache = randomBytes(len * 2)\n cur = 0\n }\n num = cache[cur++]\n if (num) {\n out[i++] = num\n }\n }\n return out\n}\n","var parseKeys = require('parse-asn1')\nvar mgf = require('./mgf')\nvar xor = require('./xor')\nvar BN = require('bn.js')\nvar crt = require('browserify-rsa')\nvar createHash = require('create-hash')\nvar withPublic = require('./withPublic')\nvar Buffer = require('safe-buffer').Buffer\n\nmodule.exports = function privateDecrypt (privateKey, enc, reverse) {\n var padding\n if (privateKey.padding) {\n padding = privateKey.padding\n } else if (reverse) {\n padding = 1\n } else {\n padding = 4\n }\n\n var key = parseKeys(privateKey)\n var k = key.modulus.byteLength()\n if (enc.length > k || new BN(enc).cmp(key.modulus) >= 0) {\n throw new Error('decryption error')\n }\n var msg\n if (reverse) {\n msg = withPublic(new BN(enc), key)\n } else {\n msg = crt(enc, key)\n }\n var zBuffer = Buffer.alloc(k - msg.length)\n msg = Buffer.concat([zBuffer, msg], k)\n if (padding === 4) {\n return oaep(key, msg)\n } else if (padding === 1) {\n return pkcs1(key, msg, reverse)\n } else if (padding === 3) {\n return msg\n } else {\n throw new Error('unknown padding')\n }\n}\n\nfunction oaep (key, msg) {\n var k = key.modulus.byteLength()\n var iHash = createHash('sha1').update(Buffer.alloc(0)).digest()\n var hLen = iHash.length\n if (msg[0] !== 0) {\n throw new Error('decryption error')\n }\n var maskedSeed = msg.slice(1, hLen + 1)\n var maskedDb = msg.slice(hLen + 1)\n var seed = xor(maskedSeed, mgf(maskedDb, hLen))\n var db = xor(maskedDb, mgf(seed, k - hLen - 1))\n if (compare(iHash, db.slice(0, hLen))) {\n throw new Error('decryption error')\n }\n var i = hLen\n while (db[i] === 0) {\n i++\n }\n if (db[i++] !== 1) {\n throw new Error('decryption error')\n }\n return db.slice(i)\n}\n\nfunction pkcs1 (key, msg, reverse) {\n var p1 = msg.slice(0, 2)\n var i = 2\n var status = 0\n while (msg[i++] !== 0) {\n if (i >= msg.length) {\n status++\n break\n }\n }\n var ps = msg.slice(2, i - 1)\n\n if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)) {\n status++\n }\n if (ps.length < 8) {\n status++\n }\n if (status) {\n throw new Error('decryption error')\n }\n return msg.slice(i)\n}\nfunction compare (a, b) {\n a = Buffer.from(a)\n b = Buffer.from(b)\n var dif = 0\n var len = a.length\n if (a.length !== b.length) {\n dif++\n len = Math.min(a.length, b.length)\n }\n var i = -1\n while (++i < len) {\n dif += (a[i] ^ b[i])\n }\n return dif\n}\n","exports.publicEncrypt = require('./publicEncrypt')\nexports.privateDecrypt = require('./privateDecrypt')\n\nexports.privateEncrypt = function privateEncrypt (key, buf) {\n return exports.publicEncrypt(key, buf, true)\n}\n\nexports.publicDecrypt = function publicDecrypt (key, buf) {\n return exports.privateDecrypt(key, buf, true)\n}\n","'use strict'\n\nfunction oldBrowser () {\n throw new Error('secure random number generation not supported by this browser\\nuse chrome, FireFox or Internet Explorer 11')\n}\nvar safeBuffer = require('safe-buffer')\nvar randombytes = require('randombytes')\nvar Buffer = safeBuffer.Buffer\nvar kBufferMaxLength = safeBuffer.kMaxLength\nvar crypto = global.crypto || global.msCrypto\nvar kMaxUint32 = Math.pow(2, 32) - 1\nfunction assertOffset (offset, length) {\n if (typeof offset !== 'number' || offset !== offset) { // eslint-disable-line no-self-compare\n throw new TypeError('offset must be a number')\n }\n\n if (offset > kMaxUint32 || offset < 0) {\n throw new TypeError('offset must be a uint32')\n }\n\n if (offset > kBufferMaxLength || offset > length) {\n throw new RangeError('offset out of range')\n }\n}\n\nfunction assertSize (size, offset, length) {\n if (typeof size !== 'number' || size !== size) { // eslint-disable-line no-self-compare\n throw new TypeError('size must be a number')\n }\n\n if (size > kMaxUint32 || size < 0) {\n throw new TypeError('size must be a uint32')\n }\n\n if (size + offset > length || size > kBufferMaxLength) {\n throw new RangeError('buffer too small')\n }\n}\nif ((crypto && crypto.getRandomValues) || !process.browser) {\n exports.randomFill = randomFill\n exports.randomFillSync = randomFillSync\n} else {\n exports.randomFill = oldBrowser\n exports.randomFillSync = oldBrowser\n}\nfunction randomFill (buf, offset, size, cb) {\n if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {\n throw new TypeError('\"buf\" argument must be a Buffer or Uint8Array')\n }\n\n if (typeof offset === 'function') {\n cb = offset\n offset = 0\n size = buf.length\n } else if (typeof size === 'function') {\n cb = size\n size = buf.length - offset\n } else if (typeof cb !== 'function') {\n throw new TypeError('\"cb\" argument must be a function')\n }\n assertOffset(offset, buf.length)\n assertSize(size, offset, buf.length)\n return actualFill(buf, offset, size, cb)\n}\n\nfunction actualFill (buf, offset, size, cb) {\n if (process.browser) {\n var ourBuf = buf.buffer\n var uint = new Uint8Array(ourBuf, offset, size)\n crypto.getRandomValues(uint)\n if (cb) {\n process.nextTick(function () {\n cb(null, buf)\n })\n return\n }\n return buf\n }\n if (cb) {\n randombytes(size, function (err, bytes) {\n if (err) {\n return cb(err)\n }\n bytes.copy(buf, offset)\n cb(null, buf)\n })\n return\n }\n var bytes = randombytes(size)\n bytes.copy(buf, offset)\n return buf\n}\nfunction randomFillSync (buf, offset, size) {\n if (typeof offset === 'undefined') {\n offset = 0\n }\n if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {\n throw new TypeError('\"buf\" argument must be a Buffer or Uint8Array')\n }\n\n assertOffset(offset, buf.length)\n\n if (size === undefined) size = buf.length - offset\n\n assertSize(size, offset, buf.length)\n\n return actualFill(buf, offset, size)\n}\n","'use strict'\n\nexports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes')\nexports.createHash = exports.Hash = require('create-hash')\nexports.createHmac = exports.Hmac = require('create-hmac')\n\nvar algos = require('browserify-sign/algos')\nvar algoKeys = Object.keys(algos)\nvar hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys)\nexports.getHashes = function () {\n return hashes\n}\n\nvar p = require('pbkdf2')\nexports.pbkdf2 = p.pbkdf2\nexports.pbkdf2Sync = p.pbkdf2Sync\n\nvar aes = require('browserify-cipher')\n\nexports.Cipher = aes.Cipher\nexports.createCipher = aes.createCipher\nexports.Cipheriv = aes.Cipheriv\nexports.createCipheriv = aes.createCipheriv\nexports.Decipher = aes.Decipher\nexports.createDecipher = aes.createDecipher\nexports.Decipheriv = aes.Decipheriv\nexports.createDecipheriv = aes.createDecipheriv\nexports.getCiphers = aes.getCiphers\nexports.listCiphers = aes.listCiphers\n\nvar dh = require('diffie-hellman')\n\nexports.DiffieHellmanGroup = dh.DiffieHellmanGroup\nexports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup\nexports.getDiffieHellman = dh.getDiffieHellman\nexports.createDiffieHellman = dh.createDiffieHellman\nexports.DiffieHellman = dh.DiffieHellman\n\nvar sign = require('browserify-sign')\n\nexports.createSign = sign.createSign\nexports.Sign = sign.Sign\nexports.createVerify = sign.createVerify\nexports.Verify = sign.Verify\n\nexports.createECDH = require('create-ecdh')\n\nvar publicEncrypt = require('public-encrypt')\n\nexports.publicEncrypt = publicEncrypt.publicEncrypt\nexports.privateEncrypt = publicEncrypt.privateEncrypt\nexports.publicDecrypt = publicEncrypt.publicDecrypt\nexports.privateDecrypt = publicEncrypt.privateDecrypt\n\n// the least I can do is make error messages for the rest of the node.js/crypto api.\n// ;[\n// 'createCredentials'\n// ].forEach(function (name) {\n// exports[name] = function () {\n// throw new Error([\n// 'sorry, ' + name + ' is not implemented yet',\n// 'we accept pull requests',\n// 'https://github.com/crypto-browserify/crypto-browserify'\n// ].join('\\n'))\n// }\n// })\n\nvar rf = require('randomfill')\n\nexports.randomFill = rf.randomFill\nexports.randomFillSync = rf.randomFillSync\n\nexports.createCredentials = function () {\n throw new Error([\n 'sorry, createCredentials is not implemented yet',\n 'we accept pull requests',\n 'https://github.com/crypto-browserify/crypto-browserify'\n ].join('\\n'))\n}\n\nexports.constants = {\n 'DH_CHECK_P_NOT_SAFE_PRIME': 2,\n 'DH_CHECK_P_NOT_PRIME': 1,\n 'DH_UNABLE_TO_CHECK_GENERATOR': 4,\n 'DH_NOT_SUITABLE_GENERATOR': 8,\n 'NPN_ENABLED': 1,\n 'ALPN_ENABLED': 1,\n 'RSA_PKCS1_PADDING': 1,\n 'RSA_SSLV23_PADDING': 2,\n 'RSA_NO_PADDING': 3,\n 'RSA_PKCS1_OAEP_PADDING': 4,\n 'RSA_X931_PADDING': 5,\n 'RSA_PKCS1_PSS_PADDING': 6,\n 'POINT_CONVERSION_COMPRESSED': 2,\n 'POINT_CONVERSION_UNCOMPRESSED': 4,\n 'POINT_CONVERSION_HYBRID': 6\n}\n",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory();\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\troot.CryptoJS = factory();\n\t}\n}(this, function () {\n\n\t/*globals window, global, require*/\n\n\t/**\n\t * CryptoJS core components.\n\t */\n\tvar CryptoJS = CryptoJS || (function (Math, undefined) {\n\n\t var crypto;\n\n\t // Native crypto from window (Browser)\n\t if (typeof window !== 'undefined' && window.crypto) {\n\t crypto = window.crypto;\n\t }\n\n\t // Native crypto in web worker (Browser)\n\t if (typeof self !== 'undefined' && self.crypto) {\n\t crypto = self.crypto;\n\t }\n\n\t // Native crypto from worker\n\t if (typeof globalThis !== 'undefined' && globalThis.crypto) {\n\t crypto = globalThis.crypto;\n\t }\n\n\t // Native (experimental IE 11) crypto from window (Browser)\n\t if (!crypto && typeof window !== 'undefined' && window.msCrypto) {\n\t crypto = window.msCrypto;\n\t }\n\n\t // Native crypto from global (NodeJS)\n\t if (!crypto && typeof global !== 'undefined' && global.crypto) {\n\t crypto = global.crypto;\n\t }\n\n\t // Native crypto import via require (NodeJS)\n\t if (!crypto && typeof require === 'function') {\n\t try {\n\t crypto = require('crypto');\n\t } catch (err) {}\n\t }\n\n\t /*\n\t * Cryptographically secure pseudorandom number generator\n\t *\n\t * As Math.random() is cryptographically not safe to use\n\t */\n\t var cryptoSecureRandomInt = function () {\n\t if (crypto) {\n\t // Use getRandomValues method (Browser)\n\t if (typeof crypto.getRandomValues === 'function') {\n\t try {\n\t return crypto.getRandomValues(new Uint32Array(1))[0];\n\t } catch (err) {}\n\t }\n\n\t // Use randomBytes method (NodeJS)\n\t if (typeof crypto.randomBytes === 'function') {\n\t try {\n\t return crypto.randomBytes(4).readInt32LE();\n\t } catch (err) {}\n\t }\n\t }\n\n\t throw new Error('Native crypto module could not be used to get secure random number.');\n\t };\n\n\t /*\n\t * Local polyfill of Object.create\n\n\t */\n\t var create = Object.create || (function () {\n\t function F() {}\n\n\t return function (obj) {\n\t var subtype;\n\n\t F.prototype = obj;\n\n\t subtype = new F();\n\n\t F.prototype = null;\n\n\t return subtype;\n\t };\n\t }());\n\n\t /**\n\t * CryptoJS namespace.\n\t */\n\t var C = {};\n\n\t /**\n\t * Library namespace.\n\t */\n\t var C_lib = C.lib = {};\n\n\t /**\n\t * Base object for prototypal inheritance.\n\t */\n\t var Base = C_lib.Base = (function () {\n\n\n\t return {\n\t /**\n\t * Creates a new object that inherits from this object.\n\t *\n\t * @param {Object} overrides Properties to copy into the new object.\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * field: 'value',\n\t *\n\t * method: function () {\n\t * }\n\t * });\n\t */\n\t extend: function (overrides) {\n\t // Spawn\n\t var subtype = create(this);\n\n\t // Augment\n\t if (overrides) {\n\t subtype.mixIn(overrides);\n\t }\n\n\t // Create default initializer\n\t if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {\n\t subtype.init = function () {\n\t subtype.$super.init.apply(this, arguments);\n\t };\n\t }\n\n\t // Initializer's prototype is the subtype object\n\t subtype.init.prototype = subtype;\n\n\t // Reference supertype\n\t subtype.$super = this;\n\n\t return subtype;\n\t },\n\n\t /**\n\t * Extends this object and runs the init method.\n\t * Arguments to create() will be passed to init().\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var instance = MyType.create();\n\t */\n\t create: function () {\n\t var instance = this.extend();\n\t instance.init.apply(instance, arguments);\n\n\t return instance;\n\t },\n\n\t /**\n\t * Initializes a newly created object.\n\t * Override this method to add some logic when your objects are created.\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * init: function () {\n\t * // ...\n\t * }\n\t * });\n\t */\n\t init: function () {\n\t },\n\n\t /**\n\t * Copies properties into this object.\n\t *\n\t * @param {Object} properties The properties to mix in.\n\t *\n\t * @example\n\t *\n\t * MyType.mixIn({\n\t * field: 'value'\n\t * });\n\t */\n\t mixIn: function (properties) {\n\t for (var propertyName in properties) {\n\t if (properties.hasOwnProperty(propertyName)) {\n\t this[propertyName] = properties[propertyName];\n\t }\n\t }\n\n\t // IE won't copy toString using the loop above\n\t if (properties.hasOwnProperty('toString')) {\n\t this.toString = properties.toString;\n\t }\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = instance.clone();\n\t */\n\t clone: function () {\n\t return this.init.prototype.extend(this);\n\t }\n\t };\n\t }());\n\n\t /**\n\t * An array of 32-bit words.\n\t *\n\t * @property {Array} words The array of 32-bit words.\n\t * @property {number} sigBytes The number of significant bytes in this word array.\n\t */\n\t var WordArray = C_lib.WordArray = Base.extend({\n\t /**\n\t * Initializes a newly created word array.\n\t *\n\t * @param {Array} words (Optional) An array of 32-bit words.\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.create();\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\n\t */\n\t init: function (words, sigBytes) {\n\t words = this.words = words || [];\n\n\t if (sigBytes != undefined) {\n\t this.sigBytes = sigBytes;\n\t } else {\n\t this.sigBytes = words.length * 4;\n\t }\n\t },\n\n\t /**\n\t * Converts this word array to a string.\n\t *\n\t * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n\t *\n\t * @return {string} The stringified word array.\n\t *\n\t * @example\n\t *\n\t * var string = wordArray + '';\n\t * var string = wordArray.toString();\n\t * var string = wordArray.toString(CryptoJS.enc.Utf8);\n\t */\n\t toString: function (encoder) {\n\t return (encoder || Hex).stringify(this);\n\t },\n\n\t /**\n\t * Concatenates a word array to this word array.\n\t *\n\t * @param {WordArray} wordArray The word array to append.\n\t *\n\t * @return {WordArray} This word array.\n\t *\n\t * @example\n\t *\n\t * wordArray1.concat(wordArray2);\n\t */\n\t concat: function (wordArray) {\n\t // Shortcuts\n\t var thisWords = this.words;\n\t var thatWords = wordArray.words;\n\t var thisSigBytes = this.sigBytes;\n\t var thatSigBytes = wordArray.sigBytes;\n\n\t // Clamp excess bits\n\t this.clamp();\n\n\t // Concat\n\t if (thisSigBytes % 4) {\n\t // Copy one byte at a time\n\t for (var i = 0; i < thatSigBytes; i++) {\n\t var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\n\t }\n\t } else {\n\t // Copy one word at a time\n\t for (var j = 0; j < thatSigBytes; j += 4) {\n\t thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2];\n\t }\n\t }\n\t this.sigBytes += thatSigBytes;\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Removes insignificant bits.\n\t *\n\t * @example\n\t *\n\t * wordArray.clamp();\n\t */\n\t clamp: function () {\n\t // Shortcuts\n\t var words = this.words;\n\t var sigBytes = this.sigBytes;\n\n\t // Clamp\n\t words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\n\t words.length = Math.ceil(sigBytes / 4);\n\t },\n\n\t /**\n\t * Creates a copy of this word array.\n\t *\n\t * @return {WordArray} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = wordArray.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone.words = this.words.slice(0);\n\n\t return clone;\n\t },\n\n\t /**\n\t * Creates a word array filled with random bytes.\n\t *\n\t * @param {number} nBytes The number of random bytes to generate.\n\t *\n\t * @return {WordArray} The random word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.random(16);\n\t */\n\t random: function (nBytes) {\n\t var words = [];\n\n\t for (var i = 0; i < nBytes; i += 4) {\n\t words.push(cryptoSecureRandomInt());\n\t }\n\n\t return new WordArray.init(words, nBytes);\n\t }\n\t });\n\n\t /**\n\t * Encoder namespace.\n\t */\n\t var C_enc = C.enc = {};\n\n\t /**\n\t * Hex encoding strategy.\n\t */\n\t var Hex = C_enc.Hex = {\n\t /**\n\t * Converts a word array to a hex string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The hex string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var hexChars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t hexChars.push((bite >>> 4).toString(16));\n\t hexChars.push((bite & 0x0f).toString(16));\n\t }\n\n\t return hexChars.join('');\n\t },\n\n\t /**\n\t * Converts a hex string to a word array.\n\t *\n\t * @param {string} hexStr The hex string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Hex.parse(hexString);\n\t */\n\t parse: function (hexStr) {\n\t // Shortcut\n\t var hexStrLength = hexStr.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < hexStrLength; i += 2) {\n\t words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\n\t }\n\n\t return new WordArray.init(words, hexStrLength / 2);\n\t }\n\t };\n\n\t /**\n\t * Latin1 encoding strategy.\n\t */\n\t var Latin1 = C_enc.Latin1 = {\n\t /**\n\t * Converts a word array to a Latin1 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The Latin1 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var latin1Chars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t latin1Chars.push(String.fromCharCode(bite));\n\t }\n\n\t return latin1Chars.join('');\n\t },\n\n\t /**\n\t * Converts a Latin1 string to a word array.\n\t *\n\t * @param {string} latin1Str The Latin1 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\n\t */\n\t parse: function (latin1Str) {\n\t // Shortcut\n\t var latin1StrLength = latin1Str.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < latin1StrLength; i++) {\n\t words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\n\t }\n\n\t return new WordArray.init(words, latin1StrLength);\n\t }\n\t };\n\n\t /**\n\t * UTF-8 encoding strategy.\n\t */\n\t var Utf8 = C_enc.Utf8 = {\n\t /**\n\t * Converts a word array to a UTF-8 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The UTF-8 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t try {\n\t return decodeURIComponent(escape(Latin1.stringify(wordArray)));\n\t } catch (e) {\n\t throw new Error('Malformed UTF-8 data');\n\t }\n\t },\n\n\t /**\n\t * Converts a UTF-8 string to a word array.\n\t *\n\t * @param {string} utf8Str The UTF-8 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\n\t */\n\t parse: function (utf8Str) {\n\t return Latin1.parse(unescape(encodeURIComponent(utf8Str)));\n\t }\n\t };\n\n\t /**\n\t * Abstract buffered block algorithm template.\n\t *\n\t * The property blockSize must be implemented in a concrete subtype.\n\t *\n\t * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0\n\t */\n\t var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({\n\t /**\n\t * Resets this block algorithm's data buffer to its initial state.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm.reset();\n\t */\n\t reset: function () {\n\t // Initial values\n\t this._data = new WordArray.init();\n\t this._nDataBytes = 0;\n\t },\n\n\t /**\n\t * Adds new data to this block algorithm's buffer.\n\t *\n\t * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm._append('data');\n\t * bufferedBlockAlgorithm._append(wordArray);\n\t */\n\t _append: function (data) {\n\t // Convert string to WordArray, else assume WordArray already\n\t if (typeof data == 'string') {\n\t data = Utf8.parse(data);\n\t }\n\n\t // Append\n\t this._data.concat(data);\n\t this._nDataBytes += data.sigBytes;\n\t },\n\n\t /**\n\t * Processes available data blocks.\n\t *\n\t * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n\t *\n\t * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\n\t *\n\t * @return {WordArray} The processed data.\n\t *\n\t * @example\n\t *\n\t * var processedData = bufferedBlockAlgorithm._process();\n\t * var processedData = bufferedBlockAlgorithm._process(!!'flush');\n\t */\n\t _process: function (doFlush) {\n\t var processedWords;\n\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\t var dataSigBytes = data.sigBytes;\n\t var blockSize = this.blockSize;\n\t var blockSizeBytes = blockSize * 4;\n\n\t // Count blocks ready\n\t var nBlocksReady = dataSigBytes / blockSizeBytes;\n\t if (doFlush) {\n\t // Round up to include partial blocks\n\t nBlocksReady = Math.ceil(nBlocksReady);\n\t } else {\n\t // Round down to include only full blocks,\n\t // less the number of blocks that must remain in the buffer\n\t nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\n\t }\n\n\t // Count words ready\n\t var nWordsReady = nBlocksReady * blockSize;\n\n\t // Count bytes ready\n\t var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\n\n\t // Process blocks\n\t if (nWordsReady) {\n\t for (var offset = 0; offset < nWordsReady; offset += blockSize) {\n\t // Perform concrete-algorithm logic\n\t this._doProcessBlock(dataWords, offset);\n\t }\n\n\t // Remove processed words\n\t processedWords = dataWords.splice(0, nWordsReady);\n\t data.sigBytes -= nBytesReady;\n\t }\n\n\t // Return processed words\n\t return new WordArray.init(processedWords, nBytesReady);\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = bufferedBlockAlgorithm.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone._data = this._data.clone();\n\n\t return clone;\n\t },\n\n\t _minBufferSize: 0\n\t });\n\n\t /**\n\t * Abstract hasher template.\n\t *\n\t * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\n\t */\n\t var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({\n\t /**\n\t * Configuration options.\n\t */\n\t cfg: Base.extend(),\n\n\t /**\n\t * Initializes a newly created hasher.\n\t *\n\t * @param {Object} cfg (Optional) The configuration options to use for this hash computation.\n\t *\n\t * @example\n\t *\n\t * var hasher = CryptoJS.algo.SHA256.create();\n\t */\n\t init: function (cfg) {\n\t // Apply config defaults\n\t this.cfg = this.cfg.extend(cfg);\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this hasher to its initial state.\n\t *\n\t * @example\n\t *\n\t * hasher.reset();\n\t */\n\t reset: function () {\n\t // Reset data buffer\n\t BufferedBlockAlgorithm.reset.call(this);\n\n\t // Perform concrete-hasher logic\n\t this._doReset();\n\t },\n\n\t /**\n\t * Updates this hasher with a message.\n\t *\n\t * @param {WordArray|string} messageUpdate The message to append.\n\t *\n\t * @return {Hasher} This hasher.\n\t *\n\t * @example\n\t *\n\t * hasher.update('message');\n\t * hasher.update(wordArray);\n\t */\n\t update: function (messageUpdate) {\n\t // Append\n\t this._append(messageUpdate);\n\n\t // Update the hash\n\t this._process();\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Finalizes the hash computation.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @example\n\t *\n\t * var hash = hasher.finalize();\n\t * var hash = hasher.finalize('message');\n\t * var hash = hasher.finalize(wordArray);\n\t */\n\t finalize: function (messageUpdate) {\n\t // Final message update\n\t if (messageUpdate) {\n\t this._append(messageUpdate);\n\t }\n\n\t // Perform concrete-hasher logic\n\t var hash = this._doFinalize();\n\n\t return hash;\n\t },\n\n\t blockSize: 512/32,\n\n\t /**\n\t * Creates a shortcut function to a hasher's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to create a helper for.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHelper: function (hasher) {\n\t return function (message, cfg) {\n\t return new hasher.init(cfg).finalize(message);\n\t };\n\t },\n\n\t /**\n\t * Creates a shortcut function to the HMAC's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to use in this HMAC helper.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHmacHelper: function (hasher) {\n\t return function (message, key) {\n\t return new C_algo.HMAC.init(hasher, key).finalize(message);\n\t };\n\t }\n\t });\n\n\t /**\n\t * Algorithm namespace.\n\t */\n\t var C_algo = C.algo = {};\n\n\t return C;\n\t}(Math));\n\n\n\treturn CryptoJS;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function (Math) {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\t var Hasher = C_lib.Hasher;\n\t var C_algo = C.algo;\n\n\t // Initialization and round constants tables\n\t var H = [];\n\t var K = [];\n\n\t // Compute constants\n\t (function () {\n\t function isPrime(n) {\n\t var sqrtN = Math.sqrt(n);\n\t for (var factor = 2; factor <= sqrtN; factor++) {\n\t if (!(n % factor)) {\n\t return false;\n\t }\n\t }\n\n\t return true;\n\t }\n\n\t function getFractionalBits(n) {\n\t return ((n - (n | 0)) * 0x100000000) | 0;\n\t }\n\n\t var n = 2;\n\t var nPrime = 0;\n\t while (nPrime < 64) {\n\t if (isPrime(n)) {\n\t if (nPrime < 8) {\n\t H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));\n\t }\n\t K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));\n\n\t nPrime++;\n\t }\n\n\t n++;\n\t }\n\t }());\n\n\t // Reusable object\n\t var W = [];\n\n\t /**\n\t * SHA-256 hash algorithm.\n\t */\n\t var SHA256 = C_algo.SHA256 = Hasher.extend({\n\t _doReset: function () {\n\t this._hash = new WordArray.init(H.slice(0));\n\t },\n\n\t _doProcessBlock: function (M, offset) {\n\t // Shortcut\n\t var H = this._hash.words;\n\n\t // Working variables\n\t var a = H[0];\n\t var b = H[1];\n\t var c = H[2];\n\t var d = H[3];\n\t var e = H[4];\n\t var f = H[5];\n\t var g = H[6];\n\t var h = H[7];\n\n\t // Computation\n\t for (var i = 0; i < 64; i++) {\n\t if (i < 16) {\n\t W[i] = M[offset + i] | 0;\n\t } else {\n\t var gamma0x = W[i - 15];\n\t var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^\n\t ((gamma0x << 14) | (gamma0x >>> 18)) ^\n\t (gamma0x >>> 3);\n\n\t var gamma1x = W[i - 2];\n\t var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^\n\t ((gamma1x << 13) | (gamma1x >>> 19)) ^\n\t (gamma1x >>> 10);\n\n\t W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];\n\t }\n\n\t var ch = (e & f) ^ (~e & g);\n\t var maj = (a & b) ^ (a & c) ^ (b & c);\n\n\t var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));\n\t var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));\n\n\t var t1 = h + sigma1 + ch + K[i] + W[i];\n\t var t2 = sigma0 + maj;\n\n\t h = g;\n\t g = f;\n\t f = e;\n\t e = (d + t1) | 0;\n\t d = c;\n\t c = b;\n\t b = a;\n\t a = (t1 + t2) | 0;\n\t }\n\n\t // Intermediate hash value\n\t H[0] = (H[0] + a) | 0;\n\t H[1] = (H[1] + b) | 0;\n\t H[2] = (H[2] + c) | 0;\n\t H[3] = (H[3] + d) | 0;\n\t H[4] = (H[4] + e) | 0;\n\t H[5] = (H[5] + f) | 0;\n\t H[6] = (H[6] + g) | 0;\n\t H[7] = (H[7] + h) | 0;\n\t },\n\n\t _doFinalize: function () {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\n\t var nBitsTotal = this._nDataBytes * 8;\n\t var nBitsLeft = data.sigBytes * 8;\n\n\t // Add padding\n\t dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;\n\t data.sigBytes = dataWords.length * 4;\n\n\t // Hash final blocks\n\t this._process();\n\n\t // Return final computed hash\n\t return this._hash;\n\t },\n\n\t clone: function () {\n\t var clone = Hasher.clone.call(this);\n\t clone._hash = this._hash.clone();\n\n\t return clone;\n\t }\n\t });\n\n\t /**\n\t * Shortcut function to the hasher's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hash = CryptoJS.SHA256('message');\n\t * var hash = CryptoJS.SHA256(wordArray);\n\t */\n\t C.SHA256 = Hasher._createHelper(SHA256);\n\n\t /**\n\t * Shortcut function to the HMAC's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hmac = CryptoJS.HmacSHA256(message, key);\n\t */\n\t C.HmacSHA256 = Hasher._createHmacHelper(SHA256);\n\t}(Math));\n\n\n\treturn CryptoJS.SHA256;\n\n}));","/*!\n * @appland/sql-parser - v1.5.1\n * @copyright 2015-2022 Code School (http://codeschool.com)\n * @author Nick Wronski \n */\n(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.sqliteParser = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i0){for(i=1,j=1;i0;},function(d,e){return{'args':Object.assign(e,d)};},function(s){return{'filter':keyNode(s)};},peg$otherExpectation(\"OVER clause\"),function(w){return{over:w};},peg$otherExpectation(\"Window name\"),function(n){return{'type':'identifier','variant':'window','name':n};},peg$otherExpectation(\"Window specification\"),function(w,p,o){return Object.assign({type:'window'},w,p,o);},function(n){return{source:n};},peg$otherExpectation(\"window partition clause\"),function(e){return{partition:e};},peg$otherExpectation(\"Error Message\"),function(m){return m;},peg$otherExpectation(\"Statement\"),function(m,s){return Object.assign(s,m);},peg$otherExpectation(\"QUERY PLAN\"),function(e,q){return{'explain':isOkay(e)};},peg$otherExpectation(\"QUERY PLAN Keyword\"),function(q,p){return foldStringKey([q,p]);},peg$otherExpectation(\"END Transaction Statement\"),function(s,t){return{'type':'statement','variant':'transaction','action':'commit'};},peg$otherExpectation(\"BEGIN Transaction Statement\"),function(s,m,t,n){return Object.assign({'type':'statement','variant':'transaction','action':'begin'},m,n);},function(t){return t;},function(m){return{'defer':keyNode(m)};},peg$otherExpectation(\"ROLLBACK Statement\"),function(s,n){return Object.assign({'type':'statement','variant':'transaction','action':'rollback'},n);},peg$otherExpectation(\"TO Clause\"),function(n){return{'savepoint':n};},function(s){return keyNode(s);},peg$otherExpectation(\"SAVEPOINT Statement\"),function(s,n){return{'type':'statement','variant':s,'target':n};},peg$otherExpectation(\"RELEASE Statement\"),function(s,a,n){return{'type':'statement','variant':keyNode(s),'target':n};},peg$otherExpectation(\"ALTER TABLE Statement\"),function(s,n,e){return Object.assign({'type':'statement','variant':keyNode(s),'target':n},e);},peg$otherExpectation(\"ALTER TABLE Keyword\"),function(a,t){return foldStringKey([a,t]);},peg$otherExpectation(\"RENAME TO Keyword\"),function(s,n){return{'action':keyNode(s),'name':n};},peg$otherExpectation(\"ADD COLUMN Keyword\"),function(s,d){return{'action':keyNode(s),'definition':d};},function(w,s){return Object.assign(s,w);},peg$otherExpectation(\"WITH Clause\"),function(s,v,t){var recursive={'variant':isOkay(v)?'recursive':'common'};if(isArrayOkay(t)){t=t.map(function(elem){return Object.assign(elem,recursive);});}return{'with':t};},function(f,r){return flattenAll([f,r]);},peg$otherExpectation(\"Common Table Expression\"),function(t,s){return Object.assign({'type':'expression','format':'table','variant':'common','target':t},s);},function(s){return{'expression':s};},function(w,s){return Object.assign(s,w);},peg$otherExpectation(\"SET statement\"),function(l,v,r){return Object.assign({type:'statement',variant:'set',local:l||false,target:v},r);},\"local\",peg$literalExpectation(\"LOCAL\",true),function(){return true;},\"session\",peg$literalExpectation(\"SESSION\",true),function(){return false;},\"current\",peg$literalExpectation(\"CURRENT\",true),function(){return{kind:'current'};},function(){return{kind:'default'};},function(l){return{kind:'value',args:l};},function(v,l){return{type:'expression',variant:'list',expression:[v].concat(_toConsumableArray(l))};},function(v){return v;},function(t){return{type:'statement',variant:'show',target:t};},\"time\",peg$literalExpectation(\"TIME\",true),\"zone\",peg$literalExpectation(\"ZONE\",true),function(){return{type:'identifier',variant:'variable',name:'timezone'};},\"transaction\",peg$literalExpectation(\"TRANSACTION\",true),\"isolation\",peg$literalExpectation(\"ISOLATION\",true),\"level\",peg$literalExpectation(\"LEVEL\",true),function(){return{type:'identifier',variant:'variable',name:'transaction_isolation'};},\"authorization\",peg$literalExpectation(\"AUTHORIZATION\",true),function(){return{type:'identifier',variant:'variable',name:'session_authorization'};},\"all\",peg$literalExpectation(\"ALL\",true),function(){return{type:'identifier',variant:'variable',name:'all'};},peg$otherExpectation(\"ATTACH Statement\"),function(a,b,e,n){return{'type':'statement','variant':keyNode(a),'target':n,'attach':e};},peg$otherExpectation(\"DETACH Statement\"),function(d,b,n){return{'type':'statement','variant':keyNode(d),'target':n};},peg$otherExpectation(\"VACUUM Statement\"),function(v,t){return Object.assign({'type':'statement','variant':'vacuum'},t);},function(t){return{'target':t};},peg$otherExpectation(\"ANALYZE Statement\"),function(s,a){return Object.assign({'type':'statement','variant':keyNode(s)},a);},function(n){return{'target':n['name']};},peg$otherExpectation(\"REINDEX Statement\"),function(a){return{'target':a['name']};},peg$otherExpectation(\"PRAGMA Statement\"),function(s,n,v){return{'type':'statement','variant':keyNode(s),'target':n,'args':{'type':'expression','variant':'list','expression':v}};},function(v){return /^(yes|no|on|off|false|true|0|1)$/i.test(v);},function(v){return{'type':'literal','variant':'boolean','normalized':/^(yes|on|true|1)$/i.test(v)?'1':'0','value':v};},function(n){return keyNode(n);},function(n){return{'type':'identifier','variant':'name','name':n};},peg$otherExpectation(\"SELECT Statement\"),function(s,o,l,f){return Object.assign(s,o,l,f);},function(s,o,f,l){return Object.assign(s,o,l,f);},peg$otherExpectation(\"SELECT ... FOR locking clause\"),function(){return{};},function(i,r){return{locking:flattenAll([i,r])};},function(i){return i;},function(s,r,n){return Object.assign({type:'expression',variant:'locking',strength:foldStringWord(s).toLowerCase()},r,n);},function(l){return{target:l};},function(i,r){return flattenAll([i,r]);},function(p){return{policy:foldStringWord(p).toLowerCase()};},peg$otherExpectation(\"WINDOW clause\"),function(l){return{window:l};},function(n,d){return Object.assign(d,{target:n});},peg$otherExpectation(\"ORDER BY Clause\"),function(d){return{'order':d['result']};},peg$otherExpectation(\"LIMIT Clause\"),function(s,e,d){return{'limit':Object.assign({'type':'expression','variant':'limit','start':e},d)};},function(e){return{'limit':{'type':'expression','variant':'limit','offset':e}};},peg$otherExpectation(\"OFFSET Clause\"),function(o,e){return{'offset':e};},function(s,u){if(isArrayOkay(u)){return{'type':'statement','variant':'compound','statement':s,'compound':u};}else{return s;}},peg$otherExpectation(\"Union Operation\"),function(c,s){return{'type':'compound','variant':c,'statement':s};},function(s,f,w,g,i){return Object.assign({'type':'statement','variant':'select'},s,f,w,g,i);},peg$otherExpectation(\"SELECT Results Clause\"),function(d,t){return Object.assign({'result':t},d);},peg$otherExpectation(\"SELECT Results Modifier\"),function(s){return{'distinct':true};},function(s){return{};},peg$otherExpectation(\"FROM Clause\"),function(f,s){return{'from':s};},peg$otherExpectation(\"WHERE Clause\"),function(f,e){return{'where':makeArray(e)};},peg$otherExpectation(\"GROUP BY Clause\"),function(f,e,h){return Object.assign({'group':e},h);},peg$otherExpectation(\"HAVING Clause\"),function(f,e){return{'having':e};},function(q,s){return{'type':'identifier','variant':'star','name':foldStringWord([q,s])};},function(n,s){return foldStringWord([n,s]);},function(e,a){return Object.assign(e,a);},function(f,t){if(isArrayOkay(t)){return{'type':'map','variant':'join','source':f,'map':t};}return f;},function(cl,c){return Object.assign(cl,c);},peg$otherExpectation(\"CROSS JOIN Operation\"),function(n){return{'type':'join','variant':'cross join','source':n};},peg$otherExpectation(\"JOIN Operation\"),function(o,n){return{'type':'join','variant':keyNode(o),'source':n};},function(l,t){return Object.assign(t,l);},function(n,l,a){return Object.assign({'type':'function','variant':'table','name':n,'args':l},a);},function(n,c){return{alias:n,columns:c};},function(c){return{columns:c};},function(f,b){return flattenAll([f,b]);},function(n,t,c){return Object.assign({type:'definition',variant:'column',name:n,datatype:t},c);},function(){return{lateral:true};},peg$otherExpectation(\"Qualified Table\"),function(d,i){return Object.assign(d,i);},peg$otherExpectation(\"Qualified Table Identifier\"),function(n,a){return Object.assign(n,a);},peg$otherExpectation(\"Qualfied Table Index\"),function(s,n){return{'index':n};},function(n,i){return{'index':foldStringKey([n,i])};},peg$otherExpectation(\"SELECT Source\"),function(l,a){return Object.assign(l,a);},peg$otherExpectation(\"Subquery\"),function(s,a){return Object.assign(s,a);},peg$otherExpectation(\"Alias\"),function(a,n,c){return Object.assign({'alias':n},c);},peg$otherExpectation(\"JOIN Operator\"),function(n,t,j){return foldStringKey([n,t,j]);},function(t,o){return foldStringKey([t,o]);},function(t){return keyNode(t);},peg$otherExpectation(\"JOIN Constraint\"),function(c){return{'constraint':Object.assign({'type':'constraint','variant':'join'},c)};},peg$otherExpectation(\"Join ON Clause\"),function(s,e){return{'format':keyNode(s),'on':e};},peg$otherExpectation(\"Join USING Clause\"),function(s,e){return{'format':keyNode(s),'using':e};},peg$otherExpectation(\"VALUES Clause\"),function(s,l){return{'type':'statement','variant':'select','result':l};},function(f,b){return{'result':flattenAll([f,b])};},peg$otherExpectation(\"Ordering Expression\"),function(e,d,n){if(isOkay(d)||isOkay(n)){return Object.assign({'type':'expression','variant':'order','expression':e},d,n);}return e;},function(d){return{nulls:keyNode(d)};},peg$otherExpectation(\"Star\"),peg$otherExpectation(\"Fallback Type\"),peg$otherExpectation(\"INSERT Statement\"),function(k,t,c,r){return Object.assign({'type':'statement','variant':'insert'},k,t,c,r);},peg$otherExpectation(\"RETURNING clause\"),function(t){return{returning:t};},peg$otherExpectation(\"INSERT Keyword\"),function(a,m){return Object.assign({'action':keyNode(a)},m);},peg$otherExpectation(\"REPLACE Keyword\"),function(a){return{'action':keyNode(a)};},peg$otherExpectation(\"INSERT OR Modifier\"),function(s,m){return{'or':keyNode(m)};},function(i,r){return Object.assign({'into':i},r);},peg$otherExpectation(\"INTO Clause\"),function(s,t){return t;},peg$otherExpectation(\"INTO Keyword\"),function(r){return{'result':r};},peg$otherExpectation(\"PostgreSQL INSERT ON CONFLICT clause\"),\"do\",peg$literalExpectation(\"DO\",true),function(i,a){return{conflict:Object.assign(a,i)};},peg$otherExpectation(\"PostgreSQL ON CONFLICT action\"),function(s,t,w){return Object.assign({action:s},t,w);},\"nothing\",peg$literalExpectation(\"NOTHING\",true),function(s){return{action:keyNode(s)};},peg$otherExpectation(\"PostgreSQL ON CONFLICT expression\"),function(i,w){return{on:Object.assign({columns:i},w)};},function(c){return{on:{constraint:c}};},peg$otherExpectation(\"Column List\"),function(f,b){return{'columns':flattenAll([f,b])};},function(c){return c;},peg$otherExpectation(\"Column Name\"),function(n){return{'type':'identifier','variant':'column','name':n};},function(s,r){return r;},peg$otherExpectation(\"VALUES Keyword\"),peg$otherExpectation(\"Wrapped Expression List\"),function(e){return e;},peg$otherExpectation(\"DEFAULT VALUES Clause\"),function(d,v){return{'type':'values','variant':'default'};},peg$otherExpectation(\"Compound Operator\"),peg$otherExpectation(\"UNION Operator\"),function(s,a){return foldStringKey([s,a]);},function(a){return a;},peg$otherExpectation(\"UPDATE Statement\"),function(s,f,t,u,w,o,l,r){return Object.assign({'type':'statement','variant':s,'into':t},f,u,w,o,l,r);},peg$otherExpectation(\"UPDATE Keyword\"),peg$otherExpectation(\"UPDATE OR Modifier\"),function(t){return{'or':keyNode(t)};},peg$otherExpectation(\"SET Clause\"),function(c){return{'set':c};},peg$otherExpectation(\"Column Assignment\"),function(f,e){return{'type':'assignment','target':f,'value':e};},peg$otherExpectation(\"UPDATE value expression\"),function(){return{type:'literal',variant:'default',value:'default'};},peg$otherExpectation(\"DELETE Statement\"),function(s,t,w,o,l,r){return Object.assign({'type':'statement','variant':s,'from':t},w,o,l,r);},peg$otherExpectation(\"DELETE Keyword\"),peg$otherExpectation(\"CREATE Statement\"),peg$otherExpectation(\"CREATE TABLE Statement\"),function(s,ne,id,r){return Object.assign({'type':'statement','name':id},s,r,ne);},function(s,tmp,t){return Object.assign({'variant':s,'format':keyNode(t)},tmp);},function(t){return{'temporary':isOkay(t)};},peg$otherExpectation(\"IF NOT EXISTS Modifier\"),function(i,n,e){return{'condition':makeArray({'type':'condition','variant':keyNode(i),'condition':{'type':'expression','variant':keyNode(e),'operator':foldStringKey([n,e])}})};},peg$otherExpectation(\"Table Definition\"),function(s,t,r){return Object.assign({'definition':flattenAll([s,t])},r);},function(r,w){return{'optimization':[{'type':'optimization','value':foldStringKey([r,w])}]};},function(f){return f;},peg$otherExpectation(\"Column Definition\"),function(n,t,c){return Object.assign({'type':'definition','variant':'column','name':n,'definition':isOkay(c)?c:[]},t);},peg$otherExpectation(\"Column Datatype\"),function(t){return{'datatype':t};},peg$otherExpectation(\"Column Constraint\"),function(n,c,ln){return Object.assign(c,n);},function(cl){return cl[cl.length-1];},peg$otherExpectation(\"CONSTRAINT Name\"),function(n){return{'name':n};},peg$otherExpectation(\"FOREIGN KEY Column Constraint\"),function(f){return Object.assign({'variant':'foreign key'},f);},peg$otherExpectation(\"PRIMARY KEY Column Constraint\"),function(p,d,c,a){return Object.assign(p,c,d,a);},peg$otherExpectation(\"PRIMARY KEY Keyword\"),function(s,k){return{'type':'constraint','variant':foldStringKey([s,k])};},peg$otherExpectation(\"AUTOINCREMENT Keyword\"),function(a){return{'autoIncrement':true};},function(s,c){return Object.assign({'type':'constraint','variant':s},c);},peg$otherExpectation(\"UNIQUE Column Constraint\"),peg$otherExpectation(\"NULL Column Constraint\"),function(n,l){return foldStringKey([n,l]);},peg$otherExpectation(\"CHECK Column Constraint\"),peg$otherExpectation(\"DEFAULT Column Constraint\"),function(s,v){return{'type':'constraint','variant':keyNode(s),'value':v};},peg$otherExpectation(\"COLLATE Column Constraint\"),function(c){return{'type':'constraint','variant':'collate','collate':c};},peg$otherExpectation(\"Table Constraint\"),function(n,c,nl){return Object.assign({'type':'definition','variant':'constraint'},c,n);},peg$otherExpectation(\"CHECK Table Constraint\"),function(c){return{'definition':makeArray(c)};},peg$otherExpectation(\"PRIMARY KEY Table Constraint\"),function(k,c,t){return{'definition':makeArray(Object.assign(k,t,c[1])),'columns':c[0]};},function(s){return{'type':'constraint','variant':keyNode(s)};},function(p,k){return foldStringKey([p,k]);},peg$otherExpectation(\"UNIQUE Keyword\"),function(u){return keyNode(u);},function(f,b){return[f].concat(b);},function(c){return c.map(function(_ref){var _ref2=_slicedToArray(_ref,1),res=_ref2[0];return res;});},function(c){var auto=c.find(function(_ref3){var _ref4=_slicedToArray(_ref3,2),res=_ref4[0],a=_ref4[1];return isOkay(a);});return[c.map(function(_ref5){var _ref6=_slicedToArray(_ref5,2),res=_ref6[0],a=_ref6[1];return res;}),auto?auto[1]:null];},peg$otherExpectation(\"Indexed Column\"),function(e,d,a){var res=e;if(isOkay(d)){res=Object.assign({'type':'expression','variant':'order','expression':e},d);}return[res,a];},peg$otherExpectation(\"Collation\"),function(c){return{'collate':makeArray(c)};},peg$otherExpectation(\"Column Direction\"),function(t){return{'direction':keyNode(t)};},function(s,t){return{'conflict':keyNode(t)};},peg$otherExpectation(\"ON CONFLICT Keyword\"),function(o,c){return foldStringKey([o,c]);},function(k,c){return{'type':'constraint','variant':keyNode(k),'expression':c};},peg$otherExpectation(\"FOREIGN KEY Table Constraint\"),function(k,l,c){return Object.assign({'definition':makeArray(Object.assign(k,c))},l);},peg$otherExpectation(\"FOREIGN KEY Keyword\"),function(f,k){return{'type':'constraint','variant':foldStringKey([f,k])};},function(r,a,d){return Object.assign({'type':'constraint'},r,a,d);},peg$otherExpectation(\"REFERENCES Clause\"),function(s,t){return{'references':t};},function(f,b){return{'action':flattenAll([f,b])};},peg$otherExpectation(\"FOREIGN KEY Action Clause\"),function(m,a,n){return{'type':'action','variant':keyNode(m),'action':keyNode(n)};},peg$otherExpectation(\"FOREIGN KEY Action\"),function(s,v){return foldStringKey([s,v]);},function(c){return keyNode(c);},function(n,a){return foldStringKey([n,a]);},function(m,n){return{'type':'action','variant':keyNode(m),'action':n};},peg$otherExpectation(\"DEFERRABLE Clause\"),function(n,d,i){return{'defer':foldStringKey([n,d,i])};},function(i,d){return foldStringKey([i,d]);},function(s){return{'definition':makeArray(s)};},peg$otherExpectation(\"CREATE INDEX Statement\"),function(s,ne,n,o,w){return Object.assign({'type':'statement','target':n,'on':o},s,ne,w);},function(s,u,i){return Object.assign({'variant':keyNode(s),'format':keyNode(i)},u);},function(u){return{'unique':true};},peg$otherExpectation(\"ON Clause\"),function(o,t,c){return{'type':'identifier','variant':'expression','format':'table','name':t['name'],'columns':c};},peg$otherExpectation(\"CREATE TRIGGER Statement\"),function(s,ne,n,cd,o,me,wh,a){return Object.assign({'type':'statement','target':n,'on':o,'event':cd,'by':isOkay(me)?me:'row','action':makeArray(a)},s,ne,wh);},function(s,tmp,t){return Object.assign({'variant':keyNode(s),'format':keyNode(t)},tmp);},peg$otherExpectation(\"Conditional Clause\"),function(m,d){return Object.assign({'type':'event'},m,d);},function(m){return{'occurs':keyNode(m)};},function(i,o){return foldStringKey([i,o]);},peg$otherExpectation(\"Conditional Action\"),function(o){return{'event':keyNode(o)};},function(s,f){return{'event':keyNode(s),'of':f};},function(s,c){return c;},\"statement\",peg$literalExpectation(\"STATEMENT\",true),function(f,e,r){return keyNode(r);},function(w,e){return{'when':e};},peg$otherExpectation(\"Actions Clause\"),function(s,a,e){return a;},function(l){return l;},peg$otherExpectation(\"CREATE VIEW Statement\"),function(s,ne,n,r){return Object.assign({'type':'statement','target':n,'result':r},s,ne);},function(n,a){return Object.assign({'type':'identifier','variant':'expression','format':'view','name':n['name'],'columns':[]},a);},function(s,tmp,v){return Object.assign({'variant':keyNode(s),'format':keyNode(v)},tmp);},peg$otherExpectation(\"CREATE VIRTUAL TABLE Statement\"),function(s,ne,n,m){return Object.assign({'type':'statement','target':n,'result':m},s,ne);},function(s,v,t){return{'variant':keyNode(s),'format':keyNode(v)};},function(m,a){return Object.assign({'type':'module','variant':'virtual','name':m},a);},peg$otherExpectation(\"Module Arguments\"),function(l){return{'args':{'type':'expression','variant':'list','expression':isOkay(l)?l:[]}};},function(f,b){return flattenAll([f,b]).filter(function(arg){return isOkay(arg);});},peg$otherExpectation(\"DROP Statement\"),function(s,q){return Object.assign({'type':'statement','target':Object.assign(q,{'variant':s['format']})},s);},peg$otherExpectation(\"DROP Keyword\"),function(s,t,i){return Object.assign({'variant':keyNode(s),'format':t,'condition':[]},i);},peg$otherExpectation(\"DROP Type\"),peg$otherExpectation(\"IF EXISTS Keyword\"),function(i,e){return{'condition':[{'type':'condition','variant':keyNode(i),'condition':{'type':'expression','variant':keyNode(e),'operator':keyNode(e)}}]};},peg$otherExpectation(\"Or\"),peg$otherExpectation(\"Add\"),peg$otherExpectation(\"Subtract\"),peg$otherExpectation(\"Multiply\"),peg$otherExpectation(\"Divide\"),peg$otherExpectation(\"Modulo\"),peg$otherExpectation(\"Shift Left\"),peg$otherExpectation(\"Shift Right\"),peg$otherExpectation(\"Logical AND\"),peg$otherExpectation(\"Logical OR\"),peg$otherExpectation(\"Less Than\"),peg$otherExpectation(\"Greater Than\"),peg$otherExpectation(\"Less Than Or Equal\"),peg$otherExpectation(\"Greater Than Or Equal\"),peg$otherExpectation(\"Equal\"),peg$otherExpectation(\"Not Equal\"),peg$otherExpectation(\"PostgreSQL custom binary operarator\"),function(s){var sym=s.join('');if(sym.includes('--')||sym.includes('/*'))return false;var last=s[s.length-1];if(!(last==='-'||last==='+'))return true;return sym.match(/[~@#%^&|`?]/);},function(s){return s.join('');},peg$otherExpectation(\"IS\"),function(i,n){return foldStringKey([i,n]);},peg$otherExpectation(\"Identifier\"),peg$otherExpectation(\"Database Identifier\"),function(n){return{'type':'identifier','variant':'database','name':n};},peg$otherExpectation(\"Function Identifier\"),function(d,n){return{'type':'identifier','variant':'function','name':foldStringWord([d,n])};},peg$otherExpectation(\"Table Identifier\"),function(d,n){return{'type':'identifier','variant':'table','name':foldStringWord([d,n])};},function(n,d){return foldStringWord([n,d]);},peg$otherExpectation(\"Column Identifier\"),function(q,n,i){return Object.assign({'type':'identifier','variant':'column','name':foldStringWord([q,n])},i);},peg$otherExpectation(\"value indirection\"),function(l){return{element:l};},function(i,r){return flattenAll([i,r]);},function(n){return{type:'indirection',variant:'attribute',attribute:n};},function(n){return{type:'indirection',variant:'star',attribute:n};},function(l,u){return Object.assign({type:'indirection',variant:'slice'},l,u);},function(u){return Object.assign({type:'indirection',variant:'slice'},u);},function(e){return{type:'indirection',variant:'index',index:e};},function(e){return{lower:e};},function(e){return{upper:e};},function(){return'';},function(d,t){return foldStringWord([d,t]);},peg$otherExpectation(\"Collation Identifier\"),function(n){return{'type':'identifier','variant':'collation','name':n};},peg$otherExpectation(\"Savepoint Identifier\"),function(n){return{'type':'identifier','variant':'savepoint','name':n};},peg$otherExpectation(\"Index Identifier\"),function(d,n){return{'type':'identifier','variant':'index','name':foldStringWord([d,n])};},peg$otherExpectation(\"Trigger Identifier\"),function(d,n){return{'type':'identifier','variant':'trigger','name':foldStringWord([d,n])};},peg$otherExpectation(\"View Identifier\"),function(d,n){return{'type':'identifier','variant':'view','name':foldStringWord([d,n])};},peg$otherExpectation(\"Pragma Identifier\"),function(d,n){return{'type':'identifier','variant':'pragma','name':foldStringWord([d,n])};},peg$otherExpectation(\"Variable Identifier\"),function(d,n){return{'type':'identifier','variant':'variable','name':foldStringWord([d,n])};},peg$otherExpectation(\"CTE Identifier\"),function(d){return d;},function(n,a){return Object.assign({'type':'identifier','variant':'expression','format':'table','name':n['name'],'columns':[]},a);},peg$otherExpectation(\"Table Constraint Identifier\"),function(n){return{'type':'identifier','variant':'constraint','format':'table','name':n};},peg$otherExpectation(\"Column Constraint Identifier\"),function(n){return{'type':'identifier','variant':'constraint','format':'column','name':n};},peg$otherExpectation(\"Datatype Name\"),function(t){return[t,'text'];},function(t){return[t,'real'];},function(t){return[t,'numeric'];},function(t){return[t,'integer'];},function(t){return[t,'none'];},peg$otherExpectation(\"TEXT Datatype Name\"),\"n\",peg$literalExpectation(\"N\",true),\"var\",peg$literalExpectation(\"VAR\",true),\"char\",peg$literalExpectation(\"CHAR\",true),\"tiny\",peg$literalExpectation(\"TINY\",true),\"medium\",peg$literalExpectation(\"MEDIUM\",true),\"long\",peg$literalExpectation(\"LONG\",true),\"text\",peg$literalExpectation(\"TEXT\",true),\"clob\",peg$literalExpectation(\"CLOB\",true),peg$otherExpectation(\"REAL Datatype Name\"),\"float\",peg$literalExpectation(\"FLOAT\",true),\"real\",peg$literalExpectation(\"REAL\",true),peg$otherExpectation(\"DOUBLE Datatype Name\"),\"double\",peg$literalExpectation(\"DOUBLE\",true),\"precision\",peg$literalExpectation(\"PRECISION\",true),function(d,p){return foldStringWord([d,p]);},peg$otherExpectation(\"NUMERIC Datatype Name\"),\"numeric\",peg$literalExpectation(\"NUMERIC\",true),\"decimal\",peg$literalExpectation(\"DECIMAL\",true),\"boolean\",peg$literalExpectation(\"BOOLEAN\",true),\"date\",peg$literalExpectation(\"DATE\",true),\"stamp\",peg$literalExpectation(\"STAMP\",true),\"string\",peg$literalExpectation(\"STRING\",true),peg$otherExpectation(\"INTEGER Datatype Name\"),\"int\",peg$literalExpectation(\"INT\",true),\"2\",peg$literalExpectation(\"2\",false),\"4\",peg$literalExpectation(\"4\",false),\"8\",peg$literalExpectation(\"8\",false),\"eger\",peg$literalExpectation(\"EGER\",true),\"big\",peg$literalExpectation(\"BIG\",true),\"small\",peg$literalExpectation(\"SMALL\",true),\"floating\",peg$literalExpectation(\"FLOATING\",true),\"point\",peg$literalExpectation(\"POINT\",true),function(f,p){return foldStringWord([f,p]);},peg$otherExpectation(\"BLOB Datatype Name\"),\"blob\",peg$literalExpectation(\"BLOB\",true),/^[a-z0-9$_]/i,peg$classExpectation([[\"a\",\"z\"],[\"0\",\"9\"],\"$\",\"_\"],false,true),\"\\\\u\",peg$literalExpectation(\"\\\\u\",false),/^[a-f0-9]/i,peg$classExpectation([[\"a\",\"f\"],[\"0\",\"9\"]],false,true),function(u,s){return foldStringWord([u,s]).toLowerCase();},function(n){return keyNode(n);},peg$anyExpectation(),function(n){return textNode(n);},/^[ \\t]/,peg$classExpectation([\" \",\"\\t\"],false,false),\"\\\"\",peg$literalExpectation(\"\\\"\",false),\"\\\"\\\"\",peg$literalExpectation(\"\\\"\\\"\",false),/^[^\"]/,peg$classExpectation([\"\\\"\"],true,false),function(n){return unescape(n,'\"');},\"'\",peg$literalExpectation(\"'\",false),function(n){return unescape(n,\"'\");},\"`\",peg$literalExpectation(\"`\",false),\"``\",peg$literalExpectation(\"``\",false),/^[^`]/,peg$classExpectation([\"`\"],true,false),function(n){return unescape(n,'`');},peg$otherExpectation(\"Open Bracket\"),\"[\",peg$literalExpectation(\"[\",false),peg$otherExpectation(\"Close Bracket\"),\"]\",peg$literalExpectation(\"]\",false),peg$otherExpectation(\"Open Parenthesis\"),\"(\",peg$literalExpectation(\"(\",false),peg$otherExpectation(\"Close Parenthesis\"),\")\",peg$literalExpectation(\")\",false),peg$otherExpectation(\"Comma\"),\",\",peg$literalExpectation(\",\",false),peg$otherExpectation(\"Period\"),\".\",peg$literalExpectation(\".\",false),peg$otherExpectation(\"Asterisk\"),\"*\",peg$literalExpectation(\"*\",false),peg$otherExpectation(\"Question Mark\"),\"?\",peg$literalExpectation(\"?\",false),peg$otherExpectation(\"Single Quote\"),peg$otherExpectation(\"Double Quote\"),peg$otherExpectation(\"Backtick\"),peg$otherExpectation(\"Tilde\"),\"~\",peg$literalExpectation(\"~\",false),peg$otherExpectation(\"Plus\"),\"+\",peg$literalExpectation(\"+\",false),peg$otherExpectation(\"Minus\"),\"-\",peg$literalExpectation(\"-\",false),\"=\",peg$literalExpectation(\"=\",false),peg$otherExpectation(\"Ampersand\"),\"&\",peg$literalExpectation(\"&\",false),peg$otherExpectation(\"Pipe\"),\"|\",peg$literalExpectation(\"|\",false),\"%\",peg$literalExpectation(\"%\",false),\"<\",peg$literalExpectation(\"<\",false),\">\",peg$literalExpectation(\">\",false),peg$otherExpectation(\"Exclamation\"),\"!\",peg$literalExpectation(\"!\",false),peg$otherExpectation(\"Semicolon\"),\";\",peg$literalExpectation(\";\",false),peg$otherExpectation(\"Colon\"),peg$otherExpectation(\"Forward Slash\"),\"/\",peg$literalExpectation(\"/\",false),peg$otherExpectation(\"Backslash\"),\"\\\\\",peg$literalExpectation(\"\\\\\",false),peg$otherExpectation(\"Operator characters\"),/^[\\-+*\\/<>=~!@#%\\^&|`]/,peg$classExpectation([\"-\",\"+\",\"*\",\"/\",\"<\",\">\",\"=\",\"~\",\"!\",\"@\",\"#\",\"%\",\"^\",\"&\",\"|\",\"`\"],false,false),\"abort\",peg$literalExpectation(\"ABORT\",true),\"action\",peg$literalExpectation(\"ACTION\",true),\"add\",peg$literalExpectation(\"ADD\",true),\"after\",peg$literalExpectation(\"AFTER\",true),\"alter\",peg$literalExpectation(\"ALTER\",true),\"analyze\",peg$literalExpectation(\"ANALYZE\",true),\"and\",peg$literalExpectation(\"AND\",true),\"array\",peg$literalExpectation(\"ARRAY\",true),\"as\",peg$literalExpectation(\"AS\",true),\"asc\",peg$literalExpectation(\"ASC\",true),\"attach\",peg$literalExpectation(\"ATTACH\",true),\"autoincrement\",peg$literalExpectation(\"AUTOINCREMENT\",true),\"before\",peg$literalExpectation(\"BEFORE\",true),\"begin\",peg$literalExpectation(\"BEGIN\",true),\"between\",peg$literalExpectation(\"BETWEEN\",true),\"by\",peg$literalExpectation(\"BY\",true),\"cascade\",peg$literalExpectation(\"CASCADE\",true),\"case\",peg$literalExpectation(\"CASE\",true),\"cast\",peg$literalExpectation(\"CAST\",true),\"check\",peg$literalExpectation(\"CHECK\",true),\"collate\",peg$literalExpectation(\"COLLATE\",true),\"column\",peg$literalExpectation(\"COLUMN\",true),\"commit\",peg$literalExpectation(\"COMMIT\",true),\"conflict\",peg$literalExpectation(\"CONFLICT\",true),\"constraint\",peg$literalExpectation(\"CONSTRAINT\",true),\"create\",peg$literalExpectation(\"CREATE\",true),\"cross\",peg$literalExpectation(\"CROSS\",true),\"current_date\",peg$literalExpectation(\"CURRENT_DATE\",true),\"current_time\",peg$literalExpectation(\"CURRENT_TIME\",true),\"current_timestamp\",peg$literalExpectation(\"CURRENT_TIMESTAMP\",true),\"database\",peg$literalExpectation(\"DATABASE\",true),\"default\",peg$literalExpectation(\"DEFAULT\",true),\"deferrable\",peg$literalExpectation(\"DEFERRABLE\",true),\"deferred\",peg$literalExpectation(\"DEFERRED\",true),\"delete\",peg$literalExpectation(\"DELETE\",true),\"desc\",peg$literalExpectation(\"DESC\",true),\"detach\",peg$literalExpectation(\"DETACH\",true),\"distinct\",peg$literalExpectation(\"DISTINCT\",true),\"drop\",peg$literalExpectation(\"DROP\",true),\"each\",peg$literalExpectation(\"EACH\",true),\"else\",peg$literalExpectation(\"ELSE\",true),\"end\",peg$literalExpectation(\"END\",true),\"escape\",peg$literalExpectation(\"ESCAPE\",true),\"except\",peg$literalExpectation(\"EXCEPT\",true),\"exclusive\",peg$literalExpectation(\"EXCLUSIVE\",true),\"exists\",peg$literalExpectation(\"EXISTS\",true),\"explain\",peg$literalExpectation(\"EXPLAIN\",true),\"fail\",peg$literalExpectation(\"FAIL\",true),\"first\",peg$literalExpectation(\"FIRST\",true),\"for\",peg$literalExpectation(\"FOR\",true),\"foreign\",peg$literalExpectation(\"FOREIGN\",true),\"from\",peg$literalExpectation(\"FROM\",true),\"full\",peg$literalExpectation(\"FULL\",true),\"glob\",peg$literalExpectation(\"GLOB\",true),\"group\",peg$literalExpectation(\"GROUP\",true),\"having\",peg$literalExpectation(\"HAVING\",true),\"if\",peg$literalExpectation(\"IF\",true),\"ignore\",peg$literalExpectation(\"IGNORE\",true),\"ilike\",peg$literalExpectation(\"ILIKE\",true),\"immediate\",peg$literalExpectation(\"IMMEDIATE\",true),\"in\",peg$literalExpectation(\"IN\",true),\"index\",peg$literalExpectation(\"INDEX\",true),\"indexed\",peg$literalExpectation(\"INDEXED\",true),\"initially\",peg$literalExpectation(\"INITIALLY\",true),\"inner\",peg$literalExpectation(\"INNER\",true),\"insert\",peg$literalExpectation(\"INSERT\",true),\"instead\",peg$literalExpectation(\"INSTEAD\",true),\"intersect\",peg$literalExpectation(\"INTERSECT\",true),\"into\",peg$literalExpectation(\"INTO\",true),\"is\",peg$literalExpectation(\"IS\",true),\"isnull\",peg$literalExpectation(\"ISNULL\",true),\"join\",peg$literalExpectation(\"JOIN\",true),\"key\",peg$literalExpectation(\"KEY\",true),\"last\",peg$literalExpectation(\"LAST\",true),\"lateral\",peg$literalExpectation(\"LATERAL\",true),\"left\",peg$literalExpectation(\"LEFT\",true),\"like\",peg$literalExpectation(\"LIKE\",true),\"limit\",peg$literalExpectation(\"LIMIT\",true),\"locked\",peg$literalExpectation(\"LOCKED\",true),\"match\",peg$literalExpectation(\"MATCH\",true),\"natural\",peg$literalExpectation(\"NATURAL\",true),\"no\",peg$literalExpectation(\"NO\",true),\"not\",peg$literalExpectation(\"NOT\",true),\"notnull\",peg$literalExpectation(\"NOTNULL\",true),\"nowait\",peg$literalExpectation(\"NOWAIT\",true),\"nulls\",peg$literalExpectation(\"NULLS\",true),\"of\",peg$literalExpectation(\"OF\",true),\"offset\",peg$literalExpectation(\"OFFSET\",true),\"on\",peg$literalExpectation(\"ON\",true),\"only\",peg$literalExpectation(\"ONLY\",true),\"or\",peg$literalExpectation(\"OR\",true),\"order\",peg$literalExpectation(\"ORDER\",true),\"outer\",peg$literalExpectation(\"OUTER\",true),\"over\",peg$literalExpectation(\"OVER\",true),\"partition\",peg$literalExpectation(\"PARTITION\",true),\"plan\",peg$literalExpectation(\"PLAN\",true),\"pragma\",peg$literalExpectation(\"PRAGMA\",true),\"primary\",peg$literalExpectation(\"PRIMARY\",true),\"query\",peg$literalExpectation(\"QUERY\",true),\"raise\",peg$literalExpectation(\"RAISE\",true),\"read\",peg$literalExpectation(\"READ\",true),\"recursive\",peg$literalExpectation(\"RECURSIVE\",true),\"references\",peg$literalExpectation(\"REFERENCES\",true),\"regexp\",peg$literalExpectation(\"REGEXP\",true),\"reindex\",peg$literalExpectation(\"REINDEX\",true),\"release\",peg$literalExpectation(\"RELEASE\",true),\"rename\",peg$literalExpectation(\"RENAME\",true),\"replace\",peg$literalExpectation(\"REPLACE\",true),\"restrict\",peg$literalExpectation(\"RESTRICT\",true),\"returning\",peg$literalExpectation(\"RETURNING\",true),\"right\",peg$literalExpectation(\"RIGHT\",true),\"rollback\",peg$literalExpectation(\"ROLLBACK\",true),\"row\",peg$literalExpectation(\"ROW\",true),\"rowid\",peg$literalExpectation(\"ROWID\",true),\"savepoint\",peg$literalExpectation(\"SAVEPOINT\",true),\"select\",peg$literalExpectation(\"SELECT\",true),\"set\",peg$literalExpectation(\"SET\",true),\"share\",peg$literalExpectation(\"SHARE\",true),\"show\",peg$literalExpectation(\"SHOW\",true),\"skip\",peg$literalExpectation(\"SKIP\",true),\"table\",peg$literalExpectation(\"TABLE\",true),\"temp\",peg$literalExpectation(\"TEMP\",true),\"temporary\",peg$literalExpectation(\"TEMPORARY\",true),\"then\",peg$literalExpectation(\"THEN\",true),\"to\",peg$literalExpectation(\"TO\",true),\"trigger\",peg$literalExpectation(\"TRIGGER\",true),\"union\",peg$literalExpectation(\"UNION\",true),\"unique\",peg$literalExpectation(\"UNIQUE\",true),\"update\",peg$literalExpectation(\"UPDATE\",true),\"using\",peg$literalExpectation(\"USING\",true),\"vacuum\",peg$literalExpectation(\"VACUUM\",true),\"values\",peg$literalExpectation(\"VALUES\",true),\"view\",peg$literalExpectation(\"VIEW\",true),\"virtual\",peg$literalExpectation(\"VIRTUAL\",true),\"when\",peg$literalExpectation(\"WHEN\",true),\"where\",peg$literalExpectation(\"WHERE\",true),\"window\",peg$literalExpectation(\"WINDOW\",true),\"with\",peg$literalExpectation(\"WITH\",true),\"without\",peg$literalExpectation(\"WITHOUT\",true),function(r){return keyNode(r);},function(){return null;},peg$otherExpectation(\"Line Comment\"),\"--\",peg$literalExpectation(\"--\",false),/^[\\n\\v\\f\\r]/,peg$classExpectation([\"\\n\",\"\\v\",\"\\f\",\"\\r\"],false,false),peg$otherExpectation(\"Block Comment\"),\"/*\",peg$literalExpectation(\"/*\",false),\"*/\",peg$literalExpectation(\"*/\",false),/^[\\n\\v\\f\\r\\t ]/,peg$classExpectation([\"\\n\",\"\\v\",\"\\f\",\"\\r\",\"\\t\",\" \"],false,false),peg$otherExpectation(\"Whitespace\"),\"__TODO__\",peg$literalExpectation(\"__TODO__\",false)];var peg$bytecode=[peg$decode(\"%;\\u028B/H#;#/?$;\\\".\\\" &\\\"/1$;#/($8$: $!!)($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u028B/C#;#/:$;\\x88/1$;#/($8$: $!!)($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\x88/B#;\\u028B/9$$;%0#*;%&/)$8#:!#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"$;\\u01ED0#*;\\u01ED&\"),peg$decode(\"$;\\u01ED/�#*;\\u01ED&&&#\"),peg$decode(\"%;$/:#;\\x88/1$;\\u028B/($8#:\\\"#!!)(#'#(\\\"'#&'#\"),peg$decode(\"<%;).# &;*/O#;\\u028B/F$;,.\\\" &\\\"/8$;'.\\\" &\\\"/*$8$:$$##! )($'#(#'#(\\\"'#&'#=.\\\" 7#\"),peg$decode(\"<%;(/9#$;(0#*;(&/)$8\\\":&\\\"\\\"! )(\\\"'#&'#.I &%;\\u028B/?#;\\u01FA/6$;(.\\\" &\\\"/($8#:'#! )(#'#(\\\"'#&'#=.\\\" 7%\"),peg$decode(\"%;\\u028B/Z#;\\u01D8/Q$;\\u028B/H$;9.\\\" &\\\"/:$;\\u028B/1$;\\u01D9/($8&:(&!\\\")(&'#(%'#($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01C5/' 8!:)!! )\"),peg$decode(\"<%;\\u01CF/9#$;+0#*;+&/)$8\\\":+\\\"\\\"! )(\\\"'#&'#=.\\\" 7*\"),peg$decode(\"%4,\\\"\\\"5!7-/1#;\\u01D1/($8\\\":.\\\"! )(\\\"'#&'#\"),peg$decode(\"<%;\\u01DA/R#;8/I$;\\u028B/@$;-.\\\" &\\\"/2$;\\u01DB/)$8%:0%\\\"#!)(%'#($'#(#'#(\\\"'#&'#=.\\\" 7/\"),peg$decode(\"%;\\u01DC/C#;\\u028B/:$;8/1$;\\u028B/($8$:1$!!)($'#(#'#(\\\"'#&'#\"),peg$decode(\";8.A &;9.; &;4.5 &;/./ &;0.) &;1.# &;5\"),peg$decode(\"<%;\\u0248/1#;\\u028B/($8\\\":3\\\"!!)(\\\"'#&'#=.\\\" 72\"),peg$decode(\"<%;\\u020E.) &;\\u0210.# &;\\u020F/1#;\\u028B/($8\\\":5\\\"!!)(\\\"'#&'#=.\\\" 74\"),peg$decode(\"<%;7.\\\" &\\\"/2#;2/)$8\\\":7\\\"\\\"! )(\\\"'#&'#=.\\\" 76\"),peg$decode(\"<%;\\u01E0/A#$;30#*;3&/1$;\\u01E0/($8#:9#!!)(#'#(\\\"'#&'#=.\\\" 78\"),peg$decode(\"2:\\\"\\\"6:7;.) &4<\\\"\\\"5!7=\"),peg$decode(\"<%4?\\\"\\\"5!7@/1#;2/($8\\\":A\\\"! )(\\\"'#&'#=.\\\" 7>\"),peg$decode(\"<%;&/8#;1.# &;B/)$8\\\":C\\\"\\\"! )(\\\"'#&'#=.\\\" 7B\"),peg$decode(\"%;\\u01D1.# &;\\u01D5/' 8!:D!! )\"),peg$decode(\"<%;\\u01E4.# &;\\u01E5/' 8!:\\\"!! )=.\\\" 7E\"),peg$decode(\"%;7.\\\" &\\\"/2#;9/)$8\\\":F\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\";?.# &;:\"),peg$decode(\"%;;/7#;>.\\\" &\\\"/)$8\\\":G\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"<;<.# &;==.\\\" 7H\"),peg$decode(\"%$;A/�#*;A&&&#/7#;=.\\\" &\\\"/)$8\\\":I\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"%;\\u01DD/9#$;A0#*;A&/)$8\\\":J\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"<%3L\\\"\\\"5!7M/T#4N\\\"\\\"5!7O.\\\" &\\\"/@$$;A/�#*;A&&&#/*$8#:P##\\\"! )(#'#(\\\"'#&'#=.\\\" 7K\"),peg$decode(\"<%3R\\\"\\\"5\\\"7S/?#$;@/�#*;@&&&#/)$8\\\":T\\\"\\\"! )(\\\"'#&'#=.\\\" 7Q\"),peg$decode(\"4U\\\"\\\"5!7V\"),peg$decode(\"4W\\\"\\\"5!7X\"),peg$decode(\"<%;C.) &;E.# &;F/' 8!:Z!! )=.\\\" 7Y\"),peg$decode(\"<%;\\u01DF/@#;D.\\\" &\\\"/2$;\\u028B/)$8#:\\\\#\\\"\\\"!)(#'#(\\\"'#&'#=.\\\" 7[\"),peg$decode(\"%4]\\\"\\\"5!7^/9#$;A0#*;A&/)$8\\\":_\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"<%4a\\\"\\\"5!7b/H#$;\\u01CD/�#*;\\u01CD&&&#/2$;\\u028B/)$8#:c#\\\"\\\"!)(#'#(\\\"'#&'#=.\\\" 7`\"),peg$decode(\"<%2e\\\"\\\"6e7f/o#$;\\u01CD.) &2g\\\"\\\"6g7h/2#0/*;\\u01CD.) &2g\\\"\\\"6g7h&&&#/A$;\\u028B/8$;G.\\\" &\\\"/*$8$:i$##\\\" )($'#(#'#(\\\"'#&'#=.\\\" 7d\"),peg$decode(\"%;\\u01D5/1#;\\u028B/($8\\\":j\\\"!!)(\\\"'#&'#\"),peg$decode(\"<%;I.\\\" &\\\"/;#;\\u028B/2$;\\xA4/)$8#:l#\\\"\\\" )(#'#(\\\"'#&'#=.\\\" 7k\"),peg$decode(\"<%;u.\\\" &\\\"/;#;\\u0220/2$;\\u028B/)$8#:n#\\\"\\\"!)(#'#(\\\"'#&'#=.\\\" 7m\"),peg$decode(\"<%;\\u0257/_#;\\u028B/V$;\\u01DA/M$;\\u028B/D$;K/;$;\\u028B/2$;\\u01DB/)$8':p'\\\"&\\\")(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7o\"),peg$decode(\"<%;L.# &;M/' 8!:r!! )=.\\\" 7q\"),peg$decode(\"<%;\\u022C/' 8!:t!! )=.\\\" 7s\"),peg$decode(\"%;\\u0263.) &;\\u01F2.# &;\\u0222/M#;\\u028B/D$;\\u01DC/;$;\\u028B/2$;\\x87/)$8%:u%\\\"$ )(%'#($'#(#'#(\\\"'#&'#\"),peg$decode(\";B./ &;~.) &;..# &;\\u01AE\"),peg$decode(\"%;\\u01DA/L#;\\u028B/C$;z/:$;\\u028B/1$;\\u01DB/($8%:v%!\\\")(%'#($'#(#'#(\\\"'#&'#\"),peg$decode(\";O.G &;H.A &;h.; &;j.5 &;J./ &;Q.) &;R.# &;N\"),peg$decode(\"<%;\\u01FA/:#;\\u028B/1$;S/($8#:x#! )(#'#(\\\"'#&'#=.\\\" 7w\"),peg$decode(\"<%;\\u01FA/:#;\\u028B/1$;\\xA4/($8#:z#! )(#'#(\\\"'#&'#=.\\\" 7y\"),peg$decode(\"<%;\\u01D8/R#;\\u028B/I$;T.# &;{/:$;\\u028B/1$;\\u01D9/($8%:|%!\\\")(%'#($'#(#'#(\\\"'#&'#=.\\\" 7{\"),peg$decode(\"<%;S/B#;\\u028B/9$$;U0#*;U&/)$8#:~#\\\"\\\" )(#'#(\\\"'#&'#=.\\\" 7}\"),peg$decode(\"%;\\u01DC/:#;\\u028B/1$;S/($8#:\\x7F#! )(#'#(\\\"'#&'#\"),peg$decode(\"%;P/;#;\\u028B/2$;Z/)$8#:\\x80#\\\"\\\" )(#'#(\\\"'#&'#.# &;P\"),peg$decode(\"<%;V/S#;\\u028B/J$2\\x82\\\"\\\"6\\x827\\x83/;$;\\u028B/2$;&/)$8%:\\x84%\\\"$ )(%'#($'#(#'#(\\\"'#&'#.# &;V=.\\\" 7\\x81\"),peg$decode(\"%;Y/A#;\\u028B/8$;W.# &;z/)$8#:\\x85#\\\"\\\" )(#'#(\\\"'#&'#.# &;W\"),peg$decode(\";\\u01E3.U &;\\u01E5.O &;\\u01E4.I &%%;u/8#%<;\\u0220=.##&&!&'#/#$+\\\")(\\\"'#&'#/\\\"!&,)\"),peg$decode(\"<%;\\u015D/' 8!:\\x87!! )=.\\\" 7\\x86\"),peg$decode(\"%;X/\\x83#$%;\\u028B/>#;\\u0196/5$;\\u028B/,$;X/#$+$)($'#(#'#(\\\"'#&'#0H*%;\\u028B/>#;\\u0196/5$;\\u028B/,$;X/#$+$)($'#(#'#(\\\"'#&'#&/)$8\\\":\\x88\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"%;[/\\x83#$%;\\u028B/>#;]/5$;\\u028B/,$;[/#$+$)($'#(#'#(\\\"'#&'#0H*%;\\u028B/>#;]/5$;\\u028B/,$;[/#$+$)($'#(#'#(\\\"'#&'#&/)$8\\\":\\x88\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\";\\u0199.) &;\\u019A.# &;\\u019B\"),peg$decode(\"%;\\\\/\\x83#$%;\\u028B/>#;_/5$;\\u028B/,$;\\\\/#$+$)($'#(#'#(\\\"'#&'#0H*%;\\u028B/>#;_/5$;\\u028B/,$;\\\\/#$+$)($'#(#'#(\\\"'#&'#&/)$8\\\":\\x88\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\";\\u0197.# &;\\u0198\"),peg$decode(\"%;^/\\x83#$%;\\u028B/>#;a/5$;\\u028B/,$;^/#$+$)($'#(#'#(\\\"'#&'#0H*%;\\u028B/>#;a/5$;\\u028B/,$;^/#$+$)($'#(#'#(\\\"'#&'#&/)$8\\\":\\x88\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\";\\u019C.[ &;\\u019D.U &;\\u01A7.O &;\\u019E.I &%%;\\u019F/8#%<;\\u019F=.##&&!&'#/#$+\\\")(\\\"'#&'#/\\\"!&,)\"),peg$decode(\"%;`/\\x83#$%;\\u028B/>#;c/5$;\\u028B/,$;`/#$+$)($'#(#'#(\\\"'#&'#0H*%;\\u028B/>#;c/5$;\\u028B/,$;`/#$+$)($'#(#'#(\\\"'#&'#&/)$8\\\":\\x88\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\";\\u01A2.{ &;\\u01A3.u &%%;\\u01A0/8#%<;a=.##&&!&'#/#$+\\\")(\\\"'#&'#/\\\"!&,).I &%%;\\u01A1/8#%<;a=.##&&!&'#/#$+\\\")(\\\"'#&'#/\\\"!&,)\"),peg$decode(\"%;b/9#$;e0#*;e&/)$8\\\":\\x88\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"%;\\u028B/1#;f/($8\\\":\\x89\\\"! )(\\\"'#&'#.H &%;\\u028B/>#;g/5$;\\u028B/,$;b/#$+$)($'#(#'#(\\\"'#&'#\"),peg$decode(\"%3\\x8A\\\"\\\"5$7\\x8B/?#;\\u028B/6$3\\x8C\\\"\\\"5$7\\x8D/'$8#:\\x8E# )(#'#(\\\"'#&'#.? &%;\\u0239/& 8!:\\x8F! ).. &%;\\u0246/& 8!:\\x8E! )\"),peg$decode(\";\\u01A8./ &;\\u01A5.) &;\\u01A6.# &;\\u01A4\"),peg$decode(\"<%;\\u0205/i#;\\u028B/`$;\\u01DA/W$;z/N$;\\u028B/E$;i/<$;\\u028B/3$;\\u01DB/*$8(:\\x91(#'$\\\")(('#(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\x90\"),peg$decode(\"<%;\\u01FB/:#;\\u028B/1$;&/($8#:\\x93#! )(#'#(\\\"'#&'#=.\\\" 7\\x92\"),peg$decode(\"<%;\\u0204/\\x93#;\\u028B/\\x8A$;k.\\\" &\\\"/|$;\\u028B/s$$;l/�#*;l&&&#/]$;\\u028B/T$;m.\\\" &\\\"/F$;\\u028B/=$;\\u021C/4$;\\u028B/+$8*:\\x95*$)'%#)(*'#()'#(('#(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\x94\"),peg$decode(\"%%<;\\u027B=.##&&!&'#/1#;z/($8\\\":\\x96\\\"! )(\\\"'#&'#\"),peg$decode(\"<%;\\u027B/i#;\\u028B/`$;z/W$;\\u028B/N$;\\u026F/E$;\\u028B/<$;z/3$;\\u028B/*$8(:\\x98(#'%!)(('#(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\x97\"),peg$decode(\"<%;\\u021B/D#;\\u028B/;$;z/2$;\\u028B/)$8$:\\x9A$\\\"#!)($'#(#'#(\\\"'#&'#=.\\\" 7\\x99\"),peg$decode(\"%;d/;#;\\u028B/2$;o/)$8#:\\x9B#\\\"\\\" )(#'#(\\\"'#&'#.# &;d\"),peg$decode(\";v./ &;p.) &;s.# &;q\"),peg$decode(\"<%;\\u0238/n#;\\u028B/e$;u.\\\" &\\\"/W$;\\u0218/N$;\\u028B/E$;\\u0226/<$;\\u028B/3$;n/*$8(:\\x9D(#%$ )(('#(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\x9C\"),peg$decode(\"<%;u.\\\" &\\\"/u#;\\u023F.5 &;\\u022D./ &;\\u0228.) &;\\u025B.# &;\\u0242/T$;\\u028B/K$;n/B$;\\u028B/9$;r.\\\" &\\\"/+$8&:\\x9F&$%$\\\" )(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\x9E\"),peg$decode(\"<%;\\u021D/D#;\\u028B/;$;n/2$;\\u028B/)$8$:\\xA1$\\\"#!)($'#(#'#(\\\"'#&'#=.\\\" 7\\xA0\"),peg$decode(\"<%;u.\\\" &\\\"/E#;\\u0201/<$;\\u028B/3$;t/*$8$:\\xA3$##\\\" )($'#(#'#(\\\"'#&'#=.\\\" 7\\xA2\"),peg$decode(\"%;n/W#%;\\u028B/>#;\\u01F9/5$;\\u028B/,$;n/#$+$)($'#(#'#(\\\"'#&'#/)$8\\\":\\xA4\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"%;\\u0245/1#;\\u028B/($8\\\":\\xA5\\\"!!)(\\\"'#&'#\"),peg$decode(\"<%;u.\\\" &\\\"/E#;\\u022F/<$;\\u028B/3$;w/*$8$:\\xA7$##\\\" )($'#(#'#(\\\"'#&'#=.\\\" 7\\xA6\"),peg$decode(\";x.# &;\\u01AC\"),peg$decode(\"%;\\u01DA/I#;\\xA5.# &;{/:$;\\u028B/1$;\\u01DB/($8$:\\x7F$!\\\")($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;n/\\x83#$%;\\u028B/>#;\\u01F9/5$;\\u028B/,$;n/#$+$)($'#(#'#(\\\"'#&'#0H*%;\\u028B/>#;\\u01F9/5$;\\u028B/,$;n/#$+$)($'#(#'#(\\\"'#&'#&/)$8\\\":\\x88\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"%;y/\\x83#$%;\\u028B/>#;\\u024E/5$;\\u028B/,$;y/#$+$)($'#(#'#(\\\"'#&'#0H*%;\\u028B/>#;\\u024E/5$;\\u028B/,$;y/#$+$)($'#(#'#(\\\"'#&'#&/)$8\\\":\\x88\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"<%;|.\\\" &\\\"/1#;\\u028B/($8\\\":\\xA9\\\"!!)(\\\"'#&'#=.\\\" 7\\xA8\"),peg$decode(\"%;z/B#;\\u028B/9$$;}0#*;}&/)$8#:\\xAA#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01DC/:#;z/1$;\\u028B/($8#:\\x7F#!!)(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u01AB/\\x8B#;\\u028B/\\x82$;\\u01DA/y$;\\x80.\\\" &\\\"/k$;\\u028B/b$;\\u01DB/Y$;\\u028B/P$;\\x7F.\\\" &\\\"/B$;\\u028B/9$;\\x82.\\\" &\\\"/+$8*:\\xAC*$)&\\\" )(*'#()'#(('#(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\xAB\"),peg$decode(\"<%3\\xAE\\\"\\\"5&7\\xAF/p#;\\u028B/g$;\\u01DA/^$;\\u028B/U$;\\u027C/L$;\\u028B/C$;z/:$;\\u028B/1$;\\u01DB/($8):\\xB0)!\\\")()'#(('#(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\xAD\"),peg$decode(\"<%;\\xE2/' 8!:\\xB2!! ).V &%;\\x81.\\\" &\\\"/G#;{/>$9:\\xB3 \\\"! -\\\"\\\"&!&#/)$8#:\\xB4#\\\"\\\"!)(#'#(\\\"'#&'#=.\\\" 7\\xB1\"),peg$decode(\"%;\\u0218.# &;\\u01F6/1#;\\u028B/($8\\\":\\xB5\\\"!!)(\\\"'#&'#\"),peg$decode(\"<%;\\u0251/@#;\\u028B/7$;\\x84.# &;\\x83/($8#:\\xB7#! )(#'#(\\\"'#&'#=.\\\" 7\\xB6\"),peg$decode(\"<%;\\u01A9/' 8!:\\xB9!! )=.\\\" 7\\xB8\"),peg$decode(\"<%;\\u01DA/\\x81#;\\u028B/x$;\\x85.\\\" &\\\"/j$;\\u028B/a$;\\x86.\\\" &\\\"/S$;\\u028B/J$;\\xCE.\\\" &\\\"/<$;\\u028B/3$;\\u01DB/*$8):\\xBB)#&$\\\")()'#(('#(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\xBA\"),peg$decode(\"%;\\x83/P#%<%;\\u028B/,#;\\u0202/#$+\\\")(\\\"'#&'#=.##&&!&'#/($8\\\":\\xBC\\\"!!)(\\\"'#&'#\"),peg$decode(\"<%;\\u0252/L#;\\u028B/C$;\\u0202/:$;\\u028B/1$;{/($8%:\\xBE%! )(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\xBD\"),peg$decode(\"<%;1/' 8!:\\xC0!! )=.\\\" 7\\xBF\"),peg$decode(\"<%;\\x89.\\\" &\\\"/;#;\\x8B/2$;\\u028B/)$8#:\\xC2#\\\"\\\"!)(#'#(\\\"'#&'#=.\\\" 7\\xC1\"),peg$decode(\"<%;\\u0221/@#;\\u028B/7$;\\x8A.\\\" &\\\"/)$8#:\\xC4#\\\"\\\" )(#'#(\\\"'#&'#=.\\\" 7\\xC3\"),peg$decode(\"<%;\\u0256/D#;\\u028B/;$;\\u0253/2$;\\u028B/)$8$:\\xC6$\\\"#!)($'#(#'#(\\\"'#&'#=.\\\" 7\\xC5\"),peg$decode(\";\\x9C._ &;\\u012B.Y &;\\u0192.S &;\\x8D.M &;\\x8C.G &;\\x96.A &;\\x90.; &;\\x94.5 &;\\x95./ &;\\xA6.) &;\\xAC.# &;\\xAE\"),peg$decode(\"<%;\\u0209.# &;\\u021C/@#;\\u028B/7$;\\x8E.\\\" &\\\"/)$8#:\\xC8#\\\"\\\" )(#'#(\\\"'#&'#=.\\\" 7\\xC7\"),peg$decode(\"<%;\\u0200/^#;\\u028B/U$;\\x8F.\\\" &\\\"/G$;\\x8E.\\\" &\\\"/9$;\\x92.\\\" &\\\"/+$8%:\\xCA%$$\\\"! )(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\xC9\"),peg$decode(\"%;\\u0271/1#;\\u028B/($8\\\":\\xCB\\\"!!)(\\\"'#&'#\"),peg$decode(\"%;\\u0214.) &;\\u022E.# &;\\u021F/1#;\\u028B/($8\\\":\\xCC\\\"!!)(\\\"'#&'#\"),peg$decode(\"<%;\\u0263/N#;\\u028B/E$;\\x8E.\\\" &\\\"/7$;\\x91.\\\" &\\\"/)$8$:\\xCE$\\\"# )($'#(#'#(\\\"'#&'#=.\\\" 7\\xCD\"),peg$decode(\"<%%;\\u0270/,#;\\u028B/#$+\\\")(\\\"'#&'#.\\\" &\\\"/?#;\\x93.\\\" &\\\"/1$;\\x92/($8#:v#! )(#'#(\\\"'#&'#=.\\\" 7\\xCF\"),peg$decode(\"%;\\u01BB/1#;\\u028B/($8\\\":\\xD0\\\"!!)(\\\"'#&'#\"),peg$decode(\"%;\\u0266/1#;\\u028B/($8\\\":\\xD1\\\"!!)(\\\"'#&'#\"),peg$decode(\"<%;\\x93/2#;\\x92/)$8\\\":\\xD3\\\"\\\"! )(\\\"'#&'#=.\\\" 7\\xD2\"),peg$decode(\"<%;\\u025D/J#;\\u028B/A$;\\x93.\\\" &\\\"/3$;\\x92/*$8$:\\xD5$##! )($'#(#'#(\\\"'#&'#=.\\\" 7\\xD4\"),peg$decode(\"<%;\\x97/N#;\\u01AC/E$;\\u028B/<$;\\x98/3$;\\u028B/*$8%:\\xD7%#$#!)(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\xD6\"),peg$decode(\"<%;\\u01F7/D#;\\u028B/;$;\\u026C/2$;\\u028B/)$8$:\\xD9$\\\"#!)($'#(#'#(\\\"'#&'#=.\\\" 7\\xD8\"),peg$decode(\";\\x99.# &;\\x9A\"),peg$decode(\"<%;\\u025E/M#;\\u028B/D$;\\u0270/;$;\\u028B/2$;\\u01AC/)$8%:\\xDB%\\\"$ )(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\xDA\"),peg$decode(\"<%;\\u01F4/I#;\\u028B/@$;\\x9B.\\\" &\\\"/2$;\\u013C/)$8$:\\xDD$\\\"# )($'#(#'#(\\\"'#&'#=.\\\" 7\\xDC\"),peg$decode(\"%;\\u0208/1#;\\u028B/($8\\\":\\xD1\\\"!!)(\\\"'#&'#\"),peg$decode(\"%;\\x9D/2#;\\xBF/)$8\\\":\\xDE\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"<%;\\x9E.\\\" &\\\"/1#;\\u028B/($8\\\":.\\\"!!)(\\\"'#&'#=.\\\" 7\\xDF\"),peg$decode(\"%;\\u027E/J#;\\u028B/A$;\\x9F.\\\" &\\\"/3$;\\xA0/*$8$:\\xE0$##! )($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u0259/1#;\\u028B/($8\\\":\\xD1\\\"!!)(\\\"'#&'#\"),peg$decode(\"%;\\xA2/B#;\\u028B/9$$;\\xA10#*;\\xA1&/)$8#:\\xE1#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01DC/:#;\\xA2/1$;\\u028B/($8#:\\x7F#!!)(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u01C1/2#;\\xA3/)$8\\\":\\xE3\\\"\\\"! )(\\\"'#&'#=.\\\" 7\\xE2\"),peg$decode(\"%;\\u01FB/:#;\\u028B/1$;\\xA4/($8#:\\xE4#! )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01DA/C#;\\xA5/:$;\\u028B/1$;\\u01DB/($8$: $!\\\")($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\x9D/2#;\\xC0/)$8\\\":\\xE5\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"<%;\\u0268/e#;\\u028B/\\\\$;\\xA7.\\\" &\\\"/N$;\\u028B/E$;\\u01C0/<$;\\u028B/3$;\\xA8/*$8':\\xE7'#$\\\" )(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\xE6\"),peg$decode(\"%3\\xE8\\\"\\\"5%7\\xE9/& 8!:\\xEA! ).4 &%3\\xEB\\\"\\\"5'7\\xEC/& 8!:\\xED! )\"),peg$decode(\"%;\\u0226/?#;\\u028B/6$3\\xEE\\\"\\\"5'7\\xEF/'$8#:\\xF0# )(#'#(\\\"'#&'#.v &%;\\u0270.# &;\\u01E6/9#;\\u028B/0$;\\u0212/'$8#:\\xF1# )(#'#(\\\"'#&'#.J &%;\\u0270.# &;\\u01E6/:#;\\u028B/1$;\\xA9/($8#:\\xF2#! )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\xAB/9#$;\\xAA0#*;\\xAA&/)$8\\\":\\xF3\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"%;\\u028B/C#;\\u01DC/:$;\\u028B/1$;\\xAB/($8$:\\xF4$! )($'#(#'#(\\\"'#&'#\"),peg$decode(\";\\xBA.# &;B\"),peg$decode(\"%;\\u026A/:#;\\u028B/1$;\\xAD/($8#:\\xF5#! )(#'#(\\\"'#&'#\"),peg$decode(\"%3\\xF6\\\"\\\"5$7\\xF7/?#;\\u028B/6$3\\xF8\\\"\\\"5$7\\xF9/'$8#:\\xFA# )(#'#(\\\"'#&'#.\\xB6 &%3\\xFB\\\"\\\"5+7\\xFC/W#;\\u028B/N$3\\xFD\\\"\\\"5)7\\xFE/?$;\\u028B/6$3\\xFF\\\"\\\"5%7\\u0100/'$8%:\\u0101% )(%'#($'#(#'#(\\\"'#&'#.l &%3\\xEB\\\"\\\"5'7\\xEC/?#;\\u028B/6$3\\u0102\\\"\\\"5-7\\u0103/'$8#:\\u0104# )(#'#(\\\"'#&'#.: &%3\\u0105\\\"\\\"5#7\\u0106/& 8!:\\u0107! ).# &;\\u01C0\"),peg$decode(\";\\xAF.; &;\\xB1.5 &;\\xB2./ &;\\xB4.) &;\\xB6.# &;\\xB8\"),peg$decode(\"<%;\\u01FD/\\x8B#;\\u028B/\\x82$%;\\u0211/,#;\\u028B/#$+\\\")(\\\"'#&'#.\\\" &\\\"/a$;z/X$;\\u028B/O$;\\u01FB/F$;\\u028B/=$;\\xB0/4$;\\u028B/+$8):\\u0109)$(&%!)()'#(('#(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u0108\"),peg$decode(\";\\u01AA.) &;/.# &;B\"),peg$decode(\"<%;\\u0217/f#;\\u028B/]$%;\\u0211/,#;\\u028B/#$+\\\")(\\\"'#&'#.\\\" &\\\"/<$;\\xB0/3$;\\u028B/*$8%:\\u010B%#$\\\"!)(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u010A\"),peg$decode(\"<%;\\u0277/@#;\\u028B/7$;\\xB3.\\\" &\\\"/)$8#:\\u010D#\\\"\\\" )(#'#(\\\"'#&'#=.\\\" 7\\u010C\"),peg$decode(\"%;\\u01AA/1#;\\u028B/($8\\\":\\u010E\\\"!!)(\\\"'#&'#\"),peg$decode(\"<%;\\u01F8/@#;\\u028B/7$;\\xB5.\\\" &\\\"/)$8#:\\u0110#\\\"\\\" )(#'#(\\\"'#&'#=.\\\" 7\\u010F\"),peg$decode(\"%;\\u01AC.) &;\\u01BC.# &;\\u01AA/1#;\\u028B/($8\\\":\\u0111\\\"!!)(\\\"'#&'#\"),peg$decode(\"<%;\\u025C/I#;\\u028B/@$;\\xB7.\\\" &\\\"/2$;\\u028B/)$8$:\\u0110$\\\"#!)($'#(#'#(\\\"'#&'#=.\\\" 7\\u0112\"),peg$decode(\"%;\\u01AC.) &;\\u01BC.# &;\\u01BA/1#;\\u028B/($8\\\":\\u0113\\\"!!)(\\\"'#&'#\"),peg$decode(\"<%;\\u0254/S#;\\u028B/J$;\\u01BF/A$;\\u028B/8$;\\xB9.\\\" &\\\"/*$8%:\\u0115%#$\\\" )(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u0114\"),peg$decode(\"%;\\u01DA/C#;\\xBA/:$;\\u028B/1$;\\u01DB/($8$:\\xF4$!\\\")($'#(#'#(\\\"'#&'#.D &%;\\u01E6/:#;\\xBA/1$;\\u028B/($8#:\\xF4#!!)(#'#(\\\"'#&'#\"),peg$decode(\";\\xBC.) &;\\xBB.# &;\\xBE\"),peg$decode(\";8.) &;1.# &;6\"),peg$decode(\"%;\\xBD/<#9:\\u0116 ! -\\\"\\\"&!&#/($8\\\":\\u0117\\\"!!)(\\\"'#&'#\"),peg$decode(\"%$;\\u01CD/�#*;\\u01CD&&&#/' 8!:\\u0118!! )\"),peg$decode(\"%;\\xBD/' 8!:\\u0119!! )\"),peg$decode(\";\\xC0./ &;\\u0108.) &;\\u0121.# &;\\u0129\"),peg$decode(\"<%;\\xD3/k#;\\u028B/b$;\\xCE.\\\" &\\\"/T$;\\u028B/K$;\\xCF/B$;\\u028B/9$;\\xC1.\\\" &\\\"/+$8':\\u011B'$&$\\\" )(''#(&'#(%'#($'#(#'#(\\\"'#&'#.z &%;\\xD3/p#;\\u028B/g$;\\xCE.\\\" &\\\"/Y$;\\u028B/P$;\\xC1.\\\" &\\\"/B$;\\u028B/9$;\\xCF.\\\" &\\\"/+$8':\\u011C'$&$\\\" )(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u011A\"),peg$decode(\"<;\\xC2.^ &%;\\u0224/T#;\\u028B/K$;\\u0258/B$;\\u028B/9$;\\u024D/0$;\\u028B/'$8&:\\u011E& )(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u011D\"),peg$decode(\"%;\\xC4/B#;\\u028B/9$$;\\xC30#*;\\xC3&/)$8#:\\u011F#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\xC4/1#;\\u028B/($8\\\":\\u0120\\\"!!)(\\\"'#&'#\"),peg$decode(\"%;\\u0224/j#;\\u028B/a$;\\xC5/X$;\\u028B/O$;\\xC6.\\\" &\\\"/A$;\\u028B/8$;\\xC9.\\\" &\\\"/*$8':\\u0121'#$\\\" )(''#(&'#(%'#($'#(#'#(\\\"'#&'#\"),peg$decode(\";\\u0275.y &%;\\u0244/G#;\\u028B/>$;\\u023B/5$;\\u028B/,$;\\u0275/#$+%)(%'#($'#(#'#(\\\"'#&'#.E &;\\u0269.? &%;\\u023B/5#;\\u028B/,$;\\u0269/#$+#)(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u024A/:#;\\u028B/1$;\\xC7/($8#:\\u0122#! )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01AC/B#;\\u028B/9$$;\\xC80#*;\\xC8&/)$8#:\\u0123#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01DC/:#;\\u028B/1$;\\u01AC/($8#:\\u0120#! )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u0247.? &%;\\u026B/5#;\\u028B/,$;\\u0241/#$+#)(#'#(\\\"'#&'#/' 8!:\\u0124!! )\"),peg$decode(\"<%;\\u027D/C#;\\u028B/:$;\\xCB/1$;\\u028B/($8$:\\u0126$!!)($'#(#'#(\\\"'#&'#=.\\\" 7\\u0125\"),peg$decode(\"%;\\xCD/B#;\\u028B/9$$;\\xCC0#*;\\xCC&/)$8#:\\xE1#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01DC/:#;\\xCD/1$;\\u028B/($8#:1#!!)(#'#(\\\"'#&'#\"),peg$decode(\"%;\\x83/M#;\\u028B/D$;\\u01FB/;$;\\u028B/2$;\\x84/)$8%:\\u0127%\\\"$ )(%'#($'#(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u024F/L#;\\u028B/C$;\\u0202/:$;\\u028B/1$;\\u0102/($8%:\\u0129%! )(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u0128\"),peg$decode(\"<%;\\u0240/S#;\\u028B/J$;z/A$;\\u028B/8$;\\xD0.\\\" &\\\"/*$8%:\\u012B%#$\\\" )(%'#($'#(#'#(\\\"'#&'#.D &%;\\u024B/:#;\\u028B/1$;z/($8#:\\u012C#! )(#'#(\\\"'#&'#=.\\\" 7\\u012A\"),peg$decode(\"<%;\\xD1/2#;z/)$8\\\":\\u012E\\\"\\\"! )(\\\"'#&'#=.\\\" 7\\u012D\"),peg$decode(\";\\xD2.# &;\\u01DC\"),peg$decode(\"%;\\u024B/1#;\\u028B/($8\\\":\\xD1\\\"!!)(\\\"'#&'#\"),peg$decode(\"%;\\xD5/B#;\\u028B/9$$;\\xD40#*;\\xD4&/)$8#:\\u012F#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u011E/D#;\\u028B/;$;\\xD5/2$;\\u028B/)$8$:\\u0131$\\\"#!)($'#(#'#(\\\"'#&'#=.\\\" 7\\u0130\"),peg$decode(\";\\xD6.# &;\\u0101\"),peg$decode(\"%;\\xD7/m#;\\xDD.\\\" &\\\"/_$;\\xDE.\\\" &\\\"/Q$;\\xDF.\\\" &\\\"/C$;\\u028B/:$;\\xCA.\\\" &\\\"/,$8&:\\u0132&%%$#\\\" )(&'#(%'#($'#(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u0267/R#;\\u028B/I$;\\xD8.\\\" &\\\"/;$;\\u028B/2$;\\xDB/)$8%:\\u0134%\\\"\\\" )(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u0133\"),peg$decode(\"<;\\xD9.# &;\\xDA=.\\\" 7\\u0135\"),peg$decode(\"%;\\u0218/1#;\\u028B/($8\\\":\\u0136\\\"!!)(\\\"'#&'#\"),peg$decode(\"%;\\u01F6/1#;\\u028B/($8\\\":\\u0137\\\"!!)(\\\"'#&'#\"),peg$decode(\"%;\\xE1/B#;\\u028B/9$$;\\xDC0#*;\\xDC&/)$8#:\\xE1#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01DC/:#;\\xE1/1$;\\u028B/($8#:1#!!)(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u0226/D#;\\u028B/;$;\\xE5/2$;\\u028B/)$8$:\\u0139$\\\"#!)($'#(#'#(\\\"'#&'#=.\\\" 7\\u0138\"),peg$decode(\"<%;\\u027C/D#;\\u028B/;$;z/2$;\\u028B/)$8$:\\u013B$\\\"#!)($'#(#'#(\\\"'#&'#=.\\\" 7\\u013A\"),peg$decode(\"<%;\\u0229/e#;\\u028B/\\\\$;\\u0202/S$;\\u028B/J$;{/A$;\\u028B/8$;\\xE0.\\\" &\\\"/*$8':\\u013D'#&\\\" )(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u013C\"),peg$decode(\"<%;\\u022A/D#;\\u028B/;$;z/2$;\\u028B/)$8$:\\u013F$\\\"#!)($'#(#'#(\\\"'#&'#=.\\\" 7\\u013E\"),peg$decode(\";\\xE2.# &;\\xE4\"),peg$decode(\"%;\\xE3.\\\" &\\\"/2#;\\u0106/)$8\\\":\\u0140\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"%;\\u01CF/2#;\\u01DD/)$8\\\":\\u0141\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"%;z/@#;\\u028B/7$;\\xF7.\\\" &\\\"/)$8#:\\u0142#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\xE9/B#;\\u028B/9$$;\\xE60#*;\\xE6&/)$8#:\\u0143#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\xE7.# &;\\xE8/7#;\\xFE.\\\" &\\\"/)$8\\\":\\u0144\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"<%;\\u01DC/:#;\\xE9/1$;\\u028B/($8#:\\u0146#!!)(#'#(\\\"'#&'#=.\\\" 7\\u0145\"),peg$decode(\"<%;\\xF8/D#;\\u028B/;$;\\xE9/2$;\\u028B/)$8$:\\u0148$\\\"#!)($'#(#'#(\\\"'#&'#=.\\\" 7\\u0147\"),peg$decode(\"%;\\xEF.\\\" &\\\"/S#;\\u028B/J$;\\xF5.5 &;B./ &;\\xEA.) &;\\xF0.# &;\\xF6/)$8#:\\u0149#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01AB/S#;\\u028B/J$;\\u011C/A$;\\u028B/8$;\\xEB.\\\" &\\\"/*$8%:\\u014A%#$\\\" )(%'#($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01FB.\\\" &\\\"/h#;\\u028B/_$;\\u01CF/V$;\\u028B/M$;\\u01DA/D$;\\xEC/;$;\\u028B/2$;\\u01DB/)$8(:\\u014B(\\\"%\\\")(('#(''#(&'#(%'#($'#(#'#(\\\"'#&'#.n &%;\\u01FB/^#;\\u028B/U$;\\u01DA/L$;\\u028B/C$;\\xEC/:$;\\u028B/1$;\\u01DB/($8':\\u014C'!\\\")(''#(&'#(%'#($'#(#'#(\\\"'#&'#.# &;\\xF7\"),peg$decode(\"%;\\xED/B#;\\u028B/9$$;\\xEE0#*;\\xEE&/)$8#:\\u014D#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u013D/S#;\\u028B/J$;&/A$;\\u028B/8$;\\u015D.\\\" &\\\"/*$8%:\\u014E%#$\\\" )(%'#($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01DC/C#;\\u028B/:$;\\xED/1$;\\u028B/($8$:\\xCB$!!)($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u023D/& 8!:\\u014F! )\"),peg$decode(\"<%;\\xF1/@#;\\u028B/7$;\\xF2.\\\" &\\\"/)$8#:\\u0151#\\\"\\\" )(#'#(\\\"'#&'#=.\\\" 7\\u0150\"),peg$decode(\"<%;\\u01AC/@#;\\u028B/7$;\\xF7.\\\" &\\\"/)$8#:\\u0153#\\\"\\\" )(#'#(\\\"'#&'#=.\\\" 7\\u0152\"),peg$decode(\"<;\\xF3.# &;\\xF4=.\\\" 7\\u0154\"),peg$decode(\"%;\\u0231/V#;\\u028B/M$;\\u0202/D$;\\u028B/;$;\\u01BC/2$;\\u028B/)$8&:\\u0155&\\\"%!)(&'#(%'#($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;u/;#;\\u0231/2$;\\u028B/)$8#:\\u0156#\\\"\\\"!)(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u01DA/R#;\\xE5/I$;\\u028B/@$;\\u01DB/7$;\\xF7.\\\" &\\\"/)$8%:\\u0158%\\\"# )(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u0157\"),peg$decode(\"<%;\\xA4/7#;\\xF7.\\\" &\\\"/)$8\\\":\\u015A\\\"\\\"! )(\\\"'#&'#=.\\\" 7\\u0159\"),peg$decode(\"<%%;\\u01FB/Q#%%<;\\u01CD.# &;\\u0282=.##&&!&'#/,#;\\u028B/#$+\\\")(\\\"'#&'#/#$+\\\")(\\\"'#&'#.\\\" &\\\"/S#;\\u01CF/J$;\\u028B/A$;\\u0115.\\\" &\\\"/3$;\\u028B/*$8%:\\u015C%#$#!)(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u015B\"),peg$decode(\"<%;\\xF9.\\\" &\\\"/J#;\\u028B/A$;\\xFA.\\\" &\\\"/3$;\\u023A/*$8$:\\u015E$##! )($'#(#'#(\\\"'#&'#=.\\\" 7\\u015D\"),peg$decode(\"%;\\u0243/1#;\\u028B/($8\\\":\\xA5\\\"!!)(\\\"'#&'#\"),peg$decode(\";\\xFB.# &;\\xFD\"),peg$decode(\"%;\\u023E.) &;\\u0262.# &;\\u0227/@#;\\u028B/7$;\\xFC.\\\" &\\\"/)$8#:\\u015F#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u0250/1#;\\u028B/($8\\\":\\u0160\\\"!!)(\\\"'#&'#\"),peg$decode(\"%;\\u0233.# &;\\u020D/1#;\\u028B/($8\\\":\\u0160\\\"!!)(\\\"'#&'#\"),peg$decode(\"<%;\\xFF.# &;\\u0100/1#;\\u028B/($8\\\":\\u0162\\\"!!)(\\\"'#&'#=.\\\" 7\\u0161\"),peg$decode(\"<%;\\u024C/;#;\\u028B/2$;z/)$8#:\\u0164#\\\"\\\" )(#'#(\\\"'#&'#=.\\\" 7\\u0163\"),peg$decode(\"<%;\\u0276/;#;\\u028B/2$;\\u0115/)$8#:\\u0166#\\\"\\\" )(#'#(\\\"'#&'#=.\\\" 7\\u0165\"),peg$decode(\"<%;\\u0278/;#;\\u028B/2$;\\u011A/)$8#:\\u0168#\\\"\\\" )(#'#(\\\"'#&'#=.\\\" 7\\u0167\"),peg$decode(\"%;\\u0104/B#;\\u028B/9$$;\\u01030#*;\\u0103&/)$8#:\\u0169#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01DC/:#;\\u0104/1$;\\u028B/($8#:\\u0120#!!)(#'#(\\\"'#&'#\"),peg$decode(\"<%;z/X#;\\u028B/O$;\\u015F.\\\" &\\\"/A$;\\u028B/8$;\\u0105.\\\" &\\\"/*$8%:\\u016B%#$\\\" )(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u016A\"),peg$decode(\"%;\\u0249/@#;\\u028B/7$;\\u0223.# &;\\u023C/($8#:\\u016C#! )(#'#(\\\"'#&'#\"),peg$decode(\"<;\\u01DE=.\\\" 7\\u016D\"),peg$decode(\"<;\\u025F.5 &;\\u0263./ &;\\u01F2.) &;\\u0222.# &;\\u022C=.\\\" 7\\u016E\"),peg$decode(\"<%;\\u010A/k#;\\u028B/b$;\\u010E/Y$;\\u028B/P$;\\u0112.\\\" &\\\"/B$;\\u028B/9$;\\u0109.\\\" &\\\"/+$8':\\u0170'$&$\\\" )(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u016F\"),peg$decode(\"<%;\\u0261/:#;\\u028B/1$;\\xDB/($8#:\\u0172#! )(#'#(\\\"'#&'#=.\\\" 7\\u0171\"),peg$decode(\";\\u010B.# &;\\u010C\"),peg$decode(\"<%;\\u0234/@#;\\u028B/7$;\\u010D.\\\" &\\\"/)$8#:\\u0174#\\\"\\\" )(#'#(\\\"'#&'#=.\\\" 7\\u0173\"),peg$decode(\"<%;\\u025F/1#;\\u028B/($8\\\":\\u0176\\\"!!)(\\\"'#&'#=.\\\" 7\\u0175\"),peg$decode(\"<%;\\u024E/;#;\\u028B/2$;\\u0107/)$8#:\\u0178#\\\"\\\" )(#'#(\\\"'#&'#=.\\\" 7\\u0177\"),peg$decode(\"%;\\u010F/2#;\\u0111/)$8\\\":\\u0179\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"<%;\\u0110/2#;\\u01C1/)$8\\\":\\u017B\\\"\\\"! )(\\\"'#&'#=.\\\" 7\\u017A\"),peg$decode(\"<%;\\u0237/,#;\\u028B/#$+\\\")(\\\"'#&'#=.\\\" 7\\u017C\"),peg$decode(\"<%;\\u0118.) &;\\xA5.# &;\\u011D/1#;\\u028B/($8\\\":\\u017D\\\"!!)(\\\"'#&'#=.\\\" 7\\u0167\"),peg$decode(\"<%;\\u0161/j#;\\u028B/a$;\\u0114.\\\" &\\\"/S$;\\u028B/J$3\\u017F\\\"\\\"5\\\"7\\u0180/;$;\\u028B/2$;\\u0113/)$8':\\u0181'\\\"$ )(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u017E\"),peg$decode(\"<%;\\u0122/S#;\\u028B/J$;\\u0124/A$;\\u028B/8$;\\xDE.\\\" &\\\"/*$8%:\\u0183%#$\\\" )(%'#($'#(#'#(\\\"'#&'#.5 &%3\\u0184\\\"\\\"5'7\\u0185/' 8!:\\u0186!! )=.\\\" 7\\u0182\"),peg$decode(\"<%;\\u0158/@#;\\u028B/7$;\\xDE.\\\" &\\\"/)$8#:\\u0188#\\\"\\\" )(#'#(\\\"'#&'#.V &%;\\u024C/L#;\\u028B/C$;\\u020B/:$;\\u028B/1$;\\u01A9/($8%:\\u0189%! )(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u0187\"),peg$decode(\"<%;\\u01DA/T#;\\u0117/K$;\\u028B/B$$;\\u01160#*;\\u0116&/2$;\\u01DB/)$8%:\\u018B%\\\"#!)(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u018A\"),peg$decode(\"%;\\u01DC/:#;\\u0117/1$;\\u028B/($8#:\\u018C#!!)(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u01A9/' 8!:\\u018E!! )=.\\\" 7\\u018D\"),peg$decode(\"<%;\\u0119/2#;\\u011A/)$8\\\":\\u018F\\\"\\\"! )(\\\"'#&'#=.\\\" 7\\u0167\"),peg$decode(\"<%;\\u0278/1#;\\u028B/($8\\\":\\xD1\\\"!!)(\\\"'#&'#=.\\\" 7\\u0190\"),peg$decode(\"%;\\u011C/B#;\\u028B/9$$;\\u011B0#*;\\u011B&/)$8#:\\u014D#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01DC/:#;\\u011C/1$;\\u028B/($8#:\\x7F#!!)(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u01DA/C#;{/:$;\\u028B/1$;\\u01DB/($8$:\\u0192$!\\\")($'#(#'#(\\\"'#&'#=.\\\" 7\\u0191\"),peg$decode(\"<%;\\u0212/;#;\\u028B/2$;\\u0278/)$8#:\\u0194#\\\"\\\" )(#'#(\\\"'#&'#=.\\\" 7\\u0193\"),peg$decode(\"<%;\\u011F.) &;\\u0236.# &;\\u021E/' 8!:\\xD1!! )=.\\\" 7\\u0195\"),peg$decode(\"<%;\\u0273/@#;\\u028B/7$;\\u0120.\\\" &\\\"/)$8#:\\u0197#\\\"\\\" )(#'#(\\\"'#&'#=.\\\" 7\\u0196\"),peg$decode(\"%;\\u01F6/1#;\\u028B/($8\\\":\\u0198\\\"!!)(\\\"'#&'#\"),peg$decode(\"<%;\\u0122/\\xA2#;\\u0123.\\\" &\\\"/\\x94$;\\xF0/\\x8B$;\\u028B/\\x82$;\\u0124/y$;\\xDE.\\\" &\\\"/k$;\\xCE.\\\" &\\\"/]$;\\u028B/T$;\\xCF.\\\" &\\\"/F$;\\u028B/=$;\\u0109.\\\" &\\\"//$8+:\\u019A+(*)(&%$\\\" )(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u0199\"),peg$decode(\"<%;\\u0275/1#;\\u028B/($8\\\":\\xD1\\\"!!)(\\\"'#&'#=.\\\" 7\\u019B\"),peg$decode(\"<%;\\u024E/C#;\\u028B/:$;\\u0107/1$;\\u028B/($8$:\\u019D$!!)($'#(#'#(\\\"'#&'#=.\\\" 7\\u019C\"),peg$decode(\"<%;\\u0268/C#;\\u028B/:$;\\u0125/1$;\\u028B/($8$:\\u019F$!!)($'#(#'#(\\\"'#&'#=.\\\" 7\\u019E\"),peg$decode(\"%;\\u0127/9#$;\\u01260#*;\\u0126&/)$8\\\":\\u014D\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"%;\\u028B/:#;\\u01DC/1$;\\u0127/($8#:\\u018C#! )(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u01AE/M#;\\u028B/D$;\\u01E6/;$;\\u0128/2$;\\u028B/)$8%:\\u01A1%\\\"$!)(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u01A0\"),peg$decode(\"<;z.. &%;\\u0212/& 8!:\\u01A3! )=.\\\" 7\\u01A2\"),peg$decode(\"<%;\\u012A/\\x80#;\\xF0/w$;\\u028B/n$;\\xDE.\\\" &\\\"/`$;\\xCE.\\\" &\\\"/R$;\\xCF.\\\" &\\\"/D$;\\u028B/;$;\\u0109.\\\" &\\\"/-$8(:\\u01A5(&'&$#\\\" )(('#(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u01A4\"),peg$decode(\"<%;\\u0215/C#;\\u028B/:$;\\u0226/1$;\\u028B/($8$:\\xD1$!#)($'#(#'#(\\\"'#&'#=.\\\" 7\\u01A6\"),peg$decode(\"<;\\u012D.5 &;\\u012E./ &;\\u012F.) &;\\u0130.# &;\\u0131=.\\\" 7\\u01A7\"),peg$decode(\"%;\\u020C/1#;\\u028B/($8\\\":\\xD1\\\"!!)(\\\"'#&'#\"),peg$decode(\"%%<%;\\u012C/>#;\\u0230./ &;\\u0272.) &;\\u0279.# &;\\u027A/#$+\\\")(\\\"'#&'#=.##&&!&'#/1#;\\u0132/($8\\\":\\u018C\\\"! )(\\\"'#&'#\"),peg$decode(\"%%<%;\\u012C/>#;\\u026C./ &;\\u0272.) &;\\u0279.# &;\\u027A/#$+\\\")(\\\"'#&'#=.##&&!&'#/1#;\\u0173/($8\\\":\\u018C\\\"! )(\\\"'#&'#\"),peg$decode(\"%%<%;\\u012C/>#;\\u026C./ &;\\u0230.) &;\\u0279.# &;\\u027A/#$+\\\")(\\\"'#&'#=.##&&!&'#/1#;\\u0177/($8\\\":\\u018C\\\"! )(\\\"'#&'#\"),peg$decode(\"%%<%;\\u012C/>#;\\u026C./ &;\\u0230.) &;\\u0272.# &;\\u027A/#$+\\\")(\\\"'#&'#=.##&&!&'#/1#;\\u0186/($8\\\":\\u018C\\\"! )(\\\"'#&'#\"),peg$decode(\"%%<%;\\u012C/>#;\\u026C./ &;\\u0230.) &;\\u0272.# &;\\u0279/#$+\\\")(\\\"'#&'#=.##&&!&'#/1#;\\u018A/($8\\\":\\u018C\\\"! )(\\\"'#&'#\"),peg$decode(\"<%;\\u0133/T#;\\u0135.\\\" &\\\"/F$;\\u01AC/=$;\\u028B/4$;\\u0136/+$8%:\\u01A9%$$#\\\" )(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u01A8\"),peg$decode(\"%;\\u012C/J#;\\u0134.\\\" &\\\"/<$;\\u026C/3$;\\u028B/*$8$:\\u01AA$##\\\"!)($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u026E.# &;\\u026D/1#;\\u028B/($8\\\":\\u01AB\\\"!!)(\\\"'#&'#\"),peg$decode(\"<%;\\u022B/N#;\\u028B/E$;u/<$;\\u0220/3$;\\u028B/*$8%:\\u01AD%#$\\\"!)(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u01AC\"),peg$decode(\";\\u0137.# &;\\u0172\"),peg$decode(\"<%;\\u01DA/Z#;\\u0139/Q$$;\\u013B0#*;\\u013B&/A$;\\u01DB/8$;\\u0138.\\\" &\\\"/*$8%:\\u01AF%##\\\" )(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u01AE\"),peg$decode(\"%;\\u027F/D#;\\u028B/;$;\\u0265/2$;\\u028B/)$8$:\\u01B0$\\\"#!)($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u013C/B#;\\u028B/9$$;\\u013A0#*;\\u013A&/)$8#:\\u014D#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01DC/:#;\\u013C/1$;\\u028B/($8#:\\xCB#!!)(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01DC.\\\" &\\\"/1#;\\u0150/($8\\\":\\u01B1\\\"! )(\\\"'#&'#\"),peg$decode(\"<%;\\u013D/O#;\\u028B/F$;\\u013E.\\\" &\\\"/8$;\\u013F.\\\" &\\\"/*$8$:\\u01B3$##! )($'#(#'#(\\\"'#&'#=.\\\" 7\\u01B2\"),peg$decode(\"%;\\u01CF/=#%<;\\u028B=/##&'!&&#/($8\\\":v\\\"!!)(\\\"'#&'#.\\\\ &%%<;\\u013E.) &;\\u0141.# &;\\u0150=.##&&!&'#/:#;\\u028B/1$;\\u01D2/($8#:v#! )(#'#(\\\"'#&'#\"),peg$decode(\"<%;&/1#;\\u028B/($8\\\":\\u01B5\\\"!!)(\\\"'#&'#=.\\\" 7\\u01B4\"),peg$decode(\"%;\\u0141/B#$;\\u01400#*;\\u0140&/2$;\\u028B/)$8#:\\u014D#\\\"\\\"!)(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u028B/1#;\\u0141/($8\\\":\\u018C\\\"! )(\\\"'#&'#\"),peg$decode(\"<%;\\u0142.\\\" &\\\"/A#;\\u0144/8$;\\u0142.\\\" &\\\"/*$8#:\\u01B7##\\\"! )(#'#(\\\"'#&'#=.\\\" 7\\u01B6\"),peg$decode(\"%$;\\u0143/�#*;\\u0143&&&#/' 8!:\\u01B8!! )\"),peg$decode(\"<%;\\u020B/C#;\\u028B/:$;\\u01CF/1$;\\u028B/($8$:\\u01BA$!!)($'#(#'#(\\\"'#&'#=.\\\" 7\\u01B9\"),peg$decode(\";\\u0146.; &;\\u0149.5 &;\\u014C./ &;\\u014D.) &;\\u014F.# &;\\u0145\"),peg$decode(\"<%;\\u0165/' 8!:\\u01BC!! )=.\\\" 7\\u01BB\"),peg$decode(\"<%;\\u0147/U#;\\u015F.\\\" &\\\"/G$;\\u0160.\\\" &\\\"/9$;\\u0148.\\\" &\\\"/+$8$:\\u01BE$$#\\\"! )($'#(#'#(\\\"'#&'#=.\\\" 7\\u01BD\"),peg$decode(\"<%;\\u0255.# &;\\u0254/D#;\\u028B/;$;\\u023B/2$;\\u028B/)$8$:\\u01C0$\\\"#!)($'#(#'#(\\\"'#&'#=.\\\" 7\\u01BF\"),peg$decode(\"<%;\\u01FE/1#;\\u028B/($8\\\":\\u01C2\\\"!!)(\\\"'#&'#=.\\\" 7\\u01C1\"),peg$decode(\"%;\\u014A/@#;\\u0160.\\\" &\\\"/2$;\\u028B/)$8#:\\u01C3#\\\"\\\"!)(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u014B.# &;\\u0274/1#;\\u028B/($8\\\":\\u0160\\\"!!)(\\\"'#&'#=.\\\" 7\\u01C4\"),peg$decode(\"<%;u.\\\" &\\\"/2#;\\u0248/)$8\\\":\\u01C6\\\"\\\"! )(\\\"'#&'#=.\\\" 7\\u01C5\"),peg$decode(\"<;\\u0162=.\\\" 7\\u01C7\"),peg$decode(\"<%;\\u0212/D#;\\u028B/;$;\\u014E/2$;\\u028B/)$8$:\\u01C9$\\\"#!)($'#(#'#(\\\"'#&'#=.\\\" 7\\u01C8\"),peg$decode(\";O./ &;8.) &;..# &;6\"),peg$decode(\"<%;\\u015D/' 8!:\\u01CB!! )=.\\\" 7\\u01CA\"),peg$decode(\"<%;\\u0142.\\\" &\\\"/J#;\\u0151/A$;\\u028B/8$;\\u0142.\\\" &\\\"/*$8$:\\u01CD$##\\\" )($'#(#'#(\\\"'#&'#=.\\\" 7\\u01CC\"),peg$decode(\";\\u0163.) &;\\u0153.# &;\\u0152\"),peg$decode(\"<%;\\u0162/' 8!:\\u01CF!! )=.\\\" 7\\u01CE\"),peg$decode(\"<%;\\u0154/J#;\\u028B/A$;\\u0159/8$;\\u0160.\\\" &\\\"/*$8$:\\u01D1$##! )($'#(#'#(\\\"'#&'#=.\\\" 7\\u01D0\"),peg$decode(\"%;\\u0155.# &;\\u0156/1#;\\u028B/($8\\\":\\u01D2\\\"!!)(\\\"'#&'#\"),peg$decode(\"<%;\\u0255/;#;\\u028B/2$;\\u023B/)$8#:\\u01D3#\\\"\\\" )(#'#(\\\"'#&'#=.\\\" 7\\u01BF\"),peg$decode(\"<%;\\u0274/' 8!:\\u01D5!! )=.\\\" 7\\u01D4\"),peg$decode(\"%;\\u01DA/T#;\\u015B/K$;\\u028B/B$$;\\u015A0#*;\\u015A&/2$;\\u01DB/)$8%:\\u01D6%\\\"#!)(%'#($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u0157/' 8!:\\u01D7!! )\"),peg$decode(\"%;\\u0157/' 8!:\\u01D8!! )\"),peg$decode(\"%;\\u01DC/:#;\\u015B/1$;\\u028B/($8#:\\u018C#!!)(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u015C/O#;\\u028B/F$;\\u015F.\\\" &\\\"/8$;\\u0148.\\\" &\\\"/*$8$:\\u01DA$##! )($'#(#'#(\\\"'#&'#=.\\\" 7\\u01D9\"),peg$decode(\"%;\\u0117/\\\\#%<%;\\u028B/8#;\\u01ED.) &;\\u01DB.# &;\\u015F/#$+\\\")(\\\"'#&'#=/##&'!&&#/($8\\\":v\\\"!!)(\\\"'#&'#.# &;z\"),peg$decode(\"<%$;\\u015E/�#*;\\u015E&&&#/' 8!:\\u01DC!! )=.\\\" 7\\u01DB\"),peg$decode(\"%;\\u0207/C#;\\u028B/:$;\\u01BA/1$;\\u028B/($8$:v$!!)($'#(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u01FC.# &;\\u0216/1#;\\u028B/($8\\\":\\u01DE\\\"!!)(\\\"'#&'#=.\\\" 7\\u01DD\"),peg$decode(\"%;\\u0161/;#;\\u0107/2$;\\u028B/)$8#:\\u01DF#\\\"\\\"!)(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u024C/D#;\\u028B/;$;\\u020A/2$;\\u028B/)$8$:\\u01E1$\\\"#!)($'#(#'#(\\\"'#&'#=.\\\" 7\\u01E0\"),peg$decode(\"%;\\u0206/;#;\\u028B/2$;O/)$8#:\\u01E2#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u0164/E#;\\u0115/<$;\\u0165/3$;\\u028B/*$8$:\\u01E4$##\\\"!)($'#(#'#(\\\"'#&'#=.\\\" 7\\u01E3\"),peg$decode(\"<%;\\u0225/D#;\\u028B/;$;\\u023B/2$;\\u028B/)$8$:\\u01E6$\\\"#!)($'#(#'#(\\\"'#&'#=.\\\" 7\\u01E5\"),peg$decode(\"%;\\u0166/F#;\\u0167.\\\" &\\\"/8$;\\u0170.\\\" &\\\"/*$8#:\\u01E7##\\\"! )(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u025A/D#;\\u028B/;$;\\u01C1/2$;\\u028B/)$8$:\\u01E9$\\\"#!)($'#(#'#(\\\"'#&'#=.\\\" 7\\u01E8\"),peg$decode(\"%;\\u0169/B#;\\u028B/9$$;\\u01680#*;\\u0168&/)$8#:\\u01EA#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u0169/1#;\\u028B/($8\\\":\\u0198\\\"!!)(\\\"'#&'#\"),peg$decode(\"<;\\u016A.# &;\\u016F=.\\\" 7\\u01EB\"),peg$decode(\"%;\\u024C/T#;\\u028B/K$;\\u0215.# &;\\u0275/<$;\\u028B/3$;\\u016B/*$8%:\\u01EC%#$\\\" )(%'#($'#(#'#(\\\"'#&'#\"),peg$decode(\"<;\\u016C.) &;\\u016D.# &;\\u016E=.\\\" 7\\u01ED\"),peg$decode(\"%;\\u0268/J#;\\u028B/A$;\\u0248.# &;\\u0212/2$;\\u028B/)$8$:\\u01EE$\\\"#!)($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u0203.# &;\\u0260/1#;\\u028B/($8\\\":\\u01EF\\\"!!)(\\\"'#&'#\"),peg$decode(\"%;\\u0244/D#;\\u028B/;$;\\u01F3/2$;\\u028B/)$8$:\\u01F0$\\\"#!)($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u0242/D#;\\u028B/;$;\\u01CF/2$;\\u028B/)$8$:\\u01F1$\\\"#!)($'#(#'#(\\\"'#&'#\"),peg$decode(\"<%;u.\\\" &\\\"/J#;\\u0213/A$;\\u028B/8$;\\u0171.\\\" &\\\"/*$8$:\\u01F3$##\\\" )($'#(#'#(\\\"'#&'#=.\\\" 7\\u01F2\"),peg$decode(\"%;\\u0232/J#;\\u028B/A$;\\u0214.# &;\\u022E/2$;\\u028B/)$8$:\\u01F4$\\\"#!)($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u0189/' 8!:\\u01F5!! )\"),peg$decode(\"<%;\\u0174/c#;\\u0135.\\\" &\\\"/U$;\\u01BC/L$;\\u028B/C$;\\u0176/:$;\\xDE.\\\" &\\\"/,$8&:\\u01F7&%%$#! )(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u01F6\"),peg$decode(\"%;\\u012C/J#;\\u0175.\\\" &\\\"/<$;\\u0230/3$;\\u028B/*$8$:\\u01F8$##\\\"!)($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u0274/1#;\\u028B/($8\\\":\\u01F9\\\"!!)(\\\"'#&'#\"),peg$decode(\"<%;\\u024C/N#;\\u028B/E$;\\u01AC/<$;\\u028B/3$;\\u0158/*$8%:\\u01FB%#$\\\" )(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u01FA\"),peg$decode(\"<%;\\u0178/\\xA6#;\\u0135.\\\" &\\\"/\\x98$;\\u01BD.\\\" &\\\"/\\x8A$;\\u028B/\\x81$;\\u0179/x$;\\u024C/o$;\\u028B/f$;\\u01AC/]$;\\u028B/T$;\\u0181.\\\" &\\\"/F$;\\u0182.\\\" &\\\"/8$;\\u0183//$8,:\\u01FD,(+*)'$\\\"! )(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u01FC\"),peg$decode(\"%;\\u012C/J#;\\u0134.\\\" &\\\"/<$;\\u0272/3$;\\u028B/*$8$:\\u01FE$##\\\"!)($'#(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u017A.\\\" &\\\"/2#;\\u017C/)$8\\\":\\u0200\\\"\\\"! )(\\\"'#&'#=.\\\" 7\\u01FF\"),peg$decode(\"%;\\u01FF.) &;\\u01F5.# &;\\u017B/1#;\\u028B/($8\\\":\\u0201\\\"!!)(\\\"'#&'#\"),peg$decode(\"%;\\u0235/;#;\\u028B/2$;\\u024A/)$8#:\\u0202#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"<;\\u017D.# &;\\u017E=.\\\" 7\\u0203\"),peg$decode(\"%;\\u0215.# &;\\u0234/1#;\\u028B/($8\\\":\\u0204\\\"!!)(\\\"'#&'#\"),peg$decode(\"%;\\u0275/@#;\\u028B/7$;\\u017F.\\\" &\\\"/)$8#:\\u0205#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u024A/;#;\\u028B/2$;\\u0180/)$8#:\\u0206#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u0117/B#;\\u028B/9$$;\\u01160#*;\\u0116&/)$8#:\\u014D#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u0224/c#;\\u028B/Z$;\\u021A/Q$;\\u028B/H$;\\u0264.) &3\\u0207\\\"\\\"5)7\\u0208/3$;\\u028B/*$8&:\\u0209&#%#!)(&'#(%'#($'#(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u027B/D#;\\u028B/;$;z/2$;\\u028B/)$8$:\\u020A$\\\"#!)($'#(#'#(\\\"'#&'#=.\\\" 7\\x97\"),peg$decode(\"<%;\\u0200/W#;\\u028B/N$;\\u0184/E$;\\u028B/<$;\\u021C/3$;\\u028B/*$8&:\\u020C&#%#!)(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u020B\"),peg$decode(\"%$;\\u0185/�#*;\\u0185&&&#/' 8!:\\u020D!! )\"),peg$decode(\"%;\\x9C/:#;\\u028B/1$;$/($8#:\\\"#!\\\")(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u0188/T#;\\u0135.\\\" &\\\"/F$;\\u0187/=$;\\u028B/4$;\\u0189/+$8%:\\u020F%$$#\\\" )(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u020E\"),peg$decode(\"%;\\u01BE/;#;\\u028B/2$;\\u0115/)$8#:\\u0210#\\\"\\\" )(#'#(\\\"'#&'#.# &;\\u01BE\"),peg$decode(\"%;\\u012C/J#;\\u0134.\\\" &\\\"/<$;\\u0279/3$;\\u028B/*$8$:\\u0211$##\\\"!)($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01FB/D#;\\u028B/;$;\\xC0/2$;\\u028B/)$8$:\\u018F$\\\"#!)($'#(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u018B/f#;\\u0135.\\\" &\\\"/X$;\\u01AC/O$;\\u028B/F$;\\u0276/=$;\\u028B/4$;\\u018C/+$8':\\u0213'$&%$ )(''#(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u0212\"),peg$decode(\"%;\\u012C/N#;\\u027A/E$;\\u028B/<$;\\u026C/3$;\\u028B/*$8%:\\u0214%#$#!)(%'#($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01D1/@#;\\u028B/7$;\\u018D.\\\" &\\\"/)$8#:\\u0215#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u01DA/Z#;\\u028B/Q$;\\u018E.\\\" &\\\"/C$;\\u028B/:$;\\u01DB/1$;\\u028B/($8&:\\u0217&!#)(&'#(%'#($'#(#'#(\\\"'#&'#=.\\\" 7\\u0216\"),peg$decode(\"%;\\u0190/9#$;\\u018F0#*;\\u018F&/)$8\\\":\\u0218\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"%;\\u028B/H#;\\u01DC/?$;\\u028B/6$;\\u0190.\\\" &\\\"/($8$:x$! )($'#(#'#(\\\"'#&'#\"),peg$decode(\"%%<%;\\u01CF/;#;\\u028B/2$;&.# &;\\u0141/#$+#)(#'#(\\\"'#&'#=.##&&!&'#/:#;z/1$;\\u028B/($8#:\\u0192#!!)(#'#(\\\"'#&'#.x &%;\\u0191/n#%%<;\\u01CD=.##&&!&'#/,#;\\u028B/#$+\\\")(\\\"'#&'#/F$;\\u013E.\\\" &\\\"/8$;\\u013F.\\\" &\\\"/*$8$:\\u01B3$##! )($'#(#'#(\\\"'#&'#\"),peg$decode(\";\\u01CF.# &;\\u01D2\"),peg$decode(\"<%;\\u0193/;#;\\u01AC/2$;\\u028B/)$8#:\\u021A#\\\"\\\"!)(#'#(\\\"'#&'#=.\\\" 7\\u0219\"),peg$decode(\"<%;\\u0219/J#;\\u028B/A$;\\u0194/8$;\\u0195.\\\" &\\\"/*$8$:\\u021C$##! )($'#(#'#(\\\"'#&'#=.\\\" 7\\u021B\"),peg$decode(\"<%;\\u026C./ &;\\u0230.) &;\\u0272.# &;\\u0279/1#;\\u028B/($8\\\":\\u0160\\\"!!)(\\\"'#&'#=.\\\" 7\\u021D\"),peg$decode(\"<%;\\u022B/D#;\\u028B/;$;\\u0220/2$;\\u028B/)$8$:\\u021F$\\\"#!)($'#(#'#(\\\"'#&'#=.\\\" 7\\u021E\"),peg$decode(\"<%;\\u01E8/,#;\\u01E8/#$+\\\")(\\\"'#&'#=.\\\" 7\\u0220\"),peg$decode(\"<;\\u01E4=.\\\" 7\\u0221\"),peg$decode(\"<;\\u01E5=.\\\" 7\\u0222\"),peg$decode(\"<;\\u01DE=.\\\" 7\\u0223\"),peg$decode(\"<;\\u01EF=.\\\" 7\\u0224\"),peg$decode(\"<;\\u01E9=.\\\" 7\\u0225\"),peg$decode(\"<%;\\u01EA/,#;\\u01EA/#$+\\\")(\\\"'#&'#=.\\\" 7\\u0226\"),peg$decode(\"<%;\\u01EB/,#;\\u01EB/#$+\\\")(\\\"'#&'#=.\\\" 7\\u0227\"),peg$decode(\"<;\\u01E7=.\\\" 7\\u0228\"),peg$decode(\"<;\\u01E8=.\\\" 7\\u0229\"),peg$decode(\"<;\\u01EA=.\\\" 7\\u022A\"),peg$decode(\"<;\\u01EB=.\\\" 7\\u022B\"),peg$decode(\"<%;\\u01EA/,#;\\u01E6/#$+\\\")(\\\"'#&'#=.\\\" 7\\u022C\"),peg$decode(\"<%;\\u01EB/,#;\\u01E6/#$+\\\")(\\\"'#&'#=.\\\" 7\\u022D\"),peg$decode(\"<%;\\u01E6/1#;\\u01E6.\\\" &\\\"/#$+\\\")(\\\"'#&'#=.\\\" 7\\u022E\"),peg$decode(\"<%;\\u01EC/,#;\\u01E6/#$+\\\")(\\\"'#&'#=.\\\" 7\\u022F\"),peg$decode(\"<%;\\u01EA/,#;\\u01EB/#$+\\\")(\\\"'#&'#=.\\\" 7\\u022F\"),peg$decode(\"<%$;\\u01F1/�#*;\\u01F1&&&#/<#9:\\u0231 ! -\\\"\\\"&!&#/($8\\\":\\u0232\\\"!!)(\\\"'#&'#=.\\\" 7\\u0230\"),peg$decode(\"<%;\\u0238/@#;\\u028B/7$;u.\\\" &\\\"/)$8#:\\u0234#\\\"\\\" )(#'#(\\\"'#&'#=.\\\" 7\\u0233\"),peg$decode(\"<;\\u01CF.# &;\\u01D2=.\\\" 7\\u0235\"),peg$decode(\"<%;\\u01A9/' 8!:\\u0237!! )=.\\\" 7\\u0236\"),peg$decode(\"<%;\\u01AD.\\\" &\\\"/2#;\\u01A9/)$8\\\":\\u0239\\\"\\\"! )(\\\"'#&'#=.\\\" 7\\u0238\"),peg$decode(\"<%;\\u01AD.\\\" &\\\"/2#;\\u01A9/)$8\\\":\\u023B\\\"\\\"! )(\\\"'#&'#=.\\\" 7\\u023A\"),peg$decode(\"%;\\u01A9/2#;\\u01DD/)$8\\\":\\u023C\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"<%;\\u01B8.) &;\\u01B9.# &;\\u01B7/J#;\\u01A9/A$;\\u028B/8$;\\u01AF.\\\" &\\\"/*$8$:\\u023E$##\\\" )($'#(#'#(\\\"'#&'#=.\\\" 7\\u023D\"),peg$decode(\"<%;\\u01B0/' 8!:\\u0240!! )=.\\\" 7\\u023F\"),peg$decode(\"%;\\u01B1/B#;\\u028B/9$$;\\u01B10#*;\\u01B1&/)$8#:\\u0241#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\";\\u01B2.) &;\\u01B3.# &;\\u01B4\"),peg$decode(\"%;\\u01DD/:#;\\u028B/1$;\\u01CF/($8#:\\u0242#! )(#'#(\\\"'#&'#.D &%;\\u01DD/:#;\\u028B/1$;\\u01DE/($8#:\\u0243#! )(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01D8/r#;\\u028B/i$;\\u01B5.\\\" &\\\"/[$;\\u01EE/R$;\\u028B/I$;\\u01B6.\\\" &\\\"/;$;\\u028B/2$;\\u01D9/)$8(:\\u0244(\\\"%\\\")(('#(''#(&'#(%'#($'#(#'#(\\\"'#&'#.m &%;\\u01D8/c#;\\u028B/Z$;\\u01EE/Q$;\\u028B/H$;\\u01B6.\\\" &\\\"/:$;\\u028B/1$;\\u01D9/($8':\\u0245'!\\\")(''#(&'#(%'#($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;\\u01D8/L#;\\u028B/C$;z/:$;\\u028B/1$;\\u01D9/($8%:\\u0246%!\\\")(%'#($'#(#'#(\\\"'#&'#\"),peg$decode(\"%;z/' 8!:\\u0247!! )\"),peg$decode(\"%;z/' 8!:\\u0248!! )\"),peg$decode(\"%;\\u028B/& 8!:\\u0249! )\"),peg$decode(\"%;\\u01AD/2#;\\u01B9/)$8\\\":\\u024A\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"%;\\u01A9/2#;\\u01DD/)$8\\\":J\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"<%;\\u01A9/' 8!:\\u024C!! )=.\\\" 7\\u024B\"),peg$decode(\"<%;\\u01A9/' 8!:\\u024E!! )=.\\\" 7\\u024D\"),peg$decode(\"<%;\\u01AD.\\\" &\\\"/2#;\\u01A9/)$8\\\":\\u0250\\\"\\\"! )(\\\"'#&'#=.\\\" 7\\u024F\"),peg$decode(\"<%;\\u01AD.\\\" &\\\"/2#;\\u01A9/)$8\\\":\\u0252\\\"\\\"! )(\\\"'#&'#=.\\\" 7\\u0251\"),peg$decode(\"<%;\\u01AD.\\\" &\\\"/2#;\\u01A9/)$8\\\":\\u0254\\\"\\\"! )(\\\"'#&'#=.\\\" 7\\u0253\"),peg$decode(\"<%;\\u01AD.\\\" &\\\"/2#;\\u01A9/)$8\\\":\\u0256\\\"\\\"! )(\\\"'#&'#=.\\\" 7\\u0255\"),peg$decode(\"<%;\\u01AD.\\\" &\\\"/2#;\\u01A9/)$8\\\":\\u0258\\\"\\\"! )(\\\"'#&'#=.\\\" 7\\u0257\"),peg$decode(\"<%;\\u01C2.# &;\\u01AC/1#;\\u028B/($8\\\":\\u025A\\\"!!)(\\\"'#&'#=.\\\" 7\\u0259\"),peg$decode(\"%;\\u01AC/;#;\\u028B/2$;\\u0115/)$8#:\\u025B#\\\"\\\" )(#'#(\\\"'#&'#\"),peg$decode(\"<%;\\u01A9/' 8!:\\u025D!! )=.\\\" 7\\u025C\"),peg$decode(\"<%;\\u01A9/' 8!:\\u025F!! )=.\\\" 7\\u025E\"),peg$decode(\"<%;\\u01C6/=#%<;\\u01CD=.##&&!&'#/($8\\\":\\u0261\\\"!!)(\\\"'#&'#.\\xC5 &%;\\u01C7/=#%<;\\u01CD=.##&&!&'#/($8\\\":\\u0262\\\"!!)(\\\"'#&'#.\\x9B &%;\\u01C9/=#%<;\\u01CD=.##&&!&'#/($8\\\":\\u0263\\\"!!)(\\\"'#&'#.q &%;\\u01CA/=#%<;\\u01CD=.##&&!&'#/($8\\\":\\u0264\\\"!!)(\\\"'#&'#.G &%;\\u01CC/=#%<;\\u01CD=.##&&!&'#/($8\\\":\\u0265\\\"!!)(\\\"'#&'#=.\\\" 7\\u0260\"),peg$decode(\"<%%3\\u0267\\\"\\\"5!7\\u0268.\\\" &\\\"/F#3\\u0269\\\"\\\"5#7\\u026A.\\\" &\\\"/2$3\\u026B\\\"\\\"5$7\\u026C/#$+#)(#'#(\\\"'#&'#.k &%3\\u026D\\\"\\\"5$7\\u026E.5 &3\\u026F\\\"\\\"5&7\\u0270.) &3\\u0271\\\"\\\"5$7\\u0272.\\\" &\\\"/2#3\\u0273\\\"\\\"5$7\\u0274/#$+\\\")(\\\"'#&'#.) &3\\u0275\\\"\\\"5$7\\u0276/' 8!:\\u0160!! )=.\\\" 7\\u0266\"),peg$decode(\"<%;\\u01C8.5 &3\\u0278\\\"\\\"5%7\\u0279.) &3\\u027A\\\"\\\"5$7\\u027B/' 8!:\\u0160!! )=.\\\" 7\\u0277\"),peg$decode(\"<%3\\u027D\\\"\\\"5&7\\u027E/i#%$4,\\\"\\\"5!7-/,#0)*4,\\\"\\\"5!7-&&&#/2#3\\u027F\\\"\\\"5)7\\u0280/#$+\\\")(\\\"'#&'#.\\\" &\\\"/)$8\\\":\\u0281\\\"\\\"! )(\\\"'#&'#=.\\\" 7\\u027C\"),peg$decode(\"<%3\\u0283\\\"\\\"5'7\\u0284.\\x95 &3\\u0285\\\"\\\"5'7\\u0286.\\x89 &3\\u0287\\\"\\\"5'7\\u0288.} &%3\\u0289\\\"\\\"5$7\\u028A/7#3\\xF6\\\"\\\"5$7\\xF7.\\\" &\\\"/#$+\\\")(\\\"'#&'#.S &%3\\xF6\\\"\\\"5$7\\xF7/7#3\\u028B\\\"\\\"5%7\\u028C.\\\" &\\\"/#$+\\\")(\\\"'#&'#.) &3\\u028D\\\"\\\"5&7\\u028E/' 8!:\\u0160!! )=.\\\" 7\\u0282\"),peg$decode(\"<%%3\\u0290\\\"\\\"5#7\\u0291/V#2\\u0292\\\"\\\"6\\u02927\\u0293.A &2\\u0294\\\"\\\"6\\u02947\\u0295.5 &2\\u0296\\\"\\\"6\\u02967\\u0297.) &3\\u0298\\\"\\\"5$7\\u0299/#$+\\\")(\\\"'#&'#.q &%3\\u029A\\\"\\\"5#7\\u029B.A &3\\u026F\\\"\\\"5&7\\u0270.5 &3\\u029C\\\"\\\"5%7\\u029D.) &3\\u026D\\\"\\\"5$7\\u026E.\\\" &\\\"/2#3\\u0290\\\"\\\"5#7\\u0291/#$+\\\")(\\\"'#&'#.# &;\\u01CB/' 8!:\\u0160!! )=.\\\" 7\\u028F\"),peg$decode(\"%3\\u029E\\\"\\\"5(7\\u029F/d#%$4,\\\"\\\"5!7-/,#0)*4,\\\"\\\"5!7-&&&#/2#3\\u02A0\\\"\\\"5%7\\u02A1/#$+\\\")(\\\"'#&'#/)$8\\\":\\u02A2\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\"<%3\\u02A4\\\"\\\"5$7\\u02A5/' 8!:\\u0160!! )=.\\\" 7\\u02A3\"),peg$decode(\"4\\u02A6\\\"\\\"5!7\\u02A7\"),peg$decode(\"%2\\u02A8\\\"\\\"6\\u02A87\\u02A9/K#$4\\u02AA\\\"\\\"5!7\\u02AB/,#0)*4\\u02AA\\\"\\\"5!7\\u02AB&&&#/)$8\\\":\\u02AC\\\"\\\"! )(\\\"'#&'#\"),peg$decode(\";\\u01D0.# &;\\u01D1\"),peg$decode(\";\\u01D3./ &;\\u01D7.) &;\\u01D5.# &;\\u01D6\"),peg$decode(\"%%<;\\u0280.# &;A=.##&&!&'#/J#$;\\u01CE.# &;\\u01CD/,#0)*;\\u01CE.# &;\\u01CD&&&#/($8\\\":\\u0118\\\"! )(\\\"'#&'#\"),peg$decode(\"%%<;\\u0282.# &;A=.##&&!&'#/J#$;\\u01CE.# &;\\u01CD/,#0)*;\\u01CE.# &;\\u01CD&&&#/($8\\\":\\u02AD\\\"! )(\\\"'#&'#\"),peg$decode(\"%;\\u01D8/\\x99#;\\u028B/\\x90$%$%%<;\\u01D4=.##&&!&'#/1#1\\\"\\\"5!7\\u02AE/#$+\\\")(\\\"'#&'#0G*%%<;\\u01D4=.##&&!&'#/1#1\\\"\\\"5!7\\u02AE/#$+\\\")(\\\"'#&'#&/\\\"!&,)/1$;\\u01D4/($8$:\\u02AF$!!)($'#(#'#(\\\"'#&'#\"),peg$decode(\"%$4\\u02B0\\\"\\\"5!7\\u02B10)*4\\u02B0\\\"\\\"5!7\\u02B1&/5#;\\u01D9/,$;\\u028B/#$+#)(#'#(\\\"'#&'#\"),peg$decode(\"%2\\u02B2\\\"\\\"6\\u02B27\\u02B3/k#$2\\u02B4\\\"\\\"6\\u02B47\\u02B5.) &4\\u02B6\\\"\\\"5!7\\u02B705*2\\u02B4\\\"\\\"6\\u02B47\\u02B5.) &4\\u02B6\\\"\\\"5!7\\u02B7&/7$2\\u02B2\\\"\\\"6\\u02B27\\u02B3/($8#:\\u02B8#!!)(#'#(\\\"'#&'#\"),peg$decode(\"%2\\u02B9\\\"\\\"6\\u02B97\\u02BA/k#$2:\\\"\\\"6:7;.) &4<\\\"\\\"5!7=05*2:\\\"\\\"6:7;.) &4<\\\"\\\"5!7=&/7$2\\u02B9\\\"\\\"6\\u02B97\\u02BA/($8#:\\u02BB#!!)(#'#(\\\"'#&'#\"),peg$decode(\"%2\\u02BC\\\"\\\"6\\u02BC7\\u02BD/k#$2\\u02BE\\\"\\\"6\\u02BE7\\u02BF.) &4\\u02C0\\\"\\\"5!7\\u02C105*2\\u02BE\\\"\\\"6\\u02BE7\\u02BF.) &4\\u02C0\\\"\\\"5!7\\u02C1&/7$2\\u02BC\\\"\\\"6\\u02BC7\\u02BD/($8#:\\u02C2#!!)(#'#(\\\"'#&'#\"),peg$decode(\"<%2\\u02C4\\\"\\\"6\\u02C47\\u02C5/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02C3\"),peg$decode(\"<%2\\u02C7\\\"\\\"6\\u02C77\\u02C8/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02C6\"),peg$decode(\"<%2\\u02CA\\\"\\\"6\\u02CA7\\u02CB/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02C9\"),peg$decode(\"<%2\\u02CD\\\"\\\"6\\u02CD7\\u02CE/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02CC\"),peg$decode(\"<%2\\u02D0\\\"\\\"6\\u02D07\\u02D1/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02CF\"),peg$decode(\"<%2\\u02D3\\\"\\\"6\\u02D37\\u02D4/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02D2\"),peg$decode(\"<%2\\u02D6\\\"\\\"6\\u02D67\\u02D7/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02D5\"),peg$decode(\"<%2\\u02D9\\\"\\\"6\\u02D97\\u02DA/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02D8\"),peg$decode(\"<%2\\u02B9\\\"\\\"6\\u02B97\\u02BA/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02DB\"),peg$decode(\"<%2\\u02B2\\\"\\\"6\\u02B27\\u02B3/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02DC\"),peg$decode(\"<%2\\u02BC\\\"\\\"6\\u02BC7\\u02BD/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02DD\"),peg$decode(\"<%2\\u02DF\\\"\\\"6\\u02DF7\\u02E0/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02DE\"),peg$decode(\"<%2\\u02E2\\\"\\\"6\\u02E27\\u02E3/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02E1\"),peg$decode(\"<%2\\u02E5\\\"\\\"6\\u02E57\\u02E6/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02E4\"),peg$decode(\"<%2\\u02E7\\\"\\\"6\\u02E77\\u02E8/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u022E\"),peg$decode(\"<%2\\u02EA\\\"\\\"6\\u02EA7\\u02EB/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02E9\"),peg$decode(\"<%2\\u02ED\\\"\\\"6\\u02ED7\\u02EE/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02EC\"),peg$decode(\"<%2\\u02EF\\\"\\\"6\\u02EF7\\u02F0/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u0225\"),peg$decode(\"<%2\\u02F1\\\"\\\"6\\u02F17\\u02F2/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u022A\"),peg$decode(\"<%2\\u02F3\\\"\\\"6\\u02F37\\u02F4/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u022B\"),peg$decode(\"<%2\\u02F6\\\"\\\"6\\u02F67\\u02F7/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02F5\"),peg$decode(\"<%2\\u02F9\\\"\\\"6\\u02F97\\u02FA/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02F8\"),peg$decode(\"<%2g\\\"\\\"6g7h/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02FB\"),peg$decode(\"<%2\\u02FD\\\"\\\"6\\u02FD7\\u02FE/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02FC\"),peg$decode(\"<%2\\u0300\\\"\\\"6\\u03007\\u0301/1#;\\u028B/($8\\\":\\\"\\\"!!)(\\\"'#&'#=.\\\" 7\\u02FF\"),peg$decode(\"<4\\u0303\\\"\\\"5!7\\u0304=.\\\" 7\\u0302\"),peg$decode(\"%3\\u0305\\\"\\\"5%7\\u0306/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0307\\\"\\\"5&7\\u0308/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0309\\\"\\\"5#7\\u030A/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u030B\\\"\\\"5%7\\u030C/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0105\\\"\\\"5#7\\u0106/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u030D\\\"\\\"5%7\\u030E/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u030F\\\"\\\"5'7\\u0310/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0311\\\"\\\"5#7\\u0312/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0313\\\"\\\"5%7\\u0314/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0315\\\"\\\"5\\\"7\\u0316/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0317\\\"\\\"5#7\\u0318/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0319\\\"\\\"5&7\\u031A/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u031B\\\"\\\"5-7\\u031C/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u031D\\\"\\\"5&7\\u031E/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u031F\\\"\\\"5%7\\u0320/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0321\\\"\\\"5'7\\u0322/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0323\\\"\\\"5\\\"7\\u0324/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0325\\\"\\\"5'7\\u0326/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0327\\\"\\\"5$7\\u0328/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0329\\\"\\\"5$7\\u032A/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u032B\\\"\\\"5%7\\u032C/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u032D\\\"\\\"5'7\\u032E/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u032F\\\"\\\"5&7\\u0330/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0331\\\"\\\"5&7\\u0332/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0333\\\"\\\"5(7\\u0334/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0335\\\"\\\"5*7\\u0336/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0337\\\"\\\"5&7\\u0338/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0339\\\"\\\"5%7\\u033A/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u033B\\\"\\\"5,7\\u033C/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u033D\\\"\\\"5,7\\u033E/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u033F\\\"\\\"517\\u0340/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0341\\\"\\\"5(7\\u0342/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0343\\\"\\\"5'7\\u0344/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0345\\\"\\\"5*7\\u0346/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0347\\\"\\\"5(7\\u0348/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0349\\\"\\\"5&7\\u034A/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u034B\\\"\\\"5$7\\u034C/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u034D\\\"\\\"5&7\\u034E/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u034F\\\"\\\"5(7\\u0350/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0351\\\"\\\"5$7\\u0352/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0353\\\"\\\"5$7\\u0354/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0355\\\"\\\"5$7\\u0356/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0357\\\"\\\"5#7\\u0358/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0359\\\"\\\"5&7\\u035A/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u035B\\\"\\\"5&7\\u035C/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u035D\\\"\\\"5)7\\u035E/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u035F\\\"\\\"5&7\\u0360/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0361\\\"\\\"5'7\\u0362/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0363\\\"\\\"5$7\\u0364/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0365\\\"\\\"5%7\\u0366/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0367\\\"\\\"5#7\\u0368/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0369\\\"\\\"5'7\\u036A/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u036B\\\"\\\"5$7\\u036C/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u036D\\\"\\\"5$7\\u036E/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u036F\\\"\\\"5$7\\u0370/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0371\\\"\\\"5%7\\u0372/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0373\\\"\\\"5&7\\u0374/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0375\\\"\\\"5\\\"7\\u0376/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0377\\\"\\\"5&7\\u0378/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0379\\\"\\\"5%7\\u037A/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u037B\\\"\\\"5)7\\u037C/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u037D\\\"\\\"5\\\"7\\u037E/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u037F\\\"\\\"5%7\\u0380/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0381\\\"\\\"5'7\\u0382/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0383\\\"\\\"5)7\\u0384/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0385\\\"\\\"5%7\\u0386/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0387\\\"\\\"5&7\\u0388/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0389\\\"\\\"5'7\\u038A/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u038B\\\"\\\"5)7\\u038C/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u038D\\\"\\\"5$7\\u038E/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u038F\\\"\\\"5\\\"7\\u0390/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0391\\\"\\\"5&7\\u0392/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0393\\\"\\\"5$7\\u0394/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0395\\\"\\\"5#7\\u0396/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0397\\\"\\\"5$7\\u0398/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0399\\\"\\\"5'7\\u039A/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u039B\\\"\\\"5$7\\u039C/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u039D\\\"\\\"5$7\\u039E/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u039F\\\"\\\"5%7\\u03A0/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03A1\\\"\\\"5&7\\u03A2/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03A3\\\"\\\"5%7\\u03A4/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03A5\\\"\\\"5'7\\u03A6/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03A7\\\"\\\"5\\\"7\\u03A8/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03A9\\\"\\\"5#7\\u03AA/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03AB\\\"\\\"5'7\\u03AC/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03AD\\\"\\\"5&7\\u03AE/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\x8C\\\"\\\"5$7\\x8D/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03AF\\\"\\\"5%7\\u03B0/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03B1\\\"\\\"5\\\"7\\u03B2/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03B3\\\"\\\"5&7\\u03B4/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03B5\\\"\\\"5\\\"7\\u03B6/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03B7\\\"\\\"5$7\\u03B8/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03B9\\\"\\\"5\\\"7\\u03BA/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03BB\\\"\\\"5%7\\u03BC/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03BD\\\"\\\"5%7\\u03BE/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03BF\\\"\\\"5$7\\u03C0/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03C1\\\"\\\"5)7\\u03C2/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03C3\\\"\\\"5$7\\u03C4/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03C5\\\"\\\"5&7\\u03C6/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03C7\\\"\\\"5'7\\u03C8/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03C9\\\"\\\"5%7\\u03CA/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03CB\\\"\\\"5%7\\u03CC/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03CD\\\"\\\"5$7\\u03CE/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03CF\\\"\\\"5)7\\u03D0/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03D1\\\"\\\"5*7\\u03D2/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03D3\\\"\\\"5&7\\u03D4/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03D5\\\"\\\"5'7\\u03D6/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03D7\\\"\\\"5'7\\u03D8/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03D9\\\"\\\"5&7\\u03DA/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03DB\\\"\\\"5'7\\u03DC/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03DD\\\"\\\"5(7\\u03DE/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03DF\\\"\\\"5)7\\u03E0/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03E1\\\"\\\"5%7\\u03E2/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03E3\\\"\\\"5(7\\u03E4/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03E5\\\"\\\"5#7\\u03E6/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03E7\\\"\\\"5%7\\u03E8/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03E9\\\"\\\"5)7\\u03EA/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03EB\\\"\\\"5&7\\u03EC/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03ED\\\"\\\"5#7\\u03EE/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03EF\\\"\\\"5%7\\u03F0/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03F1\\\"\\\"5$7\\u03F2/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03F3\\\"\\\"5$7\\u03F4/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03F5\\\"\\\"5%7\\u03F6/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03F7\\\"\\\"5$7\\u03F8/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03F9\\\"\\\"5)7\\u03FA/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03FB\\\"\\\"5$7\\u03FC/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03FD\\\"\\\"5\\\"7\\u03FE/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\xFB\\\"\\\"5+7\\xFC/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u03FF\\\"\\\"5'7\\u0400/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0401\\\"\\\"5%7\\u0402/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0403\\\"\\\"5&7\\u0404/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0405\\\"\\\"5&7\\u0406/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0407\\\"\\\"5%7\\u0408/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0409\\\"\\\"5&7\\u040A/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u040B\\\"\\\"5&7\\u040C/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u040D\\\"\\\"5$7\\u040E/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u040F\\\"\\\"5'7\\u0410/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0411\\\"\\\"5$7\\u0412/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0413\\\"\\\"5%7\\u0414/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0415\\\"\\\"5&7\\u0416/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0417\\\"\\\"5$7\\u0418/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%3\\u0419\\\"\\\"5'7\\u041A/8#%<;\\u01CD=.##&&!&'#/#$+\\\")(\\\"'#&'#\"),peg$decode(\"%;\\u0281/' 8!:\\u041B!! )\"),peg$decode(\";\\u01F2.\\u0353 &;\\u01F3.\\u034D &;\\u01F4.\\u0347 &;\\u01F5.\\u0341 &;\\u01F6.\\u033B &;\\u01F7.\\u0335 &;\\u01F8.\\u032F &;\\u01F9.\\u0329 &;\\u01FA.\\u0323 &;\\u01FB.\\u031D &;\\u01FC.\\u0317 &;\\u01FD.\\u0311 &;\\u01FE.\\u030B &;\\u01FF.\\u0305 &;\\u0200.\\u02FF &;\\u0201.\\u02F9 &;\\u0202.\\u02F3 &;\\u0203.\\u02ED &;\\u0204.\\u02E7 &;\\u0205.\\u02E1 &;\\u0206.\\u02DB &;\\u0207.\\u02D5 &;\\u0208.\\u02CF &;\\u0209.\\u02C9 &;\\u020A.\\u02C3 &;\\u020B.\\u02BD &;\\u020C.\\u02B7 &;\\u020D.\\u02B1 &;\\u020E.\\u02AB &;\\u020F.\\u02A5 &;\\u0210.\\u029F &;\\u0211.\\u0299 &;\\u0212.\\u0293 &;\\u0213.\\u028D &;\\u0214.\\u0287 &;\\u0215.\\u0281 &;\\u0216.\\u027B &;\\u0217.\\u0275 &;\\u0218.\\u026F &;\\u0219.\\u0269 &;\\u021A.\\u0263 &;\\u021B.\\u025D &;\\u021C.\\u0257 &;\\u021D.\\u0251 &;\\u021E.\\u024B &;\\u021F.\\u0245 &;\\u0220.\\u023F &;\\u0221.\\u0239 &;\\u0222.\\u0233 &;\\u0223.\\u022D &;\\u0224.\\u0227 &;\\u0225.\\u0221 &;\\u0226.\\u021B &;\\u0227.\\u0215 &;\\u0228.\\u020F &;\\u0229.\\u0209 &;\\u022A.\\u0203 &;\\u022B.\\u01FD &;\\u022C.\\u01F7 &;\\u022D.\\u01F1 &;\\u022E.\\u01EB &;\\u022F.\\u01E5 &;\\u0230.\\u01DF &;\\u0231.\\u01D9 &;\\u0232.\\u01D3 &;\\u0233.\\u01CD &;\\u0234.\\u01C7 &;\\u0235.\\u01C1 &;\\u0236.\\u01BB &;\\u0237.\\u01B5 &;\\u0238.\\u01AF &;\\u0239.\\u01A9 &;\\u023A.\\u01A3 &;\\u023B.\\u019D &;\\u023C.\\u0197 &;\\u023E.\\u0191 &;\\u023F.\\u018B &;\\u0240.\\u0185 &;\\u0241.\\u017F &;\\u0242.\\u0179 &;\\u0243.\\u0173 &;\\u0244.\\u016D &;\\u0245.\\u0167 &;\\u0246.\\u0161 &;\\u0247.\\u015B &;\\u0248.\\u0155 &;\\u0249.\\u014F &;\\u024A.\\u0149 &;\\u024B.\\u0143 &;\\u024C.\\u013D &;\\u024D.\\u0137 &;\\u024E.\\u0131 &;\\u024F.\\u012B &;\\u0250.\\u0125 &;\\u0251.\\u011F &;\\u0252.\\u0119 &;\\u0253.\\u0113 &;\\u0254.\\u010D &;\\u0255.\\u0107 &;\\u0256.\\u0101 &;\\u0257.\\xFB &;\\u0258.\\xF5 &;\\u0259.\\xEF &;\\u025A.\\xE9 &;\\u025B.\\xE3 &;\\u025C.\\xDD &;\\u025D.\\xD7 &;\\u025E.\\xD1 &;\\u025F.\\xCB &;\\u0260.\\xC5 &;\\u0261.\\xBF &;\\u0262.\\xB9 &;\\u0263.\\xB3 &;\\u0266.\\xAD &;\\u0267.\\xA7 &;\\u0268.\\xA1 &;\\u0269.\\x9B &;\\u026A.\\x95 &;\\u026B.\\x8F &;\\u026C.\\x89 &;\\u026E.\\x83 &;\\u026F.} &;\\u0270.w &;\\u0271.q &;\\u0272.k &;\\u0273.e &;\\u0274._ &;\\u0275.Y &;\\u0276.S &;\\u0277.M &;\\u0278.G &;\\u0279.A &;\\u027A.; &;\\u027B.5 &;\\u027C./ &;\\u027D.) &;\\u027E.# &;\\u027F\"),peg$decode(\";\\u01F4.\\u0167 &;\\u01F6.\\u0161 &;\\u01F7.\\u015B &;\\u01F9.\\u0155 &;\\u01FB.\\u014F &;\\u01FE.\\u0149 &;\\u0201.\\u0143 &;\\u0204.\\u013D &;\\u0206.\\u0137 &;\\u0207.\\u0131 &;\\u0209.\\u012B &;\\u020B.\\u0125 &;\\u020C.\\u011F &;\\u0212.\\u0119 &;\\u0213.\\u0113 &;\\u0215.\\u010D &;\\u0218.\\u0107 &;\\u0219.\\u0101 &;\\u021B.\\xFB &;\\u021D.\\xF5 &;\\u021E.\\xEF &;\\u0220.\\xE9 &;\\u0225.\\xE3 &;\\u0226.\\xDD &;\\u0229.\\xD7 &;\\u022A.\\xD1 &;\\u022F.\\xCB &;\\u0230.\\xC5 &;\\u0234.\\xBF &;\\u0236.\\xB9 &;\\u0237.\\xB3 &;\\u0238.\\xAD &;\\u0239.\\xA7 &;\\u023A.\\xA1 &;\\u0240.\\x9B &;\\u0245.\\x95 &;\\u0246.\\x8F &;\\u0248.\\x89 &;\\u024C.\\x83 &;\\u024E.} &;\\u024F.w &;\\u0255.q &;\\u025A.k &;\\u0267.e &;\\u0268._ &;\\u026C.Y &;\\u026F.S &;\\u0270.M &;\\u0271.G &;\\u0273.A &;\\u0274.; &;\\u0275.5 &;\\u0276./ &;\\u0278.) &;\\u027B.# &;\\u027C\"),peg$decode(\";\\u0284.. &%;\\u0285/& 8!:\\u041C! )\"),peg$decode(\"<%2\\u041E\\\"\\\"6\\u041E7\\u041F/\\x87#$%%<4\\u0420\\\"\\\"5!7\\u0421=.##&&!&'#/1#1\\\"\\\"5!7\\u02AE/#$+\\\")(\\\"'#&'#0M*%%<4\\u0420\\\"\\\"5!7\\u0421=.##&&!&'#/1#1\\\"\\\"5!7\\u02AE/#$+\\\")(\\\"'#&'#&/#$+\\\")(\\\"'#&'#=.\\\" 7\\u041D\"),peg$decode(\"<%;\\u0286/5#;\\u028A/,$;\\u0287/#$+#)(#'#(\\\"'#&'#=.\\\" 7\\u0422\"),peg$decode(\"2\\u0423\\\"\\\"6\\u04237\\u0424\"),peg$decode(\"2\\u0425\\\"\\\"6\\u04257\\u0426\"),peg$decode(\"$%%<;\\u0287.# &;\\u0286=.##&&!&'#/1#1\\\"\\\"5!7\\u02AE/#$+\\\")(\\\"'#&'#/P#0M*%%<;\\u0287.# &;\\u0286=.##&&!&'#/1#1\\\"\\\"5!7\\u02AE/#$+\\\")(\\\"'#&'#&&&#\"),peg$decode(\";\\u0288.# &;\\u0285\"),peg$decode(\"%;\\u0289/K#$4\\u0427\\\"\\\"5!7\\u0428.# &;\\u02890/*4\\u0427\\\"\\\"5!7\\u0428.# &;\\u0289&/#$+\\\")(\\\"'#&'#\"),peg$decode(\"<%$4\\u0427\\\"\\\"5!7\\u0428.# &;\\u02830/*4\\u0427\\\"\\\"5!7\\u0428.# &;\\u0283&/' 8!:1!! )=.\\\" 7\\u0429\"),peg$decode(\"2\\u042A\\\"\\\"6\\u042A7\\u042B\")];var peg$currPos=0;var peg$savedPos=0;var peg$posDetailsCache=[{line:1,column:1}];var peg$maxFailPos=0;var peg$maxFailExpected=[];var peg$silentFails=0;var peg$resultsCache={};var peg$ruleNames=[\"start\",\"start_streaming\",\"stmt_list\",\"semi_optional\",\"semi_required\",\"stmt_list_tail\",\"type_definition\",\"array_bounds\",\"array_bound\",\"type_definition_types\",\"datatype_custom\",\"datatype_word_tail\",\"type_definition_args\",\"definition_args_loop\",\"literal_value\",\"literal_null\",\"literal_date\",\"literal_string\",\"literal_string_single\",\"literal_string_schar\",\"literal_blob\",\"literal_typed\",\"literal_text\",\"number_sign\",\"literal_number_signed\",\"literal_number\",\"literal_number_decimal\",\"number_decimal_node\",\"number_decimal_full\",\"number_decimal_fraction\",\"number_decimal_exponent\",\"literal_number_hex\",\"number_hex\",\"number_digit\",\"bind_parameter\",\"bind_parameter_numbered\",\"bind_number_id\",\"bind_parameter_named\",\"bind_parameter_tcl\",\"tcl_suffix\",\"expression_exists\",\"expression_exists_ne\",\"expression_raise\",\"expression_raise_args\",\"raise_args_ignore\",\"raise_args_message\",\"expression_root\",\"expression_wrapped\",\"expression_recur\",\"expression_array\",\"expression_array_select\",\"array_expr\",\"array_expr_list\",\"array_expr_tail\",\"expression_unary_collate\",\"expression_pg_cast\",\"expression_unary\",\"expression_unary_op\",\"expression_collate\",\"expression_concat\",\"expression_multiply\",\"expression_multiply_op\",\"expression_add\",\"expression_add_op\",\"expression_shift\",\"expression_shift_op\",\"expression_compare\",\"expression_compare_op\",\"expression_equiv\",\"expression_equiv_tails\",\"expression_equiv_null_op\",\"expression_equiv_op\",\"expression_cast\",\"type_alias\",\"expression_case\",\"case_expression\",\"expression_case_when\",\"expression_case_else\",\"expression_postfix\",\"expression_postfix_tail\",\"expression_distinct\",\"expression_like\",\"expression_escape\",\"expression_between\",\"expression_between_tail\",\"expression_is_not\",\"expression_in\",\"expression_in_target\",\"expression_list_or_select\",\"expression_and\",\"expression\",\"expression_list\",\"expression_list_loop\",\"expression_list_rest\",\"function_call\",\"filter_clause\",\"function_call_args\",\"args_list_distinct\",\"over_clause\",\"window_name\",\"window_specification\",\"source_window_name\",\"partition_clause\",\"error_message\",\"stmt\",\"stmt_modifier\",\"modifier_query\",\"stmt_nodes\",\"stmt_commit\",\"stmt_begin\",\"commit_transaction\",\"stmt_begin_modifier\",\"stmt_rollback\",\"rollback_savepoint\",\"savepoint_name\",\"savepoint_alt\",\"stmt_savepoint\",\"stmt_release\",\"stmt_alter\",\"alter_start\",\"alter_action\",\"alter_action_rename\",\"alter_action_add\",\"action_add_modifier\",\"stmt_crud\",\"stmt_core_with\",\"clause_with\",\"clause_with_recursive\",\"clause_with_tables\",\"clause_with_loop\",\"expression_cte\",\"select_alias\",\"select_wrapped\",\"stmt_select_full\",\"stmt_set\",\"set_local_session\",\"set_rest\",\"var_list\",\"var_list_tail\",\"var_value\",\"stmt_show\",\"show_target\",\"stmt_sqlite\",\"stmt_attach\",\"attach_arg\",\"stmt_detach\",\"stmt_vacuum\",\"vacuum_target\",\"stmt_analyze\",\"analyze_arg\",\"stmt_reindex\",\"reindex_arg\",\"stmt_pragma\",\"pragma_expression\",\"pragma_value\",\"pragma_value_literal\",\"pragma_value_bool\",\"pragma_bool_id\",\"pragma_value_name\",\"stmt_crud_types\",\"stmt_select\",\"stmt_core_for_locking\",\"for_locking_items\",\"for_locking_loop\",\"for_locking_item\",\"for_locking_strength\",\"locked_rels_list\",\"id_table_list\",\"id_table_loop\",\"nowait_or_skip\",\"window_clause\",\"window_definition_list\",\"window_definition_loop\",\"window_definition\",\"stmt_core_order\",\"stmt_core_limit\",\"stmt_core_limit_offset\",\"limit_offset_variant\",\"limit_offset_variant_name\",\"select_loop\",\"select_loop_union\",\"select_parts\",\"select_parts_core\",\"select_core_select\",\"select_modifier\",\"select_modifier_distinct\",\"select_modifier_all\",\"select_target\",\"select_target_loop\",\"select_core_from\",\"stmt_core_where\",\"select_core_group\",\"select_core_having\",\"select_node\",\"select_node_star\",\"select_node_star_qualified\",\"select_node_aliased\",\"select_source\",\"source_loop_tail\",\"select_cross_clause\",\"select_join_clause\",\"table_or_sub\",\"table_or_sub_func\",\"func_alias_clause\",\"table_func_element_list\",\"table_func_element\",\"table_func_element_tail\",\"lateral\",\"table_qualified\",\"table_qualified_id\",\"table_or_sub_index_node\",\"index_node_indexed\",\"index_node_none\",\"table_or_sub_sub\",\"table_or_sub_select\",\"alias\",\"join_operator\",\"join_operator_natural\",\"join_operator_types\",\"operator_types_hand\",\"types_hand_outer\",\"operator_types_misc\",\"join_condition\",\"join_condition_on\",\"join_condition_using\",\"select_parts_values\",\"stmt_core_order_list\",\"stmt_core_order_list_loop\",\"stmt_core_order_list_item\",\"nulls_order\",\"select_star\",\"stmt_fallback_types\",\"stmt_insert\",\"returning_clause\",\"insert_keyword\",\"insert_keyword_ins\",\"insert_keyword_repl\",\"insert_keyword_mod\",\"insert_target\",\"insert_into\",\"insert_into_start\",\"insert_results\",\"opt_on_conflict\",\"opt_on_conflict_action\",\"opt_conf_expr\",\"loop_columns\",\"loop_column_tail\",\"loop_name\",\"insert_value\",\"insert_value_start\",\"insert_values_list\",\"insert_values_loop\",\"expression_list_wrapped\",\"insert_default\",\"operator_compound\",\"compound_union\",\"compound_union_all\",\"stmt_update\",\"update_start\",\"update_fallback\",\"update_set\",\"update_columns\",\"update_columns_tail\",\"update_column\",\"update_expression\",\"stmt_delete\",\"delete_start\",\"stmt_create\",\"create_start\",\"create_table_only\",\"create_index_only\",\"create_trigger_only\",\"create_view_only\",\"create_virtual_only\",\"create_table\",\"create_table_start\",\"create_core_tmp\",\"create_core_ine\",\"create_table_source\",\"table_source_def\",\"source_def_rowid\",\"source_def_loop\",\"source_def_tail\",\"source_tbl_loop\",\"source_def_column\",\"source_def_name\",\"column_type\",\"column_constraints\",\"column_constraint_tail\",\"column_constraint\",\"constraint_name\",\"constraint_name_loop\",\"column_constraint_types\",\"column_constraint_foreign\",\"column_constraint_primary\",\"col_primary_start\",\"col_primary_auto\",\"column_constraint_null\",\"constraint_null_types\",\"constraint_null_value\",\"column_constraint_check\",\"column_constraint_default\",\"column_default_values\",\"column_constraint_collate\",\"table_constraint\",\"table_constraint_types\",\"table_constraint_check\",\"table_constraint_primary\",\"primary_start\",\"primary_start_normal\",\"primary_start_unique\",\"primary_columns\",\"primary_columns_index\",\"primary_columns_table\",\"primary_column_tail\",\"primary_column\",\"primary_column_types\",\"column_collate\",\"column_collate_loop\",\"primary_column_dir\",\"primary_conflict\",\"primary_conflict_start\",\"constraint_check\",\"table_constraint_foreign\",\"foreign_start\",\"foreign_clause\",\"foreign_references\",\"foreign_actions\",\"foreign_actions_tail\",\"foreign_action\",\"foreign_action_on\",\"action_on_action\",\"on_action_set\",\"on_action_cascade\",\"on_action_none\",\"foreign_action_match\",\"foreign_deferrable\",\"deferrable_initially\",\"table_source_select\",\"create_index\",\"create_index_start\",\"index_unique\",\"index_on\",\"create_trigger\",\"create_trigger_start\",\"trigger_conditions\",\"trigger_apply_mods\",\"trigger_apply_instead\",\"trigger_do\",\"trigger_do_on\",\"trigger_do_update\",\"do_update_of\",\"do_update_columns\",\"trigger_foreach\",\"trigger_when\",\"trigger_action\",\"action_loop\",\"action_loop_stmt\",\"create_view\",\"id_view_expression\",\"create_view_start\",\"create_as_select\",\"create_virtual\",\"create_virtual_start\",\"virtual_module\",\"virtual_args\",\"virtual_args_loop\",\"virtual_args_tail\",\"virtual_arg_types\",\"virtual_column_name\",\"stmt_drop\",\"drop_start\",\"drop_types\",\"drop_ie\",\"binary_concat\",\"binary_plus\",\"binary_minus\",\"binary_multiply\",\"binary_divide\",\"binary_mod\",\"binary_left\",\"binary_right\",\"binary_and\",\"binary_or\",\"binary_lt\",\"binary_gt\",\"binary_lte\",\"binary_gte\",\"binary_equal\",\"binary_notequal_a\",\"binary_notequal_b\",\"binary_custom\",\"binary_lang_isnt\",\"id_name\",\"id_database\",\"id_function\",\"id_table\",\"id_table_qualified\",\"id_column\",\"indirection\",\"indirection_loop\",\"indirection_el\",\"indirection_attr\",\"indirection_slice\",\"indirection_index\",\"slice_lbound\",\"slice_ubound\",\"column_unqualified\",\"column_qualifiers\",\"id_column_qualified\",\"id_collation\",\"id_savepoint\",\"id_index\",\"id_trigger\",\"id_view\",\"id_pragma\",\"id_variable\",\"id_cte\",\"id_table_expression\",\"id_constraint_table\",\"id_constraint_column\",\"datatype_types\",\"datatype_text\",\"datatype_real\",\"datatype_real_double\",\"datatype_numeric\",\"datatype_integer\",\"datatype_integer_fp\",\"datatype_none\",\"name_char\",\"unicode_char\",\"name\",\"name_quoted\",\"name_unquoted\",\"name_reserved\",\"name_bracketed\",\"bracket_terminator\",\"name_dblquoted\",\"name_sglquoted\",\"name_backticked\",\"sym_bopen\",\"sym_bclose\",\"sym_popen\",\"sym_pclose\",\"sym_comma\",\"sym_dot\",\"sym_star\",\"sym_quest\",\"sym_sglquote\",\"sym_dblquote\",\"sym_backtick\",\"sym_tilde\",\"sym_plus\",\"sym_minus\",\"sym_equal\",\"sym_amp\",\"sym_pipe\",\"sym_mod\",\"sym_lt\",\"sym_gt\",\"sym_excl\",\"sym_semi\",\"sym_colon\",\"sym_fslash\",\"sym_bslash\",\"sym_op\",\"ABORT\",\"ACTION\",\"ADD\",\"AFTER\",\"ALL\",\"ALTER\",\"ANALYZE\",\"AND\",\"ARRAY\",\"AS\",\"ASC\",\"ATTACH\",\"AUTOINCREMENT\",\"BEFORE\",\"BEGIN\",\"BETWEEN\",\"BY\",\"CASCADE\",\"CASE\",\"CAST\",\"CHECK\",\"COLLATE\",\"COLUMN\",\"COMMIT\",\"CONFLICT\",\"CONSTRAINT\",\"CREATE\",\"CROSS\",\"CURRENT_DATE\",\"CURRENT_TIME\",\"CURRENT_TIMESTAMP\",\"DATABASE\",\"DEFAULT\",\"DEFERRABLE\",\"DEFERRED\",\"DELETE\",\"DESC\",\"DETACH\",\"DISTINCT\",\"DROP\",\"EACH\",\"ELSE\",\"END\",\"ESCAPE\",\"EXCEPT\",\"EXCLUSIVE\",\"EXISTS\",\"EXPLAIN\",\"FAIL\",\"FIRST\",\"FOR\",\"FOREIGN\",\"FROM\",\"FULL\",\"GLOB\",\"GROUP\",\"HAVING\",\"IF\",\"IGNORE\",\"ILIKE\",\"IMMEDIATE\",\"IN\",\"INDEX\",\"INDEXED\",\"INITIALLY\",\"INNER\",\"INSERT\",\"INSTEAD\",\"INTERSECT\",\"INTO\",\"IS\",\"ISNULL\",\"JOIN\",\"KEY\",\"LAST\",\"LATERAL\",\"LEFT\",\"LIKE\",\"LIMIT\",\"LOCKED\",\"MATCH\",\"NATURAL\",\"NO\",\"NOT\",\"NOTNULL\",\"NOWAIT\",\"NULL\",\"NULLS\",\"OF\",\"OFFSET\",\"ON\",\"ONLY\",\"OR\",\"ORDER\",\"OUTER\",\"OVER\",\"PARTITION\",\"PLAN\",\"PRAGMA\",\"PRIMARY\",\"QUERY\",\"RAISE\",\"READ\",\"RECURSIVE\",\"REFERENCES\",\"REGEXP\",\"REINDEX\",\"RELEASE\",\"RENAME\",\"REPLACE\",\"RESTRICT\",\"RETURNING\",\"RIGHT\",\"ROLLBACK\",\"ROW\",\"ROWID\",\"SAVEPOINT\",\"SELECT\",\"SET\",\"SHARE\",\"SHOW\",\"SKIP\",\"TABLE\",\"TEMP\",\"TEMPORARY\",\"THEN\",\"TO\",\"TRANSACTION\",\"TRIGGER\",\"UNION\",\"UNIQUE\",\"UPDATE\",\"USING\",\"VACUUM\",\"VALUES\",\"VIEW\",\"VIRTUAL\",\"WHEN\",\"WHERE\",\"WINDOW\",\"WITH\",\"WITHOUT\",\"reserved_words\",\"reserved_word_list\",\"reserved_critical_list\",\"comment\",\"comment_line\",\"comment_block\",\"comment_block_start\",\"comment_block_end\",\"comment_block_body\",\"block_body_nodes\",\"comment_block_feed\",\"o\",\"_TODO_\"];var peg$descNames=[null,null,null,null,null,null,\"Type Definition\",\"Array bounds\",null,null,\"Custom Datatype Name\",null,\"Type Definition Arguments\",null,null,\"Null Literal\",\"Date Literal\",\"String Literal\",\"Single-quoted String Literal\",null,\"Blob Literal\",\"Typed literal (or bind parameter)\",null,\"Number Sign\",null,null,null,\"Decimal Literal\",null,null,\"Decimal Literal Exponent\",\"Hexidecimal Literal\",null,null,\"Bind Parameter\",\"Numbered Bind Parameter\",null,\"Named Bind Parameter\",\"TCL Bind Parameter\",null,\"EXISTS Expression\",\"EXISTS Keyword\",\"RAISE Expression\",\"RAISE Expression Arguments\",\"IGNORE Keyword\",null,null,null,null,\"ARRAY expression\",\"ARRAY SELECT expression\",\"array expression\",\"multi-dimensional array expression\",null,null,\"PSQL-style cast\",null,null,\"COLLATE Expression\",null,null,null,null,null,null,null,null,null,null,null,null,null,\"CAST Expression\",\"Type Alias\",\"CASE Expression\",null,\"WHEN Clause\",\"ELSE Clause\",null,null,\"IS DISTINCT expression\",\"Comparison Expression\",\"ESCAPE Expression\",\"BETWEEN Expression\",null,null,\"IN Expression\",null,null,null,null,\"Expression List\",null,null,\"Function Call\",\"FILTER clause\",\"Function Call Arguments\",null,\"OVER clause\",\"Window name\",\"Window specification\",null,\"window partition clause\",\"Error Message\",\"Statement\",\"QUERY PLAN\",\"QUERY PLAN Keyword\",null,\"END Transaction Statement\",\"BEGIN Transaction Statement\",null,null,\"ROLLBACK Statement\",\"TO Clause\",null,null,\"SAVEPOINT Statement\",\"RELEASE Statement\",\"ALTER TABLE Statement\",\"ALTER TABLE Keyword\",null,\"RENAME TO Keyword\",\"ADD COLUMN Keyword\",null,null,\"WITH Clause\",null,null,null,null,\"Common Table Expression\",null,null,null,\"SET statement\",null,null,null,null,null,null,null,null,\"ATTACH Statement\",null,\"DETACH Statement\",\"VACUUM Statement\",null,\"ANALYZE Statement\",null,\"REINDEX Statement\",null,\"PRAGMA Statement\",null,null,null,null,null,null,null,\"SELECT Statement\",\"SELECT ... FOR locking clause\",null,null,null,null,null,null,null,null,\"WINDOW clause\",null,null,null,\"ORDER BY Clause\",\"LIMIT Clause\",\"OFFSET Clause\",null,null,null,\"Union Operation\",null,null,\"SELECT Results Clause\",\"SELECT Results Modifier\",null,null,null,null,\"FROM Clause\",\"WHERE Clause\",\"GROUP BY Clause\",\"HAVING Clause\",null,null,null,null,null,null,\"CROSS JOIN Operation\",\"JOIN Operation\",null,null,null,null,null,null,null,\"Qualified Table\",\"Qualified Table Identifier\",\"Qualfied Table Index\",null,null,\"SELECT Source\",\"Subquery\",\"Alias\",\"JOIN Operator\",null,null,null,null,null,\"JOIN Constraint\",\"Join ON Clause\",\"Join USING Clause\",\"VALUES Clause\",null,null,\"Ordering Expression\",null,\"Star\",\"Fallback Type\",\"INSERT Statement\",\"RETURNING clause\",null,\"INSERT Keyword\",\"REPLACE Keyword\",\"INSERT OR Modifier\",null,\"INTO Clause\",\"INTO Keyword\",\"VALUES Clause\",\"PostgreSQL INSERT ON CONFLICT clause\",\"PostgreSQL ON CONFLICT action\",\"PostgreSQL ON CONFLICT expression\",\"Column List\",null,\"Column Name\",\"VALUES Clause\",\"VALUES Keyword\",null,null,\"Wrapped Expression List\",\"DEFAULT VALUES Clause\",\"Compound Operator\",\"UNION Operator\",null,\"UPDATE Statement\",\"UPDATE Keyword\",\"UPDATE OR Modifier\",\"SET Clause\",null,null,\"Column Assignment\",\"UPDATE value expression\",\"DELETE Statement\",\"DELETE Keyword\",\"CREATE Statement\",null,null,null,null,null,null,\"CREATE TABLE Statement\",null,null,\"IF NOT EXISTS Modifier\",null,\"Table Definition\",null,null,null,null,\"Column Definition\",null,\"Column Datatype\",null,null,\"Column Constraint\",null,\"CONSTRAINT Name\",null,\"FOREIGN KEY Column Constraint\",\"PRIMARY KEY Column Constraint\",\"PRIMARY KEY Keyword\",\"AUTOINCREMENT Keyword\",null,\"UNIQUE Column Constraint\",\"NULL Column Constraint\",\"CHECK Column Constraint\",\"DEFAULT Column Constraint\",null,\"COLLATE Column Constraint\",\"Table Constraint\",null,\"CHECK Table Constraint\",\"PRIMARY KEY Table Constraint\",null,\"PRIMARY KEY Keyword\",\"UNIQUE Keyword\",null,null,null,null,\"Indexed Column\",null,\"Collation\",null,\"Column Direction\",null,\"ON CONFLICT Keyword\",null,\"FOREIGN KEY Table Constraint\",\"FOREIGN KEY Keyword\",null,\"REFERENCES Clause\",null,null,\"FOREIGN KEY Action Clause\",null,\"FOREIGN KEY Action\",null,null,null,null,\"DEFERRABLE Clause\",null,null,\"CREATE INDEX Statement\",null,null,\"ON Clause\",\"CREATE TRIGGER Statement\",null,\"Conditional Clause\",null,null,\"Conditional Action\",null,null,null,null,null,\"WHEN Clause\",\"Actions Clause\",null,null,\"CREATE VIEW Statement\",null,null,null,\"CREATE VIRTUAL TABLE Statement\",null,null,\"Module Arguments\",null,null,null,null,\"DROP Statement\",\"DROP Keyword\",\"DROP Type\",\"IF EXISTS Keyword\",\"Or\",\"Add\",\"Subtract\",\"Multiply\",\"Divide\",\"Modulo\",\"Shift Left\",\"Shift Right\",\"Logical AND\",\"Logical OR\",\"Less Than\",\"Greater Than\",\"Less Than Or Equal\",\"Greater Than Or Equal\",\"Equal\",\"Not Equal\",\"Not Equal\",\"PostgreSQL custom binary operarator\",\"IS\",\"Identifier\",\"Database Identifier\",\"Function Identifier\",\"Table Identifier\",null,\"Column Identifier\",\"value indirection\",null,null,null,null,null,null,null,null,null,null,\"Collation Identifier\",\"Savepoint Identifier\",\"Index Identifier\",\"Trigger Identifier\",\"View Identifier\",\"Pragma Identifier\",\"Variable Identifier\",\"CTE Identifier\",null,\"Table Constraint Identifier\",\"Column Constraint Identifier\",\"Datatype Name\",\"TEXT Datatype Name\",\"REAL Datatype Name\",\"DOUBLE Datatype Name\",\"NUMERIC Datatype Name\",\"INTEGER Datatype Name\",null,\"BLOB Datatype Name\",null,null,null,null,null,null,null,null,null,null,null,\"Open Bracket\",\"Close Bracket\",\"Open Parenthesis\",\"Close Parenthesis\",\"Comma\",\"Period\",\"Asterisk\",\"Question Mark\",\"Single Quote\",\"Double Quote\",\"Backtick\",\"Tilde\",\"Plus\",\"Minus\",\"Equal\",\"Ampersand\",\"Pipe\",\"Modulo\",\"Less Than\",\"Greater Than\",\"Exclamation\",\"Semicolon\",\"Colon\",\"Forward Slash\",\"Backslash\",\"Operator characters\",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,\"Line Comment\",\"Block Comment\",null,null,null,null,null,\"Whitespace\",null];var peg$tracer=\"tracer\"in options?options.tracer:new peg$DefaultTracer();var peg$result;if(\"startRule\"in options){if(!(options.startRule in peg$startRuleIndices)){throw new Error(\"Can't start parsing from rule \\\"\"+options.startRule+\"\\\".\");}peg$startRuleIndex=peg$startRuleIndices[options.startRule];}function text(){return input.substring(peg$savedPos,peg$currPos);}function location(){return peg$computeLocation(peg$savedPos,peg$currPos);}function expected(description,location){location=location!==undefined?location:peg$computeLocation(peg$savedPos,peg$currPos);throw peg$buildStructuredError([peg$otherExpectation(description)],input.substring(peg$savedPos,peg$currPos),location);}function error(message,location){location=location!==undefined?location:peg$computeLocation(peg$savedPos,peg$currPos);throw peg$buildSimpleError(message,location);}function peg$literalExpectation(text,ignoreCase){return{type:\"literal\",text:text,ignoreCase:ignoreCase};}function peg$classExpectation(parts,inverted,ignoreCase){return{type:\"class\",parts:parts,inverted:inverted,ignoreCase:ignoreCase};}function peg$anyExpectation(){return{type:\"any\"};}function peg$endExpectation(){return{type:\"end\"};}function peg$otherExpectation(description){return{type:\"other\",description:description};}function peg$computePosDetails(pos){var details=peg$posDetailsCache[pos];var p;if(details){return details;}else{p=pos-1;while(!peg$posDetailsCache[p]){p--;}details=peg$posDetailsCache[p];details={line:details.line,column:details.column};while(ppeg$maxFailPos){peg$maxFailPos=peg$currPos;peg$maxFailExpected=[];}peg$maxFailExpected.push(expected);}function peg$buildSimpleError(message,location){return new peg$SyntaxError(message,null,null,location);}function peg$buildStructuredError(expected,found,location){return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected,found),expected,found,location);}function peg$decode(s){return s.split(\"\").map(function(ch){return ch.charCodeAt(0)-32;});}function peg$parseRule(index){var bc=peg$bytecode[index];var ip=0;var ips=[];var end=bc.length;var ends=[];var stack=[];var startPos=peg$currPos;var params;peg$tracer.trace({type:\"rule.enter\",rule:peg$ruleNames[index],description:peg$descNames[index],location:peg$computeLocation(startPos,startPos)});var key=peg$currPos*621+index;var cached=peg$resultsCache[key];if(cached){peg$currPos=cached.nextPos;if(cached.result!==peg$FAILED){peg$tracer.trace({type:\"rule.match\",rule:peg$ruleNames[index],description:peg$descNames[index],result:cached.result,location:peg$computeLocation(startPos,peg$currPos)});}else{peg$tracer.trace({type:\"rule.fail\",rule:peg$ruleNames[index],description:peg$descNames[index],location:peg$computeLocation(startPos,startPos)});}return cached.result;}while(true){while(ippeg$currPos){end=ip+3+bc[ip+1];ip+=3;}else{end=ip+3+bc[ip+1]+bc[ip+2];ip+=3+bc[ip+1];}break;case 18:ends.push(end);ips.push(ip+4+bc[ip+2]+bc[ip+3]);if(input.substr(peg$currPos,peg$consts[bc[ip+1]].length)===peg$consts[bc[ip+1]]){end=ip+4+bc[ip+2];ip+=4;}else{end=ip+4+bc[ip+2]+bc[ip+3];ip+=4+bc[ip+2];}break;case 19:ends.push(end);ips.push(ip+4+bc[ip+2]+bc[ip+3]);if(input.substr(peg$currPos,peg$consts[bc[ip+1]].length).toLowerCase()===peg$consts[bc[ip+1]]){end=ip+4+bc[ip+2];ip+=4;}else{end=ip+4+bc[ip+2]+bc[ip+3];ip+=4+bc[ip+2];}break;case 20:ends.push(end);ips.push(ip+4+bc[ip+2]+bc[ip+3]);if(peg$consts[bc[ip+1]].test(input.charAt(peg$currPos))){end=ip+4+bc[ip+2];ip+=4;}else{end=ip+4+bc[ip+2]+bc[ip+3];ip+=4+bc[ip+2];}break;case 21:stack.push(input.substr(peg$currPos,bc[ip+1]));peg$currPos+=bc[ip+1];ip+=2;break;case 22:stack.push(peg$consts[bc[ip+1]]);peg$currPos+=peg$consts[bc[ip+1]].length;ip+=2;break;case 23:stack.push(peg$FAILED);if(peg$silentFails===0){peg$fail(peg$consts[bc[ip+1]]);}ip+=2;break;case 24:peg$savedPos=stack[stack.length-1-bc[ip+1]];ip+=2;break;case 25:peg$savedPos=peg$currPos;ip++;break;case 26:params=bc.slice(ip+4,ip+4+bc[ip+3]).map(function(p){return stack[stack.length-1-p];});stack.splice(stack.length-bc[ip+2],bc[ip+2],peg$consts[bc[ip+1]].apply(null,params));ip+=4+bc[ip+3];break;case 27:stack.push(peg$parseRule(bc[ip+1]));ip+=2;break;case 28:peg$silentFails++;ip++;break;case 29:peg$silentFails--;ip++;break;default:throw new Error(\"Invalid opcode: \"+bc[ip]+\".\");}}if(ends.length>0){end=ends.pop();ip=ips.pop();}else{break;}}peg$resultsCache[key]={nextPos:peg$currPos,result:stack[0]};if(stack[0]!==peg$FAILED){peg$tracer.trace({type:\"rule.match\",rule:peg$ruleNames[index],description:peg$descNames[index],result:stack[0],location:peg$computeLocation(startPos,peg$currPos)});}else{peg$tracer.trace({type:\"rule.fail\",rule:peg$ruleNames[index],description:peg$descNames[index],location:peg$computeLocation(startPos,startPos)});}return stack[0];}function makeArray(arr){if(!isOkay(arr)){return[];}return!Array.isArray(arr)?[arr]:arr;}function makeInteger(literal){return Number.parseInt(literal.value);}function isOkay(obj){return obj!=null;}function foldString(parts){var glue=arguments.length>1&&arguments[1]!==undefined?arguments[1]:' ';var folded=parts.filter(function(part){return isOkay(part);}).reduce(function(prev,cur){return\"\"+prev+nodeToString(cur)+glue;},'');return folded.trim();}function foldStringWord(parts){return foldString(parts,'');}function foldStringKey(parts){return foldString(parts).toLowerCase();}function flattenAll(arr){return arr.filter(function(part){return isOkay(part);}).reduce(function(prev,cur){return prev.concat(cur);},[]);}function unescape(str){var quoteChar=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'\\'';var re=new RegExp(quoteChar+\"{2}\",'g');return nodeToString(str).replace(re,quoteChar);}function nodeToString(){var node=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];return makeArray(node).join('');}function textNode(node){return nodeToString(node).trim();}function keyNode(node){return textNode(node).toLowerCase();}function isArrayOkay(arr){return Array.isArray(arr)&&arr.length>0&&isOkay(arr[0]);}function composeBinary(first,rest){return rest.reduce(function(left,_ref7){var _ref8=_slicedToArray(_ref7,4),x=_ref8[0],operation=_ref8[1],y=_ref8[2],right=_ref8[3];return{'type':'expression','format':'binary','variant':'operation','operation':keyNode(operation),'left':left,'right':right};},first);}peg$result=peg$parseRule(peg$startRuleIndex);if(peg$result!==peg$FAILED&&peg$currPos===input.length){return peg$result;}else{if(peg$result!==peg$FAILED&&peg$currPos=0;i-=1){if(func(arr[i])){return i;}}return-1;}function takeWhile(arr,func){var len=arr.length;var i=0;for(;i1){return false;}if(!deep){if(elem.indentation>bestNode.indentation){bestNode=elem;}else{deep=true;}}else if(/^(stmt)$/i.test(elem.rule)){deep=true;return true;}return true;});if(chain.length){location=bestNode.location;firstNode=chain.find(function(elem){return that.firstNodeRule.test(elem.description)&&elem.description!==bestNode.description&&elem.indentation!==bestNode.indentation;});if(firstNode!=null){if(this.statementRule.test(bestNode.description)&&this.statementRule.test(firstNode.description)){chainDetail=firstNode.description;}else{chainDetail=bestNode.description+' ('+firstNode.description+')';}}else{chainDetail=bestNode.description;}message='Syntax error found near '+chainDetail;Object.assign(err,{'message':message,'location':location});}return err;};return Tracer;}();\n\n},{}]},{},[1])(1)\n});\n","export { default as AppMap } from './appMap';\nexport { default as buildAppMap } from './appMapBuilder';\nexport { default as Event } from './event';\nexport { default as EventNavigator } from './eventNavigator';\nexport { default as EventInfo } from './eventInfo';\nexport { default as EventSource } from './eventSource';\nexport { default as CallTree } from './callTree/callTree';\nexport { default as ClassMap } from './classMap';\nexport { default as CodeObject } from './codeObject';\nexport { default as codeObjectId } from './codeObjectId';\nexport { CodeObjectType } from './codeObjectType';\nexport { default as analyzeSQL, abstractSqlAstJSON } from './sql/analyze';\nexport { default as normalizeSQL } from './sql/normalize';\nexport { default as parseSQL } from './sql/parse';\nexport { setSQLErrorHandler } from './sql/sqlErrorHandler';\nexport { default as AppMapFilter } from './appMapFilter';\nexport {\n serializeFilter,\n deserializeFilter,\n filterStringToFilterState,\n mergeFilterState,\n} from './serialize';\nexport * from './util';\n","// eslint-disable-next-line import/prefer-default-export\nexport const CodeObjectType = {\n ANALYSIS_FINDING: 'analysis-finding',\n DATABASE: 'database',\n QUERY: 'query',\n HTTP: 'http',\n EXTERNAL_ROUTE: 'external-route',\n EXTERNAL_SERVICE: 'external-service',\n ROUTE: 'route',\n PACKAGE: 'package',\n CLASS: 'class',\n FUNCTION: 'function',\n};\n","import { CodeObjectType } from './codeObjectType';\n\nfunction isExcludedParentType(type) {\n return [CodeObjectType.HTTP, CodeObjectType.DATABASE, CodeObjectType.EXTERNAL_SERVICE].includes(\n type\n );\n}\n\nexport default function codeObjectId(codeObject, tokens = []) {\n const { parent } = codeObject;\n\n // If it's a route, query, or external service we don't need to include the parent name\n // because it's always the same ('HTTP server requests' for route and 'Database' for queries).\n // This mirrors the VS Code implementation.\n if (parent && !isExcludedParentType(parent.type)) {\n codeObjectId(parent, tokens);\n\n let separator;\n switch (codeObject.parent.type) {\n case CodeObjectType.PACKAGE:\n separator = '/';\n break;\n case CodeObjectType.CLASS:\n separator = '::';\n break;\n default:\n separator = '->';\n }\n\n if (codeObject.type === CodeObjectType.FUNCTION) {\n separator = 'static' in codeObject && codeObject.static ? '.' : '#';\n }\n\n tokens.push(separator);\n }\n\n tokens.push(codeObject.name);\n\n return tokens;\n}\n","// eslint-disable-next-line import/extensions\nimport sha256 from 'crypto-js/sha256.js';\nimport analyze from './sql/analyze';\nimport { Buffer } from 'buffer';\n\nfunction isLogPathsEnabled() {\n try {\n return process.env.APPMAP_LOG_EXTERNAL_PATH === 'true';\n } catch (e) {\n if (e instanceof ReferenceError) return false;\n\n console.warn(e);\n }\n}\n\nconst LogPaths = isLogPathsEnabled();\nexport const hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\n\nexport function isFalsey(valueObj) {\n if (!valueObj) {\n return true;\n }\n if (valueObj.class === 'FalseClass') {\n return true;\n }\n if (valueObj.class === 'Array' && valueObj.value === '[]') {\n return true;\n }\n if (valueObj.value === '') {\n return true;\n }\n\n return false;\n}\n\nexport function isCommand(event) {\n if (event.http_server_request) {\n return true;\n }\n if (event.codeObject.labels.has('command')) {\n return true;\n }\n return false;\n}\n\nexport function capitalizeString(str) {\n if (typeof str !== 'string') {\n return '';\n }\n\n return str.slice(0, 1).toUpperCase() + str.slice(1).toLowerCase();\n}\n\nexport function getHttpLabel(event) {\n if (hasProp(event, 'http_server_request') === false) {\n return null;\n }\n\n const requestMethod = event.http_server_request.request_method;\n const pathInfo = event.http_server_request.path_info;\n let label;\n\n try {\n // the url is fake, we only care about the path info anyway\n const url = new URL(pathInfo, 'http://hostname');\n label = `${requestMethod} ${url.pathname}`;\n } catch (ex) {\n label = 'HTTP Request';\n }\n\n return label;\n}\n\nconst sqlLabels = new Set([\n 'insert',\n 'update',\n 'select',\n 'delete',\n 'alter',\n 'create',\n 'drop',\n 'rename',\n 'truncate',\n 'replace',\n 'savepoint',\n 'release',\n 'rollback',\n 'lock',\n 'unlock',\n 'set',\n 'start',\n 'call',\n 'delete',\n 'do',\n 'perform',\n 'handler',\n 'load',\n 'purge',\n 'reset',\n 'prepare',\n 'execute',\n 'deallocate',\n 'xa',\n]);\n\nexport function getSqlLabelFromString(sqlString) {\n const sqlChars = [...sqlString.trimLeft()];\n if (sqlChars.length > 0 && sqlChars[0] === '(') {\n // if the query is wrapped in parenthesis, drop the opening parenthesis\n // it doesn't matter if we leave a hanging closing parenthesis.\n // e.g. (SELECT 1);\n\n sqlChars.shift();\n }\n\n // drop sub-queries and parenthesized expressions\n let depth = 0;\n const topLevelSql = sqlChars\n .reduce((arr, c) => {\n if (c === '(') {\n depth += 1;\n }\n\n if (depth === 0) {\n arr.push(c);\n }\n\n if (c === ')') {\n depth -= 1;\n }\n\n return arr;\n }, [])\n .join('');\n\n let queryType = null;\n if (topLevelSql.search(/\\s/) === -1) {\n // There's only a single token\n // e.g. BEGIN, COMMIT, CHECKPOINT\n queryType = topLevelSql;\n } else {\n // convert non-word sequences to spaces and split by space\n // find the first known token\n queryType = topLevelSql\n .replace(/[^\\w]+/g, ' ')\n .toLowerCase()\n .split(' ')\n .find((t) => sqlLabels.has(t));\n }\n\n return ['SQL', capitalizeString(queryType) || null].join(' ');\n}\n\nexport function getSqlLabel(event) {\n if (hasProp(event, 'sql_query') === false) {\n return null;\n }\n\n return getSqlLabelFromString(event.sql_query.normalized_sql || event.sql_query.sql || '');\n}\n\nexport function getLabel(event) {\n let label = getHttpLabel(event);\n if (!label) {\n label = getSqlLabel(event);\n }\n return label;\n}\n\nexport function hashify(obj) {\n const clone = { ...obj };\n Object.keys(obj).forEach((key) => {\n const val = obj[key];\n if (Array.isArray(val)) {\n clone[key] = new Set(val);\n } else if (val instanceof Set) {\n clone[key] = val;\n } else if (val && typeof val === 'object') {\n clone[key] = hashify(val);\n } else {\n clone[key] = val;\n }\n });\n return clone;\n}\n\nconst REPOSITORY_RESOLVERS = {\n github: (d) => {\n const match = d.url.match(/github.com[:|/]?(.*).git/);\n if (!match || match.length <= 1) {\n return null;\n }\n\n const hash = typeof d.lineNumber === 'number' ? `#L${d.lineNumber}` : '';\n return `https://github.com/${match[1]}/blob/${d.commit}/${d.path}${hash}`;\n },\n};\n\nexport function getRepositoryUrl(url, path, commit = 'master', lineNumber = null) {\n if (url && path) {\n const d = { url, path, lineNumber, commit };\n const resolvers = Object.values(REPOSITORY_RESOLVERS);\n for (let i = 0; i < resolvers.length; i += 1) {\n const repositoryUrl = resolvers[i](d);\n if (repositoryUrl) {\n return repositoryUrl;\n }\n }\n }\n\n return null;\n}\n\nconst UPPER = 0x1;\nconst LOWER = 0x10;\nconst getCase = (char) => (/[A-Z]/.exec(char) === null ? LOWER : UPPER);\nconst getCasePattern = (str) => {\n if (str.length <= 2) {\n return null;\n }\n\n return {\n firstCase: getCase(str[0]),\n secondCase: getCase(str[1]),\n };\n};\n\nconst splitCamelCase = (str) => {\n const strLen = str.length;\n if (strLen < 1) {\n return [];\n }\n\n const casePattern = getCasePattern(str);\n if (!casePattern) {\n return [str];\n }\n\n const { firstCase, secondCase } = casePattern;\n const ret = [];\n let matched = false;\n for (let i = 2; i < strLen; i += 1) {\n const charCase = getCase(str[i]);\n if (charCase === UPPER) {\n if (firstCase === LOWER || secondCase === LOWER) {\n const token = str.slice(0, i);\n ret.push(token);\n ret.push(...splitCamelCase(str.slice(i)));\n matched = true;\n break;\n }\n } else if (charCase === LOWER && firstCase === UPPER && secondCase === UPPER) {\n const token = str.slice(0, i - 1);\n ret.push(token);\n ret.push(...splitCamelCase(str.slice(i - 1)));\n matched = true;\n break;\n }\n }\n\n if (!matched) {\n ret.push(str);\n }\n\n return ret;\n};\n\n// Builds the fully qualified function name of a function (static or instance) within a\n// fully qualified class name.\nexport function fullyQualifiedFunctionName(event) {\n const label = getLabel(event);\n if (label) {\n return label;\n }\n\n return event.toString();\n}\n\n// tokenizeIdentifier returns tokens of an identifier split by non-alphanumeric and camel casing\n// example:\n// someMethodName -> [ 'some', 'method', 'name' ]\n// some_method_name -> [ 'some', 'method', 'name' ]\n// org.company.MyPackage.MyClass -> [ 'org', 'company', 'My', 'Package', 'My', 'Class']\nexport function tokenizeIdentifier(id) {\n const ret = [];\n\n // Split first by non-alphanumeric tokens\n const tokens = (id || '').split(/[$.:#\\-_]/);\n\n // Split remaining tokens by camel case\n tokens.forEach((token) => {\n ret.push(...splitCamelCase(token));\n });\n\n return ret;\n}\n\nexport function addHiddenProperty(obj, property, opts) {\n if (!Object.hasOwnProperty.call(obj, '$hidden')) {\n Object.defineProperty(obj, '$hidden', {\n enumerable: false,\n writable: false,\n value: {},\n });\n }\n\n Object.defineProperty(obj.$hidden, property, {\n enumerable: false,\n writable: true,\n ...opts,\n });\n}\n\nexport function buildLabels(classMap, events) {\n const result = {};\n\n function addLabel(label, obj, type, target) {\n /* eslint-disable no-param-reassign */\n if (!obj[label]) {\n obj[label] = {};\n }\n\n if (!obj[label][type]) {\n obj[label][type] = [];\n }\n\n obj[label][type].push(target);\n /* eslint-enable no-param-reassign */\n }\n\n classMap.codeObjects\n .filter((obj) => obj.labels.size)\n .forEach((codeObject) => {\n Array.from(codeObject.labels).forEach((label) => {\n addLabel(label, result, codeObject.type, codeObject);\n });\n });\n\n events\n .filter((event) => event.isCall() && event.labels.size)\n .forEach((event) => {\n Array.from(event.labels).forEach((label) => {\n addLabel(label, result, 'event', event);\n });\n });\n\n return result;\n}\n\n// sizeof returns a naive byte count for an object when serialized.\n// I was using an external library for this (object-sizeof), but getting results off by a factor of\n// ~2. This is awfully wasteful, slow and inaccurate but it works for now. -DB\nexport const sizeof = (obj) => JSON.stringify(obj).length;\n\n// Returns a unique 'hash' (or really, a key) tied to the event's core identity: SQL, HTTP, or a\n// specific method on a specific class. This is _really_ naive. The idea is that this better finds\n// a singular change versus an existing object that has been removed and a new object added in its\n// place.\nexport function identityHashEvent(e) {\n if (e.httpServerRequest) {\n return 'http';\n }\n\n const { sqlQuery } = e;\n if (sqlQuery) {\n const queryOps = analyze(sqlQuery);\n const content = ['sql', queryOps.action, ...queryOps.tables].filter(Boolean).join('');\n return sha256(content).toString();\n }\n\n return e.toString();\n}\n\nexport function resolveDifferences(arr1, arr2) {\n let arr1Index = 0;\n let arr2Index = 0;\n\n for (;;) {\n const a = arr1[arr1Index];\n const b = arr2[arr2Index];\n if (!a && !b) {\n return;\n }\n\n if (typeof a === 'undefined') {\n arr1.push(null);\n arr1Index += 1;\n arr2Index += 1;\n continue; // eslint-disable-line no-continue\n }\n\n if (typeof b === 'undefined') {\n arr2.push(null);\n arr1Index += 1;\n arr2Index += 1;\n continue; // eslint-disable-line no-continue\n }\n\n const hashA = a.identityHash;\n const hashB = b.identityHash;\n if (hashA !== hashB) {\n let instancesA = 0;\n for (let i = arr1Index + 1; i < arr1.length; i += 1) {\n instancesA += arr1[i].identityHash === hashA ? 1 : 0;\n }\n\n let instancesB = 0;\n for (let i = arr2Index + 1; i < arr2.length; i += 1) {\n instancesB += arr2[i].identityHash === hashA ? 1 : 0;\n }\n\n if (instancesA >= instancesB) {\n arr2.splice(arr2Index, 0, null);\n } else if (instancesA < instancesB) {\n arr1.splice(arr1Index, 0, null);\n } // eslint-disable-line no-continue\n }\n\n arr1Index += 1;\n arr2Index += 1;\n }\n}\n\nexport function getRootEvents(eventArray) {\n return eventArray.filter((e) => e.isCall() && !e.parent);\n}\n\nfunction isEmpty(value) {\n if (value === undefined || value === null) {\n return true;\n }\n\n if (Array.isArray(value) || typeof value === 'string') {\n return value.length === 0;\n }\n\n if (value instanceof Set || value instanceof Map) {\n return value.size === 0;\n }\n\n if (typeof value === 'object') {\n return Object.values(value).every(isEmpty);\n }\n\n return false;\n}\n\nexport function transformToJSON(dataKeys, obj) {\n return dataKeys.reduce((memo, key) => {\n const value = obj[key];\n if (isEmpty(value)) {\n // nop\n } else if (value instanceof Set) {\n memo[key] = [...value];\n } else {\n memo[key] = value;\n }\n return memo;\n }, {});\n}\n\nexport function base64UrlDecode(encodedText) {\n const buffer = Buffer.from(encodedText, 'base64');\n return buffer.toString('utf-8');\n}\n\nexport function base64UrlEncode(text) {\n const buffer = Buffer.from(text, 'utf-8');\n return buffer.toString('base64').replace(/=/g, '').replace(/_/g, '/').replace(/-/g, '+');\n}\n\nconst SeenPaths = new Set();\nfunction logPath(path, status, reason) {\n if (!LogPaths) return;\n\n if (!SeenPaths.has(path)) {\n SeenPaths.add(path);\n process.stderr.write(`${status}: ${path}`);\n if (reason) process.stderr.write(` (${reason})`);\n process.stderr.write('\\n');\n }\n}\n\n// Use heuristic methods to determine if the code location is part of the project.\n// There are a lot of weird edge cases here. It would be better if the AppMap itself would\n// definitively report local (project) vs non-project code, but that isn't yet the case.\nexport function isLocalPath(location, disallowedFolders = []) {\n if (!location) return { isLocal: false };\n\n // Remove drive letter\n if (/^[a-zA-Z]:[\\\\/]/.test(location)) location = location.slice(2);\n\n // Split into path and line number\n let [path, lineno] = location.split(':');\n\n // :308\n if (location.includes('<')) {\n logPath(location, 'remote', `includes <`);\n }\n\n if ((!lineno || isNaN(parseInt(lineno, 10))) && path.split(/[\\\\/]/).length === 1) {\n logPath(location, 'remote', `no line number and no path separator chars`);\n return { isLocal: false };\n }\n\n if (path.length === 0) {\n logPath(location, 'remote', `zero-length`);\n return { isLocal: false };\n }\n\n // Example: :308\n if (path.charAt(0) === '<') {\n logPath(location, 'remote', `starts with <`);\n return { isLocal: false };\n }\n\n if (['/', '\\\\'].includes(path.charAt(0))) {\n logPath(location, 'remote', `starts with ${path.charAt(0)}`);\n return { isLocal: false };\n }\n\n if (/^\\.[/\\\\]/.test(path)) path = path.substring(2);\n\n for (let folder of disallowedFolders) {\n if (path.startsWith(`${folder}/`) || path.startsWith(`${folder}\\\\`)) {\n logPath(location, 'remote', `starts with ${folder}`);\n return { isLocal: false };\n }\n }\n\n logPath(location, 'local ');\n return { isLocal: true, path };\n}\n","// @ts-ignore\n\n// https://github.com/newrelic/newrelic-ruby-agent/blob/dev/lib/new_relic/agent/database/obfuscation_helpers.rb\n// License: https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE\n// Apache License 2.0\n\nconst COMMENTS_REGEXP = /(?:(?:#|--).*?(?=\\r|\\n|$))|(?:\\/\\*(?:[^/]|\\/[^*])*?(?:\\*\\/|\\/\\*.*))/gi;\n\nconst COMPONENTS_REGEXP_MAP = {\n single_quotes: /'(?:[^']|'')*?(?:'(?!'))/g,\n double_quotes: /\"(?:[^\"]|\"\")*?(?:\\\\\".*|\"(?!\"))/g,\n dollar_quotes: /(\\$(?!\\d)[^$]*?\\$).*?(?:\\1|$)/g,\n uuids: /\\{?(?:[0-9a-fA-F]-*){32}\\}?/g,\n numeric_literals: /-?\\b(?:[0-9]+\\.)?[0-9]+([eE][+-]?[0-9]+)?\\b/g,\n boolean_literals: /\\b(?:true|false|null)\\b/gi,\n hexadecimal_literals: /0x[0-9a-fA-F]+/g,\n oracle_quoted_strings: /q'\\[.*?(?:\\]'|$)|q'\\{.*?(?:\\}'|$)|q'<.*?(?:>'|$)|q'\\(.*?(?:\\)'|$)/g,\n};\n\n// We use these to check whether the query contains any quote characters\n// after obfuscation. If so, that's a good indication that the original\n// query was malformed, and so our obfuscation can't reliably find\n// literals. In such a case, we'll replace the entire query with a\n// placeholder.\nconst CLEANUP_REGEXP = {\n mysql: /'|\"|\\/\\*|\\*\\//,\n mysql2: /'|\"|\\/\\*|\\*\\//,\n postgres: /'|\\/\\*|\\*\\/|\\$(?!\\?)/,\n sqlite: /'|\\/\\*|\\*\\//,\n cassandra: /'|\\/\\*|\\*\\//,\n oracle: /'|\\/\\*|\\*\\//,\n oracle_enhanced: /'|\\/\\*|\\*\\//,\n};\n\n/**\n * @type {{string: string[]}}\n */\nconst DIALECT_COMPONENTS = {\n // @ts-ignore\n fallback: Object.keys(COMPONENTS_REGEXP_MAP),\n mysql: [\n 'single_quotes',\n 'double_quotes',\n 'numeric_literals',\n 'boolean_literals',\n 'hexadecimal_literals',\n ],\n postgres: ['single_quotes', 'dollar_quotes', 'uuids', 'numeric_literals', 'boolean_literals'],\n sqlite: ['single_quotes', 'numeric_literals', 'boolean_literals', 'hexadecimal_literals'],\n oracle: ['single_quotes', 'oracle_quoted_strings', 'numeric_literals'],\n cassandra: [\n 'single_quotes',\n 'uuids',\n 'numeric_literals',\n 'boolean_literals',\n 'hexadecimal_literals',\n ],\n};\n\nconst PLACEHOLDER = '?';\n\n/**\n * @param {string} dialect\n * @returns {RegExp}\n */\nfunction generateRegexp(dialect) {\n const components = DIALECT_COMPONENTS[dialect];\n const regexData = components.map((component) => COMPONENTS_REGEXP_MAP[component].source);\n const union = `(?:${regexData.flat().join(')|(?:')})`;\n return new RegExp(union, 'gi');\n}\n\nconst MYSQL_COMPONENTS_REGEXP = generateRegexp('mysql');\nconst POSTGRES_COMPONENTS_REGEXP = generateRegexp('postgres');\nconst SQLITE_COMPONENTS_REGEXP = generateRegexp('sqlite');\nconst ORACLE_COMPONENTS_REGEXP = generateRegexp('oracle');\nconst CASSANDRA_COMPONENTS_REGEXP = generateRegexp('cassandra');\nconst FALLBACK_REGEXP = generateRegexp('fallback');\n\nfunction detectUnmatchedPairs(obfuscated, adapter) {\n if (CLEANUP_REGEXP[adapter]) {\n return CLEANUP_REGEXP[adapter].test(obfuscated);\n }\n return CLEANUP_REGEXP.mysql.test(obfuscated);\n}\n\n/**\n * Replaces literal query parameters with parameter symbols (e.g. '?');\n *\n * @param {string} sql\n * @param {string} adapter\n * @returns {string}\n */\nexport default function normalize(sql, adapter) {\n /** @type {RegExp[]} */ let regexp;\n switch (adapter) {\n case 'mysql':\n case 'mysql2':\n regexp = MYSQL_COMPONENTS_REGEXP;\n break;\n case 'postgres':\n regexp = POSTGRES_COMPONENTS_REGEXP;\n break;\n case 'sqlite':\n regexp = SQLITE_COMPONENTS_REGEXP;\n break;\n case 'oracle':\n case 'oracle_enhanced':\n regexp = ORACLE_COMPONENTS_REGEXP;\n break;\n case 'cassandra':\n regexp = CASSANDRA_COMPONENTS_REGEXP;\n break;\n default:\n regexp = FALLBACK_REGEXP;\n }\n\n let obfuscated = sql.replace(regexp, PLACEHOLDER).replace(COMMENTS_REGEXP, '');\n if (detectUnmatchedPairs(obfuscated, adapter)) {\n obfuscated = sql;\n }\n return obfuscated;\n}\n","import sqliteParser from '@appland/sql-parser';\nimport ParseError from './parseError';\nimport reportParseError from './sqlErrorHandler';\n\nexport default function parse(sql) {\n const parseSQL = sql.replace(/\\s+returning\\s+\\*/i, '');\n try {\n return sqliteParser(parseSQL);\n } catch (e) {\n reportParseError(new ParseError(e.message, parseSQL));\n return null;\n }\n}\n","export default class ParseError extends Error {\n constructor(message, sql) {\n super(message);\n\n this.sql = sql;\n }\n\n toString() {\n return `${this.message}: ${this.sql}`;\n }\n}\n","let warnedAboutSqlErrorHandler = false;\nlet sqlErrorHandler;\n\nexport function getSQLErrorHandler() {\n return sqlErrorHandler;\n}\n\nexport function setSQLErrorHandler(handler) {\n if (sqlErrorHandler)\n console.warn(`Replacing existing sqlErrorHandler ${sqlErrorHandler} with ${handler}`);\n\n sqlErrorHandler = handler;\n}\n\nexport default function reportParseError(parseError) {\n if (sqlErrorHandler) {\n sqlErrorHandler(parseError);\n return;\n }\n\n if (!warnedAboutSqlErrorHandler) {\n console.debug('No SQL error handler was set. SQL errors will be logged to the console.');\n console.debug('Set a SQL error handling by calling setSQLErrorHandler(handler).');\n warnedAboutSqlErrorHandler = true;\n }\n\n console.debug(parseError);\n}\n","/* eslint-disable no-inner-declarations */\nimport normalize from './normalize';\nimport parseAST from './parse';\n\nexport default function analyze(sql) {\n const ast = parseAST(sql);\n if (!ast) {\n return null;\n }\n\n const actions = [];\n const columns = [];\n const tables = [];\n let joins = 0;\n\n function parseQuery(statement) {\n if (statement === null) return;\n\n const tokens = ['type', 'variant']\n .map((propertyName) => statement[propertyName])\n .filter(Boolean);\n\n const key = tokens.join('.');\n // eslint-disable-next-line no-use-before-define\n let parser = parsers[key];\n if (!parser) {\n // eslint-disable-next-line no-use-before-define\n parser = parseStatement;\n }\n\n const parserList = Array.isArray(parser) ? parser : [parser];\n parserList.forEach((prs) => prs(statement));\n }\n\n function parseStatement(statement) {\n if (statement === null) {\n console.warn(`Ignoring request to parse null statement in query ${sql}`);\n return;\n }\n\n const reservedWords = ['type', 'variant', 'name', 'value'];\n Object.keys(statement)\n .filter((property) => !reservedWords.includes(property))\n .map((propertyName) => statement[propertyName])\n .forEach((property) => {\n if (Array.isArray(property)) {\n property.forEach(parseQuery);\n } else if (typeof property === 'object') {\n parseQuery(property);\n } else if (typeof property === 'string' || typeof property === 'boolean') {\n // pass\n } else {\n console.warn(`Unrecognized subexpression: ${typeof property} ${property}`);\n }\n });\n }\n\n function parseList(listElements, statement) {\n listElements.forEach((listElement) => {\n const subExpression = statement[listElement];\n if (Array.isArray(subExpression)) {\n subExpression.forEach(parseQuery);\n } else if (typeof subExpression === 'object') {\n parseQuery(subExpression);\n } else {\n console.warn(`Unrecognized subexpression: ${subExpression}`);\n }\n });\n }\n\n const nop = () => {};\n\n function parseIdentifierExpression(statement) {\n if (statement.format === 'table') {\n tables.push(statement.name);\n }\n parseList(['columns'], statement);\n }\n\n function recordAction(action) {\n return () => {\n actions.push(action);\n };\n }\n\n const parsers = {\n 'literal.text': nop,\n 'literal.decimal': nop,\n 'identifier.star': (statement) => columns.push(statement.name),\n 'identifier.column': (statement) => columns.push(statement.name),\n 'identifier.table': (statement) => tables.push(statement.name),\n 'identifier.expression': parseIdentifierExpression,\n 'statement.select': [recordAction('select'), parseStatement],\n 'statement.insert': [recordAction('insert'), parseStatement],\n 'statement.update': [recordAction('update'), parseStatement],\n 'statement.delete': [recordAction('delete'), parseStatement],\n 'statement.pragma': nop,\n 'map.join': [\n (statement) => {\n joins += statement.map.length;\n },\n parseStatement,\n ],\n };\n\n parseQuery(ast);\n\n function unique(list) {\n return [...new Set(list)];\n }\n const uniqueActions = unique(actions).sort();\n\n return {\n actions: uniqueActions,\n tables: unique(tables).sort(),\n columns: unique(columns).sort(),\n joinCount: joins,\n };\n}\n\n// returns a JSON of SQL query AST with all literals replaced by variables and all variable names\n// removed. If the query cannot be parsed, returns a best-effort normalized SQL string.\nexport function abstractSqlAstJSON(query, databaseType) {\n const ast = parseAST(query);\n if (!ast) return normalize(query, databaseType);\n\n return JSON.stringify(ast, (_, value) => {\n if (value === null) return null;\n\n switch (value.type) {\n case 'variable':\n case 'literal':\n return { type: 'variable' };\n default:\n return value;\n }\n });\n}\n","import codeObjectId from './codeObjectId';\nimport { CodeObjectType } from './codeObjectType';\nimport { addHiddenProperty, getSqlLabelFromString, transformToJSON } from './util';\n\nexport default class CodeObject {\n constructor(data, parent) {\n this.data = { ...data };\n\n // Include all raw data by default, and selectively remove some fields\n // that aren't appropriate to all types. This way, any mistakes in JSON stringification\n // will be extra data rather than missing data.\n this.dataKeys = Object.keys(data).filter(\n (item) => !['dynamic', 'static', 'location', 'database_type'].includes(item)\n );\n this.dataKeys.push('children');\n if (data.type === CodeObjectType.FUNCTION) {\n this.dataKeys.push('static');\n this.dataKeys.push('location');\n }\n if (data.type === CodeObjectType.QUERY) {\n this.dataKeys.push('database_type');\n }\n\n if (!(this.data.labels instanceof Set)) {\n this.data.labels = new Set(this.data.labels);\n }\n\n this.children = [];\n if (parent) {\n parent.children.push(this);\n }\n\n addHiddenProperty(this, 'parent', { value: parent });\n addHiddenProperty(this, 'events', { writable: false, value: [] });\n addHiddenProperty(this, 'id');\n addHiddenProperty(this, 'fqid');\n }\n\n get id() {\n if (!this.$hidden.id) {\n this.$hidden.id = this.buildId().join('');\n }\n return this.$hidden.id;\n }\n\n get name() {\n return this.data.name;\n }\n\n get type() {\n return this.data.type;\n }\n\n get static() {\n return this.data.static;\n }\n\n get location() {\n return this.data.location;\n }\n\n get labels() {\n return this.data.labels;\n }\n\n get events() {\n return this.$hidden.events;\n }\n\n get parent() {\n return this.$hidden.parent;\n }\n\n set parent(val) {\n this.$hidden.parent = val;\n }\n\n // Gets the source locations for this code object. For a package, no source locations are returned\n // (there would be too many to be useful). For a class, the paths to all files which add methods to the class are\n // returned. For a function, the path and line number is returned.\n get locations() {\n switch (this.type) {\n case CodeObjectType.CLASS:\n return Array.from(this.classLocations()).sort();\n case CodeObjectType.FUNCTION:\n return [this.location];\n default:\n return [];\n }\n }\n\n get packageOf() {\n return [this, ...this.ancestors()]\n .filter((obj) => obj.type === CodeObjectType.PACKAGE)\n .map((obj) => obj.name)\n .reverse()\n .join('/');\n }\n\n get classOf() {\n return [this, ...this.ancestors()]\n .filter((obj) => obj.type === CodeObjectType.CLASS)\n .map((obj) => obj.name)\n .reverse()\n .join('::');\n }\n\n get classObject() {\n return [this, ...this.ancestors()].find((obj) => obj.type === CodeObjectType.CLASS);\n }\n\n get packageObject() {\n return [this, ...this.ancestors()].find((obj) => obj.type === CodeObjectType.PACKAGE);\n }\n\n get functions() {\n if (this.type === CodeObjectType.CLASS) {\n // getting the functions of a class should not return functions of nested classes\n return this.children.filter((obj) => obj.type === CodeObjectType.FUNCTION);\n }\n\n return this.descendants().filter((obj) => obj.type === CodeObjectType.FUNCTION);\n }\n\n get classes() {\n return [this, ...this.descendants()].filter(\n (obj) => obj.type === CodeObjectType.CLASS && obj.functions.length\n );\n }\n\n // Enumerate this code object and all its descendants, calling a function for each one. The\n // traversal is depth-first.\n visit(fn, stack = []) {\n stack.push(this);\n fn(this, stack);\n this.children.forEach((child) => child.visit(fn, stack));\n stack.pop();\n }\n\n // Enumerate this code object and all its ancestors, calling a function for each one.\n visitAncestors(fn) {\n let ancestor = this;\n while (ancestor) {\n fn(ancestor);\n ancestor = ancestor.parent;\n }\n }\n\n /**\n * Finds the most specific descendants of a code object that have the same type.\n * The traversal stops when encountering a child of any other type.\n * This method is useful for retrieving children without worrying about types or deeply nested objects.\n *\n * For example, the 'leafs' of the package `com` may be:\n * - com.myorg.myapp\n * - com.myorg.myapp.api\n *\n * Whereas its children would only contain \"myorg\", and its descendants would include functions\n * and classes from any other nested package.\n *\n */\n leafs() {\n const { type } = this;\n const queue = [this];\n const leafArray = [];\n\n while (queue.length) {\n const obj = queue.pop();\n const childrenOfType = obj.children.filter((child) => child.type === type);\n\n // If this object has children of another type, consider it the most specific of the type.\n // For example, a package containing a class.\n if (childrenOfType.length) {\n queue.push(...childrenOfType);\n }\n\n // If, however, this object has a variety of child types, it's both a leaf and a parent\n if (\n (!obj.children.length && obj.type === type) ||\n childrenOfType.length !== obj.children.length\n ) {\n leafArray.push(obj);\n }\n }\n\n return leafArray;\n }\n\n /**\n * Returns leafs of all children. Similar to the `classes` accessor, but returns children of any\n * type.\n *\n * @see leafs\n */\n childLeafs() {\n return this.children.map((child) => child.leafs()).flat();\n }\n\n buildId(tokens = []) {\n return codeObjectId(this, tokens);\n }\n\n classLocations(paths = new Set()) {\n this.children.forEach((child) => child.classLocations(paths));\n\n if (this.type === CodeObjectType.FUNCTION && this.location) {\n const tokens = this.location.split(':', 2);\n paths.add(tokens[0]);\n }\n return paths;\n }\n\n toJSON() {\n return transformToJSON(this.dataKeys, this);\n }\n\n static constructDataChainFromEvent(event) {\n let elements;\n if (event.httpServerRequest) {\n elements = [\n {\n type: CodeObjectType.HTTP,\n name: 'HTTP server requests',\n },\n {\n type: CodeObjectType.ROUTE,\n name: event.route,\n },\n ];\n } else if (event.httpClientRequest) {\n let serviceName;\n\n try {\n const url = new URL(event.httpClientRequest.url);\n serviceName = url.host;\n } catch {\n serviceName = 'External service';\n }\n\n elements = [\n {\n type: CodeObjectType.EXTERNAL_SERVICE,\n name: serviceName,\n },\n {\n type: CodeObjectType.EXTERNAL_ROUTE,\n name: event.route,\n },\n ];\n } else if (event.sqlQuery) {\n elements = [\n {\n type: CodeObjectType.DATABASE,\n name: 'Database',\n },\n {\n type: CodeObjectType.QUERY,\n name: event.sqlQuery,\n database_type: event.sql.database_type,\n },\n ];\n } else {\n elements = [\n {\n type: CodeObjectType.CLASS,\n name: event.definedClass,\n },\n {\n type: CodeObjectType.FUNCTION,\n name: event.methodId,\n static: event.isStatic,\n location: '',\n },\n ];\n }\n\n // Flag this object as having been created dynamically\n const queue = [...elements];\n while (queue.length) {\n const obj = queue.pop();\n obj.dynamic = true;\n if (obj.children) {\n obj.children.forEach((child) => queue.push(child));\n }\n }\n\n return elements;\n }\n\n get inboundConnections() {\n return this.allEvents.filter((e) => e.parent).map((e) => e.parent.codeObject);\n }\n\n get outboundConnections() {\n return this.allEvents\n .map((e) => e.children)\n .flat()\n .map((e) => e.codeObject);\n }\n\n get sqlQueries() {\n return this.allEvents\n .map((e) => e.children)\n .flat()\n .filter((e) => e.sql)\n .map((e) => e.codeObject);\n }\n\n get prettyName() {\n switch (this.type) {\n case CodeObjectType.FUNCTION:\n return `${this.classOf}${this.static ? '.' : '#'}${this.name}`;\n case CodeObjectType.CLASS:\n return this.classOf;\n case CodeObjectType.PACKAGE:\n return this.packageOf;\n case CodeObjectType.QUERY:\n return getSqlLabelFromString(this.name);\n default:\n return this.name;\n }\n }\n\n get fqid() {\n if (!this.$hidden.fqid) {\n this.$hidden.fqid = `${this.type}:${this.id}`;\n }\n return this.$hidden.fqid;\n }\n\n // The zone of deprecation.\n // ------------------------\n\n // This function is deprecated, because it allocates all events of all descendants into a new\n // array for each invocation.\n // Use `CodeObject.visit()` and `CodeObject.events` instead. A functional style is both more\n // idiomatic and more efficient.\n get allEvents() {\n return [this, ...this.descendants()].map((obj) => obj.events).flat();\n }\n\n // This function is deprecated, because it allocates all descendants into a new array for each invocation.\n // Use `CodeObject.visit()` instead. A functional style is both more idiomatic and more efficient.\n descendants() {\n const queue = [...this.children];\n const children = [];\n\n while (queue.length) {\n const child = queue.pop();\n children.push(child);\n queue.push(...child.children);\n }\n\n return children;\n }\n\n // This function is deprecated, because it allocates all descendants into a new array for each invocation.\n // Use `CodeObject.visitAncestors()` instead. A functional style is both more idiomatic and more efficient.\n ancestors() {\n let currentObject = this.parent;\n const parents = [];\n\n while (currentObject) {\n parents.push(currentObject);\n currentObject = currentObject.parent;\n }\n\n return parents;\n }\n}\n","import CodeObject from './codeObject';\nimport { CodeObjectType } from './codeObjectType';\n\nfunction indexCodeObject(co, codeObjects, codeObjectsById) {\n codeObjects.push(co);\n codeObjectsById[co.id] = co;\n}\n\nexport default class ClassMap {\n constructor(classMap) {\n this.codeObjectsByLocation = {};\n this.codeObjects = [];\n this.codeObjectsById = {};\n\n const buildCodeObject = (data, parent = null) => {\n const co = new CodeObject(data, parent);\n indexCodeObject(co, this.codeObjects, this.codeObjectsById);\n\n (data.children || []).forEach((child) => {\n buildCodeObject(child, co);\n });\n\n if (co.type !== 'package') {\n co.locations.forEach((location) => {\n let codeObjects = this.codeObjectsByLocation[location];\n if (!codeObjects) {\n codeObjects = [];\n this.codeObjectsByLocation[location] = codeObjects;\n }\n codeObjects.push(co);\n });\n }\n\n return co;\n };\n\n this.roots = classMap.map((root) => buildCodeObject(root));\n }\n\n visit(fn) {\n this.roots.forEach((co) => co.visit(fn));\n }\n\n search(query) {\n const queryLower = query.toLowerCase();\n return this.codeObjects.filter((co) => co.id.toLowerCase().indexOf(queryLower) !== -1);\n }\n\n codeObjectFromId(id) {\n return this.codeObjectsById[id];\n }\n\n codeObjectsAtLocation(location) {\n return this.codeObjectsByLocation[location] || [];\n }\n\n codeObjectFromEvent(event) {\n let codeObject;\n // These types of events should not be reporting path and lineno, but sometimes\n // they do.\n if (!(event.httpServerRequest || event.httpClientRequest || event.sql)) {\n const { path, lineno } = event;\n const location = [path, lineno].filter((e) => e).join(':');\n if (location !== '') {\n const codeObjects = this.codeObjectsAtLocation(location);\n codeObject = codeObjects.find((o) => o.name === event.methodId);\n if (codeObject) {\n return codeObject;\n }\n }\n }\n\n return null;\n }\n\n // Returns the first root code object of a given type or null if it doesn't exist\n root(type) {\n return this.roots.find((obj) => obj.type === type);\n }\n\n // Returns the root HTTP code object if it exists\n get httpObject() {\n return this.root(CodeObjectType.HTTP);\n }\n\n // Returns the root SQL code object if it exists\n get sqlObject() {\n return this.root(CodeObjectType.DATABASE);\n }\n\n // Binds an event array to code objects and vice versa. This allows use of\n // direct accessors: `Event.codeObject` and `CodeObject.events`. Additionally,\n // it guarantees non-null accessors, meaning it will construct a code object\n // for an event if it previously did not exist.\n bindEvents(events) {\n if (!events || !Array.isArray(events) || !events.length) {\n return;\n }\n\n const validCodeObjects = new Set();\n events\n .filter((e) => e.isCall())\n .forEach((e) => {\n let codeObject = this.codeObjectFromEvent(e);\n if (!codeObject) {\n const findOrCreateCodeObject = (data, codeObjectArray, parent) => {\n // TODO: This ignores static/non-static function collisions and function overloads, though this method\n // is never currently called in a context where those edge cases exist.\n let newCodeObject = codeObjectArray.find(\n (obj) => obj.type === data.type && obj.name === data.name\n );\n\n if (!newCodeObject) {\n newCodeObject = new CodeObject(data, parent);\n if (!parent) {\n this.roots.push(newCodeObject);\n }\n indexCodeObject(newCodeObject, this.codeObjects, this.codeObjectsById);\n }\n\n return newCodeObject;\n };\n\n const dataElements = CodeObject.constructDataChainFromEvent(e);\n let parent = null;\n dataElements.forEach((dataElement) => {\n parent = findOrCreateCodeObject(\n dataElement,\n parent ? parent.children : this.roots,\n parent\n );\n });\n codeObject = parent;\n }\n\n e.codeObject = codeObject;\n codeObject.events.push(e);\n\n codeObject.visitAncestors((obj) => validCodeObjects.add(obj));\n });\n\n this.codeObjects = this.codeObjects.filter((obj) => validCodeObjects.has(obj));\n\n function filterCodeObjects(objectsList, allObjects) {\n return objectsList.filter((obj) => {\n if (allObjects.has(obj)) {\n obj.children = filterCodeObjects(obj.children, allObjects);\n return true;\n }\n return false;\n });\n }\n\n this.roots = filterCodeObjects(this.roots, validCodeObjects);\n\n Object.keys(this.codeObjectsByLocation).forEach((obj) => {\n if (!validCodeObjects.has(obj)) {\n delete this.codeObjectsByLocation[obj];\n }\n });\n\n Object.entries(this.codeObjectsById).forEach(([id, obj]) => {\n if (!validCodeObjects.has(obj)) {\n delete this.codeObjectsById[id];\n }\n });\n }\n\n toJSON() {\n return this.roots;\n }\n}\n","import { addHiddenProperty } from '../util';\n\n// Deprecated. Prefer `Event` instead.\nclass CallNode {\n constructor(input = {}, output = {}, caller = null, labels = []) {\n this.input = input;\n this.output = output;\n this.children = [];\n this.labels = labels;\n\n // Cyclic references shall not be enumerable\n addHiddenProperty(this, 'caller', { value: caller });\n }\n\n get caller() {\n return this.$hidden.caller;\n }\n\n set caller(value) {\n this.$hidden.$hiddencaller = value;\n }\n\n clone() {\n const input = { ...this.input };\n const output = { ...this.output };\n const labels = [...this.labels];\n const newNode = new CallNode(input, output, null, labels);\n\n if (this.displayName) {\n newNode.displayName = this.displayName;\n }\n\n this.children.forEach((child) => {\n const newChild = child.clone();\n newNode.addChild(newChild);\n newChild.caller = newNode;\n });\n\n return newNode;\n }\n\n addChild(node) {\n this.children.push(node);\n }\n\n // Replace a given child with a different set of children.\n replaceChild(child, children) {\n const idx = this.children.indexOf(child);\n if (idx === -1) {\n throw new Error(`${child} not found in call tree`);\n }\n\n this.children.splice(idx, 1, ...children);\n /* eslint-disable no-param-reassign */\n children.forEach((c) => {\n c.caller = this;\n });\n child.caller = null;\n /* eslint-enable no-param-reassign */\n }\n\n removeChild(child) {\n const childIndex = this.children.indexOf(child);\n if (childIndex < 0) {\n throw new Error(`${child} found orphaned by ${this} !`);\n }\n this.children.splice(childIndex, 1);\n }\n\n postOrderForEach(fn, stack = []) {\n stack.push(this);\n const children = [...this.children];\n children.forEach((child) => child.postOrderForEach(fn, stack));\n fn(this, stack);\n stack.pop(this);\n }\n\n preOrderForEach(fn, stack = []) {\n stack.push(this);\n fn(this, stack);\n const children = [...this.children];\n children.forEach((child) => child.preOrderForEach(fn, stack));\n stack.pop(this);\n }\n\n forEach(fn) {\n this.postOrderForEach(fn);\n }\n\n // filter returns a tree in which all nodes match a condition. If a node fails the\n // condition, its children are adopted by it's parent.\n filter(conditionFn) {\n const root = this.clone();\n root.forEach((node, stack) => {\n if (node.isRoot()) {\n return;\n }\n\n if (!conditionFn(node, stack)) {\n const parent = node.caller;\n parent.replaceChild(node, node.children);\n }\n });\n\n return root;\n }\n\n // include returns a tree in which all leaf nodes match a condition.\n // If a node passes the condition, the node and all of its parents are retained\n // in the tree. If it fails, the node and its children are removed from the tree.\n // Note that if a node passes the condition, the condition will not be evaluated\n // for that node's parent nodes, since they are already marked as retained.\n include(conditionFn) {\n /* eslint-disable no-param-reassign */\n const root = this.clone();\n root.postOrderForEach((node, stack) => {\n if (node.isRoot()) {\n return;\n }\n\n if (node.marked_include && node.caller) {\n node.caller.marked_include = true;\n return;\n }\n\n node.marked_include = conditionFn(node, stack);\n if (node.marked_include) {\n if (node.caller) {\n node.caller.marked_include = true;\n }\n return;\n }\n\n if (node.caller) {\n node.caller.removeChild(node);\n }\n });\n\n root.postOrderForEach((node) => {\n delete node.marked_include;\n });\n\n return root;\n /* eslint-enable no-param-reassign */\n }\n\n // exclude returns a tree in which all nodes that match a condition are removed, along\n // with their child nodes.\n exclude(conditionFn) {\n const root = this.clone();\n root.forEach((node, stack) => {\n if (node.isRoot()) {\n return;\n }\n\n if (conditionFn(node, stack)) {\n const parent = node.caller;\n parent.removeChild(node);\n }\n });\n\n return root;\n }\n\n // toArray returns this tree as a one dimensional array\n toArray() {\n const childEvents = this.children.map((child) => child.toArray()).flat();\n\n if (this.isRoot()) {\n return childEvents;\n }\n\n return [this, ...childEvents];\n }\n\n // find calls find recursively on all children\n // iterates in pre-order\n find(fn) {\n if (fn(this)) {\n return this;\n }\n\n for (let i = 0; i < this.children.length; i += 1) {\n const match = this.children[i].find(fn);\n if (match) {\n return match;\n }\n }\n\n return null;\n }\n\n // depth returns the depth of this node\n depth() {\n return this.ancestors().length;\n }\n\n // ancestors returns an array of this nodes ancestors\n ancestors() {\n const nodes = [];\n\n let parent = this.caller;\n while (parent) {\n nodes.push(parent);\n parent = parent.caller;\n }\n\n return nodes;\n }\n\n // returns whether or not a node has a particular node in its ancestry\n hasAncestor(ancestor) {\n let node = this;\n while (node) {\n if (node === ancestor) {\n return true;\n }\n node = node.caller;\n }\n return false;\n }\n\n descendants() {\n return [this, ...this.children.map((x) => x.descendants()).flat()];\n }\n\n next() {\n if (this.children.length > 0) {\n return this.children[0];\n }\n\n let child = this;\n let parent = this.caller;\n const fnChildIndex = (n) => n === child;\n while (parent) {\n const myIndex = parent.children.findIndex(fnChildIndex);\n if (myIndex < 0) {\n throw new Error(`${this} found orphaned by ${parent}!`);\n }\n\n if (myIndex < parent.children.length - 1) {\n return parent.children[myIndex + 1];\n }\n\n child = parent;\n parent = parent.caller;\n }\n\n return null;\n }\n\n previous() {\n const parent = this.caller;\n if (!parent) {\n return null;\n }\n\n if (parent.children.length === 1) {\n return parent;\n }\n\n const myIndex = parent.children.findIndex((n) => n === this);\n if (myIndex < 0) {\n throw new Error(`${this.input.id} found orphaned by ${parent.input.id}!`);\n }\n\n if (myIndex > 0) {\n // this branch will yield our previous node\n let candidate = parent.children[myIndex - 1];\n\n // iterate until we find a leaf node\n while (candidate.children.length > 0) {\n candidate = candidate.children[candidate.children.length - 1];\n }\n\n return candidate;\n }\n\n return parent;\n }\n\n // return the node to the left, at given max depth\n left(depth) {\n const target = depth || this.depth();\n\n // find the target or the nearest descendant\n let current = this;\n for (;;) {\n const parent = current.caller;\n if (!parent) return this;\n\n const siblings = parent.children;\n const i = siblings.indexOf(current);\n if (i !== 0) {\n current = parent.children[i - 1];\n break;\n } else {\n current = parent;\n }\n }\n\n // find rightmost child closest to the right depth\n while (current.depth() !== target) {\n const { children } = current;\n if (children.length === 0) break;\n current = children[children.length - 1];\n }\n\n return current;\n }\n\n // return the node to the right, at given max depth\n right(depth) {\n const target = depth || this.depth();\n\n // find the target or the nearest descendant\n let current = this;\n for (;;) {\n const parent = current.caller;\n if (!parent) return this;\n\n const siblings = parent.children;\n const i = siblings.indexOf(current);\n if (i !== siblings.length - 1) {\n current = parent.children[i + 1];\n break;\n } else {\n current = parent;\n }\n }\n\n // find leftmost child closest to the right depth\n while (current.depth() !== target) {\n const { children } = current;\n if (children.length === 0) break;\n [current] = children;\n }\n\n return current;\n }\n\n isRoot() {\n return this.caller === null;\n }\n\n count() {\n let numNodes = 0;\n this.forEach(() => {\n numNodes += 1;\n });\n return numNodes;\n }\n\n get id() {\n if (this.input && this.input.id) {\n return this.input.id;\n }\n return null;\n }\n}\n\nexport default CallNode;\n","function getListenerArray(eventSource, eventType) {\n /* eslint-disable no-param-reassign */\n let listeners = eventSource.listeners[eventType];\n if (!listeners) {\n listeners = [];\n eventSource.listeners[eventType] = listeners;\n }\n return listeners;\n /* eslint-enable no-param-reassign */\n}\n\nexport default class EventSource {\n constructor() {\n this.listeners = {};\n this.anyListeners = [];\n }\n\n once(eventType, fn) {\n const handlers = getListenerArray(this, eventType);\n handlers.push({ fn, once: true });\n return this;\n }\n\n on(eventType, fn) {\n const handlers = getListenerArray(this, eventType);\n handlers.push({ fn });\n return this;\n }\n\n off(eventType, fn) {\n const handlers = this.listeners[eventType];\n\n if (handlers) {\n const updatedHandlers = handlers.filter((h) => h.fn && h.fn !== fn);\n if (updatedHandlers.length === 0) {\n delete this.listeners[eventType];\n } else if (updatedHandlers.length !== handlers.length) {\n this.listeners[eventType] = updatedHandlers;\n }\n }\n\n return this;\n }\n\n emit(eventType, data = undefined) {\n const handlers = this.listeners[eventType];\n\n if (handlers) {\n let includesOnce = false;\n handlers.forEach((handler) => {\n if (handler.once) {\n includesOnce = true;\n }\n\n try {\n handler.fn(data);\n } catch (e) {\n console.error(`error occurred while executing event ${eventType}`);\n console.error(e);\n }\n });\n\n if (includesOnce) {\n // Only reassign this value if we've encountered a handler that's run once\n this.listeners[eventType] = this.listeners[eventType].filter((h) => !h.once);\n }\n }\n\n this.anyListeners.forEach((eventSource) => eventSource.emit(eventType, data));\n\n return this;\n }\n\n // Pipe events from EventSource A to EventSource B. If `eventTypes` are\n // provided, bind only those types. Otherwise, pipe any event.\n pipe(eventSource, ...eventTypes) {\n if (eventTypes.length) {\n eventTypes.forEach((type) => eventSource.on(type, (data) => this.emit(data)));\n return this;\n }\n\n eventSource.any(this);\n return this;\n }\n\n // Bind `eventSource` to recieve any event sent from `this`.\n any(eventSource) {\n this.anyListeners.push(eventSource);\n return this;\n }\n}\n","import CallNode from './callNode';\nimport EventSource from '../eventSource';\n\nexport default class CallTree extends EventSource {\n constructor(events, functionLabels = () => []) {\n super();\n\n this.dataStore = {\n rootEvent: this.rootNode,\n selectedEvent: this.rootNode,\n };\n\n this.rootEvent = new CallNode();\n const stack = [this.rootEvent];\n events.forEach((e) => {\n if (e.event !== 'call') {\n if (stack.length > 1) {\n stack.pop();\n }\n return;\n }\n\n const parent = stack[stack.length - 1];\n const callNode = new CallNode(e, e.returnEvent, parent, functionLabels(e));\n parent.addChild(callNode);\n stack.push(callNode);\n });\n\n return this;\n }\n\n get rootEvent() {\n return this.dataStore.rootEvent;\n }\n\n set rootEvent(event) {\n this.dataStore.rootEvent = event;\n this.emit('rootEvent', event);\n }\n\n get selectedEvent() {\n return this.dataStore.selectedEvent;\n }\n\n set selectedEvent(event) {\n this.dataStore.selectedEvent = event;\n this.emit('selectedEvent', event);\n }\n}\n","import ClassMap from './classMap';\nimport CallTree from './callTree/callTree';\nimport { buildLabels, resolveDifferences, getRootEvents } from './util';\n\n// merge contiguous changes into a single element (as an array)\nfunction groupChanges(eventArray) {\n const events = new Set(eventArray);\n const seen = new Set();\n const result = [];\n\n eventArray.forEach((e) => {\n if (seen.has(e)) {\n return;\n }\n\n seen.add(e);\n\n const group = [e];\n let currentEvent = e;\n for (;;) {\n const { nextSibling } = currentEvent;\n if (nextSibling && events.has(nextSibling)) {\n group.push(nextSibling);\n seen.add(nextSibling);\n currentEvent = nextSibling;\n } else {\n break;\n }\n }\n\n result.push(group);\n });\n\n return result;\n}\n\nexport default class AppMap {\n constructor(data) {\n this.data = {\n events: [],\n classMap: [],\n ...data,\n };\n\n this.classMap = new ClassMap(this.data.classMap);\n this.callTree = new CallTree(this.events);\n this.classMap.bindEvents(this.events);\n this.labels = buildLabels(this.classMap, this.events);\n\n // Establish event linked list references\n let previousEvent;\n this.events.forEach((e) => {\n if (previousEvent) {\n e.previous = previousEvent;\n previousEvent.next = e;\n }\n\n previousEvent = e;\n });\n\n this.eventsById = this.events.reduce((acc, event) => {\n acc[event.id] = event;\n return acc;\n }, {});\n\n // Keep these fields seperate for serialization\n delete this.data.classMap;\n }\n\n get version() {\n return this.data.version;\n }\n\n get metadata() {\n return this.data.metadata || {};\n }\n\n get name() {\n return this.metadata.name;\n }\n\n get rootEvent() {\n return this.callTree.rootEvent;\n }\n\n get events() {\n return this.data.events;\n }\n\n getEvent(eventId) {\n return this.eventsById[eventId];\n }\n\n shallowCopy() {\n const copy = new AppMap({});\n copy.data.events = this.data.events;\n copy.data.metadata = this.data.metadata;\n copy.classMap = this.classMap;\n copy.callTree = this.callTree;\n return copy;\n }\n\n // Gets an array of root events, which is all events whose parent is undefined.\n rootEvents() {\n return getRootEvents(this.events);\n }\n\n // Iterate many AppMaps at once as an event tree. This method will follow the deepest branch\n // available, and yield the nodes at that position. Given that the tree structure may differ\n // across AppMaps, it's possible that some nodes will be null.\n static *multiTreeIterator(baseAppMap, workingAppMap) {\n let baseEvent;\n let workingEvent;\n const baseQueue = baseAppMap.rootEvents();\n const workingQueue = workingAppMap.rootEvents();\n\n resolveDifferences(baseQueue, workingQueue);\n\n for (;;) {\n baseEvent = baseQueue.shift();\n workingEvent = workingQueue.shift();\n\n // If both are null, every path has been exhausted. We're done.\n if (!baseEvent && !workingEvent) {\n return;\n }\n\n // Don't bother continuing to iterate through a branch that doesn't exist in the other tree.\n if (baseEvent && workingEvent) {\n const baseChildren = baseEvent ? [...baseEvent.children] : [];\n const workingChildren = workingEvent ? [...workingEvent.children] : [];\n\n resolveDifferences(baseChildren, workingChildren);\n baseChildren.forEach((e) => baseQueue.push(e));\n workingChildren.forEach((e) => workingQueue.push(e));\n }\n\n yield [baseEvent, workingEvent];\n }\n }\n\n static getDiff(baseAppMap, workingAppMap) {\n const changeSummary = {\n changed: [],\n added: [],\n removed: [],\n };\n\n const iter = AppMap.multiTreeIterator(baseAppMap, workingAppMap);\n let result = iter.next();\n while (!result.done) {\n const [nodeBase, nodeWorking] = result.value;\n\n if (!nodeBase) {\n changeSummary.added.push(nodeWorking);\n } else if (!nodeWorking) {\n changeSummary.removed.push(nodeBase);\n } else if (nodeBase.hash !== nodeWorking.hash) {\n changeSummary.changed.push([nodeBase, nodeWorking]);\n }\n\n result = iter.next();\n }\n\n changeSummary.added = groupChanges(changeSummary.added);\n changeSummary.removed = groupChanges(changeSummary.removed);\n\n return changeSummary;\n }\n\n toJSON() {\n return {\n ...this.data,\n classMap: this.classMap,\n };\n }\n}\n","import sha256 from 'crypto-js/sha256.js';\n\nexport default class HashBuilder {\n constructor(algorithmVersion) {\n this.hashEntries = [['algorithmVersion', algorithmVersion]];\n }\n\n addProperty(key, value) {\n this.hashEntries.push([key, value]);\n }\n\n get canonicalString() {\n return this.hashEntries.map((row) => row.join('=')).join('\\n');\n }\n\n digest() {\n return sha256(this.hashEntries.map((r) => r.join('=')).join('')).toString();\n }\n\n static buildHash(algorithmName, properties) {\n const hash = new HashBuilder(algorithmName);\n\n Object.keys(properties)\n .sort()\n .forEach((key) => hash.addProperty(key, properties[key]));\n\n return hash;\n }\n}\n","import { addHiddenProperty, hasProp, transformToJSON } from './util';\nimport analyzeSQL, { abstractSqlAstJSON } from './sql/analyze';\nimport normalizeSQL from './sql/normalize';\nimport HashBuilder from './hashBuilder';\n\nfunction alias(obj, prop, alias) {\n if (!obj || typeof obj[prop] === 'undefined' || typeof obj[alias] !== 'undefined') {\n return;\n }\n\n Object.defineProperty(obj, alias, {\n get() {\n return this[prop];\n },\n enumerable: false,\n });\n}\n\n// This class supercedes `CallTree` and `CallNode`. Events are stored in a flat\n// array and can also be traversed like a tree via `parent` and `children`.\nexport default class Event {\n static contentType(...messages) {\n const msg = messages.find((message) => (message?.headers || {})['Content-Type']);\n if (!msg) {\n return null;\n }\n\n return msg.headers['Content-Type'];\n }\n\n constructor(obj) {\n let data = obj;\n\n if (obj instanceof Event) {\n data = { ...obj };\n\n if (obj.$hidden.parameters) {\n data.parameters = obj.$hidden.parameters.map((p) => ({ ...p }));\n }\n\n if (Array.isArray(obj.$hidden.message)) {\n data.message = obj.$hidden.message.map((m) => ({ ...m }));\n }\n\n if (obj.$hidden.labels) {\n data.labels = [...obj.$hidden.labels];\n }\n\n if (obj.$hidden.exceptions) {\n data.exceptions = [...obj.$hidden.exceptions];\n }\n }\n\n this.dataKeys = Object.keys(data);\n\n // Cyclic references shall not be enumerable\n if (data.event === 'call') {\n addHiddenProperty(this, 'parent');\n addHiddenProperty(this, 'children', { writable: false, value: [] });\n addHiddenProperty(this, 'dataReferences', { writable: false, value: [] });\n addHiddenProperty(this, 'codeObject');\n addHiddenProperty(this, 'parameters');\n addHiddenProperty(this, 'message');\n }\n\n addHiddenProperty(this, 'linkedEvent');\n addHiddenProperty(this, 'labels');\n addHiddenProperty(this, 'exceptions');\n addHiddenProperty(this, 'next');\n addHiddenProperty(this, 'previous');\n addHiddenProperty(this, 'hash');\n addHiddenProperty(this, 'identityHash');\n addHiddenProperty(this, 'depth');\n addHiddenProperty(this, 'sqlQuery');\n\n // Backward compatibility\n // `status_code` used to be normalized to `status` during normalization. They can now be used\n // interchangeably.\n alias(data.http_server_response, 'status_code', 'status');\n alias(data.http_server_response, 'status', 'status_code');\n alias(data.http_client_response, 'status_code', 'status');\n alias(data.http_client_response, 'status', 'status_code');\n\n // Data must be written last, after our properties are configured.\n Object.assign(this, data);\n }\n\n get depth() {\n if (this.$hidden.depth === undefined) {\n let result = 0;\n let { parent } = this;\n while (parent) {\n result += 1;\n parent = parent.parent;\n }\n this.$hidden.depth = result;\n }\n return this.$hidden.depth;\n }\n\n get methodId() {\n return this.method_id;\n }\n\n get isFunction() {\n return this.definedClass && this.methodId;\n }\n\n get isStatic() {\n return this.static;\n }\n\n get sql() {\n return this.callEvent.sql_query;\n }\n\n get returnValue() {\n return this.returnEvent ? this.returnEvent.return_value : undefined;\n }\n\n get elapsedTime() {\n return this.returnEvent ? this.returnEvent.elapsed : undefined;\n }\n\n get elapsedInstrumentationTime() {\n return this.returnEvent ? this.returnEvent.elapsed_instrumentation : undefined;\n }\n\n get linkedEvent() {\n return this.$hidden.linkedEvent;\n }\n\n get next() {\n return this.$hidden.next;\n }\n\n get previous() {\n return this.$hidden.previous;\n }\n\n get parent() {\n return this.$hidden.parent;\n }\n\n get children() {\n return this.$hidden.children || [];\n }\n\n get codeObject() {\n return this.callEvent.$hidden.codeObject;\n }\n\n get parameters() {\n return this.callEvent.$hidden.parameters;\n }\n\n get labels() {\n const eventLabels = this.callEvent.$hidden.labels || [];\n return new Set([...eventLabels, ...this.callEvent.codeObject.labels]);\n }\n\n get exceptions() {\n return this.returnEvent ? this.returnEvent.$hidden.exceptions || [] : [];\n }\n\n get message() {\n return this.callEvent.$hidden.message;\n }\n\n get httpServerRequest() {\n return this.callEvent.http_server_request;\n }\n\n get httpServerResponse() {\n return this.returnEvent ? this.returnEvent.http_server_response : undefined;\n }\n\n get httpClientRequest() {\n return this.callEvent.http_client_request;\n }\n\n get httpClientResponse() {\n return this.returnEvent ? this.returnEvent.http_client_response : undefined;\n }\n\n get definedClass() {\n return this.defined_class ? this.defined_class.replace(/\\./g, '/') : null;\n }\n\n get requestPath() {\n if (this.httpServerRequest) {\n return this.httpServerRequest.normalized_path_info || this.httpServerRequest.path_info;\n }\n if (this.httpClientRequest) {\n return this.httpClientRequest.url;\n }\n return null;\n }\n\n get requestMethod() {\n if (this.httpServerRequest) {\n return this.httpServerRequest.request_method;\n }\n if (this.httpClientRequest) {\n return this.httpClientRequest.request_method;\n }\n return null;\n }\n\n get requestContentType() {\n return Event.contentType(this.httpServerRequest, this.httpClientRequest);\n }\n\n get responseContentType() {\n return Event.contentType(this.httpServerResponse, this.httpClientResponse);\n }\n\n get route() {\n const { requestMethod, requestPath } = this;\n if (!requestMethod || !requestPath) {\n return null;\n }\n\n return `${requestMethod} ${requestPath}`;\n }\n\n get sqlQuery() {\n if (!this.$hidden.sqlQuery) {\n const { sql } = this;\n this.$hidden.sqlQuery = sql ? sql.normalized_sql || sql.sql : null;\n }\n return this.$hidden.sqlQuery;\n }\n\n get fqid() {\n return `event:${this.id}`;\n }\n\n get previousSibling() {\n const { parent } = this;\n if (!parent) {\n return null;\n }\n\n const myIndex = parent.children.findIndex((e) => e === this);\n console.assert(myIndex !== -1, 'attempted to locate index of an orphaned event');\n\n if (myIndex === 0) {\n return null;\n }\n\n return parent.children[myIndex - 1];\n }\n\n get nextSibling() {\n const { parent } = this;\n\n if (!parent) {\n let event = this.next;\n\n // Get the next root level event\n while (event) {\n if (event.isCall() && !event.parent) {\n return event;\n }\n\n event = event.next;\n }\n\n return null;\n }\n\n const myIndex = this.parent.children.findIndex((e) => e === this);\n console.assert(myIndex !== -1, 'attempted to locate index of an orphaned event');\n\n if (myIndex === parent.children.length - 1) {\n return null;\n }\n\n return parent.children[myIndex + 1];\n }\n\n set codeObject(value) {\n if (hasProp(this.$hidden, 'codeObject')) {\n this.$hidden.codeObject = value;\n }\n }\n\n set parameters(value) {\n if (hasProp(this.$hidden, 'parameters')) {\n this.$hidden.parameters = value;\n }\n }\n\n set labels(value) {\n if (hasProp(this.$hidden, 'labels')) {\n this.$hidden.labels = value;\n }\n }\n\n set exceptions(value) {\n if (hasProp(this.$hidden, 'exceptions')) {\n this.$hidden.exceptions = value;\n }\n }\n\n set message(value) {\n if (hasProp(this.$hidden, 'message')) {\n this.$hidden.message = value;\n }\n }\n\n set linkedEvent(value) {\n this.$hidden.linkedEvent = value;\n }\n\n set next(value) {\n this.$hidden.next = value;\n }\n\n set previous(value) {\n this.$hidden.previous = value;\n }\n\n set parent(value) {\n this.$hidden.parent = value;\n }\n\n link(event) {\n /* eslint-disable no-param-reassign */\n if (event.linkedEvent || this.linkedEvent) {\n return;\n }\n\n event.linkedEvent = this;\n this.linkedEvent = event;\n /* eslint-enable no-param-reassign */\n }\n\n isCall() {\n return this.event === 'call';\n }\n\n isReturn() {\n return this.event === 'return';\n }\n\n get threadId() {\n return this.thread_id;\n }\n\n get parentId() {\n return this.returnEvent ? this.returnEvent.parent_id : undefined;\n }\n\n get callEvent() {\n return this.isCall() ? this : this.$hidden.linkedEvent;\n }\n\n get returnEvent() {\n return this.isReturn() ? this : this.$hidden.linkedEvent;\n }\n\n get identityHash() {\n if (!this.$hidden.identityHash) {\n this.$hidden.identityHash = this.buildIdentityHash().digest();\n }\n return this.$hidden.identityHash;\n }\n\n get hash() {\n if (!this.$hidden.hash) {\n this.$hidden.hash = this.buildStableHash().digest();\n }\n return this.$hidden.hash;\n }\n\n get stableProperties() {\n if (!this.$hidden.stableProperties) {\n this.$hidden.stableProperties = this.gatherStableProperties();\n }\n return this.$hidden.stableProperties;\n }\n\n callStack() {\n const stack = this.ancestors().reverse();\n stack.push(this.callEvent);\n return stack;\n }\n\n ancestors() {\n const ancestorArray = [];\n let event = this.callEvent.parent;\n\n while (event) {\n ancestorArray.push(event);\n event = event.parent;\n }\n\n return ancestorArray;\n }\n\n descendants() {\n const descendantArray = [];\n const queue = [...this.children];\n\n while (queue.length) {\n const event = queue.pop();\n event.children.forEach((child) => queue.push(child));\n descendantArray.push(event);\n }\n\n return descendantArray;\n }\n\n traverse(fn) {\n let event = this;\n const boundaryEvent = this.nextSibling;\n let { onEnter } = fn;\n let { onExit } = fn;\n\n if (typeof fn === 'function') {\n onEnter = fn;\n onExit = fn;\n }\n\n while (event) {\n if (event.isCall() && onEnter) {\n onEnter(event);\n } else if (event.isReturn() && onExit) {\n onExit(event);\n }\n\n event = event.next;\n if (!event || event === boundaryEvent) {\n break;\n }\n }\n }\n\n dataObjects() {\n return [this.parameters, this.message, this.returnValue].flat().filter(Boolean);\n }\n\n get qualifiedMethodId() {\n const { definedClass, isStatic, methodId } = this;\n if (!definedClass) return undefined;\n return `${definedClass}${isStatic ? '.' : '#'}${methodId}`;\n }\n\n toJSON() {\n return transformToJSON(this.dataKeys, this);\n }\n\n toString() {\n const { sqlQuery } = this;\n if (sqlQuery) {\n return sqlQuery;\n }\n\n const { route } = this;\n if (route) {\n return route;\n }\n\n return this.qualifiedMethodId;\n }\n\n // Returns canonical properties tied to the event's core identity: SQL, HTTP, or a\n // specific method on a specific class. Identity properties are used to identify events that are\n // added/removed between two AppMaps, as opposed to changes. If two events share the same\n // identity properties, they won't be reported as an add/remove, but may be reported as a change.\n gatherIdentityProperties() {\n if (this.httpServerRequest) {\n return { event_type: 'http_server_request', route: this.route };\n }\n if (this.httpClientRequest) {\n return { event_type: 'http_client_request', route: this.route };\n }\n\n const { sqlQuery } = this;\n if (sqlQuery) {\n const queryOps = analyzeSQL(sqlQuery);\n if (!queryOps)\n return {\n event_type: 'sql',\n sql_normalized: normalizeSQL(sqlQuery, this.sql.database_type),\n }; // Best we can do\n\n return {\n event_type: 'sql',\n actions: [...new Set(queryOps.actions)].sort(),\n tables: [...new Set(queryOps.tables)].sort(),\n };\n }\n\n return {\n event_type: 'function',\n id: this.codeObject.id,\n };\n }\n\n // Collects properties of an event which are not dependent on the specifics\n // of invocation.\n gatherStableProperties(parsedSqlCache) {\n const { sqlQuery } = this;\n\n // Convert null and undefined values to empty strings\n const normalizeProperties = (/** @type{Record} */ properties) =>\n Object.fromEntries(\n Object.entries(properties).map(([key, value]) => [\n key,\n value === undefined || value === null ? '' : value,\n ])\n );\n\n // Augment a set of base properties with HTTP client/server request properties.\n const requestProperties = (/** @type{Record} */ baseProperties) =>\n Object.assign(baseProperties, {\n route: this.route,\n status_code:\n this.httpServerResponse?.status ||\n this.httpServerResponse?.status_code ||\n this.httpClientResponse?.status ||\n this.httpServerResponse?.status_code,\n });\n\n let properties;\n if (sqlQuery) {\n let sqlNormalized;\n const cacheKey = `${this.sql.database_type}:${sqlQuery}`;\n if (parsedSqlCache) sqlNormalized = parsedSqlCache.get(cacheKey);\n if (!sqlNormalized) {\n sqlNormalized = abstractSqlAstJSON(sqlQuery, this.sql.database_type)\n // Collapse repeated variable literals and parameter tokens (e.g. '?, ?' in an IN clause)\n .split(/{\"type\":\"variable\"}(?:,{\"type\":\"variable\"})*/g)\n .join(`{\"type\":\"variable\"}`);\n\n if (parsedSqlCache) parsedSqlCache.set(cacheKey, sqlNormalized);\n }\n\n properties = {\n event_type: 'sql',\n sql_normalized: sqlNormalized,\n };\n } else if (this.httpServerRequest) {\n properties = requestProperties({ event_type: 'http_server_request' });\n } else if (this.httpClientRequest) {\n properties = requestProperties({\n event_type: 'http_client_request',\n });\n } else {\n properties = {\n event_type: 'function',\n id: this.codeObject.id,\n raises_exception: this.exceptions.length > 0,\n };\n }\n return normalizeProperties(properties);\n }\n\n buildIdentityHash() {\n return HashBuilder.buildHash('event-identity-v2', this.gatherIdentityProperties());\n }\n\n buildStableHash(parsedSqlCache) {\n return HashBuilder.buildHash(\n 'event-stable-properties-v2',\n this.gatherStableProperties(parsedSqlCache)\n );\n }\n}\n","export default class EventStack {\n constructor(id) {\n this.events = [];\n this.stack = [];\n this.id = id;\n this.eventMap = {};\n }\n\n add(event) {\n if (event.isCall()) {\n this.stack.push(event);\n this.eventMap[event.id] = event;\n } else {\n if (typeof event.parent_id === 'undefined') {\n const lastEvent = this.stack[this.stack.length - 1];\n if (\n lastEvent &&\n lastEvent.defined_class === event.defined_class &&\n lastEvent.method_id === event.method_id &&\n lastEvent.path === event.path &&\n lastEvent.static === event.static\n ) {\n event.parent_id = lastEvent.id; // eslint-disable-line no-param-reassign\n } else {\n // An event has returned but the last call in the stack was not its\n // caller. There's not really anything we can do to rectify this, so\n // the event will be discarded.\n return;\n }\n }\n\n const call = this.eventMap[event.parent_id];\n if (call) {\n call.link(event);\n this.stack.pop();\n\n const parent = this.stack[this.stack.length - 1];\n if (parent) {\n parent.children.push(call);\n call.parent = parent;\n }\n } else {\n // This can happen in async contexts where the recording began in the middle\n // of another async task. It's possible that the parent call was executed\n // before the recording began. If this is the case, discard the return event.\n return;\n }\n }\n\n this.events.push(event);\n }\n\n unwound() {\n return this.events.length > 0 && this.stack.length === 0;\n }\n}\n","import EventStack from './eventStack';\nimport { sizeof } from '../util';\n\nfunction getStackId(collection) {\n return Object.keys(collection.activeStacks).length + collection.finalizedStacks.length;\n}\n\n// EventSorter is responsible for untangling an event array. It sorts events by\n// thread execution order and drops leading return statements.\nexport default class EventSorter {\n constructor() {\n this.activeStacks = {};\n this.finalizedStacks = [];\n }\n\n // Add an event to be sorted. An event must be added through this method to\n // be collected.\n add(event) {\n let stack = this.activeStacks[event.thread_id];\n if (!stack) {\n const id = getStackId(this);\n stack = new EventStack(id);\n this.activeStacks[event.thread_id] = stack;\n }\n\n stack.add(event);\n\n if (stack.unwound()) {\n this.finalizedStacks.splice(stack.id, 0, stack.events);\n delete this.activeStacks[event.thread_id];\n }\n }\n\n // Calculate the serialized size of all events. This is more of an\n // approximation than an exact number.\n size() {\n let size = sizeof(Object.values(this.activeStacks));\n size += sizeof(this.finalizedStacks);\n return size;\n }\n\n // Returns an array of \"chunks\". A chunk is an array consisting of many\n // stacks. A stack is an array consisting of many events.\n collect() {\n // Join active and finalized stacks. We want to make sure we iterate over\n // every event.\n const stacks = [...this.finalizedStacks];\n Object.values(this.activeStacks).forEach((s) => stacks.splice(s.id, 0, s.events));\n\n return stacks.reduce((chunks, stack) => {\n if (stack.length === 0) {\n return chunks;\n }\n\n // We're the first chunk in, meaning we don't need to worry about any\n // chunks behind us. Just push it.\n if (chunks.length === 0) {\n chunks.push([stack]);\n return chunks;\n }\n\n // If the root event is an HTTP request, this a complete chunk. Push it.\n if (stack[0].http_server_request) {\n chunks.push([stack]);\n return chunks;\n }\n\n if (stack[0].http_client_request) {\n chunks.push([stack]);\n return chunks;\n }\n\n // Check to see if the previous chunk began with an HTTP request. If it\n // does, push a new chunk. Otherwise, append to the last chunk.\n const prevChunk = chunks[chunks.length - 1];\n const prevStack = prevChunk[prevChunk.length - 1];\n if (prevStack[0].http_server_request || prevStack[0].http_client_request) {\n chunks.push([stack]);\n } else {\n prevChunk.push(stack);\n }\n\n return chunks;\n }, []);\n }\n}\n","import EventSource from '../eventSource';\nimport AppMap from '../appMap';\nimport ClassMap from '../classMap';\nimport Event from '../event';\nimport EventSorter from './eventSorter';\nimport { sizeof } from '../util';\n\n// Performs an array of transform functions on an object. The transform function\n// is expected to return the transformed object.\nconst transform = (transforms, obj, ...args) => transforms.reduce((x, fn) => fn(x, ...args), obj);\n\n// AppMapBuilder is responsible for transforming appmap data before returning\n// an AppMap model.\nclass AppMapBuilder extends EventSource {\n constructor(data) {\n super();\n\n this.sorter = new EventSorter();\n this.transforms = {\n event: [],\n stack: [],\n chunk: [],\n };\n this.allEvents = [];\n\n if (data) {\n this.source(data);\n }\n }\n\n // Provide a source of data - i.e. an appmap JSON object\n source(data) {\n const dataType = typeof data;\n if (dataType === 'object') {\n this.data = { ...data };\n } else if (dataType === 'string') {\n this.data = JSON.parse(data);\n } else {\n throw new Error(`got invalid type ${dataType}, expected object or string`);\n }\n\n this.exclusions = new Set();\n\n (this.data.events || []).forEach((e) => {\n if (this.data.eventUpdates && this.data.eventUpdates[e.id]) {\n // eslint-disable-next-line no-param-reassign\n e = this.data.eventUpdates[e.id];\n }\n const event = new Event(e);\n this.allEvents.push(event);\n this.sorter.add(event);\n });\n\n delete this.data.events;\n delete this.data.eventUpdates;\n\n return this;\n }\n\n // register an optional event transform\n event(fn) {\n console.assert(typeof fn === 'function');\n this.transforms.event.push(fn);\n return this;\n }\n\n // register a optional stack transform\n stack(fn) {\n console.assert(typeof fn === 'function');\n this.transforms.stack.push(fn);\n return this;\n }\n\n // register a optional chunk transform\n chunk(fn) {\n console.assert(typeof fn === 'function');\n this.transforms.chunk.push(fn);\n return this;\n }\n\n // normalize the appmap data before returning an Appmap model\n normalize() {\n // Remove credentials from git repository url\n if (/^https?/.test(this.data.metadata?.git?.repository)) {\n const url = new URL(this.data.metadata.git.repository);\n url.username = '';\n url.password = '';\n this.data.metadata.git.repository = url.toString();\n }\n\n // Re-index events\n let eventId = 1;\n this.event((event) => {\n /* eslint-disable no-param-reassign */\n event.id = eventId;\n eventId += 1;\n\n if (event.isCall() && event.returnEvent) {\n event.returnEvent.parent_id = event.id;\n }\n\n // Normalize path info\n const { httpServerRequest } = event;\n if (httpServerRequest && httpServerRequest.normalized_path_info) {\n httpServerRequest.normalized_path_info = httpServerRequest.normalized_path_info.toString();\n }\n if (httpServerRequest && httpServerRequest.path_info) {\n httpServerRequest.path_info = httpServerRequest.path_info.toString();\n }\n\n return event;\n /* eslint-enable no-param-reassign */\n });\n\n // Balance the stack by adding dummy returns to calls which never return\n return this.stack((events) => {\n events\n .filter((e) => e.isCall() && !e.returnEvent)\n .reverse()\n .map((e) => {\n const returnEvent = new Event({\n event: 'return',\n thread_id: e.thread_id,\n parent_id: e.id,\n });\n returnEvent.link(e);\n return returnEvent;\n })\n .forEach((e) => events.push(e));\n\n return events;\n });\n }\n\n // Cut down the size of the event array before creating the Appmap model\n prune(sizeBytes) {\n console.assert(typeof sizeBytes === 'number');\n\n let classMap;\n let pruneRatio = 0;\n\n return this.on('preprocess', (d) => {\n const size = this.sorter.size();\n classMap = new ClassMap(d.data.classMap);\n pruneRatio = Math.min(sizeBytes / size, 1);\n\n // We're storing size/count state in the global class map. This isn't\n // great but it works for now.\n classMap.visit((obj) => {\n /* eslint-disable no-param-reassign */\n obj.size = 0;\n obj.count = 0;\n /* eslint-enable no-param-reassign */\n });\n\n this.allEvents.forEach((e) => {\n if (e.event !== 'call' || e.sql_query || e.http_server_request || e.http_client_request) {\n return;\n }\n\n const obj = classMap.codeObjectFromEvent(e);\n if (obj) {\n const objSize = sizeof(e);\n obj.size = obj.size + objSize || objSize;\n obj.count = obj.count + 1 || 1;\n }\n });\n\n // Build an array of code objects sorted by size. The largest object\n // will always be index 0.\n let totalBytes = 0;\n const eventAggregates = classMap.codeObjects\n .filter((obj) => obj.size)\n .sort((a, b) => a.size - b.size)\n .map((obj) => {\n totalBytes += obj.size;\n return {\n fqid: obj.fqid,\n count: obj.count,\n size: obj.size,\n totalBytes,\n };\n })\n .reverse();\n\n // Build a list of unique exclusions, starting with the largest event\n // type. Iterate until the estimated event array size is under our\n // threshold.\n for (let i = 0; i < eventAggregates.length; i += 1) {\n const eventInfo = eventAggregates[i];\n if (eventInfo.totalBytes <= totalBytes * pruneRatio) {\n break;\n }\n this.exclusions.add(eventInfo.fqid);\n }\n this.updatePruneFilter();\n }).chunk((stacks) => this.excludeEvents(stacks, classMap, this.exclusions));\n }\n\n updatePruneFilter() {\n const currentHideName = Array.from(this.exclusions.values());\n\n if (!this.data.pruneFilter) {\n this.data.pruneFilter = { hideName: currentHideName };\n } else if (!this.data.pruneFilter.hideName) {\n this.data.pruneFilter.hideName = currentHideName;\n } else {\n currentHideName.forEach((pruned) => this.data.pruneFilter.hideName.push(pruned));\n }\n }\n\n // expects exclusions to be a Set\n excludeEvents(stacks, classMap, exclusions) {\n return stacks.map((events) =>\n events.filter((e) => {\n const { callEvent } = e;\n\n // If there's no call event, there's no need to retain this event\n if (!callEvent) return false;\n\n if (callEvent.http_server_request || callEvent.http_client_request || callEvent.sql_query)\n return true;\n\n const codeObj = classMap.codeObjectFromEvent(callEvent);\n\n // keep events where the code object cannot be found\n if (!codeObj || !codeObj.fqid) return true;\n\n return !exclusions.has(codeObj.fqid);\n })\n );\n }\n\n removeNoise() {\n if (!this.data.events) {\n return this;\n }\n\n const hasHttp = Boolean(\n this.data.events.find((e) => e.httpServerRequest || e.httpClientRequest)\n );\n if (!hasHttp) {\n // the entire file is noise - do nothing\n return this;\n }\n\n return this.chunk((stacks) =>\n stacks.filter((stack) => {\n if (!stack.length) {\n return false;\n }\n\n return Boolean(stack[0].httpServerRequest) || Boolean(stack[0].httpClientRequest);\n })\n );\n }\n\n collectEvents() {\n return this.sorter\n .collect()\n .map((chunk) => {\n const transformedChunk = transform(this.transforms.chunk, chunk);\n return transformedChunk.map((stack) => {\n const transformedStack = transform(this.transforms.stack, stack);\n return transformedStack.map((event) => transform(this.transforms.event, event));\n });\n })\n .flat(2);\n }\n\n // Returns an Appmap model after running transforms such as normalize, prune,\n // etc.\n build() {\n this.emit('preprocess', { data: this.data });\n const events = this.collectEvents();\n return new AppMap({ ...this.data, events });\n }\n}\n\nexport default function buildAppMap(data = null) {\n return new AppMapBuilder(data);\n}\n","/* eslint-disable no-restricted-syntax */\nexport default class EventNavigator {\n constructor(event) {\n this.event = event;\n }\n\n get callEvent() {\n return this.event.callEvent;\n }\n\n get labels() {\n const { codeObject } = this.event;\n if (codeObject && codeObject.labels) {\n return codeObject.labels;\n }\n return null;\n }\n\n *self() {\n yield this;\n }\n\n *ancestors() {\n let event = this.callEvent.parent;\n\n while (event) {\n yield new EventNavigator(event);\n event = event.parent;\n }\n }\n\n /**\n * Generates all events which precede this event in the scenario.\n */\n *preceding() {\n for (const node of [this, ...this.ancestors()]) {\n if (node !== this) yield node;\n for (const sibling of node.precedingSiblings()) {\n for (const descendant of [...sibling.descendants()].reverse()) yield descendant;\n yield sibling;\n }\n }\n }\n\n *following() {\n for (const descendant of this.descendants()) yield descendant;\n for (const node of [this, ...this.ancestors()]) {\n for (const sibling of node.followingSiblings()) {\n yield sibling;\n for (const descendant of sibling.descendants()) yield descendant;\n }\n }\n }\n\n *precedingSiblings() {\n const { parent } = this.callEvent;\n if (!parent) {\n return;\n }\n\n const index = parent.children.indexOf(this.callEvent);\n for (let i = index - 1; i >= 0; i -= 1) {\n yield new EventNavigator(parent.children[i]);\n }\n }\n\n *followingSiblings() {\n const { parent } = this.callEvent;\n if (!parent) {\n return;\n }\n\n const index = parent.children.indexOf(this.callEvent);\n for (let i = index + 1; i < parent.children.length; i += 1) {\n yield new EventNavigator(parent.children[i]);\n }\n }\n\n *descendants(filterFn = () => true) {\n const queue = [...this.event.children];\n while (queue.length) {\n const event = queue.shift();\n if (filterFn(event)) {\n yield new EventNavigator(event);\n if (event.children) queue.unshift(...event.children);\n }\n }\n }\n\n hasLabel(label) {\n return this.hasLabels([label]);\n }\n\n hasLabels(...searchLabels) {\n if (!this.labels) {\n return false;\n }\n\n if (!searchLabels || !searchLabels.length) {\n return this.labels.size > 0;\n }\n\n return searchLabels.filter((l) => this.labels.has(l)).length === searchLabels.length;\n }\n}\n","import { getLabel } from './util';\n\nfunction mapFunctionLocations(memo, obj) {\n /* eslint-disable no-param-reassign */\n if (obj.type === 'function') {\n memo[obj.location] = obj;\n }\n\n if (obj.children) {\n obj.children.reduce(mapFunctionLocations, memo);\n }\n\n return memo;\n /* eslint-enable no-param-reassign */\n}\n\nexport default class EventInfo {\n constructor(classMap) {\n this.functionObjects = classMap.reduce(mapFunctionLocations, {});\n }\n\n getName(event) {\n const label = getLabel(event);\n if (label) {\n return label;\n }\n\n const codeObj = this.getCodeObject(event);\n if (codeObj) {\n return codeObj.display_name;\n }\n\n // Fallback algorithm\n const separator = event.static ? '.' : '#';\n return [event.defined_class, separator, event.method_id].join('');\n }\n\n getLabels(event) {\n const labels = [];\n\n if (event.labels) {\n labels.push(...event.labels);\n }\n\n const codeObj = this.getCodeObject(event);\n if (codeObj && codeObj.labels.length) {\n labels.push(...codeObj.labels);\n }\n\n return labels;\n }\n\n getCodeObject(event) {\n return this.functionObjects[`${event.path}:${event.lineno}`];\n }\n}\n","import buildAppMap from './appMapBuilder';\nimport AppMap from './appMap';\nimport CodeObject from './codeObject';\nimport { isLocalPath } from './util';\n\nexport const DEFAULT_CONTEXT_DEPTH = 1;\n\nclass DeclutterProperty {\n on = true;\n default = true;\n\n constructor(on = true, defaultValue = true) {\n this.on = on;\n this.default = defaultValue;\n }\n}\n\nclass DeclutterTimeProperty extends DeclutterProperty {\n DEFAULT_TIME = 100;\n\n time = this.DEFAULT_TIME;\n\n constructor(on = true, defaultValue = true, time = DeclutterTimeProperty.DEFAULT_TIME) {\n super(on, defaultValue);\n\n this.time = time;\n }\n}\n\nclass DeclutterNamesProperty extends DeclutterProperty {\n names = [];\n\n constructor(on = true, defaultValue = true, names = []) {\n super(on, defaultValue);\n\n this.names = names;\n }\n}\n\nclass DeclutterContextNamesProperty extends DeclutterNamesProperty {\n depth = DEFAULT_CONTEXT_DEPTH;\n\n constructor(on = true, defaultValue = true, names = [], depth = undefined) {\n super(on, defaultValue, names);\n\n if (depth !== undefined) this.depth = depth;\n }\n}\n\n// Directories inside the project tree that may contain bundled dependencies.\nconst DependencyFolders = ['vendor', 'node_modules'];\n\nclass DeclutterExternalPathsProperty extends DeclutterProperty {\n dependencyFolders = DependencyFolders;\n\n constructor(on = false, defaultValue = false, dependencyFolders = DependencyFolders) {\n super(on, defaultValue);\n\n this.dependencyFolders = dependencyFolders || DependencyFolders;\n }\n}\n\nconst ROOT_EVENT_LABELS = ['cli.command', 'job.perform', 'message.handle'];\n\nclass Declutter {\n limitRootEvents = new DeclutterProperty();\n hideMediaRequests = new DeclutterProperty();\n hideExternalPaths = new DeclutterExternalPathsProperty();\n hideUnlabeled = new DeclutterProperty(false, false);\n hideElapsedTimeUnder = new DeclutterTimeProperty(false, false, 1);\n hideName = new DeclutterNamesProperty(false, false, []);\n hideTree = new DeclutterNamesProperty(false, false, []);\n context = new DeclutterContextNamesProperty(false, false, []);\n}\n\nconst FilterRegExps = {};\nfunction filterRegExp(filterExpression, regexpConstructorArgs) {\n if (!FilterRegExps[filterExpression])\n FilterRegExps[filterExpression] = new RegExp(...regexpConstructorArgs());\n\n return FilterRegExps[filterExpression];\n}\n\n// events: Array of events to process.\n// filterFn: A test function to apply to each event. If the function returns true, the event is\n// included in the result. If an ancestor of a descendant event has matched the filterFn, and distance to the\n// ancestor is within the maxDepth, then the descendant is included as well.\n// maxDepth: The maximum depth of a descendant event to include. If undefined, all descendants are included.\n// Returns: A set of events that matched the filterFn.\nfunction markSubtrees(events, filterFn, maxDepth) {\n const matchingEvents = new Set();\n\n // Collect all 'call' events that match explicitly.\n events.filter((e) => e.isCall() && filterFn(e)).forEach((e) => matchingEvents.add(e));\n\n // Match all descendants of matching events, down to maxDepth.\n const matchDescendant = (e, depth) => {\n // Already marked before by some other traversal.\n if (matchingEvents.has(e)) return;\n\n // Below the maxDepth.\n if (maxDepth !== undefined && depth > maxDepth) return;\n\n matchingEvents.add(e);\n if (e.children) e.children.forEach((child) => matchDescendant(child, depth + 1));\n };\n\n [...matchingEvents]\n .filter((e) => e.children)\n .forEach((e) => e.children.forEach((child) => matchDescendant(child, 1)));\n\n [...matchingEvents].forEach((e) => matchingEvents.add(e.returnEvent));\n\n return matchingEvents;\n}\n\n// Collect all code objects that match a filter expressions.\n// Mark all events that are in a subtree whose root is one of the matched code objects.\n// Collect all marked events.\n// This filter should run in O(n), assuming set insertion and lookup is constant time.\nfunction includeSubtrees(events, filterFn, applyIfEmpty) {\n const includedEvents = markSubtrees(events, filterFn);\n\n if (applyIfEmpty || includedEvents.size) return events.filter((e) => includedEvents.has(e));\n else return events;\n}\n\n// Collect all code objects that match a filter expressions.\n// Mark all events that are in a subtree whose root is one of the matched code objects.\n// Collect all unmarked events.\n// This filter should run in O(n), assuming set insertion and lookup is constant time.\nfunction excludeSubtrees(events, filterFn) {\n const excludedEvents = markSubtrees(events, filterFn);\n\n return events.filter((e) => !excludedEvents.has(e));\n}\n\nexport default class AppMapFilter {\n rootObjects = [];\n declutter = new Declutter();\n\n /**\n *\n * @param {AppMap} appMap\n * @param {any[]} findings\n * @returns {AppMap}\n */\n filter(appMap, findings) {\n const { classMap } = appMap;\n let { events } = appMap;\n\n // Collect all code objects that match a filter expression. When a code object matches an\n // expression, the entire subtree rooted at that code object is included as well.\n function matchCodeObjects(expressions, matchSelf, matchTrailingWildcard) {\n return classMap.codeObjects.reduce((memo, codeObject) => {\n if (\n expressions.some((expr) =>\n AppMapFilter.codeObjectIsMatched(codeObject, expr, matchTrailingWildcard)\n )\n ) {\n codeObject.visit((co) => {\n if (co !== codeObject || matchSelf) memo.add(co);\n });\n }\n\n return memo;\n }, new Set());\n }\n\n // Include only subtrees of \"command\"-type events, unless there are no commands.\n if (this.declutter.limitRootEvents.on) {\n // Return true if the event is a \"command\". Types of commands recognized by this test include:\n // - HTTP server request - the event has http_server_request data\n // - cli.command - command of a CLI application\n // - job.perform - a background job\n // - message.handle - a handler for a message queue\n //\n // @param {Event} e\n const isCommand = (e) => {\n if (e.httpServerRequest) return true;\n\n const { labels } = e.codeObject;\n\n return ROOT_EVENT_LABELS.find((label) => labels.has(label));\n };\n\n events = includeSubtrees(events, isCommand, false);\n }\n\n // Include only subtrees of a specified root object. This could also be stored and managed\n // as a declutter filter, but it isn't, for some reason. It works the same way.\n if (this.rootObjects.length) {\n const includeCodeObjects = matchCodeObjects(this.rootObjects, true);\n const filterFn = (e) => includeCodeObjects.has(e.codeObject);\n\n events = includeSubtrees(events, filterFn, true);\n }\n\n if (this.declutter.context.on && this.declutter.context.names.length) {\n const includeCodeObjects = matchCodeObjects(this.declutter.context.names, true, false);\n const filterFn = (e) => includeCodeObjects.has(e.codeObject);\n\n const subtreeEvents = markSubtrees(events, filterFn, this.declutter.context.depth);\n const ancestorEvents = new Set();\n const includeAncestors = (e, distance = 1) => {\n if (!e) return;\n\n if (ancestorEvents.has(e)) return;\n\n if (distance <= this.declutter.context.depth || !e.parent) {\n ancestorEvents.add(e);\n ancestorEvents.add(e.returnEvent);\n }\n\n if (e.parent) includeAncestors(e.parent, distance + 1);\n };\n events.filter((e) => filterFn(e)).forEach((e) => includeAncestors(e.parent));\n events = events.filter((e) => subtreeEvents.has(e) || ancestorEvents.has(e));\n }\n\n // Hide descendent events from named, pattern-matched or labeled code objects. The matching\n // event itself is not hidden. To accomplish that, add the same filter to `hideName`.\n if (this.declutter.hideTree.on && this.declutter.hideTree.names.length) {\n const excludeCodeObjects = matchCodeObjects(this.declutter.hideTree.names, false);\n events = excludeSubtrees(events, (e) => excludeCodeObjects.has(e.codeObject));\n }\n\n // Hide HTTP server requests that fetch a known media type.\n if (this.declutter.hideMediaRequests.on) {\n events = AppMapFilter.filterMediaRequests(events);\n }\n\n // Hide any unlabeled code object. This is rarely useful.\n if (this.declutter.hideUnlabeled.on) {\n events = events.filter((e) => e.labels.size > 0 || e.codeObject.type !== 'function');\n }\n\n // Hide code that appears to be sourced from outside the local source tree.\n // This isn't super reliable, because the location path may be inside the project tree\n // even for external code; and the location may be outside the project tree even for code\n // that the user considers to be part of the project.\n if (this.declutter.hideExternalPaths.on) {\n events = events.filter(\n (e) =>\n e.codeObject.type !== 'function' ||\n isLocalPath(e.codeObject.location, this.declutter.hideExternalPaths.dependencyFolders)\n .isLocal\n );\n }\n\n // Hide code whose elapsed time is less than a specified threshold.\n // This is useful for navigating down a call tree looking for expensive code.\n if (this.declutter.hideElapsedTimeUnder.on && this.declutter.hideElapsedTimeUnder.time > 0) {\n events = events.filter(\n (e) => e.elapsedTime && e.elapsedTime >= this.declutter.hideElapsedTimeUnder.time / 1000\n );\n }\n\n // Hide events from named, pattern-matched or labeled code objects. Hiding does not apply to\n // sub-events of matching events.\n if (this.declutter.hideName.on && this.declutter.hideName.names.length) {\n const excludeCodeObjects = matchCodeObjects(this.declutter.hideName.names, true);\n events = events.filter((e) => !excludeCodeObjects.has(e.codeObject));\n }\n\n const eventIds = new Set(events.filter((e) => e.isCall()).map((e) => e.id));\n\n if (findings && findings.length > 0) {\n findings.forEach((finding) => {\n if (\n finding.appMapUri &&\n finding.appMapUri.fragment &&\n typeof finding.appMapUri.fragment === 'string'\n ) {\n finding.appMapUri.fragment = JSON.parse(finding.appMapUri.fragment);\n }\n });\n\n events = AppMapFilter.attachFindingsToEvents(events, findings);\n }\n\n return buildAppMap({\n events: events.filter((e) => eventIds.has(e.id) || (e.parentId && eventIds.has(e.parentId))),\n classMap: classMap.roots.map((c) => ({ ...c.data })),\n metadata: appMap.metadata,\n }).build();\n }\n\n /**\n *\n * @param {Event[]} events\n * @returns Event[]\n */\n static filterMediaRequests(events) {\n const excludedEvents = [];\n const mediaRegex = [\n 'application/javascript',\n 'application/ecmascript',\n 'audio/.+',\n 'font/.+',\n 'image/.+',\n 'text/javascript',\n 'text/ecmascript',\n 'text/css',\n 'video/.+',\n ].map((t) => new RegExp(t, 'i'));\n const mediaFileExtensions = new Set([\n 'aac',\n 'avi',\n 'bmp',\n 'css',\n 'flv',\n 'gif',\n 'htm',\n 'html',\n 'ico',\n 'jpeg',\n 'jpg',\n 'js',\n 'json',\n 'jsonld',\n 'mid',\n 'midi',\n 'mjs',\n 'mov',\n 'mp3',\n 'mp4',\n 'mpeg',\n 'oga',\n 'ogg',\n 'ogv',\n 'ogx',\n 'opus',\n 'otf',\n 'png',\n 'svg',\n 'tif',\n 'tiff',\n 'ts',\n 'ttf',\n 'wav',\n 'weba',\n 'webm',\n 'webp',\n 'woff',\n 'woff2',\n 'xhtml',\n '3gp',\n '3g2',\n ]);\n\n events.forEach((e) => {\n const { httpServerResponse } = e;\n if (e.requestMethod === 'GET' && e.requestPath) {\n const pathExt = e.requestPath.match(/.*\\.([\\S]*)$/);\n if (pathExt && mediaFileExtensions.has(pathExt[1])) {\n excludedEvents.push(e.id);\n }\n } else if (httpServerResponse) {\n let mimeType;\n const { headers } = httpServerResponse;\n\n if (headers) {\n const contentTypeKey = Object.keys(headers).filter(\n (k) => k.toLowerCase() === 'content-type'\n )[0];\n\n mimeType = headers[contentTypeKey];\n } else {\n mimeType = httpServerResponse.mime_type; // 'mime_type' is no longer supported in the AppMap data standard, but we should keep this code for backward compatibility\n }\n\n if (mimeType && e.parentId && mediaRegex.some((regex) => regex.test(mimeType))) {\n excludedEvents.push(e.parentId);\n }\n }\n });\n\n // TODO It would be even better to exclude the whole subtree, in case the media request is handled by user code.\n return events.filter((e) => !excludedEvents.includes(e.id));\n }\n\n /**\n *\n * @param {CodeObject} object\n * @param {string} query\n * @param {boolean} matchTrailingWildcard this is a legacy option that's here for compatibility.\n * When the \"query\" can be a complex string like a SQL query, a trailing \"*\" character is not a reliable\n * indicate that the user wants to match a prefix. This is because the query itself may contain a \"*\".\n * So for cases like this, matchTrailingWildcard can be disabled.\n * @returns boolean\n */\n static codeObjectIsMatched(object, query, matchTrailingWildcard) {\n if (query === object.fqid) {\n return true;\n } else if (query.startsWith('label:')) {\n const pattern = filterRegExp(query, () => [\n `^${query.replace('label:', '').replace('*', '.*')}$`,\n 'ig',\n ]);\n return Array.from(object.labels).some((label) => pattern.test(label));\n }\n if (query.length > 2 && query.charAt(0) === '/' && query.charAt(query.length - 1) === '/') {\n const pattern = filterRegExp(query, () => [query.substring(1, query.length - 1), 'ig']);\n if (pattern.test(object.fqid)) {\n return true;\n }\n } else if (matchTrailingWildcard && query.endsWith('*')) {\n const pattern = filterRegExp(query, () => [`^${query.slice(0, query.length - 1)}.*`, 'ig']);\n if (pattern.test(object.fqid)) {\n return true;\n }\n }\n\n return false;\n }\n\n // Regarding untyped 'findings' - Finding is declared in @appland/scanner, but I'm not going to\n // add a dependency on that package just yet. All the code in this file was originally located\n // in VsCodeExtension, and as a first step I'm just refactoring it out.\n static attachFindingsToEvents(events, findings) {\n const eventsById = events.reduce((map, e) => {\n map[e.id] = e.callEvent;\n return map;\n }, {});\n\n findings.forEach((finding) => {\n const traceFilter =\n finding.appMapUri && finding.appMapUri.fragment && finding.appMapUri.fragment.traceFilter;\n\n if (traceFilter) {\n const ids = traceFilter.split(' ').map((idStr) => Number(idStr.split(':')[1]));\n\n ids.forEach((id) => {\n const event = eventsById[id];\n\n if (event && !AppMapFilter.eventAlreadyHasFinding(event, finding)) {\n if (event.findings) {\n event.findings.push(finding);\n } else {\n event.findings = [finding];\n }\n }\n });\n }\n });\n\n return events;\n }\n\n static eventAlreadyHasFinding(event, finding) {\n return (\n event.findings &&\n !!event.findings.find(\n (attachedFinding) => attachedFinding.finding.hash_v2 === finding.finding.hash_v2\n )\n );\n }\n}\n","import AppMapFilter, { DEFAULT_CONTEXT_DEPTH } from './appMapFilter';\nimport { base64UrlDecode } from './util';\n\nfunction mergeLists(a, b) {\n if (a === false && b === false) return false;\n\n const result = [...new Set([...(a || []), ...(b || [])])].sort();\n return result.length > 0 ? result : false;\n}\n\nfunction lowestNumber(...sequence) {\n sequence = sequence.filter((t) => t !== undefined && t !== null && t !== false);\n\n if (sequence.length === 0) return false;\n\n return Math.min(\n ...sequence\n .map((t) => (typeof t === 'number' ? t : parseInt(t.toString(), 10)))\n .filter((t) => !isNaN(t))\n );\n}\n\nfunction coalesce(...sequence) {\n return sequence.find((t) => t !== undefined && t !== null && t !== false);\n}\n\nexport function mergeFilterState(first, second) {\n return {\n rootObjects: mergeLists(first.rootObjects, second.rootObjects),\n limitRootEvents: coalesce(first.limitRootEvents, second.limitRootEvents),\n hideMediaRequests: coalesce(first.hideMediaRequests, second.hideMediaRequests),\n hideUnlabeled: coalesce(first.hideUnlabeled, second.hideUnlabeled),\n hideExternal: coalesce(first.hideExternal, second.hideExternal),\n dependencyFolders: mergeLists(first.dependencyFolders, second.dependencyFolders),\n hideElapsedTimeUnder: lowestNumber(first.hideElapsedTimeUnder, second.hideElapsedTimeUnder),\n hideName: mergeLists(first.hideName, second.hideName),\n };\n}\n\n// Serialize the AppMapFilter to an object.\nexport function serializeFilter(filter) {\n if (!filter) return {};\n\n let declutter = filter;\n const rootObjects = filter.rootObjects;\n if ('declutter' in filter) declutter = filter.declutter;\n\n return Object.entries({\n rootObjects: rootObjects,\n limitRootEvents: declutter.limitRootEvents.on,\n hideMediaRequests: declutter.hideMediaRequests.on,\n hideUnlabeled: declutter.hideUnlabeled.on,\n hideExternalPaths: declutter.hideExternalPaths.on\n ? declutter.hideExternalPaths.dependencyFolders\n : false,\n hideElapsedTimeUnder: declutter.hideElapsedTimeUnder.on\n ? declutter.hideElapsedTimeUnder.time\n : false,\n context: declutter.context.on ? declutter.context.names : false,\n contextDepth:\n declutter.context.on && declutter.context.depth !== DEFAULT_CONTEXT_DEPTH\n ? declutter.context.depth\n : false,\n hideName: declutter.hideName.on ? declutter.hideName.names : false,\n }).reduce((memo, [k, v]) => {\n const filter = declutter[k];\n if (Array.isArray(v) && v.length !== 0) {\n memo[k] = v;\n } else if (typeof v === 'number') {\n memo[k] = v;\n } else if (filter && filter.default !== v) {\n memo[k] = v;\n }\n return memo;\n }, {});\n}\n\n// If stringInput is a base64 URL encoded string, decode it. Parse as JSON into a FilterState object.\nexport function filterStringToFilterState(stringInput) {\n if (!stringInput) return;\n\n let json;\n const isStringifiedJson = stringInput.trimStart().startsWith('{');\n if (isStringifiedJson) {\n // The old style of deserialization expected a raw stringified JSON object.\n // To avoid introducing a breaking change, we'll support both for now.\n json = stringInput;\n } else {\n json = base64UrlDecode(stringInput);\n }\n\n return JSON.parse(json);\n}\n\n// Convert a filter string to AppMapFilter. The filter string may optionally be\n// base64 URL encoded.\nexport function deserializeFilter(filterState) {\n if (typeof filterState === 'string') filterState = filterStringToFilterState(filterState);\n\n const filter = new AppMapFilter();\n if (!filterState) return filter;\n\n for (const property in filterState) {\n if (\n Object.prototype.hasOwnProperty.call(filterState, property) &&\n filterState[property] === undefined\n )\n delete filterState[property];\n }\n\n if ('rootObjects' in filterState && filterState.rootObjects !== false) {\n filter.rootObjects = filterState.rootObjects;\n }\n if ('limitRootEvents' in filterState) {\n filter.declutter.limitRootEvents.on = filterState.limitRootEvents;\n }\n if ('hideMediaRequests' in filterState) {\n filter.declutter.hideMediaRequests.on = filterState.hideMediaRequests;\n }\n if ('hideUnlabeled' in filterState) {\n filter.declutter.hideUnlabeled.on = filterState.hideUnlabeled;\n }\n ['hideExternal', 'hideExternalPaths'].forEach((key) => {\n if (key in filterState) {\n const value = filterState[key];\n\n if (value && Array.isArray(value)) {\n filter.declutter.hideExternalPaths.on = true;\n filter.declutter.hideExternalPaths.dependencyFolders = filterState[key];\n } else {\n filter.declutter.hideExternalPaths.on = filterState[key];\n }\n }\n });\n if ('dependencyFolders' in filterState && filterState.dependencyFolders !== false) {\n filter.declutter.hideExternalPaths.dependencyFolders = filterState.dependencyFolders;\n }\n if ('hideElapsedTimeUnder' in filterState && filterState.hideElapsedTimeUnder !== false) {\n filter.declutter.hideElapsedTimeUnder.on = true;\n filter.declutter.hideElapsedTimeUnder.time = filterState.hideElapsedTimeUnder;\n }\n ['hideName', 'hideNames'].forEach((key) => {\n if (key in filterState && filterState[key] !== false) {\n filter.declutter.hideName.on = true;\n filter.declutter.hideName.names = filterState[key];\n }\n });\n if ('context' in filterState && filterState.context !== false) {\n filter.declutter.context.on = true;\n filter.declutter.context.names = filterState.context;\n if ('contextDepth' in filterState && filterState.contextDepth !== false) {\n filter.declutter.context.depth = filterState.contextDepth;\n }\n }\n if ('hideTree' in filterState && filterState.hideTree !== false) {\n filter.declutter.hideTree.on = true;\n filter.declutter.hideTree.names = filterState.hideTree;\n }\n\n return filter;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\n/**\n * Constants for token types\n */\nvar _default = {\n WORD: 'word',\n STRING: 'string',\n RESERVED: 'reserved',\n RESERVED_TOP_LEVEL: 'reserved-top-level',\n RESERVED_TOP_LEVEL_NO_INDENT: 'reserved-top-level-no-indent',\n RESERVED_NEWLINE: 'reserved-newline',\n OPERATOR: 'operator',\n OPEN_PAREN: 'open-paren',\n CLOSE_PAREN: 'close-paren',\n LINE_COMMENT: 'line-comment',\n BLOCK_COMMENT: 'block-comment',\n NUMBER: 'number',\n PLACEHOLDER: 'placeholder'\n};\nexports[\"default\"] = _default;\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.sortByLengthDesc = exports.escapeRegExp = exports.isEmpty = exports.last = exports.trimSpacesEnd = void 0;\n\n// Only removes spaces, not newlines\nvar trimSpacesEnd = function trimSpacesEnd(str) {\n return str.replace(/[\\t ]+$/, '');\n}; // Last element from array\n\n\nexports.trimSpacesEnd = trimSpacesEnd;\n\nvar last = function last(arr) {\n return arr[arr.length - 1];\n}; // True array is empty, or it's not an array at all\n\n\nexports.last = last;\n\nvar isEmpty = function isEmpty(arr) {\n return !Array.isArray(arr) || arr.length === 0;\n}; // Escapes regex special chars\n\n\nexports.isEmpty = isEmpty;\n\nvar escapeRegExp = function escapeRegExp(string) {\n return string.replace(/[\\$\\(-\\+\\.\\?\\[-\\^\\{-\\}]/g, '\\\\$&');\n}; // Sorts strings by length, so that longer ones are first\n// Also sorts alphabetically after sorting by length.\n\n\nexports.escapeRegExp = escapeRegExp;\n\nvar sortByLengthDesc = function sortByLengthDesc(strings) {\n return strings.sort(function (a, b) {\n return b.length - a.length || a.localeCompare(b);\n });\n};\n\nexports.sortByLengthDesc = sortByLengthDesc;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _utils = require(\"../utils\");\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar INDENT_TYPE_TOP_LEVEL = 'top-level';\nvar INDENT_TYPE_BLOCK_LEVEL = 'block-level';\n/**\n * Manages indentation levels.\n *\n * There are two types of indentation levels:\n *\n * - BLOCK_LEVEL : increased by open-parenthesis\n * - TOP_LEVEL : increased by RESERVED_TOP_LEVEL words\n */\n\nvar Indentation = /*#__PURE__*/function () {\n /**\n * @param {String} indent Indent value, default is \" \" (2 spaces)\n */\n function Indentation(indent) {\n _classCallCheck(this, Indentation);\n\n this.indent = indent || ' ';\n this.indentTypes = [];\n }\n /**\n * Returns current indentation string.\n * @return {String}\n */\n\n\n _createClass(Indentation, [{\n key: \"getIndent\",\n value: function getIndent() {\n return this.indent.repeat(this.indentTypes.length);\n }\n /**\n * Increases indentation by one top-level indent.\n */\n\n }, {\n key: \"increaseTopLevel\",\n value: function increaseTopLevel() {\n this.indentTypes.push(INDENT_TYPE_TOP_LEVEL);\n }\n /**\n * Increases indentation by one block-level indent.\n */\n\n }, {\n key: \"increaseBlockLevel\",\n value: function increaseBlockLevel() {\n this.indentTypes.push(INDENT_TYPE_BLOCK_LEVEL);\n }\n /**\n * Decreases indentation by one top-level indent.\n * Does nothing when the previous indent is not top-level.\n */\n\n }, {\n key: \"decreaseTopLevel\",\n value: function decreaseTopLevel() {\n if (this.indentTypes.length > 0 && (0, _utils.last)(this.indentTypes) === INDENT_TYPE_TOP_LEVEL) {\n this.indentTypes.pop();\n }\n }\n /**\n * Decreases indentation by one block-level indent.\n * If there are top-level indents within the block-level indent,\n * throws away these as well.\n */\n\n }, {\n key: \"decreaseBlockLevel\",\n value: function decreaseBlockLevel() {\n while (this.indentTypes.length > 0) {\n var type = this.indentTypes.pop();\n\n if (type !== INDENT_TYPE_TOP_LEVEL) {\n break;\n }\n }\n }\n }, {\n key: \"resetIndentation\",\n value: function resetIndentation() {\n this.indentTypes = [];\n }\n }]);\n\n return Indentation;\n}();\n\nexports[\"default\"] = Indentation;\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _tokenTypes = _interopRequireDefault(require(\"./tokenTypes\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar INLINE_MAX_LENGTH = 50;\n/**\n * Bookkeeper for inline blocks.\n *\n * Inline blocks are parenthized expressions that are shorter than INLINE_MAX_LENGTH.\n * These blocks are formatted on a single line, unlike longer parenthized\n * expressions where open-parenthesis causes newline and increase of indentation.\n */\n\nvar InlineBlock = /*#__PURE__*/function () {\n function InlineBlock() {\n _classCallCheck(this, InlineBlock);\n\n this.level = 0;\n }\n /**\n * Begins inline block when lookahead through upcoming tokens determines\n * that the block would be smaller than INLINE_MAX_LENGTH.\n * @param {Object[]} tokens Array of all tokens\n * @param {Number} index Current token position\n */\n\n\n _createClass(InlineBlock, [{\n key: \"beginIfPossible\",\n value: function beginIfPossible(tokens, index) {\n if (this.level === 0 && this.isInlineBlock(tokens, index)) {\n this.level = 1;\n } else if (this.level > 0) {\n this.level++;\n } else {\n this.level = 0;\n }\n }\n /**\n * Finishes current inline block.\n * There might be several nested ones.\n */\n\n }, {\n key: \"end\",\n value: function end() {\n this.level--;\n }\n /**\n * True when inside an inline block\n * @return {Boolean}\n */\n\n }, {\n key: \"isActive\",\n value: function isActive() {\n return this.level > 0;\n } // Check if this should be an inline parentheses block\n // Examples are \"NOW()\", \"COUNT(*)\", \"int(10)\", key(`somecolumn`), DECIMAL(7,2)\n\n }, {\n key: \"isInlineBlock\",\n value: function isInlineBlock(tokens, index) {\n var length = 0;\n var level = 0;\n\n for (var i = index; i < tokens.length; i++) {\n var token = tokens[i];\n length += token.value.length; // Overran max length\n\n if (length > INLINE_MAX_LENGTH) {\n return false;\n }\n\n if (token.type === _tokenTypes[\"default\"].OPEN_PAREN) {\n level++;\n } else if (token.type === _tokenTypes[\"default\"].CLOSE_PAREN) {\n level--;\n\n if (level === 0) {\n return true;\n }\n }\n\n if (this.isForbiddenToken(token)) {\n return false;\n }\n }\n\n return false;\n } // Reserved words that cause newlines, comments and semicolons\n // are not allowed inside inline parentheses block\n\n }, {\n key: \"isForbiddenToken\",\n value: function isForbiddenToken(_ref) {\n var type = _ref.type,\n value = _ref.value;\n return type === _tokenTypes[\"default\"].RESERVED_TOP_LEVEL || type === _tokenTypes[\"default\"].RESERVED_NEWLINE || type === _tokenTypes[\"default\"].COMMENT || type === _tokenTypes[\"default\"].BLOCK_COMMENT || value === ';';\n }\n }]);\n\n return InlineBlock;\n}();\n\nexports[\"default\"] = InlineBlock;\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * Handles placeholder replacement with given params.\n */\nvar Params = /*#__PURE__*/function () {\n /**\n * @param {Object} params\n */\n function Params(params) {\n _classCallCheck(this, Params);\n\n this.params = params;\n this.index = 0;\n }\n /**\n * Returns param value that matches given placeholder with param key.\n * @param {Object} token\n * @param {String} token.key Placeholder key\n * @param {String} token.value Placeholder value\n * @return {String} param or token.value when params are missing\n */\n\n\n _createClass(Params, [{\n key: \"get\",\n value: function get(_ref) {\n var key = _ref.key,\n value = _ref.value;\n\n if (!this.params) {\n return value;\n }\n\n if (key) {\n return this.params[key];\n }\n\n return this.params[this.index++];\n }\n }]);\n\n return Params;\n}();\n\nexports[\"default\"] = Params;\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.isEnd = exports.isWindow = exports.isBy = exports.isSet = exports.isLimit = exports.isBetween = exports.isAnd = void 0;\n\nvar _tokenTypes = _interopRequireDefault(require(\"./tokenTypes\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nvar isToken = function isToken(type, regex) {\n return function (token) {\n return (token === null || token === void 0 ? void 0 : token.type) === type && regex.test(token === null || token === void 0 ? void 0 : token.value);\n };\n};\n\nvar isAnd = isToken(_tokenTypes[\"default\"].RESERVED_NEWLINE, /^AND$/i);\nexports.isAnd = isAnd;\nvar isBetween = isToken(_tokenTypes[\"default\"].RESERVED, /^BETWEEN$/i);\nexports.isBetween = isBetween;\nvar isLimit = isToken(_tokenTypes[\"default\"].RESERVED_TOP_LEVEL, /^LIMIT$/i);\nexports.isLimit = isLimit;\nvar isSet = isToken(_tokenTypes[\"default\"].RESERVED_TOP_LEVEL, /^[S\\u017F]ET$/i);\nexports.isSet = isSet;\nvar isBy = isToken(_tokenTypes[\"default\"].RESERVED, /^BY$/i);\nexports.isBy = isBy;\nvar isWindow = isToken(_tokenTypes[\"default\"].RESERVED_TOP_LEVEL, /^WINDOW$/i);\nexports.isWindow = isWindow;\nvar isEnd = isToken(_tokenTypes[\"default\"].CLOSE_PAREN, /^END$/i);\nexports.isEnd = isEnd;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _tokenTypes = _interopRequireDefault(require(\"./tokenTypes\"));\n\nvar _Indentation = _interopRequireDefault(require(\"./Indentation\"));\n\nvar _InlineBlock = _interopRequireDefault(require(\"./InlineBlock\"));\n\nvar _Params = _interopRequireDefault(require(\"./Params\"));\n\nvar _utils = require(\"../utils\");\n\nvar _token = require(\"./token\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar Formatter = /*#__PURE__*/function () {\n /**\n * @param {Object} cfg\n * @param {String} cfg.language\n * @param {String} cfg.indent\n * @param {Boolean} cfg.uppercase\n * @param {Integer} cfg.linesBetweenQueries\n * @param {Object} cfg.params\n */\n function Formatter(cfg) {\n _classCallCheck(this, Formatter);\n\n this.cfg = cfg;\n this.indentation = new _Indentation[\"default\"](this.cfg.indent);\n this.inlineBlock = new _InlineBlock[\"default\"]();\n this.params = new _Params[\"default\"](this.cfg.params);\n this.previousReservedToken = {};\n this.tokens = [];\n this.index = 0;\n }\n /**\n * SQL Tokenizer for this formatter, provided by subclasses.\n */\n\n\n _createClass(Formatter, [{\n key: \"tokenizer\",\n value: function tokenizer() {\n throw new Error('tokenizer() not implemented by subclass');\n }\n /**\n * Reprocess and modify a token based on parsed context.\n *\n * @param {Object} token The token to modify\n * @param {String} token.type\n * @param {String} token.value\n * @return {Object} new token or the original\n * @return {String} token.type\n * @return {String} token.value\n */\n\n }, {\n key: \"tokenOverride\",\n value: function tokenOverride(token) {\n // subclasses can override this to modify tokens during formatting\n return token;\n }\n /**\n * Formats whitespace in a SQL string to make it easier to read.\n *\n * @param {String} query The SQL query string\n * @return {String} formatted query\n */\n\n }, {\n key: \"format\",\n value: function format(query) {\n this.tokens = this.tokenizer().tokenize(query);\n var formattedQuery = this.getFormattedQueryFromTokens();\n return formattedQuery.trim();\n }\n }, {\n key: \"getFormattedQueryFromTokens\",\n value: function getFormattedQueryFromTokens() {\n var _this = this;\n\n var formattedQuery = '';\n this.tokens.forEach(function (token, index) {\n _this.index = index;\n token = _this.tokenOverride(token);\n\n if (token.type === _tokenTypes[\"default\"].LINE_COMMENT) {\n formattedQuery = _this.formatLineComment(token, formattedQuery);\n } else if (token.type === _tokenTypes[\"default\"].BLOCK_COMMENT) {\n formattedQuery = _this.formatBlockComment(token, formattedQuery);\n } else if (token.type === _tokenTypes[\"default\"].RESERVED_TOP_LEVEL) {\n formattedQuery = _this.formatTopLevelReservedWord(token, formattedQuery);\n _this.previousReservedToken = token;\n } else if (token.type === _tokenTypes[\"default\"].RESERVED_TOP_LEVEL_NO_INDENT) {\n formattedQuery = _this.formatTopLevelReservedWordNoIndent(token, formattedQuery);\n _this.previousReservedToken = token;\n } else if (token.type === _tokenTypes[\"default\"].RESERVED_NEWLINE) {\n formattedQuery = _this.formatNewlineReservedWord(token, formattedQuery);\n _this.previousReservedToken = token;\n } else if (token.type === _tokenTypes[\"default\"].RESERVED) {\n formattedQuery = _this.formatWithSpaces(token, formattedQuery);\n _this.previousReservedToken = token;\n } else if (token.type === _tokenTypes[\"default\"].OPEN_PAREN) {\n formattedQuery = _this.formatOpeningParentheses(token, formattedQuery);\n } else if (token.type === _tokenTypes[\"default\"].CLOSE_PAREN) {\n formattedQuery = _this.formatClosingParentheses(token, formattedQuery);\n } else if (token.type === _tokenTypes[\"default\"].PLACEHOLDER) {\n formattedQuery = _this.formatPlaceholder(token, formattedQuery);\n } else if (token.value === ',') {\n formattedQuery = _this.formatComma(token, formattedQuery);\n } else if (token.value === ':') {\n formattedQuery = _this.formatWithSpaceAfter(token, formattedQuery);\n } else if (token.value === '.') {\n formattedQuery = _this.formatWithoutSpaces(token, formattedQuery);\n } else if (token.value === ';') {\n formattedQuery = _this.formatQuerySeparator(token, formattedQuery);\n } else {\n formattedQuery = _this.formatWithSpaces(token, formattedQuery);\n }\n });\n return formattedQuery;\n }\n }, {\n key: \"formatLineComment\",\n value: function formatLineComment(token, query) {\n return this.addNewline(query + this.show(token));\n }\n }, {\n key: \"formatBlockComment\",\n value: function formatBlockComment(token, query) {\n return this.addNewline(this.addNewline(query) + this.indentComment(token.value));\n }\n }, {\n key: \"indentComment\",\n value: function indentComment(comment) {\n return comment.replace(/\\n[\\t ]*/g, '\\n' + this.indentation.getIndent() + ' ');\n }\n }, {\n key: \"formatTopLevelReservedWordNoIndent\",\n value: function formatTopLevelReservedWordNoIndent(token, query) {\n this.indentation.decreaseTopLevel();\n query = this.addNewline(query) + this.equalizeWhitespace(this.show(token));\n return this.addNewline(query);\n }\n }, {\n key: \"formatTopLevelReservedWord\",\n value: function formatTopLevelReservedWord(token, query) {\n this.indentation.decreaseTopLevel();\n query = this.addNewline(query);\n this.indentation.increaseTopLevel();\n query += this.equalizeWhitespace(this.show(token));\n return this.addNewline(query);\n }\n }, {\n key: \"formatNewlineReservedWord\",\n value: function formatNewlineReservedWord(token, query) {\n if ((0, _token.isAnd)(token) && (0, _token.isBetween)(this.tokenLookBehind(2))) {\n return this.formatWithSpaces(token, query);\n }\n\n return this.addNewline(query) + this.equalizeWhitespace(this.show(token)) + ' ';\n } // Replace any sequence of whitespace characters with single space\n\n }, {\n key: \"equalizeWhitespace\",\n value: function equalizeWhitespace(string) {\n return string.replace(/[\\t-\\r \\xA0\\u1680\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+/g, ' ');\n } // Opening parentheses increase the block indent level and start a new line\n\n }, {\n key: \"formatOpeningParentheses\",\n value: function formatOpeningParentheses(token, query) {\n var _preserveWhitespaceFo, _this$tokenLookBehind;\n\n // Take out the preceding space unless there was whitespace there in the original query\n // or another opening parens or line comment\n var preserveWhitespaceFor = (_preserveWhitespaceFo = {}, _defineProperty(_preserveWhitespaceFo, _tokenTypes[\"default\"].OPEN_PAREN, true), _defineProperty(_preserveWhitespaceFo, _tokenTypes[\"default\"].LINE_COMMENT, true), _defineProperty(_preserveWhitespaceFo, _tokenTypes[\"default\"].OPERATOR, true), _preserveWhitespaceFo);\n\n if (token.whitespaceBefore.length === 0 && !preserveWhitespaceFor[(_this$tokenLookBehind = this.tokenLookBehind()) === null || _this$tokenLookBehind === void 0 ? void 0 : _this$tokenLookBehind.type]) {\n query = (0, _utils.trimSpacesEnd)(query);\n }\n\n query += this.show(token);\n this.inlineBlock.beginIfPossible(this.tokens, this.index);\n\n if (!this.inlineBlock.isActive()) {\n this.indentation.increaseBlockLevel();\n query = this.addNewline(query);\n }\n\n return query;\n } // Closing parentheses decrease the block indent level\n\n }, {\n key: \"formatClosingParentheses\",\n value: function formatClosingParentheses(token, query) {\n if (this.inlineBlock.isActive()) {\n this.inlineBlock.end();\n return this.formatWithSpaceAfter(token, query);\n } else {\n this.indentation.decreaseBlockLevel();\n return this.formatWithSpaces(token, this.addNewline(query));\n }\n }\n }, {\n key: \"formatPlaceholder\",\n value: function formatPlaceholder(token, query) {\n return query + this.params.get(token) + ' ';\n } // Commas start a new line (unless within inline parentheses or SQL \"LIMIT\" clause)\n\n }, {\n key: \"formatComma\",\n value: function formatComma(token, query) {\n query = (0, _utils.trimSpacesEnd)(query) + this.show(token) + ' ';\n\n if (this.inlineBlock.isActive()) {\n return query;\n } else if ((0, _token.isLimit)(this.previousReservedToken)) {\n return query;\n } else {\n return this.addNewline(query);\n }\n }\n }, {\n key: \"formatWithSpaceAfter\",\n value: function formatWithSpaceAfter(token, query) {\n return (0, _utils.trimSpacesEnd)(query) + this.show(token) + ' ';\n }\n }, {\n key: \"formatWithoutSpaces\",\n value: function formatWithoutSpaces(token, query) {\n return (0, _utils.trimSpacesEnd)(query) + this.show(token);\n }\n }, {\n key: \"formatWithSpaces\",\n value: function formatWithSpaces(token, query) {\n return query + this.show(token) + ' ';\n }\n }, {\n key: \"formatQuerySeparator\",\n value: function formatQuerySeparator(token, query) {\n this.indentation.resetIndentation();\n return (0, _utils.trimSpacesEnd)(query) + this.show(token) + '\\n'.repeat(this.cfg.linesBetweenQueries || 1);\n } // Converts token to string (uppercasing it if needed)\n\n }, {\n key: \"show\",\n value: function show(_ref) {\n var type = _ref.type,\n value = _ref.value;\n\n if (this.cfg.uppercase && (type === _tokenTypes[\"default\"].RESERVED || type === _tokenTypes[\"default\"].RESERVED_TOP_LEVEL || type === _tokenTypes[\"default\"].RESERVED_TOP_LEVEL_NO_INDENT || type === _tokenTypes[\"default\"].RESERVED_NEWLINE || type === _tokenTypes[\"default\"].OPEN_PAREN || type === _tokenTypes[\"default\"].CLOSE_PAREN)) {\n return value.toUpperCase();\n } else {\n return value;\n }\n }\n }, {\n key: \"addNewline\",\n value: function addNewline(query) {\n query = (0, _utils.trimSpacesEnd)(query);\n\n if (!query.endsWith('\\n')) {\n query += '\\n';\n }\n\n return query + this.indentation.getIndent();\n }\n }, {\n key: \"tokenLookBehind\",\n value: function tokenLookBehind() {\n var n = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n return this.tokens[this.index - n];\n }\n }, {\n key: \"tokenLookAhead\",\n value: function tokenLookAhead() {\n var n = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n return this.tokens[this.index + n];\n }\n }]);\n\n return Formatter;\n}();\n\nexports[\"default\"] = Formatter;\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createOperatorRegex = createOperatorRegex;\nexports.createLineCommentRegex = createLineCommentRegex;\nexports.createReservedWordRegex = createReservedWordRegex;\nexports.createWordRegex = createWordRegex;\nexports.createStringRegex = createStringRegex;\nexports.createStringPattern = createStringPattern;\nexports.createParenRegex = createParenRegex;\nexports.createPlaceholderRegex = createPlaceholderRegex;\n\nvar _utils = require(\"../utils\");\n\nfunction createOperatorRegex(multiLetterOperators) {\n return new RegExp(\"^(\".concat((0, _utils.sortByLengthDesc)(multiLetterOperators).map(_utils.escapeRegExp).join('|'), \"|.)\"), 'u');\n}\n\nfunction createLineCommentRegex(lineCommentTypes) {\n return new RegExp(\"^((?:\".concat(lineCommentTypes.map(function (c) {\n return (0, _utils.escapeRegExp)(c);\n }).join('|'), \").*?)(?:\\r\\n|\\r|\\n|$)\"), 'u');\n}\n\nfunction createReservedWordRegex(reservedWords) {\n if (reservedWords.length === 0) {\n return new RegExp(\"^\\b$\", 'u');\n }\n\n var reservedWordsPattern = (0, _utils.sortByLengthDesc)(reservedWords).join('|').replace(/ /g, '\\\\s+');\n return new RegExp(\"^(\".concat(reservedWordsPattern, \")\\\\b\"), 'iu');\n}\n\nfunction createWordRegex() {\n var specialChars = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n return new RegExp(\"^([\\\\p{Alphabetic}\\\\p{Mark}\\\\p{Decimal_Number}\\\\p{Connector_Punctuation}\\\\p{Join_Control}\".concat(specialChars.join(''), \"]+)\"), 'u');\n}\n\nfunction createStringRegex(stringTypes) {\n return new RegExp('^(' + createStringPattern(stringTypes) + ')', 'u');\n} // This enables the following string patterns:\n// 1. backtick quoted string using `` to escape\n// 2. square bracket quoted string (SQL Server) using ]] to escape\n// 3. double quoted string using \"\" or \\\" to escape\n// 4. single quoted string using '' or \\' to escape\n// 5. national character quoted string using N'' or N\\' to escape\n// 6. Unicode single-quoted string using \\' to escape\n// 7. Unicode double-quoted string using \\\" to escape\n// 8. PostgreSQL dollar-quoted strings\n\n\nfunction createStringPattern(stringTypes) {\n var patterns = {\n '``': '((`[^`]*($|`))+)',\n '{}': '((\\\\{[^\\\\}]*($|\\\\}))+)',\n '[]': '((\\\\[[^\\\\]]*($|\\\\]))(\\\\][^\\\\]]*($|\\\\]))*)',\n '\"\"': '((\"[^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*(\"|$))+)',\n \"''\": \"(('[^'\\\\\\\\]*(?:\\\\\\\\.[^'\\\\\\\\]*)*('|$))+)\",\n \"N''\": \"((N'[^'\\\\\\\\]*(?:\\\\\\\\.[^'\\\\\\\\]*)*('|$))+)\",\n \"U&''\": \"((U&'[^'\\\\\\\\]*(?:\\\\\\\\.[^'\\\\\\\\]*)*('|$))+)\",\n 'U&\"\"': '((U&\"[^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*(\"|$))+)',\n $$: '((?\\\\$\\\\w*\\\\$)[\\\\s\\\\S]*?(?:\\\\k|$))'\n };\n return stringTypes.map(function (t) {\n return patterns[t];\n }).join('|');\n}\n\nfunction createParenRegex(parens) {\n return new RegExp('^(' + parens.map(escapeParen).join('|') + ')', 'iu');\n}\n\nfunction escapeParen(paren) {\n if (paren.length === 1) {\n // A single punctuation character\n return (0, _utils.escapeRegExp)(paren);\n } else {\n // longer word\n return '\\\\b' + paren + '\\\\b';\n }\n}\n\nfunction createPlaceholderRegex(types, pattern) {\n if ((0, _utils.isEmpty)(types)) {\n return false;\n }\n\n var typesRegex = types.map(_utils.escapeRegExp).join('|');\n return new RegExp(\"^((?:\".concat(typesRegex, \")(?:\").concat(pattern, \"))\"), 'u');\n}","\"use strict\";\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _tokenTypes = _interopRequireDefault(require(\"./tokenTypes\"));\n\nvar regexFactory = _interopRequireWildcard(require(\"./regexFactory\"));\n\nvar _utils = require(\"../utils\");\n\nfunction _getRequireWildcardCache() { if (typeof WeakMap !== \"function\") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== \"object\" && typeof obj !== \"function\") { return { \"default\": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj[\"default\"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar Tokenizer = /*#__PURE__*/function () {\n /**\n * @param {Object} cfg\n * @param {String[]} cfg.reservedWords Reserved words in SQL\n * @param {String[]} cfg.reservedTopLevelWords Words that are set to new line separately\n * @param {String[]} cfg.reservedNewlineWords Words that are set to newline\n * @param {String[]} cfg.reservedTopLevelWordsNoIndent Words that are top level but have no indentation\n * @param {String[]} cfg.stringTypes String types to enable: \"\", '', ``, [], N''\n * @param {String[]} cfg.openParens Opening parentheses to enable, like (, [\n * @param {String[]} cfg.closeParens Closing parentheses to enable, like ), ]\n * @param {String[]} cfg.indexedPlaceholderTypes Prefixes for indexed placeholders, like ?\n * @param {String[]} cfg.namedPlaceholderTypes Prefixes for named placeholders, like @ and :\n * @param {String[]} cfg.lineCommentTypes Line comments to enable, like # and --\n * @param {String[]} cfg.specialWordChars Special chars that can be found inside of words, like @ and #\n * @param {String[]} [cfg.operator] Additional operators to recognize\n */\n function Tokenizer(cfg) {\n _classCallCheck(this, Tokenizer);\n\n this.WHITESPACE_REGEX = /^([\\t-\\r \\xA0\\u1680\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+)/;\n this.NUMBER_REGEX = /^((\\x2D[\\t-\\r \\xA0\\u1680\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]*)?[0-9]+(\\.[0-9]+)?([Ee]\\x2D?[0-9]+(\\.[0-9]+)?)?|0x[0-9A-Fa-f]+|0b[01]+)\\b/;\n this.OPERATOR_REGEX = regexFactory.createOperatorRegex(['<>', '<=', '>='].concat(_toConsumableArray(cfg.operators || [])));\n this.BLOCK_COMMENT_REGEX = /^(\\/\\*(?:(?![])[\\s\\S])*?(?:\\*\\/|$))/;\n this.LINE_COMMENT_REGEX = regexFactory.createLineCommentRegex(cfg.lineCommentTypes);\n this.RESERVED_TOP_LEVEL_REGEX = regexFactory.createReservedWordRegex(cfg.reservedTopLevelWords);\n this.RESERVED_TOP_LEVEL_NO_INDENT_REGEX = regexFactory.createReservedWordRegex(cfg.reservedTopLevelWordsNoIndent);\n this.RESERVED_NEWLINE_REGEX = regexFactory.createReservedWordRegex(cfg.reservedNewlineWords);\n this.RESERVED_PLAIN_REGEX = regexFactory.createReservedWordRegex(cfg.reservedWords);\n this.WORD_REGEX = regexFactory.createWordRegex(cfg.specialWordChars);\n this.STRING_REGEX = regexFactory.createStringRegex(cfg.stringTypes);\n this.OPEN_PAREN_REGEX = regexFactory.createParenRegex(cfg.openParens);\n this.CLOSE_PAREN_REGEX = regexFactory.createParenRegex(cfg.closeParens);\n this.INDEXED_PLACEHOLDER_REGEX = regexFactory.createPlaceholderRegex(cfg.indexedPlaceholderTypes, '[0-9]*');\n this.IDENT_NAMED_PLACEHOLDER_REGEX = regexFactory.createPlaceholderRegex(cfg.namedPlaceholderTypes, '[a-zA-Z0-9._$]+');\n this.STRING_NAMED_PLACEHOLDER_REGEX = regexFactory.createPlaceholderRegex(cfg.namedPlaceholderTypes, regexFactory.createStringPattern(cfg.stringTypes));\n }\n /**\n * Takes a SQL string and breaks it into tokens.\n * Each token is an object with type and value.\n *\n * @param {String} input The SQL string\n * @return {Object[]} tokens An array of tokens.\n * @return {String} token.type\n * @return {String} token.value\n * @return {String} token.whitespaceBefore Preceding whitespace\n */\n\n\n _createClass(Tokenizer, [{\n key: \"tokenize\",\n value: function tokenize(input) {\n var tokens = [];\n var token; // Keep processing the string until it is empty\n\n while (input.length) {\n // grab any preceding whitespace\n var whitespaceBefore = this.getWhitespace(input);\n input = input.substring(whitespaceBefore.length);\n\n if (input.length) {\n // Get the next token and the token type\n token = this.getNextToken(input, token); // Advance the string\n\n input = input.substring(token.value.length);\n tokens.push(_objectSpread(_objectSpread({}, token), {}, {\n whitespaceBefore: whitespaceBefore\n }));\n }\n }\n\n return tokens;\n }\n }, {\n key: \"getWhitespace\",\n value: function getWhitespace(input) {\n var matches = input.match(this.WHITESPACE_REGEX);\n return matches ? matches[1] : '';\n }\n }, {\n key: \"getNextToken\",\n value: function getNextToken(input, previousToken) {\n return this.getCommentToken(input) || this.getStringToken(input) || this.getOpenParenToken(input) || this.getCloseParenToken(input) || this.getPlaceholderToken(input) || this.getNumberToken(input) || this.getReservedWordToken(input, previousToken) || this.getWordToken(input) || this.getOperatorToken(input);\n }\n }, {\n key: \"getCommentToken\",\n value: function getCommentToken(input) {\n return this.getLineCommentToken(input) || this.getBlockCommentToken(input);\n }\n }, {\n key: \"getLineCommentToken\",\n value: function getLineCommentToken(input) {\n return this.getTokenOnFirstMatch({\n input: input,\n type: _tokenTypes[\"default\"].LINE_COMMENT,\n regex: this.LINE_COMMENT_REGEX\n });\n }\n }, {\n key: \"getBlockCommentToken\",\n value: function getBlockCommentToken(input) {\n return this.getTokenOnFirstMatch({\n input: input,\n type: _tokenTypes[\"default\"].BLOCK_COMMENT,\n regex: this.BLOCK_COMMENT_REGEX\n });\n }\n }, {\n key: \"getStringToken\",\n value: function getStringToken(input) {\n return this.getTokenOnFirstMatch({\n input: input,\n type: _tokenTypes[\"default\"].STRING,\n regex: this.STRING_REGEX\n });\n }\n }, {\n key: \"getOpenParenToken\",\n value: function getOpenParenToken(input) {\n return this.getTokenOnFirstMatch({\n input: input,\n type: _tokenTypes[\"default\"].OPEN_PAREN,\n regex: this.OPEN_PAREN_REGEX\n });\n }\n }, {\n key: \"getCloseParenToken\",\n value: function getCloseParenToken(input) {\n return this.getTokenOnFirstMatch({\n input: input,\n type: _tokenTypes[\"default\"].CLOSE_PAREN,\n regex: this.CLOSE_PAREN_REGEX\n });\n }\n }, {\n key: \"getPlaceholderToken\",\n value: function getPlaceholderToken(input) {\n return this.getIdentNamedPlaceholderToken(input) || this.getStringNamedPlaceholderToken(input) || this.getIndexedPlaceholderToken(input);\n }\n }, {\n key: \"getIdentNamedPlaceholderToken\",\n value: function getIdentNamedPlaceholderToken(input) {\n return this.getPlaceholderTokenWithKey({\n input: input,\n regex: this.IDENT_NAMED_PLACEHOLDER_REGEX,\n parseKey: function parseKey(v) {\n return v.slice(1);\n }\n });\n }\n }, {\n key: \"getStringNamedPlaceholderToken\",\n value: function getStringNamedPlaceholderToken(input) {\n var _this = this;\n\n return this.getPlaceholderTokenWithKey({\n input: input,\n regex: this.STRING_NAMED_PLACEHOLDER_REGEX,\n parseKey: function parseKey(v) {\n return _this.getEscapedPlaceholderKey({\n key: v.slice(2, -1),\n quoteChar: v.slice(-1)\n });\n }\n });\n }\n }, {\n key: \"getIndexedPlaceholderToken\",\n value: function getIndexedPlaceholderToken(input) {\n return this.getPlaceholderTokenWithKey({\n input: input,\n regex: this.INDEXED_PLACEHOLDER_REGEX,\n parseKey: function parseKey(v) {\n return v.slice(1);\n }\n });\n }\n }, {\n key: \"getPlaceholderTokenWithKey\",\n value: function getPlaceholderTokenWithKey(_ref) {\n var input = _ref.input,\n regex = _ref.regex,\n parseKey = _ref.parseKey;\n var token = this.getTokenOnFirstMatch({\n input: input,\n regex: regex,\n type: _tokenTypes[\"default\"].PLACEHOLDER\n });\n\n if (token) {\n token.key = parseKey(token.value);\n }\n\n return token;\n }\n }, {\n key: \"getEscapedPlaceholderKey\",\n value: function getEscapedPlaceholderKey(_ref2) {\n var key = _ref2.key,\n quoteChar = _ref2.quoteChar;\n return key.replace(new RegExp((0, _utils.escapeRegExp)('\\\\' + quoteChar), 'gu'), quoteChar);\n } // Decimal, binary, or hex numbers\n\n }, {\n key: \"getNumberToken\",\n value: function getNumberToken(input) {\n return this.getTokenOnFirstMatch({\n input: input,\n type: _tokenTypes[\"default\"].NUMBER,\n regex: this.NUMBER_REGEX\n });\n } // Punctuation and symbols\n\n }, {\n key: \"getOperatorToken\",\n value: function getOperatorToken(input) {\n return this.getTokenOnFirstMatch({\n input: input,\n type: _tokenTypes[\"default\"].OPERATOR,\n regex: this.OPERATOR_REGEX\n });\n }\n }, {\n key: \"getReservedWordToken\",\n value: function getReservedWordToken(input, previousToken) {\n // A reserved word cannot be preceded by a \".\"\n // this makes it so in \"mytable.from\", \"from\" is not considered a reserved word\n if (previousToken && previousToken.value && previousToken.value === '.') {\n return undefined;\n }\n\n return this.getTopLevelReservedToken(input) || this.getNewlineReservedToken(input) || this.getTopLevelReservedTokenNoIndent(input) || this.getPlainReservedToken(input);\n }\n }, {\n key: \"getTopLevelReservedToken\",\n value: function getTopLevelReservedToken(input) {\n return this.getTokenOnFirstMatch({\n input: input,\n type: _tokenTypes[\"default\"].RESERVED_TOP_LEVEL,\n regex: this.RESERVED_TOP_LEVEL_REGEX\n });\n }\n }, {\n key: \"getNewlineReservedToken\",\n value: function getNewlineReservedToken(input) {\n return this.getTokenOnFirstMatch({\n input: input,\n type: _tokenTypes[\"default\"].RESERVED_NEWLINE,\n regex: this.RESERVED_NEWLINE_REGEX\n });\n }\n }, {\n key: \"getTopLevelReservedTokenNoIndent\",\n value: function getTopLevelReservedTokenNoIndent(input) {\n return this.getTokenOnFirstMatch({\n input: input,\n type: _tokenTypes[\"default\"].RESERVED_TOP_LEVEL_NO_INDENT,\n regex: this.RESERVED_TOP_LEVEL_NO_INDENT_REGEX\n });\n }\n }, {\n key: \"getPlainReservedToken\",\n value: function getPlainReservedToken(input) {\n return this.getTokenOnFirstMatch({\n input: input,\n type: _tokenTypes[\"default\"].RESERVED,\n regex: this.RESERVED_PLAIN_REGEX\n });\n }\n }, {\n key: \"getWordToken\",\n value: function getWordToken(input) {\n return this.getTokenOnFirstMatch({\n input: input,\n type: _tokenTypes[\"default\"].WORD,\n regex: this.WORD_REGEX\n });\n }\n }, {\n key: \"getTokenOnFirstMatch\",\n value: function getTokenOnFirstMatch(_ref3) {\n var input = _ref3.input,\n type = _ref3.type,\n regex = _ref3.regex;\n var matches = input.match(regex);\n return matches ? {\n type: type,\n value: matches[1]\n } : undefined;\n }\n }]);\n\n return Tokenizer;\n}();\n\nexports[\"default\"] = Tokenizer;\nmodule.exports = exports.default;","\"use strict\";\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _Formatter2 = _interopRequireDefault(require(\"../core/Formatter\"));\n\nvar _Tokenizer = _interopRequireDefault(require(\"../core/Tokenizer\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nvar reservedWords = ['ABS', 'ACTIVATE', 'ALIAS', 'ALL', 'ALLOCATE', 'ALLOW', 'ALTER', 'ANY', 'ARE', 'ARRAY', 'AS', 'ASC', 'ASENSITIVE', 'ASSOCIATE', 'ASUTIME', 'ASYMMETRIC', 'AT', 'ATOMIC', 'ATTRIBUTES', 'AUDIT', 'AUTHORIZATION', 'AUX', 'AUXILIARY', 'AVG', 'BEFORE', 'BEGIN', 'BETWEEN', 'BIGINT', 'BINARY', 'BLOB', 'BOOLEAN', 'BOTH', 'BUFFERPOOL', 'BY', 'CACHE', 'CALL', 'CALLED', 'CAPTURE', 'CARDINALITY', 'CASCADED', 'CASE', 'CAST', 'CCSID', 'CEIL', 'CEILING', 'CHAR', 'CHARACTER', 'CHARACTER_LENGTH', 'CHAR_LENGTH', 'CHECK', 'CLOB', 'CLONE', 'CLOSE', 'CLUSTER', 'COALESCE', 'COLLATE', 'COLLECT', 'COLLECTION', 'COLLID', 'COLUMN', 'COMMENT', 'COMMIT', 'CONCAT', 'CONDITION', 'CONNECT', 'CONNECTION', 'CONSTRAINT', 'CONTAINS', 'CONTINUE', 'CONVERT', 'CORR', 'CORRESPONDING', 'COUNT', 'COUNT_BIG', 'COVAR_POP', 'COVAR_SAMP', 'CREATE', 'CROSS', 'CUBE', 'CUME_DIST', 'CURRENT', 'CURRENT_DATE', 'CURRENT_DEFAULT_TRANSFORM_GROUP', 'CURRENT_LC_CTYPE', 'CURRENT_PATH', 'CURRENT_ROLE', 'CURRENT_SCHEMA', 'CURRENT_SERVER', 'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'CURRENT_TIMEZONE', 'CURRENT_TRANSFORM_GROUP_FOR_TYPE', 'CURRENT_USER', 'CURSOR', 'CYCLE', 'DATA', 'DATABASE', 'DATAPARTITIONNAME', 'DATAPARTITIONNUM', 'DATE', 'DAY', 'DAYS', 'DB2GENERAL', 'DB2GENRL', 'DB2SQL', 'DBINFO', 'DBPARTITIONNAME', 'DBPARTITIONNUM', 'DEALLOCATE', 'DEC', 'DECIMAL', 'DECLARE', 'DEFAULT', 'DEFAULTS', 'DEFINITION', 'DELETE', 'DENSERANK', 'DENSE_RANK', 'DEREF', 'DESCRIBE', 'DESCRIPTOR', 'DETERMINISTIC', 'DIAGNOSTICS', 'DISABLE', 'DISALLOW', 'DISCONNECT', 'DISTINCT', 'DO', 'DOCUMENT', 'DOUBLE', 'DROP', 'DSSIZE', 'DYNAMIC', 'EACH', 'EDITPROC', 'ELEMENT', 'ELSE', 'ELSEIF', 'ENABLE', 'ENCODING', 'ENCRYPTION', 'END', 'END-EXEC', 'ENDING', 'ERASE', 'ESCAPE', 'EVERY', 'EXCEPTION', 'EXCLUDING', 'EXCLUSIVE', 'EXEC', 'EXECUTE', 'EXISTS', 'EXIT', 'EXP', 'EXPLAIN', 'EXTENDED', 'EXTERNAL', 'EXTRACT', 'FALSE', 'FENCED', 'FETCH', 'FIELDPROC', 'FILE', 'FILTER', 'FINAL', 'FIRST', 'FLOAT', 'FLOOR', 'FOR', 'FOREIGN', 'FREE', 'FULL', 'FUNCTION', 'FUSION', 'GENERAL', 'GENERATED', 'GET', 'GLOBAL', 'GOTO', 'GRANT', 'GRAPHIC', 'GROUP', 'GROUPING', 'HANDLER', 'HASH', 'HASHED_VALUE', 'HINT', 'HOLD', 'HOUR', 'HOURS', 'IDENTITY', 'IF', 'IMMEDIATE', 'IN', 'INCLUDING', 'INCLUSIVE', 'INCREMENT', 'INDEX', 'INDICATOR', 'INDICATORS', 'INF', 'INFINITY', 'INHERIT', 'INNER', 'INOUT', 'INSENSITIVE', 'INSERT', 'INT', 'INTEGER', 'INTEGRITY', 'INTERSECTION', 'INTERVAL', 'INTO', 'IS', 'ISOBID', 'ISOLATION', 'ITERATE', 'JAR', 'JAVA', 'KEEP', 'KEY', 'LABEL', 'LANGUAGE', 'LARGE', 'LATERAL', 'LC_CTYPE', 'LEADING', 'LEAVE', 'LEFT', 'LIKE', 'LINKTYPE', 'LN', 'LOCAL', 'LOCALDATE', 'LOCALE', 'LOCALTIME', 'LOCALTIMESTAMP', 'LOCATOR', 'LOCATORS', 'LOCK', 'LOCKMAX', 'LOCKSIZE', 'LONG', 'LOOP', 'LOWER', 'MAINTAINED', 'MATCH', 'MATERIALIZED', 'MAX', 'MAXVALUE', 'MEMBER', 'MERGE', 'METHOD', 'MICROSECOND', 'MICROSECONDS', 'MIN', 'MINUTE', 'MINUTES', 'MINVALUE', 'MOD', 'MODE', 'MODIFIES', 'MODULE', 'MONTH', 'MONTHS', 'MULTISET', 'NAN', 'NATIONAL', 'NATURAL', 'NCHAR', 'NCLOB', 'NEW', 'NEW_TABLE', 'NEXTVAL', 'NO', 'NOCACHE', 'NOCYCLE', 'NODENAME', 'NODENUMBER', 'NOMAXVALUE', 'NOMINVALUE', 'NONE', 'NOORDER', 'NORMALIZE', 'NORMALIZED', 'NOT', 'NULL', 'NULLIF', 'NULLS', 'NUMERIC', 'NUMPARTS', 'OBID', 'OCTET_LENGTH', 'OF', 'OFFSET', 'OLD', 'OLD_TABLE', 'ON', 'ONLY', 'OPEN', 'OPTIMIZATION', 'OPTIMIZE', 'OPTION', 'ORDER', 'OUT', 'OUTER', 'OVER', 'OVERLAPS', 'OVERLAY', 'OVERRIDING', 'PACKAGE', 'PADDED', 'PAGESIZE', 'PARAMETER', 'PART', 'PARTITION', 'PARTITIONED', 'PARTITIONING', 'PARTITIONS', 'PASSWORD', 'PATH', 'PERCENTILE_CONT', 'PERCENTILE_DISC', 'PERCENT_RANK', 'PIECESIZE', 'PLAN', 'POSITION', 'POWER', 'PRECISION', 'PREPARE', 'PREVVAL', 'PRIMARY', 'PRIQTY', 'PRIVILEGES', 'PROCEDURE', 'PROGRAM', 'PSID', 'PUBLIC', 'QUERY', 'QUERYNO', 'RANGE', 'RANK', 'READ', 'READS', 'REAL', 'RECOVERY', 'RECURSIVE', 'REF', 'REFERENCES', 'REFERENCING', 'REFRESH', 'REGR_AVGX', 'REGR_AVGY', 'REGR_COUNT', 'REGR_INTERCEPT', 'REGR_R2', 'REGR_SLOPE', 'REGR_SXX', 'REGR_SXY', 'REGR_SYY', 'RELEASE', 'RENAME', 'REPEAT', 'RESET', 'RESIGNAL', 'RESTART', 'RESTRICT', 'RESULT', 'RESULT_SET_LOCATOR', 'RETURN', 'RETURNS', 'REVOKE', 'RIGHT', 'ROLE', 'ROLLBACK', 'ROLLUP', 'ROUND_CEILING', 'ROUND_DOWN', 'ROUND_FLOOR', 'ROUND_HALF_DOWN', 'ROUND_HALF_EVEN', 'ROUND_HALF_UP', 'ROUND_UP', 'ROUTINE', 'ROW', 'ROWNUMBER', 'ROWS', 'ROWSET', 'ROW_NUMBER', 'RRN', 'RUN', 'SAVEPOINT', 'SCHEMA', 'SCOPE', 'SCRATCHPAD', 'SCROLL', 'SEARCH', 'SECOND', 'SECONDS', 'SECQTY', 'SECURITY', 'SENSITIVE', 'SEQUENCE', 'SESSION', 'SESSION_USER', 'SIGNAL', 'SIMILAR', 'SIMPLE', 'SMALLINT', 'SNAN', 'SOME', 'SOURCE', 'SPECIFIC', 'SPECIFICTYPE', 'SQL', 'SQLEXCEPTION', 'SQLID', 'SQLSTATE', 'SQLWARNING', 'SQRT', 'STACKED', 'STANDARD', 'START', 'STARTING', 'STATEMENT', 'STATIC', 'STATMENT', 'STAY', 'STDDEV_POP', 'STDDEV_SAMP', 'STOGROUP', 'STORES', 'STYLE', 'SUBMULTISET', 'SUBSTRING', 'SUM', 'SUMMARY', 'SYMMETRIC', 'SYNONYM', 'SYSFUN', 'SYSIBM', 'SYSPROC', 'SYSTEM', 'SYSTEM_USER', 'TABLE', 'TABLESAMPLE', 'TABLESPACE', 'THEN', 'TIME', 'TIMESTAMP', 'TIMEZONE_HOUR', 'TIMEZONE_MINUTE', 'TO', 'TRAILING', 'TRANSACTION', 'TRANSLATE', 'TRANSLATION', 'TREAT', 'TRIGGER', 'TRIM', 'TRUE', 'TRUNCATE', 'TYPE', 'UESCAPE', 'UNDO', 'UNIQUE', 'UNKNOWN', 'UNNEST', 'UNTIL', 'UPPER', 'USAGE', 'USER', 'USING', 'VALIDPROC', 'VALUE', 'VARCHAR', 'VARIABLE', 'VARIANT', 'VARYING', 'VAR_POP', 'VAR_SAMP', 'VCAT', 'VERSION', 'VIEW', 'VOLATILE', 'VOLUMES', 'WHEN', 'WHENEVER', 'WHILE', 'WIDTH_BUCKET', 'WINDOW', 'WITH', 'WITHIN', 'WITHOUT', 'WLM', 'WRITE', 'XMLELEMENT', 'XMLEXISTS', 'XMLNAMESPACES', 'YEAR', 'YEARS'];\nvar reservedTopLevelWords = ['ADD', 'AFTER', 'ALTER COLUMN', 'ALTER TABLE', 'DELETE FROM', 'EXCEPT', 'FETCH FIRST', 'FROM', 'GROUP BY', 'GO', 'HAVING', 'INSERT INTO', 'INTERSECT', 'LIMIT', 'ORDER BY', 'SELECT', 'SET CURRENT SCHEMA', 'SET SCHEMA', 'SET', 'UPDATE', 'VALUES', 'WHERE'];\nvar reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'MINUS', 'UNION', 'UNION ALL'];\nvar reservedNewlineWords = ['AND', 'OR', // joins\n'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN']; // For reference: https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_72/db2/rbafzintro.htm\n\nvar Db2Formatter = /*#__PURE__*/function (_Formatter) {\n _inherits(Db2Formatter, _Formatter);\n\n var _super = _createSuper(Db2Formatter);\n\n function Db2Formatter() {\n _classCallCheck(this, Db2Formatter);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Db2Formatter, [{\n key: \"tokenizer\",\n value: function tokenizer() {\n return new _Tokenizer[\"default\"]({\n reservedWords: reservedWords,\n reservedTopLevelWords: reservedTopLevelWords,\n reservedNewlineWords: reservedNewlineWords,\n reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,\n stringTypes: [\"\\\"\\\"\", \"''\", '``', '[]'],\n openParens: ['('],\n closeParens: [')'],\n indexedPlaceholderTypes: ['?'],\n namedPlaceholderTypes: [':'],\n lineCommentTypes: ['--'],\n specialWordChars: ['#', '@'],\n operators: ['**', '!=', '!>', '!>', '||']\n });\n }\n }]);\n\n return Db2Formatter;\n}(_Formatter2[\"default\"]);\n\nexports[\"default\"] = Db2Formatter;\nmodule.exports = exports.default;","\"use strict\";\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _Formatter2 = _interopRequireDefault(require(\"../core/Formatter\"));\n\nvar _Tokenizer = _interopRequireDefault(require(\"../core/Tokenizer\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nvar reservedWords = ['ACCESSIBLE', 'ADD', 'ALL', 'ALTER', 'ANALYZE', 'AND', 'AS', 'ASC', 'ASENSITIVE', 'BEFORE', 'BETWEEN', 'BIGINT', 'BINARY', 'BLOB', 'BOTH', 'BY', 'CALL', 'CASCADE', 'CASE', 'CHANGE', 'CHAR', 'CHARACTER', 'CHECK', 'COLLATE', 'COLUMN', 'CONDITION', 'CONSTRAINT', 'CONTINUE', 'CONVERT', 'CREATE', 'CROSS', 'CURRENT_DATE', 'CURRENT_ROLE', 'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'CURRENT_USER', 'CURSOR', 'DATABASE', 'DATABASES', 'DAY_HOUR', 'DAY_MICROSECOND', 'DAY_MINUTE', 'DAY_SECOND', 'DEC', 'DECIMAL', 'DECLARE', 'DEFAULT', 'DELAYED', 'DELETE', 'DESC', 'DESCRIBE', 'DETERMINISTIC', 'DISTINCT', 'DISTINCTROW', 'DIV', 'DO_DOMAIN_IDS', 'DOUBLE', 'DROP', 'DUAL', 'EACH', 'ELSE', 'ELSEIF', 'ENCLOSED', 'ESCAPED', 'EXCEPT', 'EXISTS', 'EXIT', 'EXPLAIN', 'FALSE', 'FETCH', 'FLOAT', 'FLOAT4', 'FLOAT8', 'FOR', 'FORCE', 'FOREIGN', 'FROM', 'FULLTEXT', 'GENERAL', 'GRANT', 'GROUP', 'HAVING', 'HIGH_PRIORITY', 'HOUR_MICROSECOND', 'HOUR_MINUTE', 'HOUR_SECOND', 'IF', 'IGNORE', 'IGNORE_DOMAIN_IDS', 'IGNORE_SERVER_IDS', 'IN', 'INDEX', 'INFILE', 'INNER', 'INOUT', 'INSENSITIVE', 'INSERT', 'INT', 'INT1', 'INT2', 'INT3', 'INT4', 'INT8', 'INTEGER', 'INTERSECT', 'INTERVAL', 'INTO', 'IS', 'ITERATE', 'JOIN', 'KEY', 'KEYS', 'KILL', 'LEADING', 'LEAVE', 'LEFT', 'LIKE', 'LIMIT', 'LINEAR', 'LINES', 'LOAD', 'LOCALTIME', 'LOCALTIMESTAMP', 'LOCK', 'LONG', 'LONGBLOB', 'LONGTEXT', 'LOOP', 'LOW_PRIORITY', 'MASTER_HEARTBEAT_PERIOD', 'MASTER_SSL_VERIFY_SERVER_CERT', 'MATCH', 'MAXVALUE', 'MEDIUMBLOB', 'MEDIUMINT', 'MEDIUMTEXT', 'MIDDLEINT', 'MINUTE_MICROSECOND', 'MINUTE_SECOND', 'MOD', 'MODIFIES', 'NATURAL', 'NOT', 'NO_WRITE_TO_BINLOG', 'NULL', 'NUMERIC', 'ON', 'OPTIMIZE', 'OPTION', 'OPTIONALLY', 'OR', 'ORDER', 'OUT', 'OUTER', 'OUTFILE', 'OVER', 'PAGE_CHECKSUM', 'PARSE_VCOL_EXPR', 'PARTITION', 'POSITION', 'PRECISION', 'PRIMARY', 'PROCEDURE', 'PURGE', 'RANGE', 'READ', 'READS', 'READ_WRITE', 'REAL', 'RECURSIVE', 'REF_SYSTEM_ID', 'REFERENCES', 'REGEXP', 'RELEASE', 'RENAME', 'REPEAT', 'REPLACE', 'REQUIRE', 'RESIGNAL', 'RESTRICT', 'RETURN', 'RETURNING', 'REVOKE', 'RIGHT', 'RLIKE', 'ROWS', 'SCHEMA', 'SCHEMAS', 'SECOND_MICROSECOND', 'SELECT', 'SENSITIVE', 'SEPARATOR', 'SET', 'SHOW', 'SIGNAL', 'SLOW', 'SMALLINT', 'SPATIAL', 'SPECIFIC', 'SQL', 'SQLEXCEPTION', 'SQLSTATE', 'SQLWARNING', 'SQL_BIG_RESULT', 'SQL_CALC_FOUND_ROWS', 'SQL_SMALL_RESULT', 'SSL', 'STARTING', 'STATS_AUTO_RECALC', 'STATS_PERSISTENT', 'STATS_SAMPLE_PAGES', 'STRAIGHT_JOIN', 'TABLE', 'TERMINATED', 'THEN', 'TINYBLOB', 'TINYINT', 'TINYTEXT', 'TO', 'TRAILING', 'TRIGGER', 'TRUE', 'UNDO', 'UNION', 'UNIQUE', 'UNLOCK', 'UNSIGNED', 'UPDATE', 'USAGE', 'USE', 'USING', 'UTC_DATE', 'UTC_TIME', 'UTC_TIMESTAMP', 'VALUES', 'VARBINARY', 'VARCHAR', 'VARCHARACTER', 'VARYING', 'WHEN', 'WHERE', 'WHILE', 'WINDOW', 'WITH', 'WRITE', 'XOR', 'YEAR_MONTH', 'ZEROFILL'];\nvar reservedTopLevelWords = ['ADD', 'ALTER COLUMN', 'ALTER TABLE', 'DELETE FROM', 'EXCEPT', 'FROM', 'GROUP BY', 'HAVING', 'INSERT INTO', 'INSERT', 'LIMIT', 'ORDER BY', 'SELECT', 'SET', 'UPDATE', 'VALUES', 'WHERE'];\nvar reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'UNION', 'UNION ALL'];\nvar reservedNewlineWords = ['AND', 'ELSE', 'OR', 'WHEN', // joins\n'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN', // non-standard joins\n'STRAIGHT_JOIN', 'NATURAL LEFT JOIN', 'NATURAL LEFT OUTER JOIN', 'NATURAL RIGHT JOIN', 'NATURAL RIGHT OUTER JOIN']; // For reference: https://mariadb.com/kb/en/sql-statements-structure/\n\nvar MariaDbFormatter = /*#__PURE__*/function (_Formatter) {\n _inherits(MariaDbFormatter, _Formatter);\n\n var _super = _createSuper(MariaDbFormatter);\n\n function MariaDbFormatter() {\n _classCallCheck(this, MariaDbFormatter);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(MariaDbFormatter, [{\n key: \"tokenizer\",\n value: function tokenizer() {\n return new _Tokenizer[\"default\"]({\n reservedWords: reservedWords,\n reservedTopLevelWords: reservedTopLevelWords,\n reservedNewlineWords: reservedNewlineWords,\n reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,\n stringTypes: ['``', \"''\", '\"\"'],\n openParens: ['(', 'CASE'],\n closeParens: [')', 'END'],\n indexedPlaceholderTypes: ['?'],\n namedPlaceholderTypes: [],\n lineCommentTypes: ['--', '#'],\n specialWordChars: ['@'],\n operators: [':=', '<<', '>>', '!=', '<>', '<=>', '&&', '||']\n });\n }\n }]);\n\n return MariaDbFormatter;\n}(_Formatter2[\"default\"]);\n\nexports[\"default\"] = MariaDbFormatter;\nmodule.exports = exports.default;","\"use strict\";\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _Formatter2 = _interopRequireDefault(require(\"../core/Formatter\"));\n\nvar _Tokenizer = _interopRequireDefault(require(\"../core/Tokenizer\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nvar reservedWords = ['ACCESSIBLE', 'ADD', 'ALL', 'ALTER', 'ANALYZE', 'AND', 'AS', 'ASC', 'ASENSITIVE', 'BEFORE', 'BETWEEN', 'BIGINT', 'BINARY', 'BLOB', 'BOTH', 'BY', 'CALL', 'CASCADE', 'CASE', 'CHANGE', 'CHAR', 'CHARACTER', 'CHECK', 'COLLATE', 'COLUMN', 'CONDITION', 'CONSTRAINT', 'CONTINUE', 'CONVERT', 'CREATE', 'CROSS', 'CUBE', 'CUME_DIST', 'CURRENT_DATE', 'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'CURRENT_USER', 'CURSOR', 'DATABASE', 'DATABASES', 'DAY_HOUR', 'DAY_MICROSECOND', 'DAY_MINUTE', 'DAY_SECOND', 'DEC', 'DECIMAL', 'DECLARE', 'DEFAULT', 'DELAYED', 'DELETE', 'DENSE_RANK', 'DESC', 'DESCRIBE', 'DETERMINISTIC', 'DISTINCT', 'DISTINCTROW', 'DIV', 'DOUBLE', 'DROP', 'DUAL', 'EACH', 'ELSE', 'ELSEIF', 'EMPTY', 'ENCLOSED', 'ESCAPED', 'EXCEPT', 'EXISTS', 'EXIT', 'EXPLAIN', 'FALSE', 'FETCH', 'FIRST_VALUE', 'FLOAT', 'FLOAT4', 'FLOAT8', 'FOR', 'FORCE', 'FOREIGN', 'FROM', 'FULLTEXT', 'FUNCTION', 'GENERATED', 'GET', 'GRANT', 'GROUP', 'GROUPING', 'GROUPS', 'HAVING', 'HIGH_PRIORITY', 'HOUR_MICROSECOND', 'HOUR_MINUTE', 'HOUR_SECOND', 'IF', 'IGNORE', 'IN', 'INDEX', 'INFILE', 'INNER', 'INOUT', 'INSENSITIVE', 'INSERT', 'INT', 'INT1', 'INT2', 'INT3', 'INT4', 'INT8', 'INTEGER', 'INTERVAL', 'INTO', 'IO_AFTER_GTIDS', 'IO_BEFORE_GTIDS', 'IS', 'ITERATE', 'JOIN', 'JSON_TABLE', 'KEY', 'KEYS', 'KILL', 'LAG', 'LAST_VALUE', 'LATERAL', 'LEAD', 'LEADING', 'LEAVE', 'LEFT', 'LIKE', 'LIMIT', 'LINEAR', 'LINES', 'LOAD', 'LOCALTIME', 'LOCALTIMESTAMP', 'LOCK', 'LONG', 'LONGBLOB', 'LONGTEXT', 'LOOP', 'LOW_PRIORITY', 'MASTER_BIND', 'MASTER_SSL_VERIFY_SERVER_CERT', 'MATCH', 'MAXVALUE', 'MEDIUMBLOB', 'MEDIUMINT', 'MEDIUMTEXT', 'MIDDLEINT', 'MINUTE_MICROSECOND', 'MINUTE_SECOND', 'MOD', 'MODIFIES', 'NATURAL', 'NOT', 'NO_WRITE_TO_BINLOG', 'NTH_VALUE', 'NTILE', 'NULL', 'NUMERIC', 'OF', 'ON', 'OPTIMIZE', 'OPTIMIZER_COSTS', 'OPTION', 'OPTIONALLY', 'OR', 'ORDER', 'OUT', 'OUTER', 'OUTFILE', 'OVER', 'PARTITION', 'PERCENT_RANK', 'PRECISION', 'PRIMARY', 'PROCEDURE', 'PURGE', 'RANGE', 'RANK', 'READ', 'READS', 'READ_WRITE', 'REAL', 'RECURSIVE', 'REFERENCES', 'REGEXP', 'RELEASE', 'RENAME', 'REPEAT', 'REPLACE', 'REQUIRE', 'RESIGNAL', 'RESTRICT', 'RETURN', 'REVOKE', 'RIGHT', 'RLIKE', 'ROW', 'ROWS', 'ROW_NUMBER', 'SCHEMA', 'SCHEMAS', 'SECOND_MICROSECOND', 'SELECT', 'SENSITIVE', 'SEPARATOR', 'SET', 'SHOW', 'SIGNAL', 'SMALLINT', 'SPATIAL', 'SPECIFIC', 'SQL', 'SQLEXCEPTION', 'SQLSTATE', 'SQLWARNING', 'SQL_BIG_RESULT', 'SQL_CALC_FOUND_ROWS', 'SQL_SMALL_RESULT', 'SSL', 'STARTING', 'STORED', 'STRAIGHT_JOIN', 'SYSTEM', 'TABLE', 'TERMINATED', 'THEN', 'TINYBLOB', 'TINYINT', 'TINYTEXT', 'TO', 'TRAILING', 'TRIGGER', 'TRUE', 'UNDO', 'UNION', 'UNIQUE', 'UNLOCK', 'UNSIGNED', 'UPDATE', 'USAGE', 'USE', 'USING', 'UTC_DATE', 'UTC_TIME', 'UTC_TIMESTAMP', 'VALUES', 'VARBINARY', 'VARCHAR', 'VARCHARACTER', 'VARYING', 'VIRTUAL', 'WHEN', 'WHERE', 'WHILE', 'WINDOW', 'WITH', 'WRITE', 'XOR', 'YEAR_MONTH', 'ZEROFILL'];\nvar reservedTopLevelWords = ['ADD', 'ALTER COLUMN', 'ALTER TABLE', 'DELETE FROM', 'EXCEPT', 'FROM', 'GROUP BY', 'HAVING', 'INSERT INTO', 'INSERT', 'LIMIT', 'ORDER BY', 'SELECT', 'SET', 'UPDATE', 'VALUES', 'WHERE'];\nvar reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'UNION', 'UNION ALL'];\nvar reservedNewlineWords = ['AND', 'ELSE', 'OR', 'WHEN', // joins\n'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN', // non-standard joins\n'STRAIGHT_JOIN', 'NATURAL LEFT JOIN', 'NATURAL LEFT OUTER JOIN', 'NATURAL RIGHT JOIN', 'NATURAL RIGHT OUTER JOIN'];\n\nvar MySqlFormatter = /*#__PURE__*/function (_Formatter) {\n _inherits(MySqlFormatter, _Formatter);\n\n var _super = _createSuper(MySqlFormatter);\n\n function MySqlFormatter() {\n _classCallCheck(this, MySqlFormatter);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(MySqlFormatter, [{\n key: \"tokenizer\",\n value: function tokenizer() {\n return new _Tokenizer[\"default\"]({\n reservedWords: reservedWords,\n reservedTopLevelWords: reservedTopLevelWords,\n reservedNewlineWords: reservedNewlineWords,\n reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,\n stringTypes: ['``', \"''\", '\"\"'],\n openParens: ['(', 'CASE'],\n closeParens: [')', 'END'],\n indexedPlaceholderTypes: ['?'],\n namedPlaceholderTypes: [],\n lineCommentTypes: ['--', '#'],\n specialWordChars: ['@'],\n operators: [':=', '<<', '>>', '!=', '<>', '<=>', '&&', '||', '->', '->>']\n });\n }\n }]);\n\n return MySqlFormatter;\n}(_Formatter2[\"default\"]);\n\nexports[\"default\"] = MySqlFormatter;\nmodule.exports = exports.default;","\"use strict\";\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _Formatter2 = _interopRequireDefault(require(\"../core/Formatter\"));\n\nvar _Tokenizer = _interopRequireDefault(require(\"../core/Tokenizer\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nvar reservedWords = ['ALL', 'ALTER', 'ANALYZE', 'AND', 'ANY', 'ARRAY', 'AS', 'ASC', 'BEGIN', 'BETWEEN', 'BINARY', 'BOOLEAN', 'BREAK', 'BUCKET', 'BUILD', 'BY', 'CALL', 'CASE', 'CAST', 'CLUSTER', 'COLLATE', 'COLLECTION', 'COMMIT', 'CONNECT', 'CONTINUE', 'CORRELATE', 'COVER', 'CREATE', 'DATABASE', 'DATASET', 'DATASTORE', 'DECLARE', 'DECREMENT', 'DELETE', 'DERIVED', 'DESC', 'DESCRIBE', 'DISTINCT', 'DO', 'DROP', 'EACH', 'ELEMENT', 'ELSE', 'END', 'EVERY', 'EXCEPT', 'EXCLUDE', 'EXECUTE', 'EXISTS', 'EXPLAIN', 'FALSE', 'FETCH', 'FIRST', 'FLATTEN', 'FOR', 'FORCE', 'FROM', 'FUNCTION', 'GRANT', 'GROUP', 'GSI', 'HAVING', 'IF', 'IGNORE', 'ILIKE', 'IN', 'INCLUDE', 'INCREMENT', 'INDEX', 'INFER', 'INLINE', 'INNER', 'INSERT', 'INTERSECT', 'INTO', 'IS', 'JOIN', 'KEY', 'KEYS', 'KEYSPACE', 'KNOWN', 'LAST', 'LEFT', 'LET', 'LETTING', 'LIKE', 'LIMIT', 'LSM', 'MAP', 'MAPPING', 'MATCHED', 'MATERIALIZED', 'MERGE', 'MISSING', 'NAMESPACE', 'NEST', 'NOT', 'NULL', 'NUMBER', 'OBJECT', 'OFFSET', 'ON', 'OPTION', 'OR', 'ORDER', 'OUTER', 'OVER', 'PARSE', 'PARTITION', 'PASSWORD', 'PATH', 'POOL', 'PREPARE', 'PRIMARY', 'PRIVATE', 'PRIVILEGE', 'PROCEDURE', 'PUBLIC', 'RAW', 'REALM', 'REDUCE', 'RENAME', 'RETURN', 'RETURNING', 'REVOKE', 'RIGHT', 'ROLE', 'ROLLBACK', 'SATISFIES', 'SCHEMA', 'SELECT', 'SELF', 'SEMI', 'SET', 'SHOW', 'SOME', 'START', 'STATISTICS', 'STRING', 'SYSTEM', 'THEN', 'TO', 'TRANSACTION', 'TRIGGER', 'TRUE', 'TRUNCATE', 'UNDER', 'UNION', 'UNIQUE', 'UNKNOWN', 'UNNEST', 'UNSET', 'UPDATE', 'UPSERT', 'USE', 'USER', 'USING', 'VALIDATE', 'VALUE', 'VALUED', 'VALUES', 'VIA', 'VIEW', 'WHEN', 'WHERE', 'WHILE', 'WITH', 'WITHIN', 'WORK', 'XOR'];\nvar reservedTopLevelWords = ['DELETE FROM', 'EXCEPT ALL', 'EXCEPT', 'EXPLAIN DELETE FROM', 'EXPLAIN UPDATE', 'EXPLAIN UPSERT', 'FROM', 'GROUP BY', 'HAVING', 'INFER', 'INSERT INTO', 'LET', 'LIMIT', 'MERGE', 'NEST', 'ORDER BY', 'PREPARE', 'SELECT', 'SET CURRENT SCHEMA', 'SET SCHEMA', 'SET', 'UNNEST', 'UPDATE', 'UPSERT', 'USE KEYS', 'VALUES', 'WHERE'];\nvar reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'MINUS', 'UNION', 'UNION ALL'];\nvar reservedNewlineWords = ['AND', 'OR', 'XOR', // joins\n'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN']; // For reference: http://docs.couchbase.com.s3-website-us-west-1.amazonaws.com/server/6.0/n1ql/n1ql-language-reference/index.html\n\nvar N1qlFormatter = /*#__PURE__*/function (_Formatter) {\n _inherits(N1qlFormatter, _Formatter);\n\n var _super = _createSuper(N1qlFormatter);\n\n function N1qlFormatter() {\n _classCallCheck(this, N1qlFormatter);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(N1qlFormatter, [{\n key: \"tokenizer\",\n value: function tokenizer() {\n return new _Tokenizer[\"default\"]({\n reservedWords: reservedWords,\n reservedTopLevelWords: reservedTopLevelWords,\n reservedNewlineWords: reservedNewlineWords,\n reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,\n stringTypes: [\"\\\"\\\"\", \"''\", '``'],\n openParens: ['(', '[', '{'],\n closeParens: [')', ']', '}'],\n namedPlaceholderTypes: ['$'],\n lineCommentTypes: ['#', '--'],\n operators: ['==', '!=']\n });\n }\n }]);\n\n return N1qlFormatter;\n}(_Formatter2[\"default\"]);\n\nexports[\"default\"] = N1qlFormatter;\nmodule.exports = exports.default;","\"use strict\";\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _Formatter2 = _interopRequireDefault(require(\"../core/Formatter\"));\n\nvar _token = require(\"../core/token\");\n\nvar _Tokenizer = _interopRequireDefault(require(\"../core/Tokenizer\"));\n\nvar _tokenTypes = _interopRequireDefault(require(\"../core/tokenTypes\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nvar reservedWords = ['A', 'ACCESSIBLE', 'AGENT', 'AGGREGATE', 'ALL', 'ALTER', 'ANY', 'ARRAY', 'AS', 'ASC', 'AT', 'ATTRIBUTE', 'AUTHID', 'AVG', 'BETWEEN', 'BFILE_BASE', 'BINARY_INTEGER', 'BINARY', 'BLOB_BASE', 'BLOCK', 'BODY', 'BOOLEAN', 'BOTH', 'BOUND', 'BREADTH', 'BULK', 'BY', 'BYTE', 'C', 'CALL', 'CALLING', 'CASCADE', 'CASE', 'CHAR_BASE', 'CHAR', 'CHARACTER', 'CHARSET', 'CHARSETFORM', 'CHARSETID', 'CHECK', 'CLOB_BASE', 'CLONE', 'CLOSE', 'CLUSTER', 'CLUSTERS', 'COALESCE', 'COLAUTH', 'COLLECT', 'COLUMNS', 'COMMENT', 'COMMIT', 'COMMITTED', 'COMPILED', 'COMPRESS', 'CONNECT', 'CONSTANT', 'CONSTRUCTOR', 'CONTEXT', 'CONTINUE', 'CONVERT', 'COUNT', 'CRASH', 'CREATE', 'CREDENTIAL', 'CURRENT', 'CURRVAL', 'CURSOR', 'CUSTOMDATUM', 'DANGLING', 'DATA', 'DATE_BASE', 'DATE', 'DAY', 'DECIMAL', 'DEFAULT', 'DEFINE', 'DELETE', 'DEPTH', 'DESC', 'DETERMINISTIC', 'DIRECTORY', 'DISTINCT', 'DO', 'DOUBLE', 'DROP', 'DURATION', 'ELEMENT', 'ELSIF', 'EMPTY', 'END', 'ESCAPE', 'EXCEPTIONS', 'EXCLUSIVE', 'EXECUTE', 'EXISTS', 'EXIT', 'EXTENDS', 'EXTERNAL', 'EXTRACT', 'FALSE', 'FETCH', 'FINAL', 'FIRST', 'FIXED', 'FLOAT', 'FOR', 'FORALL', 'FORCE', 'FROM', 'FUNCTION', 'GENERAL', 'GOTO', 'GRANT', 'GROUP', 'HASH', 'HEAP', 'HIDDEN', 'HOUR', 'IDENTIFIED', 'IF', 'IMMEDIATE', 'IN', 'INCLUDING', 'INDEX', 'INDEXES', 'INDICATOR', 'INDICES', 'INFINITE', 'INSTANTIABLE', 'INT', 'INTEGER', 'INTERFACE', 'INTERVAL', 'INTO', 'INVALIDATE', 'IS', 'ISOLATION', 'JAVA', 'LANGUAGE', 'LARGE', 'LEADING', 'LENGTH', 'LEVEL', 'LIBRARY', 'LIKE', 'LIKE2', 'LIKE4', 'LIKEC', 'LIMITED', 'LOCAL', 'LOCK', 'LONG', 'MAP', 'MAX', 'MAXLEN', 'MEMBER', 'MERGE', 'MIN', 'MINUTE', 'MLSLABEL', 'MOD', 'MODE', 'MONTH', 'MULTISET', 'NAME', 'NAN', 'NATIONAL', 'NATIVE', 'NATURAL', 'NATURALN', 'NCHAR', 'NEW', 'NEXTVAL', 'NOCOMPRESS', 'NOCOPY', 'NOT', 'NOWAIT', 'NULL', 'NULLIF', 'NUMBER_BASE', 'NUMBER', 'OBJECT', 'OCICOLL', 'OCIDATE', 'OCIDATETIME', 'OCIDURATION', 'OCIINTERVAL', 'OCILOBLOCATOR', 'OCINUMBER', 'OCIRAW', 'OCIREF', 'OCIREFCURSOR', 'OCIROWID', 'OCISTRING', 'OCITYPE', 'OF', 'OLD', 'ON', 'ONLY', 'OPAQUE', 'OPEN', 'OPERATOR', 'OPTION', 'ORACLE', 'ORADATA', 'ORDER', 'ORGANIZATION', 'ORLANY', 'ORLVARY', 'OTHERS', 'OUT', 'OVERLAPS', 'OVERRIDING', 'PACKAGE', 'PARALLEL_ENABLE', 'PARAMETER', 'PARAMETERS', 'PARENT', 'PARTITION', 'PASCAL', 'PCTFREE', 'PIPE', 'PIPELINED', 'PLS_INTEGER', 'PLUGGABLE', 'POSITIVE', 'POSITIVEN', 'PRAGMA', 'PRECISION', 'PRIOR', 'PRIVATE', 'PROCEDURE', 'PUBLIC', 'RAISE', 'RANGE', 'RAW', 'READ', 'REAL', 'RECORD', 'REF', 'REFERENCE', 'RELEASE', 'RELIES_ON', 'REM', 'REMAINDER', 'RENAME', 'RESOURCE', 'RESULT_CACHE', 'RESULT', 'RETURN', 'RETURNING', 'REVERSE', 'REVOKE', 'ROLLBACK', 'ROW', 'ROWID', 'ROWNUM', 'ROWTYPE', 'SAMPLE', 'SAVE', 'SAVEPOINT', 'SB1', 'SB2', 'SB4', 'SEARCH', 'SECOND', 'SEGMENT', 'SELF', 'SEPARATE', 'SEQUENCE', 'SERIALIZABLE', 'SHARE', 'SHORT', 'SIZE_T', 'SIZE', 'SMALLINT', 'SOME', 'SPACE', 'SPARSE', 'SQL', 'SQLCODE', 'SQLDATA', 'SQLERRM', 'SQLNAME', 'SQLSTATE', 'STANDARD', 'START', 'STATIC', 'STDDEV', 'STORED', 'STRING', 'STRUCT', 'STYLE', 'SUBMULTISET', 'SUBPARTITION', 'SUBSTITUTABLE', 'SUBTYPE', 'SUCCESSFUL', 'SUM', 'SYNONYM', 'SYSDATE', 'TABAUTH', 'TABLE', 'TDO', 'THE', 'THEN', 'TIME', 'TIMESTAMP', 'TIMEZONE_ABBR', 'TIMEZONE_HOUR', 'TIMEZONE_MINUTE', 'TIMEZONE_REGION', 'TO', 'TRAILING', 'TRANSACTION', 'TRANSACTIONAL', 'TRIGGER', 'TRUE', 'TRUSTED', 'TYPE', 'UB1', 'UB2', 'UB4', 'UID', 'UNDER', 'UNIQUE', 'UNPLUG', 'UNSIGNED', 'UNTRUSTED', 'USE', 'USER', 'USING', 'VALIDATE', 'VALIST', 'VALUE', 'VARCHAR', 'VARCHAR2', 'VARIABLE', 'VARIANCE', 'VARRAY', 'VARYING', 'VIEW', 'VIEWS', 'VOID', 'WHENEVER', 'WHILE', 'WITH', 'WORK', 'WRAPPED', 'WRITE', 'YEAR', 'ZONE'];\nvar reservedTopLevelWords = ['ADD', 'ALTER COLUMN', 'ALTER TABLE', 'BEGIN', 'CONNECT BY', 'DECLARE', 'DELETE FROM', 'DELETE', 'END', 'EXCEPT', 'EXCEPTION', 'FETCH FIRST', 'FROM', 'GROUP BY', 'HAVING', 'INSERT INTO', 'INSERT', 'LIMIT', 'LOOP', 'MODIFY', 'ORDER BY', 'SELECT', 'SET CURRENT SCHEMA', 'SET SCHEMA', 'SET', 'START WITH', 'UPDATE', 'VALUES', 'WHERE'];\nvar reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'MINUS', 'UNION', 'UNION ALL'];\nvar reservedNewlineWords = ['AND', 'CROSS APPLY', 'ELSE', 'END', 'OR', 'OUTER APPLY', 'WHEN', 'XOR', // joins\n'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN'];\n\nvar PlSqlFormatter = /*#__PURE__*/function (_Formatter) {\n _inherits(PlSqlFormatter, _Formatter);\n\n var _super = _createSuper(PlSqlFormatter);\n\n function PlSqlFormatter() {\n _classCallCheck(this, PlSqlFormatter);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(PlSqlFormatter, [{\n key: \"tokenizer\",\n value: function tokenizer() {\n return new _Tokenizer[\"default\"]({\n reservedWords: reservedWords,\n reservedTopLevelWords: reservedTopLevelWords,\n reservedNewlineWords: reservedNewlineWords,\n reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,\n stringTypes: [\"\\\"\\\"\", \"N''\", \"''\", '``'],\n openParens: ['(', 'CASE'],\n closeParens: [')', 'END'],\n indexedPlaceholderTypes: ['?'],\n namedPlaceholderTypes: [':'],\n lineCommentTypes: ['--'],\n specialWordChars: ['_', '$', '#', '.', '@'],\n operators: ['||', '**', '!=', ':=']\n });\n }\n }, {\n key: \"tokenOverride\",\n value: function tokenOverride(token) {\n if ((0, _token.isSet)(token) && (0, _token.isBy)(this.previousReservedToken)) {\n return {\n type: _tokenTypes[\"default\"].RESERVED,\n value: token.value\n };\n }\n\n return token;\n }\n }]);\n\n return PlSqlFormatter;\n}(_Formatter2[\"default\"]);\n\nexports[\"default\"] = PlSqlFormatter;\nmodule.exports = exports.default;","\"use strict\";\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _Formatter2 = _interopRequireDefault(require(\"../core/Formatter\"));\n\nvar _Tokenizer = _interopRequireDefault(require(\"../core/Tokenizer\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nvar reservedWords = ['ABORT', 'ABSOLUTE', 'ACCESS', 'ACTION', 'ADD', 'ADMIN', 'AFTER', 'AGGREGATE', 'ALL', 'ALSO', 'ALTER', 'ALWAYS', 'ANALYSE', 'ANALYZE', 'AND', 'ANY', 'ARRAY', 'AS', 'ASC', 'ASSERTION', 'ASSIGNMENT', 'ASYMMETRIC', 'AT', 'ATTACH', 'ATTRIBUTE', 'AUTHORIZATION', 'BACKWARD', 'BEFORE', 'BEGIN', 'BETWEEN', 'BIGINT', 'BINARY', 'BIT', 'BOOLEAN', 'BOTH', 'BY', 'CACHE', 'CALL', 'CALLED', 'CASCADE', 'CASCADED', 'CASE', 'CAST', 'CATALOG', 'CHAIN', 'CHAR', 'CHARACTER', 'CHARACTERISTICS', 'CHECK', 'CHECKPOINT', 'CLASS', 'CLOSE', 'CLUSTER', 'COALESCE', 'COLLATE', 'COLLATION', 'COLUMN', 'COLUMNS', 'COMMENT', 'COMMENTS', 'COMMIT', 'COMMITTED', 'CONCURRENTLY', 'CONFIGURATION', 'CONFLICT', 'CONNECTION', 'CONSTRAINT', 'CONSTRAINTS', 'CONTENT', 'CONTINUE', 'CONVERSION', 'COPY', 'COST', 'CREATE', 'CROSS', 'CSV', 'CUBE', 'CURRENT', 'CURRENT_CATALOG', 'CURRENT_DATE', 'CURRENT_ROLE', 'CURRENT_SCHEMA', 'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'CURRENT_USER', 'CURSOR', 'CYCLE', 'DATA', 'DATABASE', 'DAY', 'DEALLOCATE', 'DEC', 'DECIMAL', 'DECLARE', 'DEFAULT', 'DEFAULTS', 'DEFERRABLE', 'DEFERRED', 'DEFINER', 'DELETE', 'DELIMITER', 'DELIMITERS', 'DEPENDS', 'DESC', 'DETACH', 'DICTIONARY', 'DISABLE', 'DISCARD', 'DISTINCT', 'DO', 'DOCUMENT', 'DOMAIN', 'DOUBLE', 'DROP', 'EACH', 'ELSE', 'ENABLE', 'ENCODING', 'ENCRYPTED', 'END', 'ENUM', 'ESCAPE', 'EVENT', 'EXCEPT', 'EXCLUDE', 'EXCLUDING', 'EXCLUSIVE', 'EXECUTE', 'EXISTS', 'EXPLAIN', 'EXPRESSION', 'EXTENSION', 'EXTERNAL', 'EXTRACT', 'FALSE', 'FAMILY', 'FETCH', 'FILTER', 'FIRST', 'FLOAT', 'FOLLOWING', 'FOR', 'FORCE', 'FOREIGN', 'FORWARD', 'FREEZE', 'FROM', 'FULL', 'FUNCTION', 'FUNCTIONS', 'GENERATED', 'GLOBAL', 'GRANT', 'GRANTED', 'GREATEST', 'GROUP', 'GROUPING', 'GROUPS', 'HANDLER', 'HAVING', 'HEADER', 'HOLD', 'HOUR', 'IDENTITY', 'IF', 'ILIKE', 'IMMEDIATE', 'IMMUTABLE', 'IMPLICIT', 'IMPORT', 'IN', 'INCLUDE', 'INCLUDING', 'INCREMENT', 'INDEX', 'INDEXES', 'INHERIT', 'INHERITS', 'INITIALLY', 'INLINE', 'INNER', 'INOUT', 'INPUT', 'INSENSITIVE', 'INSERT', 'INSTEAD', 'INT', 'INTEGER', 'INTERSECT', 'INTERVAL', 'INTO', 'INVOKER', 'IS', 'ISNULL', 'ISOLATION', 'JOIN', 'KEY', 'LABEL', 'LANGUAGE', 'LARGE', 'LAST', 'LATERAL', 'LEADING', 'LEAKPROOF', 'LEAST', 'LEFT', 'LEVEL', 'LIKE', 'LIMIT', 'LISTEN', 'LOAD', 'LOCAL', 'LOCALTIME', 'LOCALTIMESTAMP', 'LOCATION', 'LOCK', 'LOCKED', 'LOGGED', 'MAPPING', 'MATCH', 'MATERIALIZED', 'MAXVALUE', 'METHOD', 'MINUTE', 'MINVALUE', 'MODE', 'MONTH', 'MOVE', 'NAME', 'NAMES', 'NATIONAL', 'NATURAL', 'NCHAR', 'NEW', 'NEXT', 'NFC', 'NFD', 'NFKC', 'NFKD', 'NO', 'NONE', 'NORMALIZE', 'NORMALIZED', 'NOT', 'NOTHING', 'NOTIFY', 'NOTNULL', 'NOWAIT', 'NULL', 'NULLIF', 'NULLS', 'NUMERIC', 'OBJECT', 'OF', 'OFF', 'OFFSET', 'OIDS', 'OLD', 'ON', 'ONLY', 'OPERATOR', 'OPTION', 'OPTIONS', 'OR', 'ORDER', 'ORDINALITY', 'OTHERS', 'OUT', 'OUTER', 'OVER', 'OVERLAPS', 'OVERLAY', 'OVERRIDING', 'OWNED', 'OWNER', 'PARALLEL', 'PARSER', 'PARTIAL', 'PARTITION', 'PASSING', 'PASSWORD', 'PLACING', 'PLANS', 'POLICY', 'POSITION', 'PRECEDING', 'PRECISION', 'PREPARE', 'PREPARED', 'PRESERVE', 'PRIMARY', 'PRIOR', 'PRIVILEGES', 'PROCEDURAL', 'PROCEDURE', 'PROCEDURES', 'PROGRAM', 'PUBLICATION', 'QUOTE', 'RANGE', 'READ', 'REAL', 'REASSIGN', 'RECHECK', 'RECURSIVE', 'REF', 'REFERENCES', 'REFERENCING', 'REFRESH', 'REINDEX', 'RELATIVE', 'RELEASE', 'RENAME', 'REPEATABLE', 'REPLACE', 'REPLICA', 'RESET', 'RESTART', 'RESTRICT', 'RETURNING', 'RETURNS', 'REVOKE', 'RIGHT', 'ROLE', 'ROLLBACK', 'ROLLUP', 'ROUTINE', 'ROUTINES', 'ROW', 'ROWS', 'RULE', 'SAVEPOINT', 'SCHEMA', 'SCHEMAS', 'SCROLL', 'SEARCH', 'SECOND', 'SECURITY', 'SELECT', 'SEQUENCE', 'SEQUENCES', 'SERIALIZABLE', 'SERVER', 'SESSION', 'SESSION_USER', 'SET', 'SETOF', 'SETS', 'SHARE', 'SHOW', 'SIMILAR', 'SIMPLE', 'SKIP', 'SMALLINT', 'SNAPSHOT', 'SOME', 'SQL', 'STABLE', 'STANDALONE', 'START', 'STATEMENT', 'STATISTICS', 'STDIN', 'STDOUT', 'STORAGE', 'STORED', 'STRICT', 'STRIP', 'SUBSCRIPTION', 'SUBSTRING', 'SUPPORT', 'SYMMETRIC', 'SYSID', 'SYSTEM', 'TABLE', 'TABLES', 'TABLESAMPLE', 'TABLESPACE', 'TEMP', 'TEMPLATE', 'TEMPORARY', 'TEXT', 'THEN', 'TIES', 'TIME', 'TIMESTAMP', 'TO', 'TRAILING', 'TRANSACTION', 'TRANSFORM', 'TREAT', 'TRIGGER', 'TRIM', 'TRUE', 'TRUNCATE', 'TRUSTED', 'TYPE', 'TYPES', 'UESCAPE', 'UNBOUNDED', 'UNCOMMITTED', 'UNENCRYPTED', 'UNION', 'UNIQUE', 'UNKNOWN', 'UNLISTEN', 'UNLOGGED', 'UNTIL', 'UPDATE', 'USER', 'USING', 'VACUUM', 'VALID', 'VALIDATE', 'VALIDATOR', 'VALUE', 'VALUES', 'VARCHAR', 'VARIADIC', 'VARYING', 'VERBOSE', 'VERSION', 'VIEW', 'VIEWS', 'VOLATILE', 'WHEN', 'WHERE', 'WHITESPACE', 'WINDOW', 'WITH', 'WITHIN', 'WITHOUT', 'WORK', 'WRAPPER', 'WRITE', 'XML', 'XMLATTRIBUTES', 'XMLCONCAT', 'XMLELEMENT', 'XMLEXISTS', 'XMLFOREST', 'XMLNAMESPACES', 'XMLPARSE', 'XMLPI', 'XMLROOT', 'XMLSERIALIZE', 'XMLTABLE', 'YEAR', 'YES', 'ZONE'];\nvar reservedTopLevelWords = ['ADD', 'AFTER', 'ALTER COLUMN', 'ALTER TABLE', 'CASE', 'DELETE FROM', 'END', 'EXCEPT', 'FETCH FIRST', 'FROM', 'GROUP BY', 'HAVING', 'INSERT INTO', 'INSERT', 'LIMIT', 'ORDER BY', 'SELECT', 'SET CURRENT SCHEMA', 'SET SCHEMA', 'SET', 'UPDATE', 'VALUES', 'WHERE'];\nvar reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'UNION', 'UNION ALL'];\nvar reservedNewlineWords = ['AND', 'ELSE', 'OR', 'WHEN', // joins\n'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN'];\n\nvar PostgreSqlFormatter = /*#__PURE__*/function (_Formatter) {\n _inherits(PostgreSqlFormatter, _Formatter);\n\n var _super = _createSuper(PostgreSqlFormatter);\n\n function PostgreSqlFormatter() {\n _classCallCheck(this, PostgreSqlFormatter);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(PostgreSqlFormatter, [{\n key: \"tokenizer\",\n value: function tokenizer() {\n return new _Tokenizer[\"default\"]({\n reservedWords: reservedWords,\n reservedTopLevelWords: reservedTopLevelWords,\n reservedNewlineWords: reservedNewlineWords,\n reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,\n stringTypes: [\"\\\"\\\"\", \"''\", \"U&''\", 'U&\"\"', '$$'],\n openParens: ['(', 'CASE'],\n closeParens: [')', 'END'],\n indexedPlaceholderTypes: ['$'],\n namedPlaceholderTypes: [':'],\n lineCommentTypes: ['--'],\n operators: ['!=', '<<', '>>', '||/', '|/', '::', '->>', '->', '~~*', '~~', '!~~*', '!~~', '~*', '!~*', '!~', '!!']\n });\n }\n }]);\n\n return PostgreSqlFormatter;\n}(_Formatter2[\"default\"]);\n\nexports[\"default\"] = PostgreSqlFormatter;\nmodule.exports = exports.default;","\"use strict\";\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _Formatter2 = _interopRequireDefault(require(\"../core/Formatter\"));\n\nvar _Tokenizer = _interopRequireDefault(require(\"../core/Tokenizer\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nvar reservedWords = ['AES128', 'AES256', 'ALLOWOVERWRITE', 'ANALYSE', 'ARRAY', 'AS', 'ASC', 'AUTHORIZATION', 'BACKUP', 'BINARY', 'BLANKSASNULL', 'BOTH', 'BYTEDICT', 'BZIP2', 'CAST', 'CHECK', 'COLLATE', 'COLUMN', 'CONSTRAINT', 'CREATE', 'CREDENTIALS', 'CURRENT_DATE', 'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'CURRENT_USER', 'CURRENT_USER_ID', 'DEFAULT', 'DEFERRABLE', 'DEFLATE', 'DEFRAG', 'DELTA', 'DELTA32K', 'DESC', 'DISABLE', 'DISTINCT', 'DO', 'ELSE', 'EMPTYASNULL', 'ENABLE', 'ENCODE', 'ENCRYPT', 'ENCRYPTION', 'END', 'EXPLICIT', 'FALSE', 'FOR', 'FOREIGN', 'FREEZE', 'FULL', 'GLOBALDICT256', 'GLOBALDICT64K', 'GRANT', 'GZIP', 'IDENTITY', 'IGNORE', 'ILIKE', 'INITIALLY', 'INTO', 'LEADING', 'LOCALTIME', 'LOCALTIMESTAMP', 'LUN', 'LUNS', 'LZO', 'LZOP', 'MINUS', 'MOSTLY13', 'MOSTLY32', 'MOSTLY8', 'NATURAL', 'NEW', 'NULLS', 'OFF', 'OFFLINE', 'OFFSET', 'OLD', 'ON', 'ONLY', 'OPEN', 'ORDER', 'OVERLAPS', 'PARALLEL', 'PARTITION', 'PERCENT', 'PERMISSIONS', 'PLACING', 'PRIMARY', 'RAW', 'READRATIO', 'RECOVER', 'REFERENCES', 'REJECTLOG', 'RESORT', 'RESTORE', 'SESSION_USER', 'SIMILAR', 'SYSDATE', 'SYSTEM', 'TABLE', 'TAG', 'TDES', 'TEXT255', 'TEXT32K', 'THEN', 'TIMESTAMP', 'TO', 'TOP', 'TRAILING', 'TRUE', 'TRUNCATECOLUMNS', 'UNIQUE', 'USER', 'USING', 'VERBOSE', 'WALLET', 'WHEN', 'WITH', 'WITHOUT', 'PREDICATE', 'COLUMNS', 'COMPROWS', 'COMPRESSION', 'COPY', 'FORMAT', 'DELIMITER', 'FIXEDWIDTH', 'AVRO', 'JSON', 'ENCRYPTED', 'BZIP2', 'GZIP', 'LZOP', 'PARQUET', 'ORC', 'ACCEPTANYDATE', 'ACCEPTINVCHARS', 'BLANKSASNULL', 'DATEFORMAT', 'EMPTYASNULL', 'ENCODING', 'ESCAPE', 'EXPLICIT_IDS', 'FILLRECORD', 'IGNOREBLANKLINES', 'IGNOREHEADER', 'NULL AS', 'REMOVEQUOTES', 'ROUNDEC', 'TIMEFORMAT', 'TRIMBLANKS', 'TRUNCATECOLUMNS', 'COMPROWS', 'COMPUPDATE', 'MAXERROR', 'NOLOAD', 'STATUPDATE', 'MANIFEST', 'REGION', 'IAM_ROLE', 'MASTER_SYMMETRIC_KEY', 'SSH', 'ACCEPTANYDATE', 'ACCEPTINVCHARS', 'ACCESS_KEY_ID', 'SECRET_ACCESS_KEY', 'AVRO', 'BLANKSASNULL', 'BZIP2', 'COMPROWS', 'COMPUPDATE', 'CREDENTIALS', 'DATEFORMAT', 'DELIMITER', 'EMPTYASNULL', 'ENCODING', 'ENCRYPTED', 'ESCAPE', 'EXPLICIT_IDS', 'FILLRECORD', 'FIXEDWIDTH', 'FORMAT', 'IAM_ROLE', 'GZIP', 'IGNOREBLANKLINES', 'IGNOREHEADER', 'JSON', 'LZOP', 'MANIFEST', 'MASTER_SYMMETRIC_KEY', 'MAXERROR', 'NOLOAD', 'NULL AS', 'READRATIO', 'REGION', 'REMOVEQUOTES', 'ROUNDEC', 'SSH', 'STATUPDATE', 'TIMEFORMAT', 'SESSION_TOKEN', 'TRIMBLANKS', 'TRUNCATECOLUMNS', 'EXTERNAL', 'DATA CATALOG', 'HIVE METASTORE', 'CATALOG_ROLE', 'VACUUM', 'COPY', 'UNLOAD', 'EVEN', 'ALL'];\nvar reservedTopLevelWords = ['ADD', 'AFTER', 'ALTER COLUMN', 'ALTER TABLE', 'DELETE FROM', 'EXCEPT', 'FROM', 'GROUP BY', 'HAVING', 'INSERT INTO', 'INSERT', 'INTERSECT', 'TOP', 'LIMIT', 'MODIFY', 'ORDER BY', 'SELECT', 'SET CURRENT SCHEMA', 'SET SCHEMA', 'SET', 'UNION ALL', 'UNION', 'UPDATE', 'VALUES', 'WHERE', 'VACUUM', 'COPY', 'UNLOAD', 'ANALYZE', 'ANALYSE', 'DISTKEY', 'SORTKEY', 'COMPOUND', 'INTERLEAVED', 'FORMAT', 'DELIMITER', 'FIXEDWIDTH', 'AVRO', 'JSON', 'ENCRYPTED', 'BZIP2', 'GZIP', 'LZOP', 'PARQUET', 'ORC', 'ACCEPTANYDATE', 'ACCEPTINVCHARS', 'BLANKSASNULL', 'DATEFORMAT', 'EMPTYASNULL', 'ENCODING', 'ESCAPE', 'EXPLICIT_IDS', 'FILLRECORD', 'IGNOREBLANKLINES', 'IGNOREHEADER', 'NULL AS', 'REMOVEQUOTES', 'ROUNDEC', 'TIMEFORMAT', 'TRIMBLANKS', 'TRUNCATECOLUMNS', 'COMPROWS', 'COMPUPDATE', 'MAXERROR', 'NOLOAD', 'STATUPDATE', 'MANIFEST', 'REGION', 'IAM_ROLE', 'MASTER_SYMMETRIC_KEY', 'SSH', 'ACCEPTANYDATE', 'ACCEPTINVCHARS', 'ACCESS_KEY_ID', 'SECRET_ACCESS_KEY', 'AVRO', 'BLANKSASNULL', 'BZIP2', 'COMPROWS', 'COMPUPDATE', 'CREDENTIALS', 'DATEFORMAT', 'DELIMITER', 'EMPTYASNULL', 'ENCODING', 'ENCRYPTED', 'ESCAPE', 'EXPLICIT_IDS', 'FILLRECORD', 'FIXEDWIDTH', 'FORMAT', 'IAM_ROLE', 'GZIP', 'IGNOREBLANKLINES', 'IGNOREHEADER', 'JSON', 'LZOP', 'MANIFEST', 'MASTER_SYMMETRIC_KEY', 'MAXERROR', 'NOLOAD', 'NULL AS', 'READRATIO', 'REGION', 'REMOVEQUOTES', 'ROUNDEC', 'SSH', 'STATUPDATE', 'TIMEFORMAT', 'SESSION_TOKEN', 'TRIMBLANKS', 'TRUNCATECOLUMNS', 'EXTERNAL', 'DATA CATALOG', 'HIVE METASTORE', 'CATALOG_ROLE'];\nvar reservedTopLevelWordsNoIndent = [];\nvar reservedNewlineWords = ['AND', 'ELSE', 'OR', 'OUTER APPLY', 'WHEN', 'VACUUM', 'COPY', 'UNLOAD', 'ANALYZE', 'ANALYSE', 'DISTKEY', 'SORTKEY', 'COMPOUND', 'INTERLEAVED', // joins\n'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN'];\n\nvar RedshiftFormatter = /*#__PURE__*/function (_Formatter) {\n _inherits(RedshiftFormatter, _Formatter);\n\n var _super = _createSuper(RedshiftFormatter);\n\n function RedshiftFormatter() {\n _classCallCheck(this, RedshiftFormatter);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(RedshiftFormatter, [{\n key: \"tokenizer\",\n value: function tokenizer() {\n return new _Tokenizer[\"default\"]({\n reservedWords: reservedWords,\n reservedTopLevelWords: reservedTopLevelWords,\n reservedNewlineWords: reservedNewlineWords,\n reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,\n stringTypes: [\"\\\"\\\"\", \"''\", '``'],\n openParens: ['('],\n closeParens: [')'],\n indexedPlaceholderTypes: ['?'],\n namedPlaceholderTypes: ['@', '#', '$'],\n lineCommentTypes: ['--'],\n operators: ['|/', '||/', '<<', '>>', '!=', '||']\n });\n }\n }]);\n\n return RedshiftFormatter;\n}(_Formatter2[\"default\"]);\n\nexports[\"default\"] = RedshiftFormatter;\nmodule.exports = exports.default;","\"use strict\";\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _Formatter2 = _interopRequireDefault(require(\"../core/Formatter\"));\n\nvar _token = require(\"../core/token\");\n\nvar _Tokenizer = _interopRequireDefault(require(\"../core/Tokenizer\"));\n\nvar _tokenTypes = _interopRequireDefault(require(\"../core/tokenTypes\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nvar reservedWords = ['ALL', 'ALTER', 'ANALYSE', 'ANALYZE', 'ARRAY_ZIP', 'ARRAY', 'AS', 'ASC', 'AVG', 'BETWEEN', 'CASCADE', 'CASE', 'CAST', 'COALESCE', 'COLLECT_LIST', 'COLLECT_SET', 'COLUMN', 'COLUMNS', 'COMMENT', 'CONSTRAINT', 'CONTAINS', 'CONVERT', 'COUNT', 'CUME_DIST', 'CURRENT ROW', 'CURRENT_DATE', 'CURRENT_TIMESTAMP', 'DATABASE', 'DATABASES', 'DATE_ADD', 'DATE_SUB', 'DATE_TRUNC', 'DAY_HOUR', 'DAY_MINUTE', 'DAY_SECOND', 'DAY', 'DAYS', 'DECODE', 'DEFAULT', 'DELETE', 'DENSE_RANK', 'DESC', 'DESCRIBE', 'DISTINCT', 'DISTINCTROW', 'DIV', 'DROP', 'ELSE', 'ENCODE', 'END', 'EXISTS', 'EXPLAIN', 'EXPLODE_OUTER', 'EXPLODE', 'FILTER', 'FIRST_VALUE', 'FIRST', 'FIXED', 'FLATTEN', 'FOLLOWING', 'FROM_UNIXTIME', 'FULL', 'GREATEST', 'GROUP_CONCAT', 'HOUR_MINUTE', 'HOUR_SECOND', 'HOUR', 'HOURS', 'IF', 'IFNULL', 'IN', 'INSERT', 'INTERVAL', 'INTO', 'IS', 'LAG', 'LAST_VALUE', 'LAST', 'LEAD', 'LEADING', 'LEAST', 'LEVEL', 'LIKE', 'MAX', 'MERGE', 'MIN', 'MINUTE_SECOND', 'MINUTE', 'MONTH', 'NATURAL', 'NOT', 'NOW()', 'NTILE', 'NULL', 'NULLIF', 'OFFSET', 'ON DELETE', 'ON UPDATE', 'ON', 'ONLY', 'OPTIMIZE', 'OVER', 'PERCENT_RANK', 'PRECEDING', 'RANGE', 'RANK', 'REGEXP', 'RENAME', 'RLIKE', 'ROW', 'ROWS', 'SECOND', 'SEPARATOR', 'SEQUENCE', 'SIZE', 'STRING', 'STRUCT', 'SUM', 'TABLE', 'TABLES', 'TEMPORARY', 'THEN', 'TO_DATE', 'TO_JSON', 'TO', 'TRAILING', 'TRANSFORM', 'TRUE', 'TRUNCATE', 'TYPE', 'TYPES', 'UNBOUNDED', 'UNIQUE', 'UNIX_TIMESTAMP', 'UNLOCK', 'UNSIGNED', 'USING', 'VARIABLES', 'VIEW', 'WHEN', 'WITH', 'YEAR_MONTH'];\nvar reservedTopLevelWords = ['ADD', 'AFTER', 'ALTER COLUMN', 'ALTER DATABASE', 'ALTER SCHEMA', 'ALTER TABLE', 'CLUSTER BY', 'CLUSTERED BY', 'DELETE FROM', 'DISTRIBUTE BY', 'FROM', 'GROUP BY', 'HAVING', 'INSERT INTO', 'INSERT', 'LIMIT', 'OPTIONS', 'ORDER BY', 'PARTITION BY', 'PARTITIONED BY', 'RANGE', 'ROWS', 'SELECT', 'SET CURRENT SCHEMA', 'SET SCHEMA', 'SET', 'TBLPROPERTIES', 'UPDATE', 'USING', 'VALUES', 'WHERE', 'WINDOW'];\nvar reservedTopLevelWordsNoIndent = ['EXCEPT ALL', 'EXCEPT', 'INTERSECT ALL', 'INTERSECT', 'UNION ALL', 'UNION'];\nvar reservedNewlineWords = ['AND', 'CREATE OR', 'CREATE', 'ELSE', 'LATERAL VIEW', 'OR', 'OUTER APPLY', 'WHEN', 'XOR', // joins\n'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN', // non-standard-joins\n'ANTI JOIN', 'SEMI JOIN', 'LEFT ANTI JOIN', 'LEFT SEMI JOIN', 'RIGHT OUTER JOIN', 'RIGHT SEMI JOIN', 'NATURAL ANTI JOIN', 'NATURAL FULL OUTER JOIN', 'NATURAL INNER JOIN', 'NATURAL LEFT ANTI JOIN', 'NATURAL LEFT OUTER JOIN', 'NATURAL LEFT SEMI JOIN', 'NATURAL OUTER JOIN', 'NATURAL RIGHT OUTER JOIN', 'NATURAL RIGHT SEMI JOIN', 'NATURAL SEMI JOIN'];\n\nvar SparkSqlFormatter = /*#__PURE__*/function (_Formatter) {\n _inherits(SparkSqlFormatter, _Formatter);\n\n var _super = _createSuper(SparkSqlFormatter);\n\n function SparkSqlFormatter() {\n _classCallCheck(this, SparkSqlFormatter);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(SparkSqlFormatter, [{\n key: \"tokenizer\",\n value: function tokenizer() {\n return new _Tokenizer[\"default\"]({\n reservedWords: reservedWords,\n reservedTopLevelWords: reservedTopLevelWords,\n reservedNewlineWords: reservedNewlineWords,\n reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,\n stringTypes: [\"\\\"\\\"\", \"''\", '``', '{}'],\n openParens: ['(', 'CASE'],\n closeParens: [')', 'END'],\n indexedPlaceholderTypes: ['?'],\n namedPlaceholderTypes: ['$'],\n lineCommentTypes: ['--'],\n operators: ['!=', '<=>', '&&', '||', '==']\n });\n }\n }, {\n key: \"tokenOverride\",\n value: function tokenOverride(token) {\n // Fix cases where names are ambiguously keywords or functions\n if ((0, _token.isWindow)(token)) {\n var aheadToken = this.tokenLookAhead();\n\n if (aheadToken && aheadToken.type === _tokenTypes[\"default\"].OPEN_PAREN) {\n // This is a function call, treat it as a reserved word\n return {\n type: _tokenTypes[\"default\"].RESERVED,\n value: token.value\n };\n }\n } // Fix cases where names are ambiguously keywords or properties\n\n\n if ((0, _token.isEnd)(token)) {\n var backToken = this.tokenLookBehind();\n\n if (backToken && backToken.type === _tokenTypes[\"default\"].OPERATOR && backToken.value === '.') {\n // This is window().end (or similar) not CASE ... END\n return {\n type: _tokenTypes[\"default\"].WORD,\n value: token.value\n };\n }\n }\n\n return token;\n }\n }]);\n\n return SparkSqlFormatter;\n}(_Formatter2[\"default\"]);\n\nexports[\"default\"] = SparkSqlFormatter;\nmodule.exports = exports.default;","\"use strict\";\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _Formatter2 = _interopRequireDefault(require(\"../core/Formatter\"));\n\nvar _Tokenizer = _interopRequireDefault(require(\"../core/Tokenizer\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n// https://jakewheat.github.io/sql-overview/sql-2008-foundation-grammar.html#reserved-word\nvar reservedWords = ['ABS', 'ALL', 'ALLOCATE', 'ALTER', 'AND', 'ANY', 'ARE', 'ARRAY', 'AS', 'ASENSITIVE', 'ASYMMETRIC', 'AT', 'ATOMIC', 'AUTHORIZATION', 'AVG', 'BEGIN', 'BETWEEN', 'BIGINT', 'BINARY', 'BLOB', 'BOOLEAN', 'BOTH', 'BY', 'CALL', 'CALLED', 'CARDINALITY', 'CASCADED', 'CASE', 'CAST', 'CEIL', 'CEILING', 'CHAR', 'CHAR_LENGTH', 'CHARACTER', 'CHARACTER_LENGTH', 'CHECK', 'CLOB', 'CLOSE', 'COALESCE', 'COLLATE', 'COLLECT', 'COLUMN', 'COMMIT', 'CONDITION', 'CONNECT', 'CONSTRAINT', 'CONVERT', 'CORR', 'CORRESPONDING', 'COUNT', 'COVAR_POP', 'COVAR_SAMP', 'CREATE', 'CROSS', 'CUBE', 'CUME_DIST', 'CURRENT', 'CURRENT_CATALOG', 'CURRENT_DATE', 'CURRENT_DEFAULT_TRANSFORM_GROUP', 'CURRENT_PATH', 'CURRENT_ROLE', 'CURRENT_SCHEMA', 'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'CURRENT_TRANSFORM_GROUP_FOR_TYPE', 'CURRENT_USER', 'CURSOR', 'CYCLE', 'DATE', 'DAY', 'DEALLOCATE', 'DEC', 'DECIMAL', 'DECLARE', 'DEFAULT', 'DELETE', 'DENSE_RANK', 'DEREF', 'DESCRIBE', 'DETERMINISTIC', 'DISCONNECT', 'DISTINCT', 'DOUBLE', 'DROP', 'DYNAMIC', 'EACH', 'ELEMENT', 'ELSE', 'END', 'END-EXEC', 'ESCAPE', 'EVERY', 'EXCEPT', 'EXEC', 'EXECUTE', 'EXISTS', 'EXP', 'EXTERNAL', 'EXTRACT', 'FALSE', 'FETCH', 'FILTER', 'FLOAT', 'FLOOR', 'FOR', 'FOREIGN', 'FREE', 'FROM', 'FULL', 'FUNCTION', 'FUSION', 'GET', 'GLOBAL', 'GRANT', 'GROUP', 'GROUPING', 'HAVING', 'HOLD', 'HOUR', 'IDENTITY', 'IN', 'INDICATOR', 'INNER', 'INOUT', 'INSENSITIVE', 'INSERT', 'INT', 'INTEGER', 'INTERSECT', 'INTERSECTION', 'INTERVAL', 'INTO', 'IS', 'JOIN', 'LANGUAGE', 'LARGE', 'LATERAL', 'LEADING', 'LEFT', 'LIKE', 'LIKE_REGEX', 'LN', 'LOCAL', 'LOCALTIME', 'LOCALTIMESTAMP', 'LOWER', 'MATCH', 'MAX', 'MEMBER', 'MERGE', 'METHOD', 'MIN', 'MINUTE', 'MOD', 'MODIFIES', 'MODULE', 'MONTH', 'MULTISET', 'NATIONAL', 'NATURAL', 'NCHAR', 'NCLOB', 'NEW', 'NO', 'NONE', 'NORMALIZE', 'NOT', 'NULL', 'NULLIF', 'NUMERIC', 'OCTET_LENGTH', 'OCCURRENCES_REGEX', 'OF', 'OLD', 'ON', 'ONLY', 'OPEN', 'OR', 'ORDER', 'OUT', 'OUTER', 'OVER', 'OVERLAPS', 'OVERLAY', 'PARAMETER', 'PARTITION', 'PERCENT_RANK', 'PERCENTILE_CONT', 'PERCENTILE_DISC', 'POSITION', 'POSITION_REGEX', 'POWER', 'PRECISION', 'PREPARE', 'PRIMARY', 'PROCEDURE', 'RANGE', 'RANK', 'READS', 'REAL', 'RECURSIVE', 'REF', 'REFERENCES', 'REFERENCING', 'REGR_AVGX', 'REGR_AVGY', 'REGR_COUNT', 'REGR_INTERCEPT', 'REGR_R2', 'REGR_SLOPE', 'REGR_SXX', 'REGR_SXY', 'REGR_SYY', 'RELEASE', 'RESULT', 'RETURN', 'RETURNS', 'REVOKE', 'RIGHT', 'ROLLBACK', 'ROLLUP', 'ROW', 'ROW_NUMBER', 'ROWS', 'SAVEPOINT', 'SCOPE', 'SCROLL', 'SEARCH', 'SECOND', 'SELECT', 'SENSITIVE', 'SESSION_USER', 'SET', 'SIMILAR', 'SMALLINT', 'SOME', 'SPECIFIC', 'SPECIFICTYPE', 'SQL', 'SQLEXCEPTION', 'SQLSTATE', 'SQLWARNING', 'SQRT', 'START', 'STATIC', 'STDDEV_POP', 'STDDEV_SAMP', 'SUBMULTISET', 'SUBSTRING', 'SUBSTRING_REGEX', 'SUM', 'SYMMETRIC', 'SYSTEM', 'SYSTEM_USER', 'TABLE', 'TABLESAMPLE', 'THEN', 'TIME', 'TIMESTAMP', 'TIMEZONE_HOUR', 'TIMEZONE_MINUTE', 'TO', 'TRAILING', 'TRANSLATE', 'TRANSLATE_REGEX', 'TRANSLATION', 'TREAT', 'TRIGGER', 'TRIM', 'TRUE', 'UESCAPE', 'UNION', 'UNIQUE', 'UNKNOWN', 'UNNEST', 'UPDATE', 'UPPER', 'USER', 'USING', 'VALUE', 'VALUES', 'VAR_POP', 'VAR_SAMP', 'VARBINARY', 'VARCHAR', 'VARYING', 'WHEN', 'WHENEVER', 'WHERE', 'WIDTH_BUCKET', 'WINDOW', 'WITH', 'WITHIN', 'WITHOUT', 'YEAR'];\nvar reservedTopLevelWords = ['ADD', 'ALTER COLUMN', 'ALTER TABLE', 'CASE', 'DELETE FROM', 'END', 'FETCH FIRST', 'FETCH NEXT', 'FETCH PRIOR', 'FETCH LAST', 'FETCH ABSOLUTE', 'FETCH RELATIVE', 'FROM', 'GROUP BY', 'HAVING', 'INSERT INTO', 'LIMIT', 'ORDER BY', 'SELECT', 'SET SCHEMA', 'SET', 'UPDATE', 'VALUES', 'WHERE'];\nvar reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'INTERSECT DISTINCT', 'UNION', 'UNION ALL', 'UNION DISTINCT', 'EXCEPT', 'EXCEPT ALL', 'EXCEPT DISTINCT'];\nvar reservedNewlineWords = ['AND', 'ELSE', 'OR', 'WHEN', // joins\n'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN'];\n\nvar StandardSqlFormatter = /*#__PURE__*/function (_Formatter) {\n _inherits(StandardSqlFormatter, _Formatter);\n\n var _super = _createSuper(StandardSqlFormatter);\n\n function StandardSqlFormatter() {\n _classCallCheck(this, StandardSqlFormatter);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(StandardSqlFormatter, [{\n key: \"tokenizer\",\n value: function tokenizer() {\n return new _Tokenizer[\"default\"]({\n reservedWords: reservedWords,\n reservedTopLevelWords: reservedTopLevelWords,\n reservedNewlineWords: reservedNewlineWords,\n reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,\n stringTypes: [\"\\\"\\\"\", \"''\"],\n openParens: ['(', 'CASE'],\n closeParens: [')', 'END'],\n indexedPlaceholderTypes: ['?'],\n namedPlaceholderTypes: [],\n lineCommentTypes: ['--']\n });\n }\n }]);\n\n return StandardSqlFormatter;\n}(_Formatter2[\"default\"]);\n\nexports[\"default\"] = StandardSqlFormatter;\nmodule.exports = exports.default;","\"use strict\";\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _Formatter2 = _interopRequireDefault(require(\"../core/Formatter\"));\n\nvar _Tokenizer = _interopRequireDefault(require(\"../core/Tokenizer\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nvar reservedWords = ['ADD', 'EXTERNAL', 'PROCEDURE', 'ALL', 'FETCH', 'PUBLIC', 'ALTER', 'FILE', 'RAISERROR', 'AND', 'FILLFACTOR', 'READ', 'ANY', 'FOR', 'READTEXT', 'AS', 'FOREIGN', 'RECONFIGURE', 'ASC', 'FREETEXT', 'REFERENCES', 'AUTHORIZATION', 'FREETEXTTABLE', 'REPLICATION', 'BACKUP', 'FROM', 'RESTORE', 'BEGIN', 'FULL', 'RESTRICT', 'BETWEEN', 'FUNCTION', 'RETURN', 'BREAK', 'GOTO', 'REVERT', 'BROWSE', 'GRANT', 'REVOKE', 'BULK', 'GROUP', 'RIGHT', 'BY', 'HAVING', 'ROLLBACK', 'CASCADE', 'HOLDLOCK', 'ROWCOUNT', 'CASE', 'IDENTITY', 'ROWGUIDCOL', 'CHECK', 'IDENTITY_INSERT', 'RULE', 'CHECKPOINT', 'IDENTITYCOL', 'SAVE', 'CLOSE', 'IF', 'SCHEMA', 'CLUSTERED', 'IN', 'SECURITYAUDIT', 'COALESCE', 'INDEX', 'SELECT', 'COLLATE', 'INNER', 'SEMANTICKEYPHRASETABLE', 'COLUMN', 'INSERT', 'SEMANTICSIMILARITYDETAILSTABLE', 'COMMIT', 'INTERSECT', 'SEMANTICSIMILARITYTABLE', 'COMPUTE', 'INTO', 'SESSION_USER', 'CONSTRAINT', 'IS', 'SET', 'CONTAINS', 'JOIN', 'SETUSER', 'CONTAINSTABLE', 'KEY', 'SHUTDOWN', 'CONTINUE', 'KILL', 'SOME', 'CONVERT', 'LEFT', 'STATISTICS', 'CREATE', 'LIKE', 'SYSTEM_USER', 'CROSS', 'LINENO', 'TABLE', 'CURRENT', 'LOAD', 'TABLESAMPLE', 'CURRENT_DATE', 'MERGE', 'TEXTSIZE', 'CURRENT_TIME', 'NATIONAL', 'THEN', 'CURRENT_TIMESTAMP', 'NOCHECK', 'TO', 'CURRENT_USER', 'NONCLUSTERED', 'TOP', 'CURSOR', 'NOT', 'TRAN', 'DATABASE', 'NULL', 'TRANSACTION', 'DBCC', 'NULLIF', 'TRIGGER', 'DEALLOCATE', 'OF', 'TRUNCATE', 'DECLARE', 'OFF', 'TRY_CONVERT', 'DEFAULT', 'OFFSETS', 'TSEQUAL', 'DELETE', 'ON', 'UNION', 'DENY', 'OPEN', 'UNIQUE', 'DESC', 'OPENDATASOURCE', 'UNPIVOT', 'DISK', 'OPENQUERY', 'UPDATE', 'DISTINCT', 'OPENROWSET', 'UPDATETEXT', 'DISTRIBUTED', 'OPENXML', 'USE', 'DOUBLE', 'OPTION', 'USER', 'DROP', 'OR', 'VALUES', 'DUMP', 'ORDER', 'VARYING', 'ELSE', 'OUTER', 'VIEW', 'END', 'OVER', 'WAITFOR', 'ERRLVL', 'PERCENT', 'WHEN', 'ESCAPE', 'PIVOT', 'WHERE', 'EXCEPT', 'PLAN', 'WHILE', 'EXEC', 'PRECISION', 'WITH', 'EXECUTE', 'PRIMARY', 'WITHIN GROUP', 'EXISTS', 'PRINT', 'WRITETEXT', 'EXIT', 'PROC'];\nvar reservedTopLevelWords = ['ADD', 'ALTER COLUMN', 'ALTER TABLE', 'CASE', 'DELETE FROM', 'END', 'EXCEPT', 'FROM', 'GROUP BY', 'HAVING', 'INSERT INTO', 'INSERT', 'LIMIT', 'ORDER BY', 'SELECT', 'SET CURRENT SCHEMA', 'SET SCHEMA', 'SET', 'UPDATE', 'VALUES', 'WHERE'];\nvar reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'MINUS', 'UNION', 'UNION ALL'];\nvar reservedNewlineWords = ['AND', 'ELSE', 'OR', 'WHEN', // joins\n'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN'];\n\nvar TSqlFormatter = /*#__PURE__*/function (_Formatter) {\n _inherits(TSqlFormatter, _Formatter);\n\n var _super = _createSuper(TSqlFormatter);\n\n function TSqlFormatter() {\n _classCallCheck(this, TSqlFormatter);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(TSqlFormatter, [{\n key: \"tokenizer\",\n value: function tokenizer() {\n return new _Tokenizer[\"default\"]({\n reservedWords: reservedWords,\n reservedTopLevelWords: reservedTopLevelWords,\n reservedNewlineWords: reservedNewlineWords,\n reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,\n stringTypes: [\"\\\"\\\"\", \"N''\", \"''\", '[]'],\n openParens: ['(', 'CASE'],\n closeParens: [')', 'END'],\n indexedPlaceholderTypes: [],\n namedPlaceholderTypes: ['@'],\n lineCommentTypes: ['--'],\n specialWordChars: ['#', '@'],\n operators: ['>=', '<=', '<>', '!=', '!<', '!>', '+=', '-=', '*=', '/=', '%=', '|=', '&=', '^=', '::'] // TODO: Support for money constants\n\n });\n }\n }]);\n\n return TSqlFormatter;\n}(_Formatter2[\"default\"]);\n\nexports[\"default\"] = TSqlFormatter;\nmodule.exports = exports.default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.supportedDialects = exports.format = void 0;\n\nvar _Db2Formatter = _interopRequireDefault(require(\"./languages/Db2Formatter\"));\n\nvar _MariaDbFormatter = _interopRequireDefault(require(\"./languages/MariaDbFormatter\"));\n\nvar _MySqlFormatter = _interopRequireDefault(require(\"./languages/MySqlFormatter\"));\n\nvar _N1qlFormatter = _interopRequireDefault(require(\"./languages/N1qlFormatter\"));\n\nvar _PlSqlFormatter = _interopRequireDefault(require(\"./languages/PlSqlFormatter\"));\n\nvar _PostgreSqlFormatter = _interopRequireDefault(require(\"./languages/PostgreSqlFormatter\"));\n\nvar _RedshiftFormatter = _interopRequireDefault(require(\"./languages/RedshiftFormatter\"));\n\nvar _SparkSqlFormatter = _interopRequireDefault(require(\"./languages/SparkSqlFormatter\"));\n\nvar _StandardSqlFormatter = _interopRequireDefault(require(\"./languages/StandardSqlFormatter\"));\n\nvar _TSqlFormatter = _interopRequireDefault(require(\"./languages/TSqlFormatter\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar formatters = {\n db2: _Db2Formatter[\"default\"],\n mariadb: _MariaDbFormatter[\"default\"],\n mysql: _MySqlFormatter[\"default\"],\n n1ql: _N1qlFormatter[\"default\"],\n plsql: _PlSqlFormatter[\"default\"],\n postgresql: _PostgreSqlFormatter[\"default\"],\n redshift: _RedshiftFormatter[\"default\"],\n spark: _SparkSqlFormatter[\"default\"],\n sql: _StandardSqlFormatter[\"default\"],\n tsql: _TSqlFormatter[\"default\"]\n};\n/**\n * Format whitespace in a query to make it easier to read.\n *\n * @param {String} query\n * @param {Object} cfg\n * @param {String} cfg.language Query language, default is Standard SQL\n * @param {String} cfg.indent Characters used for indentation, default is \" \" (2 spaces)\n * @param {Boolean} cfg.uppercase Converts keywords to uppercase\n * @param {Integer} cfg.linesBetweenQueries How many line breaks between queries\n * @param {Object} cfg.params Collection of params for placeholder replacement\n * @return {String}\n */\n\nvar format = function format(query) {\n var cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (typeof query !== 'string') {\n throw new Error('Invalid query argument. Extected string, instead got ' + _typeof(query));\n }\n\n var Formatter = _StandardSqlFormatter[\"default\"];\n\n if (cfg.language !== undefined) {\n Formatter = formatters[cfg.language];\n }\n\n if (Formatter === undefined) {\n throw Error(\"Unsupported SQL dialect: \".concat(cfg.language));\n }\n\n return new Formatter(cfg).format(query);\n};\n\nexports.format = format;\nvar supportedDialects = Object.keys(formatters);\nexports.supportedDialects = supportedDialects;","/* eslint-disable no-multi-assign */\n\nfunction deepFreeze(obj) {\n if (obj instanceof Map) {\n obj.clear =\n obj.delete =\n obj.set =\n function () {\n throw new Error('map is read-only');\n };\n } else if (obj instanceof Set) {\n obj.add =\n obj.clear =\n obj.delete =\n function () {\n throw new Error('set is read-only');\n };\n }\n\n // Freeze self\n Object.freeze(obj);\n\n Object.getOwnPropertyNames(obj).forEach((name) => {\n const prop = obj[name];\n const type = typeof prop;\n\n // Freeze prop if it is an object or function and also not already frozen\n if ((type === 'object' || type === 'function') && !Object.isFrozen(prop)) {\n deepFreeze(prop);\n }\n });\n\n return obj;\n}\n\n/** @typedef {import('highlight.js').CallbackResponse} CallbackResponse */\n/** @typedef {import('highlight.js').CompiledMode} CompiledMode */\n/** @implements CallbackResponse */\n\nclass Response {\n /**\n * @param {CompiledMode} mode\n */\n constructor(mode) {\n // eslint-disable-next-line no-undefined\n if (mode.data === undefined) mode.data = {};\n\n this.data = mode.data;\n this.isMatchIgnored = false;\n }\n\n ignoreMatch() {\n this.isMatchIgnored = true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {string}\n */\nfunction escapeHTML(value) {\n return value\n .replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n\n/**\n * performs a shallow merge of multiple objects into one\n *\n * @template T\n * @param {T} original\n * @param {Record[]} objects\n * @returns {T} a single new object\n */\nfunction inherit$1(original, ...objects) {\n /** @type Record */\n const result = Object.create(null);\n\n for (const key in original) {\n result[key] = original[key];\n }\n objects.forEach(function(obj) {\n for (const key in obj) {\n result[key] = obj[key];\n }\n });\n return /** @type {T} */ (result);\n}\n\n/**\n * @typedef {object} Renderer\n * @property {(text: string) => void} addText\n * @property {(node: Node) => void} openNode\n * @property {(node: Node) => void} closeNode\n * @property {() => string} value\n */\n\n/** @typedef {{scope?: string, language?: string, sublanguage?: boolean}} Node */\n/** @typedef {{walk: (r: Renderer) => void}} Tree */\n/** */\n\nconst SPAN_CLOSE = '';\n\n/**\n * Determines if a node needs to be wrapped in \n *\n * @param {Node} node */\nconst emitsWrappingTags = (node) => {\n // rarely we can have a sublanguage where language is undefined\n // TODO: track down why\n return !!node.scope;\n};\n\n/**\n *\n * @param {string} name\n * @param {{prefix:string}} options\n */\nconst scopeToCSSClass = (name, { prefix }) => {\n // sub-language\n if (name.startsWith(\"language:\")) {\n return name.replace(\"language:\", \"language-\");\n }\n // tiered scope: comment.line\n if (name.includes(\".\")) {\n const pieces = name.split(\".\");\n return [\n `${prefix}${pieces.shift()}`,\n ...(pieces.map((x, i) => `${x}${\"_\".repeat(i + 1)}`))\n ].join(\" \");\n }\n // simple scope\n return `${prefix}${name}`;\n};\n\n/** @type {Renderer} */\nclass HTMLRenderer {\n /**\n * Creates a new HTMLRenderer\n *\n * @param {Tree} parseTree - the parse tree (must support `walk` API)\n * @param {{classPrefix: string}} options\n */\n constructor(parseTree, options) {\n this.buffer = \"\";\n this.classPrefix = options.classPrefix;\n parseTree.walk(this);\n }\n\n /**\n * Adds texts to the output stream\n *\n * @param {string} text */\n addText(text) {\n this.buffer += escapeHTML(text);\n }\n\n /**\n * Adds a node open to the output stream (if needed)\n *\n * @param {Node} node */\n openNode(node) {\n if (!emitsWrappingTags(node)) return;\n\n const className = scopeToCSSClass(node.scope,\n { prefix: this.classPrefix });\n this.span(className);\n }\n\n /**\n * Adds a node close to the output stream (if needed)\n *\n * @param {Node} node */\n closeNode(node) {\n if (!emitsWrappingTags(node)) return;\n\n this.buffer += SPAN_CLOSE;\n }\n\n /**\n * returns the accumulated buffer\n */\n value() {\n return this.buffer;\n }\n\n // helpers\n\n /**\n * Builds a span element\n *\n * @param {string} className */\n span(className) {\n this.buffer += ``;\n }\n}\n\n/** @typedef {{scope?: string, language?: string, children: Node[]} | string} Node */\n/** @typedef {{scope?: string, language?: string, children: Node[]} } DataNode */\n/** @typedef {import('highlight.js').Emitter} Emitter */\n/** */\n\n/** @returns {DataNode} */\nconst newNode = (opts = {}) => {\n /** @type DataNode */\n const result = { children: [] };\n Object.assign(result, opts);\n return result;\n};\n\nclass TokenTree {\n constructor() {\n /** @type DataNode */\n this.rootNode = newNode();\n this.stack = [this.rootNode];\n }\n\n get top() {\n return this.stack[this.stack.length - 1];\n }\n\n get root() { return this.rootNode; }\n\n /** @param {Node} node */\n add(node) {\n this.top.children.push(node);\n }\n\n /** @param {string} scope */\n openNode(scope) {\n /** @type Node */\n const node = newNode({ scope });\n this.add(node);\n this.stack.push(node);\n }\n\n closeNode() {\n if (this.stack.length > 1) {\n return this.stack.pop();\n }\n // eslint-disable-next-line no-undefined\n return undefined;\n }\n\n closeAllNodes() {\n while (this.closeNode());\n }\n\n toJSON() {\n return JSON.stringify(this.rootNode, null, 4);\n }\n\n /**\n * @typedef { import(\"./html_renderer\").Renderer } Renderer\n * @param {Renderer} builder\n */\n walk(builder) {\n // this does not\n return this.constructor._walk(builder, this.rootNode);\n // this works\n // return TokenTree._walk(builder, this.rootNode);\n }\n\n /**\n * @param {Renderer} builder\n * @param {Node} node\n */\n static _walk(builder, node) {\n if (typeof node === \"string\") {\n builder.addText(node);\n } else if (node.children) {\n builder.openNode(node);\n node.children.forEach((child) => this._walk(builder, child));\n builder.closeNode(node);\n }\n return builder;\n }\n\n /**\n * @param {Node} node\n */\n static _collapse(node) {\n if (typeof node === \"string\") return;\n if (!node.children) return;\n\n if (node.children.every(el => typeof el === \"string\")) {\n // node.text = node.children.join(\"\");\n // delete node.children;\n node.children = [node.children.join(\"\")];\n } else {\n node.children.forEach((child) => {\n TokenTree._collapse(child);\n });\n }\n }\n}\n\n/**\n Currently this is all private API, but this is the minimal API necessary\n that an Emitter must implement to fully support the parser.\n\n Minimal interface:\n\n - addText(text)\n - __addSublanguage(emitter, subLanguageName)\n - startScope(scope)\n - endScope()\n - finalize()\n - toHTML()\n\n*/\n\n/**\n * @implements {Emitter}\n */\nclass TokenTreeEmitter extends TokenTree {\n /**\n * @param {*} options\n */\n constructor(options) {\n super();\n this.options = options;\n }\n\n /**\n * @param {string} text\n */\n addText(text) {\n if (text === \"\") { return; }\n\n this.add(text);\n }\n\n /** @param {string} scope */\n startScope(scope) {\n this.openNode(scope);\n }\n\n endScope() {\n this.closeNode();\n }\n\n /**\n * @param {Emitter & {root: DataNode}} emitter\n * @param {string} name\n */\n __addSublanguage(emitter, name) {\n /** @type DataNode */\n const node = emitter.root;\n if (name) node.scope = `language:${name}`;\n\n this.add(node);\n }\n\n toHTML() {\n const renderer = new HTMLRenderer(this, this.options);\n return renderer.value();\n }\n\n finalize() {\n this.closeAllNodes();\n return true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {RegExp}\n * */\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction source(re) {\n if (!re) return null;\n if (typeof re === \"string\") return re;\n\n return re.source;\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction lookahead(re) {\n return concat('(?=', re, ')');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction anyNumberOfTimes(re) {\n return concat('(?:', re, ')*');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction optional(re) {\n return concat('(?:', re, ')?');\n}\n\n/**\n * @param {...(RegExp | string) } args\n * @returns {string}\n */\nfunction concat(...args) {\n const joined = args.map((x) => source(x)).join(\"\");\n return joined;\n}\n\n/**\n * @param { Array } args\n * @returns {object}\n */\nfunction stripOptionsFromArgs(args) {\n const opts = args[args.length - 1];\n\n if (typeof opts === 'object' && opts.constructor === Object) {\n args.splice(args.length - 1, 1);\n return opts;\n } else {\n return {};\n }\n}\n\n/** @typedef { {capture?: boolean} } RegexEitherOptions */\n\n/**\n * Any of the passed expresssions may match\n *\n * Creates a huge this | this | that | that match\n * @param {(RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]} args\n * @returns {string}\n */\nfunction either(...args) {\n /** @type { object & {capture?: boolean} } */\n const opts = stripOptionsFromArgs(args);\n const joined = '('\n + (opts.capture ? \"\" : \"?:\")\n + args.map((x) => source(x)).join(\"|\") + \")\";\n return joined;\n}\n\n/**\n * @param {RegExp | string} re\n * @returns {number}\n */\nfunction countMatchGroups(re) {\n return (new RegExp(re.toString() + '|')).exec('').length - 1;\n}\n\n/**\n * Does lexeme start with a regular expression match at the beginning\n * @param {RegExp} re\n * @param {string} lexeme\n */\nfunction startsWith(re, lexeme) {\n const match = re && re.exec(lexeme);\n return match && match.index === 0;\n}\n\n// BACKREF_RE matches an open parenthesis or backreference. To avoid\n// an incorrect parse, it additionally matches the following:\n// - [...] elements, where the meaning of parentheses and escapes change\n// - other escape sequences, so we do not misparse escape sequences as\n// interesting elements\n// - non-matching or lookahead parentheses, which do not capture. These\n// follow the '(' with a '?'.\nconst BACKREF_RE = /\\[(?:[^\\\\\\]]|\\\\.)*\\]|\\(\\??|\\\\([1-9][0-9]*)|\\\\./;\n\n// **INTERNAL** Not intended for outside usage\n// join logically computes regexps.join(separator), but fixes the\n// backreferences so they continue to match.\n// it also places each individual regular expression into it's own\n// match group, keeping track of the sequencing of those match groups\n// is currently an exercise for the caller. :-)\n/**\n * @param {(string | RegExp)[]} regexps\n * @param {{joinWith: string}} opts\n * @returns {string}\n */\nfunction _rewriteBackreferences(regexps, { joinWith }) {\n let numCaptures = 0;\n\n return regexps.map((regex) => {\n numCaptures += 1;\n const offset = numCaptures;\n let re = source(regex);\n let out = '';\n\n while (re.length > 0) {\n const match = BACKREF_RE.exec(re);\n if (!match) {\n out += re;\n break;\n }\n out += re.substring(0, match.index);\n re = re.substring(match.index + match[0].length);\n if (match[0][0] === '\\\\' && match[1]) {\n // Adjust the backreference.\n out += '\\\\' + String(Number(match[1]) + offset);\n } else {\n out += match[0];\n if (match[0] === '(') {\n numCaptures++;\n }\n }\n }\n return out;\n }).map(re => `(${re})`).join(joinWith);\n}\n\n/** @typedef {import('highlight.js').Mode} Mode */\n/** @typedef {import('highlight.js').ModeCallback} ModeCallback */\n\n// Common regexps\nconst MATCH_NOTHING_RE = /\\b\\B/;\nconst IDENT_RE = '[a-zA-Z]\\\\w*';\nconst UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\\\w*';\nconst NUMBER_RE = '\\\\b\\\\d+(\\\\.\\\\d+)?';\nconst C_NUMBER_RE = '(-?)(\\\\b0[xX][a-fA-F0-9]+|(\\\\b\\\\d+(\\\\.\\\\d*)?|\\\\.\\\\d+)([eE][-+]?\\\\d+)?)'; // 0x..., 0..., decimal, float\nconst BINARY_NUMBER_RE = '\\\\b(0b[01]+)'; // 0b...\nconst RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\\\*|\\\\*=|\\\\+|\\\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\\\?|\\\\[|\\\\{|\\\\(|\\\\^|\\\\^=|\\\\||\\\\|=|\\\\|\\\\||~';\n\n/**\n* @param { Partial & {binary?: string | RegExp} } opts\n*/\nconst SHEBANG = (opts = {}) => {\n const beginShebang = /^#![ ]*\\//;\n if (opts.binary) {\n opts.begin = concat(\n beginShebang,\n /.*\\b/,\n opts.binary,\n /\\b.*/);\n }\n return inherit$1({\n scope: 'meta',\n begin: beginShebang,\n end: /$/,\n relevance: 0,\n /** @type {ModeCallback} */\n \"on:begin\": (m, resp) => {\n if (m.index !== 0) resp.ignoreMatch();\n }\n }, opts);\n};\n\n// Common modes\nconst BACKSLASH_ESCAPE = {\n begin: '\\\\\\\\[\\\\s\\\\S]', relevance: 0\n};\nconst APOS_STRING_MODE = {\n scope: 'string',\n begin: '\\'',\n end: '\\'',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst QUOTE_STRING_MODE = {\n scope: 'string',\n begin: '\"',\n end: '\"',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst PHRASAL_WORDS_MODE = {\n begin: /\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b/\n};\n/**\n * Creates a comment mode\n *\n * @param {string | RegExp} begin\n * @param {string | RegExp} end\n * @param {Mode | {}} [modeOptions]\n * @returns {Partial}\n */\nconst COMMENT = function(begin, end, modeOptions = {}) {\n const mode = inherit$1(\n {\n scope: 'comment',\n begin,\n end,\n contains: []\n },\n modeOptions\n );\n mode.contains.push({\n scope: 'doctag',\n // hack to avoid the space from being included. the space is necessary to\n // match here to prevent the plain text rule below from gobbling up doctags\n begin: '[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)',\n end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,\n excludeBegin: true,\n relevance: 0\n });\n const ENGLISH_WORD = either(\n // list of common 1 and 2 letter words in English\n \"I\",\n \"a\",\n \"is\",\n \"so\",\n \"us\",\n \"to\",\n \"at\",\n \"if\",\n \"in\",\n \"it\",\n \"on\",\n // note: this is not an exhaustive list of contractions, just popular ones\n /[A-Za-z]+['](d|ve|re|ll|t|s|n)/, // contractions - can't we'd they're let's, etc\n /[A-Za-z]+[-][a-z]+/, // `no-way`, etc.\n /[A-Za-z][a-z]{2,}/ // allow capitalized words at beginning of sentences\n );\n // looking like plain text, more likely to be a comment\n mode.contains.push(\n {\n // TODO: how to include \", (, ) without breaking grammars that use these for\n // comment delimiters?\n // begin: /[ ]+([()\"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()\":]?([.][ ]|[ ]|\\))){3}/\n // ---\n\n // this tries to find sequences of 3 english words in a row (without any\n // \"programming\" type syntax) this gives us a strong signal that we've\n // TRULY found a comment - vs perhaps scanning with the wrong language.\n // It's possible to find something that LOOKS like the start of the\n // comment - but then if there is no readable text - good chance it is a\n // false match and not a comment.\n //\n // for a visual example please see:\n // https://github.com/highlightjs/highlight.js/issues/2827\n\n begin: concat(\n /[ ]+/, // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */\n '(',\n ENGLISH_WORD,\n /[.]?[:]?([.][ ]|[ ])/,\n '){3}') // look for 3 words in a row\n }\n );\n return mode;\n};\nconst C_LINE_COMMENT_MODE = COMMENT('//', '$');\nconst C_BLOCK_COMMENT_MODE = COMMENT('/\\\\*', '\\\\*/');\nconst HASH_COMMENT_MODE = COMMENT('#', '$');\nconst NUMBER_MODE = {\n scope: 'number',\n begin: NUMBER_RE,\n relevance: 0\n};\nconst C_NUMBER_MODE = {\n scope: 'number',\n begin: C_NUMBER_RE,\n relevance: 0\n};\nconst BINARY_NUMBER_MODE = {\n scope: 'number',\n begin: BINARY_NUMBER_RE,\n relevance: 0\n};\nconst REGEXP_MODE = {\n scope: \"regexp\",\n begin: /\\/(?=[^/\\n]*\\/)/,\n end: /\\/[gimuy]*/,\n contains: [\n BACKSLASH_ESCAPE,\n {\n begin: /\\[/,\n end: /\\]/,\n relevance: 0,\n contains: [BACKSLASH_ESCAPE]\n }\n ]\n};\nconst TITLE_MODE = {\n scope: 'title',\n begin: IDENT_RE,\n relevance: 0\n};\nconst UNDERSCORE_TITLE_MODE = {\n scope: 'title',\n begin: UNDERSCORE_IDENT_RE,\n relevance: 0\n};\nconst METHOD_GUARD = {\n // excludes method names from keyword processing\n begin: '\\\\.\\\\s*' + UNDERSCORE_IDENT_RE,\n relevance: 0\n};\n\n/**\n * Adds end same as begin mechanics to a mode\n *\n * Your mode must include at least a single () match group as that first match\n * group is what is used for comparison\n * @param {Partial} mode\n */\nconst END_SAME_AS_BEGIN = function(mode) {\n return Object.assign(mode,\n {\n /** @type {ModeCallback} */\n 'on:begin': (m, resp) => { resp.data._beginMatch = m[1]; },\n /** @type {ModeCallback} */\n 'on:end': (m, resp) => { if (resp.data._beginMatch !== m[1]) resp.ignoreMatch(); }\n });\n};\n\nvar MODES = /*#__PURE__*/Object.freeze({\n __proto__: null,\n APOS_STRING_MODE: APOS_STRING_MODE,\n BACKSLASH_ESCAPE: BACKSLASH_ESCAPE,\n BINARY_NUMBER_MODE: BINARY_NUMBER_MODE,\n BINARY_NUMBER_RE: BINARY_NUMBER_RE,\n COMMENT: COMMENT,\n C_BLOCK_COMMENT_MODE: C_BLOCK_COMMENT_MODE,\n C_LINE_COMMENT_MODE: C_LINE_COMMENT_MODE,\n C_NUMBER_MODE: C_NUMBER_MODE,\n C_NUMBER_RE: C_NUMBER_RE,\n END_SAME_AS_BEGIN: END_SAME_AS_BEGIN,\n HASH_COMMENT_MODE: HASH_COMMENT_MODE,\n IDENT_RE: IDENT_RE,\n MATCH_NOTHING_RE: MATCH_NOTHING_RE,\n METHOD_GUARD: METHOD_GUARD,\n NUMBER_MODE: NUMBER_MODE,\n NUMBER_RE: NUMBER_RE,\n PHRASAL_WORDS_MODE: PHRASAL_WORDS_MODE,\n QUOTE_STRING_MODE: QUOTE_STRING_MODE,\n REGEXP_MODE: REGEXP_MODE,\n RE_STARTERS_RE: RE_STARTERS_RE,\n SHEBANG: SHEBANG,\n TITLE_MODE: TITLE_MODE,\n UNDERSCORE_IDENT_RE: UNDERSCORE_IDENT_RE,\n UNDERSCORE_TITLE_MODE: UNDERSCORE_TITLE_MODE\n});\n\n/**\n@typedef {import('highlight.js').CallbackResponse} CallbackResponse\n@typedef {import('highlight.js').CompilerExt} CompilerExt\n*/\n\n// Grammar extensions / plugins\n// See: https://github.com/highlightjs/highlight.js/issues/2833\n\n// Grammar extensions allow \"syntactic sugar\" to be added to the grammar modes\n// without requiring any underlying changes to the compiler internals.\n\n// `compileMatch` being the perfect small example of now allowing a grammar\n// author to write `match` when they desire to match a single expression rather\n// than being forced to use `begin`. The extension then just moves `match` into\n// `begin` when it runs. Ie, no features have been added, but we've just made\n// the experience of writing (and reading grammars) a little bit nicer.\n\n// ------\n\n// TODO: We need negative look-behind support to do this properly\n/**\n * Skip a match if it has a preceding dot\n *\n * This is used for `beginKeywords` to prevent matching expressions such as\n * `bob.keyword.do()`. The mode compiler automatically wires this up as a\n * special _internal_ 'on:begin' callback for modes with `beginKeywords`\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\nfunction skipIfHasPrecedingDot(match, response) {\n const before = match.input[match.index - 1];\n if (before === \".\") {\n response.ignoreMatch();\n }\n}\n\n/**\n *\n * @type {CompilerExt}\n */\nfunction scopeClassName(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.className !== undefined) {\n mode.scope = mode.className;\n delete mode.className;\n }\n}\n\n/**\n * `beginKeywords` syntactic sugar\n * @type {CompilerExt}\n */\nfunction beginKeywords(mode, parent) {\n if (!parent) return;\n if (!mode.beginKeywords) return;\n\n // for languages with keywords that include non-word characters checking for\n // a word boundary is not sufficient, so instead we check for a word boundary\n // or whitespace - this does no harm in any case since our keyword engine\n // doesn't allow spaces in keywords anyways and we still check for the boundary\n // first\n mode.begin = '\\\\b(' + mode.beginKeywords.split(' ').join('|') + ')(?!\\\\.)(?=\\\\b|\\\\s)';\n mode.__beforeBegin = skipIfHasPrecedingDot;\n mode.keywords = mode.keywords || mode.beginKeywords;\n delete mode.beginKeywords;\n\n // prevents double relevance, the keywords themselves provide\n // relevance, the mode doesn't need to double it\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 0;\n}\n\n/**\n * Allow `illegal` to contain an array of illegal values\n * @type {CompilerExt}\n */\nfunction compileIllegal(mode, _parent) {\n if (!Array.isArray(mode.illegal)) return;\n\n mode.illegal = either(...mode.illegal);\n}\n\n/**\n * `match` to match a single expression for readability\n * @type {CompilerExt}\n */\nfunction compileMatch(mode, _parent) {\n if (!mode.match) return;\n if (mode.begin || mode.end) throw new Error(\"begin & end are not supported with match\");\n\n mode.begin = mode.match;\n delete mode.match;\n}\n\n/**\n * provides the default 1 relevance to all modes\n * @type {CompilerExt}\n */\nfunction compileRelevance(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 1;\n}\n\n// allow beforeMatch to act as a \"qualifier\" for the match\n// the full match begin must be [beforeMatch][begin]\nconst beforeMatchExt = (mode, parent) => {\n if (!mode.beforeMatch) return;\n // starts conflicts with endsParent which we need to make sure the child\n // rule is not matched multiple times\n if (mode.starts) throw new Error(\"beforeMatch cannot be used with starts\");\n\n const originalMode = Object.assign({}, mode);\n Object.keys(mode).forEach((key) => { delete mode[key]; });\n\n mode.keywords = originalMode.keywords;\n mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin));\n mode.starts = {\n relevance: 0,\n contains: [\n Object.assign(originalMode, { endsParent: true })\n ]\n };\n mode.relevance = 0;\n\n delete originalMode.beforeMatch;\n};\n\n// keywords that should have no default relevance value\nconst COMMON_KEYWORDS = [\n 'of',\n 'and',\n 'for',\n 'in',\n 'not',\n 'or',\n 'if',\n 'then',\n 'parent', // common variable name\n 'list', // common variable name\n 'value' // common variable name\n];\n\nconst DEFAULT_KEYWORD_SCOPE = \"keyword\";\n\n/**\n * Given raw keywords from a language definition, compile them.\n *\n * @param {string | Record | Array} rawKeywords\n * @param {boolean} caseInsensitive\n */\nfunction compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {\n /** @type {import(\"highlight.js/private\").KeywordDict} */\n const compiledKeywords = Object.create(null);\n\n // input can be a string of keywords, an array of keywords, or a object with\n // named keys representing scopeName (which can then point to a string or array)\n if (typeof rawKeywords === 'string') {\n compileList(scopeName, rawKeywords.split(\" \"));\n } else if (Array.isArray(rawKeywords)) {\n compileList(scopeName, rawKeywords);\n } else {\n Object.keys(rawKeywords).forEach(function(scopeName) {\n // collapse all our objects back into the parent object\n Object.assign(\n compiledKeywords,\n compileKeywords(rawKeywords[scopeName], caseInsensitive, scopeName)\n );\n });\n }\n return compiledKeywords;\n\n // ---\n\n /**\n * Compiles an individual list of keywords\n *\n * Ex: \"for if when while|5\"\n *\n * @param {string} scopeName\n * @param {Array} keywordList\n */\n function compileList(scopeName, keywordList) {\n if (caseInsensitive) {\n keywordList = keywordList.map(x => x.toLowerCase());\n }\n keywordList.forEach(function(keyword) {\n const pair = keyword.split('|');\n compiledKeywords[pair[0]] = [scopeName, scoreForKeyword(pair[0], pair[1])];\n });\n }\n}\n\n/**\n * Returns the proper score for a given keyword\n *\n * Also takes into account comment keywords, which will be scored 0 UNLESS\n * another score has been manually assigned.\n * @param {string} keyword\n * @param {string} [providedScore]\n */\nfunction scoreForKeyword(keyword, providedScore) {\n // manual scores always win over common keywords\n // so you can force a score of 1 if you really insist\n if (providedScore) {\n return Number(providedScore);\n }\n\n return commonKeyword(keyword) ? 0 : 1;\n}\n\n/**\n * Determines if a given keyword is common or not\n *\n * @param {string} keyword */\nfunction commonKeyword(keyword) {\n return COMMON_KEYWORDS.includes(keyword.toLowerCase());\n}\n\n/*\n\nFor the reasoning behind this please see:\nhttps://github.com/highlightjs/highlight.js/issues/2880#issuecomment-747275419\n\n*/\n\n/**\n * @type {Record}\n */\nconst seenDeprecations = {};\n\n/**\n * @param {string} message\n */\nconst error = (message) => {\n console.error(message);\n};\n\n/**\n * @param {string} message\n * @param {any} args\n */\nconst warn = (message, ...args) => {\n console.log(`WARN: ${message}`, ...args);\n};\n\n/**\n * @param {string} version\n * @param {string} message\n */\nconst deprecated = (version, message) => {\n if (seenDeprecations[`${version}/${message}`]) return;\n\n console.log(`Deprecated as of ${version}. ${message}`);\n seenDeprecations[`${version}/${message}`] = true;\n};\n\n/* eslint-disable no-throw-literal */\n\n/**\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n*/\n\nconst MultiClassError = new Error();\n\n/**\n * Renumbers labeled scope names to account for additional inner match\n * groups that otherwise would break everything.\n *\n * Lets say we 3 match scopes:\n *\n * { 1 => ..., 2 => ..., 3 => ... }\n *\n * So what we need is a clean match like this:\n *\n * (a)(b)(c) => [ \"a\", \"b\", \"c\" ]\n *\n * But this falls apart with inner match groups:\n *\n * (a)(((b)))(c) => [\"a\", \"b\", \"b\", \"b\", \"c\" ]\n *\n * Our scopes are now \"out of alignment\" and we're repeating `b` 3 times.\n * What needs to happen is the numbers are remapped:\n *\n * { 1 => ..., 2 => ..., 5 => ... }\n *\n * We also need to know that the ONLY groups that should be output\n * are 1, 2, and 5. This function handles this behavior.\n *\n * @param {CompiledMode} mode\n * @param {Array} regexes\n * @param {{key: \"beginScope\"|\"endScope\"}} opts\n */\nfunction remapScopeNames(mode, regexes, { key }) {\n let offset = 0;\n const scopeNames = mode[key];\n /** @type Record */\n const emit = {};\n /** @type Record */\n const positions = {};\n\n for (let i = 1; i <= regexes.length; i++) {\n positions[i + offset] = scopeNames[i];\n emit[i + offset] = true;\n offset += countMatchGroups(regexes[i - 1]);\n }\n // we use _emit to keep track of which match groups are \"top-level\" to avoid double\n // output from inside match groups\n mode[key] = positions;\n mode[key]._emit = emit;\n mode[key]._multi = true;\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction beginMultiClass(mode) {\n if (!Array.isArray(mode.begin)) return;\n\n if (mode.skip || mode.excludeBegin || mode.returnBegin) {\n error(\"skip, excludeBegin, returnBegin not compatible with beginScope: {}\");\n throw MultiClassError;\n }\n\n if (typeof mode.beginScope !== \"object\" || mode.beginScope === null) {\n error(\"beginScope must be object\");\n throw MultiClassError;\n }\n\n remapScopeNames(mode, mode.begin, { key: \"beginScope\" });\n mode.begin = _rewriteBackreferences(mode.begin, { joinWith: \"\" });\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction endMultiClass(mode) {\n if (!Array.isArray(mode.end)) return;\n\n if (mode.skip || mode.excludeEnd || mode.returnEnd) {\n error(\"skip, excludeEnd, returnEnd not compatible with endScope: {}\");\n throw MultiClassError;\n }\n\n if (typeof mode.endScope !== \"object\" || mode.endScope === null) {\n error(\"endScope must be object\");\n throw MultiClassError;\n }\n\n remapScopeNames(mode, mode.end, { key: \"endScope\" });\n mode.end = _rewriteBackreferences(mode.end, { joinWith: \"\" });\n}\n\n/**\n * this exists only to allow `scope: {}` to be used beside `match:`\n * Otherwise `beginScope` would necessary and that would look weird\n\n {\n match: [ /def/, /\\w+/ ]\n scope: { 1: \"keyword\" , 2: \"title\" }\n }\n\n * @param {CompiledMode} mode\n */\nfunction scopeSugar(mode) {\n if (mode.scope && typeof mode.scope === \"object\" && mode.scope !== null) {\n mode.beginScope = mode.scope;\n delete mode.scope;\n }\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction MultiClass(mode) {\n scopeSugar(mode);\n\n if (typeof mode.beginScope === \"string\") {\n mode.beginScope = { _wrap: mode.beginScope };\n }\n if (typeof mode.endScope === \"string\") {\n mode.endScope = { _wrap: mode.endScope };\n }\n\n beginMultiClass(mode);\n endMultiClass(mode);\n}\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').CompiledLanguage} CompiledLanguage\n*/\n\n// compilation\n\n/**\n * Compiles a language definition result\n *\n * Given the raw result of a language definition (Language), compiles this so\n * that it is ready for highlighting code.\n * @param {Language} language\n * @returns {CompiledLanguage}\n */\nfunction compileLanguage(language) {\n /**\n * Builds a regex with the case sensitivity of the current language\n *\n * @param {RegExp | string} value\n * @param {boolean} [global]\n */\n function langRe(value, global) {\n return new RegExp(\n source(value),\n 'm'\n + (language.case_insensitive ? 'i' : '')\n + (language.unicodeRegex ? 'u' : '')\n + (global ? 'g' : '')\n );\n }\n\n /**\n Stores multiple regular expressions and allows you to quickly search for\n them all in a string simultaneously - returning the first match. It does\n this by creating a huge (a|b|c) regex - each individual item wrapped with ()\n and joined by `|` - using match groups to track position. When a match is\n found checking which position in the array has content allows us to figure\n out which of the original regexes / match groups triggered the match.\n\n The match object itself (the result of `Regex.exec`) is returned but also\n enhanced by merging in any meta-data that was registered with the regex.\n This is how we keep track of which mode matched, and what type of rule\n (`illegal`, `begin`, end, etc).\n */\n class MultiRegex {\n constructor() {\n this.matchIndexes = {};\n // @ts-ignore\n this.regexes = [];\n this.matchAt = 1;\n this.position = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n opts.position = this.position++;\n // @ts-ignore\n this.matchIndexes[this.matchAt] = opts;\n this.regexes.push([opts, re]);\n this.matchAt += countMatchGroups(re) + 1;\n }\n\n compile() {\n if (this.regexes.length === 0) {\n // avoids the need to check length every time exec is called\n // @ts-ignore\n this.exec = () => null;\n }\n const terminators = this.regexes.map(el => el[1]);\n this.matcherRe = langRe(_rewriteBackreferences(terminators, { joinWith: '|' }), true);\n this.lastIndex = 0;\n }\n\n /** @param {string} s */\n exec(s) {\n this.matcherRe.lastIndex = this.lastIndex;\n const match = this.matcherRe.exec(s);\n if (!match) { return null; }\n\n // eslint-disable-next-line no-undefined\n const i = match.findIndex((el, i) => i > 0 && el !== undefined);\n // @ts-ignore\n const matchData = this.matchIndexes[i];\n // trim off any earlier non-relevant match groups (ie, the other regex\n // match groups that make up the multi-matcher)\n match.splice(0, i);\n\n return Object.assign(match, matchData);\n }\n }\n\n /*\n Created to solve the key deficiently with MultiRegex - there is no way to\n test for multiple matches at a single location. Why would we need to do\n that? In the future a more dynamic engine will allow certain matches to be\n ignored. An example: if we matched say the 3rd regex in a large group but\n decided to ignore it - we'd need to started testing again at the 4th\n regex... but MultiRegex itself gives us no real way to do that.\n\n So what this class creates MultiRegexs on the fly for whatever search\n position they are needed.\n\n NOTE: These additional MultiRegex objects are created dynamically. For most\n grammars most of the time we will never actually need anything more than the\n first MultiRegex - so this shouldn't have too much overhead.\n\n Say this is our search group, and we match regex3, but wish to ignore it.\n\n regex1 | regex2 | regex3 | regex4 | regex5 ' ie, startAt = 0\n\n What we need is a new MultiRegex that only includes the remaining\n possibilities:\n\n regex4 | regex5 ' ie, startAt = 3\n\n This class wraps all that complexity up in a simple API... `startAt` decides\n where in the array of expressions to start doing the matching. It\n auto-increments, so if a match is found at position 2, then startAt will be\n set to 3. If the end is reached startAt will return to 0.\n\n MOST of the time the parser will be setting startAt manually to 0.\n */\n class ResumableMultiRegex {\n constructor() {\n // @ts-ignore\n this.rules = [];\n // @ts-ignore\n this.multiRegexes = [];\n this.count = 0;\n\n this.lastIndex = 0;\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n getMatcher(index) {\n if (this.multiRegexes[index]) return this.multiRegexes[index];\n\n const matcher = new MultiRegex();\n this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts));\n matcher.compile();\n this.multiRegexes[index] = matcher;\n return matcher;\n }\n\n resumingScanAtSamePosition() {\n return this.regexIndex !== 0;\n }\n\n considerAll() {\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n this.rules.push([re, opts]);\n if (opts.type === \"begin\") this.count++;\n }\n\n /** @param {string} s */\n exec(s) {\n const m = this.getMatcher(this.regexIndex);\n m.lastIndex = this.lastIndex;\n let result = m.exec(s);\n\n // The following is because we have no easy way to say \"resume scanning at the\n // existing position but also skip the current rule ONLY\". What happens is\n // all prior rules are also skipped which can result in matching the wrong\n // thing. Example of matching \"booger\":\n\n // our matcher is [string, \"booger\", number]\n //\n // ....booger....\n\n // if \"booger\" is ignored then we'd really need a regex to scan from the\n // SAME position for only: [string, number] but ignoring \"booger\" (if it\n // was the first match), a simple resume would scan ahead who knows how\n // far looking only for \"number\", ignoring potential string matches (or\n // future \"booger\" matches that might be valid.)\n\n // So what we do: We execute two matchers, one resuming at the same\n // position, but the second full matcher starting at the position after:\n\n // /--- resume first regex match here (for [number])\n // |/---- full match here for [string, \"booger\", number]\n // vv\n // ....booger....\n\n // Which ever results in a match first is then used. So this 3-4 step\n // process essentially allows us to say \"match at this position, excluding\n // a prior rule that was ignored\".\n //\n // 1. Match \"booger\" first, ignore. Also proves that [string] does non match.\n // 2. Resume matching for [number]\n // 3. Match at index + 1 for [string, \"booger\", number]\n // 4. If #2 and #3 result in matches, which came first?\n if (this.resumingScanAtSamePosition()) {\n if (result && result.index === this.lastIndex) ; else { // use the second matcher result\n const m2 = this.getMatcher(0);\n m2.lastIndex = this.lastIndex + 1;\n result = m2.exec(s);\n }\n }\n\n if (result) {\n this.regexIndex += result.position + 1;\n if (this.regexIndex === this.count) {\n // wrap-around to considering all matches again\n this.considerAll();\n }\n }\n\n return result;\n }\n }\n\n /**\n * Given a mode, builds a huge ResumableMultiRegex that can be used to walk\n * the content and find matches.\n *\n * @param {CompiledMode} mode\n * @returns {ResumableMultiRegex}\n */\n function buildModeRegex(mode) {\n const mm = new ResumableMultiRegex();\n\n mode.contains.forEach(term => mm.addRule(term.begin, { rule: term, type: \"begin\" }));\n\n if (mode.terminatorEnd) {\n mm.addRule(mode.terminatorEnd, { type: \"end\" });\n }\n if (mode.illegal) {\n mm.addRule(mode.illegal, { type: \"illegal\" });\n }\n\n return mm;\n }\n\n /** skip vs abort vs ignore\n *\n * @skip - The mode is still entered and exited normally (and contains rules apply),\n * but all content is held and added to the parent buffer rather than being\n * output when the mode ends. Mostly used with `sublanguage` to build up\n * a single large buffer than can be parsed by sublanguage.\n *\n * - The mode begin ands ends normally.\n * - Content matched is added to the parent mode buffer.\n * - The parser cursor is moved forward normally.\n *\n * @abort - A hack placeholder until we have ignore. Aborts the mode (as if it\n * never matched) but DOES NOT continue to match subsequent `contains`\n * modes. Abort is bad/suboptimal because it can result in modes\n * farther down not getting applied because an earlier rule eats the\n * content but then aborts.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is added to the mode buffer.\n * - The parser cursor is moved forward accordingly.\n *\n * @ignore - Ignores the mode (as if it never matched) and continues to match any\n * subsequent `contains` modes. Ignore isn't technically possible with\n * the current parser implementation.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is ignored.\n * - The parser cursor is not moved forward.\n */\n\n /**\n * Compiles an individual mode\n *\n * This can raise an error if the mode contains certain detectable known logic\n * issues.\n * @param {Mode} mode\n * @param {CompiledMode | null} [parent]\n * @returns {CompiledMode | never}\n */\n function compileMode(mode, parent) {\n const cmode = /** @type CompiledMode */ (mode);\n if (mode.isCompiled) return cmode;\n\n [\n scopeClassName,\n // do this early so compiler extensions generally don't have to worry about\n // the distinction between match/begin\n compileMatch,\n MultiClass,\n beforeMatchExt\n ].forEach(ext => ext(mode, parent));\n\n language.compilerExtensions.forEach(ext => ext(mode, parent));\n\n // __beforeBegin is considered private API, internal use only\n mode.__beforeBegin = null;\n\n [\n beginKeywords,\n // do this later so compiler extensions that come earlier have access to the\n // raw array if they wanted to perhaps manipulate it, etc.\n compileIllegal,\n // default to 1 relevance if not specified\n compileRelevance\n ].forEach(ext => ext(mode, parent));\n\n mode.isCompiled = true;\n\n let keywordPattern = null;\n if (typeof mode.keywords === \"object\" && mode.keywords.$pattern) {\n // we need a copy because keywords might be compiled multiple times\n // so we can't go deleting $pattern from the original on the first\n // pass\n mode.keywords = Object.assign({}, mode.keywords);\n keywordPattern = mode.keywords.$pattern;\n delete mode.keywords.$pattern;\n }\n keywordPattern = keywordPattern || /\\w+/;\n\n if (mode.keywords) {\n mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);\n }\n\n cmode.keywordPatternRe = langRe(keywordPattern, true);\n\n if (parent) {\n if (!mode.begin) mode.begin = /\\B|\\b/;\n cmode.beginRe = langRe(cmode.begin);\n if (!mode.end && !mode.endsWithParent) mode.end = /\\B|\\b/;\n if (mode.end) cmode.endRe = langRe(cmode.end);\n cmode.terminatorEnd = source(cmode.end) || '';\n if (mode.endsWithParent && parent.terminatorEnd) {\n cmode.terminatorEnd += (mode.end ? '|' : '') + parent.terminatorEnd;\n }\n }\n if (mode.illegal) cmode.illegalRe = langRe(/** @type {RegExp | string} */ (mode.illegal));\n if (!mode.contains) mode.contains = [];\n\n mode.contains = [].concat(...mode.contains.map(function(c) {\n return expandOrCloneMode(c === 'self' ? mode : c);\n }));\n mode.contains.forEach(function(c) { compileMode(/** @type Mode */ (c), cmode); });\n\n if (mode.starts) {\n compileMode(mode.starts, parent);\n }\n\n cmode.matcher = buildModeRegex(cmode);\n return cmode;\n }\n\n if (!language.compilerExtensions) language.compilerExtensions = [];\n\n // self is not valid at the top-level\n if (language.contains && language.contains.includes('self')) {\n throw new Error(\"ERR: contains `self` is not supported at the top-level of a language. See documentation.\");\n }\n\n // we need a null object, which inherit will guarantee\n language.classNameAliases = inherit$1(language.classNameAliases || {});\n\n return compileMode(/** @type Mode */ (language));\n}\n\n/**\n * Determines if a mode has a dependency on it's parent or not\n *\n * If a mode does have a parent dependency then often we need to clone it if\n * it's used in multiple places so that each copy points to the correct parent,\n * where-as modes without a parent can often safely be re-used at the bottom of\n * a mode chain.\n *\n * @param {Mode | null} mode\n * @returns {boolean} - is there a dependency on the parent?\n * */\nfunction dependencyOnParent(mode) {\n if (!mode) return false;\n\n return mode.endsWithParent || dependencyOnParent(mode.starts);\n}\n\n/**\n * Expands a mode or clones it if necessary\n *\n * This is necessary for modes with parental dependenceis (see notes on\n * `dependencyOnParent`) and for nodes that have `variants` - which must then be\n * exploded into their own individual modes at compile time.\n *\n * @param {Mode} mode\n * @returns {Mode | Mode[]}\n * */\nfunction expandOrCloneMode(mode) {\n if (mode.variants && !mode.cachedVariants) {\n mode.cachedVariants = mode.variants.map(function(variant) {\n return inherit$1(mode, { variants: null }, variant);\n });\n }\n\n // EXPAND\n // if we have variants then essentially \"replace\" the mode with the variants\n // this happens in compileMode, where this function is called from\n if (mode.cachedVariants) {\n return mode.cachedVariants;\n }\n\n // CLONE\n // if we have dependencies on parents then we need a unique\n // instance of ourselves, so we can be reused with many\n // different parents without issue\n if (dependencyOnParent(mode)) {\n return inherit$1(mode, { starts: mode.starts ? inherit$1(mode.starts) : null });\n }\n\n if (Object.isFrozen(mode)) {\n return inherit$1(mode);\n }\n\n // no special dependency issues, just return ourselves\n return mode;\n}\n\nvar version = \"11.9.0\";\n\nclass HTMLInjectionError extends Error {\n constructor(reason, html) {\n super(reason);\n this.name = \"HTMLInjectionError\";\n this.html = html;\n }\n}\n\n/*\nSyntax highlighting with language autodetection.\nhttps://highlightjs.org/\n*/\n\n\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').CompiledScope} CompiledScope\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSApi} HLJSApi\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').PluginEvent} PluginEvent\n@typedef {import('highlight.js').HLJSOptions} HLJSOptions\n@typedef {import('highlight.js').LanguageFn} LanguageFn\n@typedef {import('highlight.js').HighlightedHTMLElement} HighlightedHTMLElement\n@typedef {import('highlight.js').BeforeHighlightContext} BeforeHighlightContext\n@typedef {import('highlight.js/private').MatchType} MatchType\n@typedef {import('highlight.js/private').KeywordData} KeywordData\n@typedef {import('highlight.js/private').EnhancedMatch} EnhancedMatch\n@typedef {import('highlight.js/private').AnnotatedError} AnnotatedError\n@typedef {import('highlight.js').AutoHighlightResult} AutoHighlightResult\n@typedef {import('highlight.js').HighlightOptions} HighlightOptions\n@typedef {import('highlight.js').HighlightResult} HighlightResult\n*/\n\n\nconst escape = escapeHTML;\nconst inherit = inherit$1;\nconst NO_MATCH = Symbol(\"nomatch\");\nconst MAX_KEYWORD_HITS = 7;\n\n/**\n * @param {any} hljs - object that is extended (legacy)\n * @returns {HLJSApi}\n */\nconst HLJS = function(hljs) {\n // Global internal variables used within the highlight.js library.\n /** @type {Record} */\n const languages = Object.create(null);\n /** @type {Record} */\n const aliases = Object.create(null);\n /** @type {HLJSPlugin[]} */\n const plugins = [];\n\n // safe/production mode - swallows more errors, tries to keep running\n // even if a single syntax or parse hits a fatal error\n let SAFE_MODE = true;\n const LANGUAGE_NOT_FOUND = \"Could not find the language '{}', did you forget to load/include a language module?\";\n /** @type {Language} */\n const PLAINTEXT_LANGUAGE = { disableAutodetect: true, name: 'Plain text', contains: [] };\n\n // Global options used when within external APIs. This is modified when\n // calling the `hljs.configure` function.\n /** @type HLJSOptions */\n let options = {\n ignoreUnescapedHTML: false,\n throwUnescapedHTML: false,\n noHighlightRe: /^(no-?highlight)$/i,\n languageDetectRe: /\\blang(?:uage)?-([\\w-]+)\\b/i,\n classPrefix: 'hljs-',\n cssSelector: 'pre code',\n languages: null,\n // beta configuration options, subject to change, welcome to discuss\n // https://github.com/highlightjs/highlight.js/issues/1086\n __emitter: TokenTreeEmitter\n };\n\n /* Utility functions */\n\n /**\n * Tests a language name to see if highlighting should be skipped\n * @param {string} languageName\n */\n function shouldNotHighlight(languageName) {\n return options.noHighlightRe.test(languageName);\n }\n\n /**\n * @param {HighlightedHTMLElement} block - the HTML element to determine language for\n */\n function blockLanguage(block) {\n let classes = block.className + ' ';\n\n classes += block.parentNode ? block.parentNode.className : '';\n\n // language-* takes precedence over non-prefixed class names.\n const match = options.languageDetectRe.exec(classes);\n if (match) {\n const language = getLanguage(match[1]);\n if (!language) {\n warn(LANGUAGE_NOT_FOUND.replace(\"{}\", match[1]));\n warn(\"Falling back to no-highlight mode for this block.\", block);\n }\n return language ? match[1] : 'no-highlight';\n }\n\n return classes\n .split(/\\s+/)\n .find((_class) => shouldNotHighlight(_class) || getLanguage(_class));\n }\n\n /**\n * Core highlighting function.\n *\n * OLD API\n * highlight(lang, code, ignoreIllegals, continuation)\n *\n * NEW API\n * highlight(code, {lang, ignoreIllegals})\n *\n * @param {string} codeOrLanguageName - the language to use for highlighting\n * @param {string | HighlightOptions} optionsOrCode - the code to highlight\n * @param {boolean} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n *\n * @returns {HighlightResult} Result - an object that represents the result\n * @property {string} language - the language name\n * @property {number} relevance - the relevance score\n * @property {string} value - the highlighted HTML code\n * @property {string} code - the original raw code\n * @property {CompiledMode} top - top of the current mode stack\n * @property {boolean} illegal - indicates whether any illegal matches were found\n */\n function highlight(codeOrLanguageName, optionsOrCode, ignoreIllegals) {\n let code = \"\";\n let languageName = \"\";\n if (typeof optionsOrCode === \"object\") {\n code = codeOrLanguageName;\n ignoreIllegals = optionsOrCode.ignoreIllegals;\n languageName = optionsOrCode.language;\n } else {\n // old API\n deprecated(\"10.7.0\", \"highlight(lang, code, ...args) has been deprecated.\");\n deprecated(\"10.7.0\", \"Please use highlight(code, options) instead.\\nhttps://github.com/highlightjs/highlight.js/issues/2277\");\n languageName = codeOrLanguageName;\n code = optionsOrCode;\n }\n\n // https://github.com/highlightjs/highlight.js/issues/3149\n // eslint-disable-next-line no-undefined\n if (ignoreIllegals === undefined) { ignoreIllegals = true; }\n\n /** @type {BeforeHighlightContext} */\n const context = {\n code,\n language: languageName\n };\n // the plugin can change the desired language or the code to be highlighted\n // just be changing the object it was passed\n fire(\"before:highlight\", context);\n\n // a before plugin can usurp the result completely by providing it's own\n // in which case we don't even need to call highlight\n const result = context.result\n ? context.result\n : _highlight(context.language, context.code, ignoreIllegals);\n\n result.code = context.code;\n // the plugin can change anything in result to suite it\n fire(\"after:highlight\", result);\n\n return result;\n }\n\n /**\n * private highlight that's used internally and does not fire callbacks\n *\n * @param {string} languageName - the language to use for highlighting\n * @param {string} codeToHighlight - the code to highlight\n * @param {boolean?} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n * @param {CompiledMode?} [continuation] - current continuation mode, if any\n * @returns {HighlightResult} - result of the highlight operation\n */\n function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {\n const keywordHits = Object.create(null);\n\n /**\n * Return keyword data if a match is a keyword\n * @param {CompiledMode} mode - current mode\n * @param {string} matchText - the textual match\n * @returns {KeywordData | false}\n */\n function keywordData(mode, matchText) {\n return mode.keywords[matchText];\n }\n\n function processKeywords() {\n if (!top.keywords) {\n emitter.addText(modeBuffer);\n return;\n }\n\n let lastIndex = 0;\n top.keywordPatternRe.lastIndex = 0;\n let match = top.keywordPatternRe.exec(modeBuffer);\n let buf = \"\";\n\n while (match) {\n buf += modeBuffer.substring(lastIndex, match.index);\n const word = language.case_insensitive ? match[0].toLowerCase() : match[0];\n const data = keywordData(top, word);\n if (data) {\n const [kind, keywordRelevance] = data;\n emitter.addText(buf);\n buf = \"\";\n\n keywordHits[word] = (keywordHits[word] || 0) + 1;\n if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance;\n if (kind.startsWith(\"_\")) {\n // _ implied for relevance only, do not highlight\n // by applying a class name\n buf += match[0];\n } else {\n const cssClass = language.classNameAliases[kind] || kind;\n emitKeyword(match[0], cssClass);\n }\n } else {\n buf += match[0];\n }\n lastIndex = top.keywordPatternRe.lastIndex;\n match = top.keywordPatternRe.exec(modeBuffer);\n }\n buf += modeBuffer.substring(lastIndex);\n emitter.addText(buf);\n }\n\n function processSubLanguage() {\n if (modeBuffer === \"\") return;\n /** @type HighlightResult */\n let result = null;\n\n if (typeof top.subLanguage === 'string') {\n if (!languages[top.subLanguage]) {\n emitter.addText(modeBuffer);\n return;\n }\n result = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]);\n continuations[top.subLanguage] = /** @type {CompiledMode} */ (result._top);\n } else {\n result = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);\n }\n\n // Counting embedded language score towards the host language may be disabled\n // with zeroing the containing mode relevance. Use case in point is Markdown that\n // allows XML everywhere and makes every XML snippet to have a much larger Markdown\n // score.\n if (top.relevance > 0) {\n relevance += result.relevance;\n }\n emitter.__addSublanguage(result._emitter, result.language);\n }\n\n function processBuffer() {\n if (top.subLanguage != null) {\n processSubLanguage();\n } else {\n processKeywords();\n }\n modeBuffer = '';\n }\n\n /**\n * @param {string} text\n * @param {string} scope\n */\n function emitKeyword(keyword, scope) {\n if (keyword === \"\") return;\n\n emitter.startScope(scope);\n emitter.addText(keyword);\n emitter.endScope();\n }\n\n /**\n * @param {CompiledScope} scope\n * @param {RegExpMatchArray} match\n */\n function emitMultiClass(scope, match) {\n let i = 1;\n const max = match.length - 1;\n while (i <= max) {\n if (!scope._emit[i]) { i++; continue; }\n const klass = language.classNameAliases[scope[i]] || scope[i];\n const text = match[i];\n if (klass) {\n emitKeyword(text, klass);\n } else {\n modeBuffer = text;\n processKeywords();\n modeBuffer = \"\";\n }\n i++;\n }\n }\n\n /**\n * @param {CompiledMode} mode - new mode to start\n * @param {RegExpMatchArray} match\n */\n function startNewMode(mode, match) {\n if (mode.scope && typeof mode.scope === \"string\") {\n emitter.openNode(language.classNameAliases[mode.scope] || mode.scope);\n }\n if (mode.beginScope) {\n // beginScope just wraps the begin match itself in a scope\n if (mode.beginScope._wrap) {\n emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap);\n modeBuffer = \"\";\n } else if (mode.beginScope._multi) {\n // at this point modeBuffer should just be the match\n emitMultiClass(mode.beginScope, match);\n modeBuffer = \"\";\n }\n }\n\n top = Object.create(mode, { parent: { value: top } });\n return top;\n }\n\n /**\n * @param {CompiledMode } mode - the mode to potentially end\n * @param {RegExpMatchArray} match - the latest match\n * @param {string} matchPlusRemainder - match plus remainder of content\n * @returns {CompiledMode | void} - the next mode, or if void continue on in current mode\n */\n function endOfMode(mode, match, matchPlusRemainder) {\n let matched = startsWith(mode.endRe, matchPlusRemainder);\n\n if (matched) {\n if (mode[\"on:end\"]) {\n const resp = new Response(mode);\n mode[\"on:end\"](match, resp);\n if (resp.isMatchIgnored) matched = false;\n }\n\n if (matched) {\n while (mode.endsParent && mode.parent) {\n mode = mode.parent;\n }\n return mode;\n }\n }\n // even if on:end fires an `ignore` it's still possible\n // that we might trigger the end node because of a parent mode\n if (mode.endsWithParent) {\n return endOfMode(mode.parent, match, matchPlusRemainder);\n }\n }\n\n /**\n * Handle matching but then ignoring a sequence of text\n *\n * @param {string} lexeme - string containing full match text\n */\n function doIgnore(lexeme) {\n if (top.matcher.regexIndex === 0) {\n // no more regexes to potentially match here, so we move the cursor forward one\n // space\n modeBuffer += lexeme[0];\n return 1;\n } else {\n // no need to move the cursor, we still have additional regexes to try and\n // match at this very spot\n resumeScanAtSamePosition = true;\n return 0;\n }\n }\n\n /**\n * Handle the start of a new potential mode match\n *\n * @param {EnhancedMatch} match - the current match\n * @returns {number} how far to advance the parse cursor\n */\n function doBeginMatch(match) {\n const lexeme = match[0];\n const newMode = match.rule;\n\n const resp = new Response(newMode);\n // first internal before callbacks, then the public ones\n const beforeCallbacks = [newMode.__beforeBegin, newMode[\"on:begin\"]];\n for (const cb of beforeCallbacks) {\n if (!cb) continue;\n cb(match, resp);\n if (resp.isMatchIgnored) return doIgnore(lexeme);\n }\n\n if (newMode.skip) {\n modeBuffer += lexeme;\n } else {\n if (newMode.excludeBegin) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (!newMode.returnBegin && !newMode.excludeBegin) {\n modeBuffer = lexeme;\n }\n }\n startNewMode(newMode, match);\n return newMode.returnBegin ? 0 : lexeme.length;\n }\n\n /**\n * Handle the potential end of mode\n *\n * @param {RegExpMatchArray} match - the current match\n */\n function doEndMatch(match) {\n const lexeme = match[0];\n const matchPlusRemainder = codeToHighlight.substring(match.index);\n\n const endMode = endOfMode(top, match, matchPlusRemainder);\n if (!endMode) { return NO_MATCH; }\n\n const origin = top;\n if (top.endScope && top.endScope._wrap) {\n processBuffer();\n emitKeyword(lexeme, top.endScope._wrap);\n } else if (top.endScope && top.endScope._multi) {\n processBuffer();\n emitMultiClass(top.endScope, match);\n } else if (origin.skip) {\n modeBuffer += lexeme;\n } else {\n if (!(origin.returnEnd || origin.excludeEnd)) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (origin.excludeEnd) {\n modeBuffer = lexeme;\n }\n }\n do {\n if (top.scope) {\n emitter.closeNode();\n }\n if (!top.skip && !top.subLanguage) {\n relevance += top.relevance;\n }\n top = top.parent;\n } while (top !== endMode.parent);\n if (endMode.starts) {\n startNewMode(endMode.starts, match);\n }\n return origin.returnEnd ? 0 : lexeme.length;\n }\n\n function processContinuations() {\n const list = [];\n for (let current = top; current !== language; current = current.parent) {\n if (current.scope) {\n list.unshift(current.scope);\n }\n }\n list.forEach(item => emitter.openNode(item));\n }\n\n /** @type {{type?: MatchType, index?: number, rule?: Mode}}} */\n let lastMatch = {};\n\n /**\n * Process an individual match\n *\n * @param {string} textBeforeMatch - text preceding the match (since the last match)\n * @param {EnhancedMatch} [match] - the match itself\n */\n function processLexeme(textBeforeMatch, match) {\n const lexeme = match && match[0];\n\n // add non-matched text to the current mode buffer\n modeBuffer += textBeforeMatch;\n\n if (lexeme == null) {\n processBuffer();\n return 0;\n }\n\n // we've found a 0 width match and we're stuck, so we need to advance\n // this happens when we have badly behaved rules that have optional matchers to the degree that\n // sometimes they can end up matching nothing at all\n // Ref: https://github.com/highlightjs/highlight.js/issues/2140\n if (lastMatch.type === \"begin\" && match.type === \"end\" && lastMatch.index === match.index && lexeme === \"\") {\n // spit the \"skipped\" character that our regex choked on back into the output sequence\n modeBuffer += codeToHighlight.slice(match.index, match.index + 1);\n if (!SAFE_MODE) {\n /** @type {AnnotatedError} */\n const err = new Error(`0 width match regex (${languageName})`);\n err.languageName = languageName;\n err.badRule = lastMatch.rule;\n throw err;\n }\n return 1;\n }\n lastMatch = match;\n\n if (match.type === \"begin\") {\n return doBeginMatch(match);\n } else if (match.type === \"illegal\" && !ignoreIllegals) {\n // illegal match, we do not continue processing\n /** @type {AnnotatedError} */\n const err = new Error('Illegal lexeme \"' + lexeme + '\" for mode \"' + (top.scope || '') + '\"');\n err.mode = top;\n throw err;\n } else if (match.type === \"end\") {\n const processed = doEndMatch(match);\n if (processed !== NO_MATCH) {\n return processed;\n }\n }\n\n // edge case for when illegal matches $ (end of line) which is technically\n // a 0 width match but not a begin/end match so it's not caught by the\n // first handler (when ignoreIllegals is true)\n if (match.type === \"illegal\" && lexeme === \"\") {\n // advance so we aren't stuck in an infinite loop\n return 1;\n }\n\n // infinite loops are BAD, this is a last ditch catch all. if we have a\n // decent number of iterations yet our index (cursor position in our\n // parsing) still 3x behind our index then something is very wrong\n // so we bail\n if (iterations > 100000 && iterations > match.index * 3) {\n const err = new Error('potential infinite loop, way more iterations than matches');\n throw err;\n }\n\n /*\n Why might be find ourselves here? An potential end match that was\n triggered but could not be completed. IE, `doEndMatch` returned NO_MATCH.\n (this could be because a callback requests the match be ignored, etc)\n\n This causes no real harm other than stopping a few times too many.\n */\n\n modeBuffer += lexeme;\n return lexeme.length;\n }\n\n const language = getLanguage(languageName);\n if (!language) {\n error(LANGUAGE_NOT_FOUND.replace(\"{}\", languageName));\n throw new Error('Unknown language: \"' + languageName + '\"');\n }\n\n const md = compileLanguage(language);\n let result = '';\n /** @type {CompiledMode} */\n let top = continuation || md;\n /** @type Record */\n const continuations = {}; // keep continuations for sub-languages\n const emitter = new options.__emitter(options);\n processContinuations();\n let modeBuffer = '';\n let relevance = 0;\n let index = 0;\n let iterations = 0;\n let resumeScanAtSamePosition = false;\n\n try {\n if (!language.__emitTokens) {\n top.matcher.considerAll();\n\n for (;;) {\n iterations++;\n if (resumeScanAtSamePosition) {\n // only regexes not matched previously will now be\n // considered for a potential match\n resumeScanAtSamePosition = false;\n } else {\n top.matcher.considerAll();\n }\n top.matcher.lastIndex = index;\n\n const match = top.matcher.exec(codeToHighlight);\n // console.log(\"match\", match[0], match.rule && match.rule.begin)\n\n if (!match) break;\n\n const beforeMatch = codeToHighlight.substring(index, match.index);\n const processedCount = processLexeme(beforeMatch, match);\n index = match.index + processedCount;\n }\n processLexeme(codeToHighlight.substring(index));\n } else {\n language.__emitTokens(codeToHighlight, emitter);\n }\n\n emitter.finalize();\n result = emitter.toHTML();\n\n return {\n language: languageName,\n value: result,\n relevance,\n illegal: false,\n _emitter: emitter,\n _top: top\n };\n } catch (err) {\n if (err.message && err.message.includes('Illegal')) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: true,\n relevance: 0,\n _illegalBy: {\n message: err.message,\n index,\n context: codeToHighlight.slice(index - 100, index + 100),\n mode: err.mode,\n resultSoFar: result\n },\n _emitter: emitter\n };\n } else if (SAFE_MODE) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: false,\n relevance: 0,\n errorRaised: err,\n _emitter: emitter,\n _top: top\n };\n } else {\n throw err;\n }\n }\n }\n\n /**\n * returns a valid highlight result, without actually doing any actual work,\n * auto highlight starts with this and it's possible for small snippets that\n * auto-detection may not find a better match\n * @param {string} code\n * @returns {HighlightResult}\n */\n function justTextHighlightResult(code) {\n const result = {\n value: escape(code),\n illegal: false,\n relevance: 0,\n _top: PLAINTEXT_LANGUAGE,\n _emitter: new options.__emitter(options)\n };\n result._emitter.addText(code);\n return result;\n }\n\n /**\n Highlighting with language detection. Accepts a string with the code to\n highlight. Returns an object with the following properties:\n\n - language (detected language)\n - relevance (int)\n - value (an HTML string with highlighting markup)\n - secondBest (object with the same structure for second-best heuristically\n detected language, may be absent)\n\n @param {string} code\n @param {Array} [languageSubset]\n @returns {AutoHighlightResult}\n */\n function highlightAuto(code, languageSubset) {\n languageSubset = languageSubset || options.languages || Object.keys(languages);\n const plaintext = justTextHighlightResult(code);\n\n const results = languageSubset.filter(getLanguage).filter(autoDetection).map(name =>\n _highlight(name, code, false)\n );\n results.unshift(plaintext); // plaintext is always an option\n\n const sorted = results.sort((a, b) => {\n // sort base on relevance\n if (a.relevance !== b.relevance) return b.relevance - a.relevance;\n\n // always award the tie to the base language\n // ie if C++ and Arduino are tied, it's more likely to be C++\n if (a.language && b.language) {\n if (getLanguage(a.language).supersetOf === b.language) {\n return 1;\n } else if (getLanguage(b.language).supersetOf === a.language) {\n return -1;\n }\n }\n\n // otherwise say they are equal, which has the effect of sorting on\n // relevance while preserving the original ordering - which is how ties\n // have historically been settled, ie the language that comes first always\n // wins in the case of a tie\n return 0;\n });\n\n const [best, secondBest] = sorted;\n\n /** @type {AutoHighlightResult} */\n const result = best;\n result.secondBest = secondBest;\n\n return result;\n }\n\n /**\n * Builds new class name for block given the language name\n *\n * @param {HTMLElement} element\n * @param {string} [currentLang]\n * @param {string} [resultLang]\n */\n function updateClassName(element, currentLang, resultLang) {\n const language = (currentLang && aliases[currentLang]) || resultLang;\n\n element.classList.add(\"hljs\");\n element.classList.add(`language-${language}`);\n }\n\n /**\n * Applies highlighting to a DOM node containing code.\n *\n * @param {HighlightedHTMLElement} element - the HTML element to highlight\n */\n function highlightElement(element) {\n /** @type HTMLElement */\n let node = null;\n const language = blockLanguage(element);\n\n if (shouldNotHighlight(language)) return;\n\n fire(\"before:highlightElement\",\n { el: element, language });\n\n if (element.dataset.highlighted) {\n console.log(\"Element previously highlighted. To highlight again, first unset `dataset.highlighted`.\", element);\n return;\n }\n\n // we should be all text, no child nodes (unescaped HTML) - this is possibly\n // an HTML injection attack - it's likely too late if this is already in\n // production (the code has likely already done its damage by the time\n // we're seeing it)... but we yell loudly about this so that hopefully it's\n // more likely to be caught in development before making it to production\n if (element.children.length > 0) {\n if (!options.ignoreUnescapedHTML) {\n console.warn(\"One of your code blocks includes unescaped HTML. This is a potentially serious security risk.\");\n console.warn(\"https://github.com/highlightjs/highlight.js/wiki/security\");\n console.warn(\"The element with unescaped HTML:\");\n console.warn(element);\n }\n if (options.throwUnescapedHTML) {\n const err = new HTMLInjectionError(\n \"One of your code blocks includes unescaped HTML.\",\n element.innerHTML\n );\n throw err;\n }\n }\n\n node = element;\n const text = node.textContent;\n const result = language ? highlight(text, { language, ignoreIllegals: true }) : highlightAuto(text);\n\n element.innerHTML = result.value;\n element.dataset.highlighted = \"yes\";\n updateClassName(element, language, result.language);\n element.result = {\n language: result.language,\n // TODO: remove with version 11.0\n re: result.relevance,\n relevance: result.relevance\n };\n if (result.secondBest) {\n element.secondBest = {\n language: result.secondBest.language,\n relevance: result.secondBest.relevance\n };\n }\n\n fire(\"after:highlightElement\", { el: element, result, text });\n }\n\n /**\n * Updates highlight.js global options with the passed options\n *\n * @param {Partial} userOptions\n */\n function configure(userOptions) {\n options = inherit(options, userOptions);\n }\n\n // TODO: remove v12, deprecated\n const initHighlighting = () => {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlighting() deprecated. Use highlightAll() now.\");\n };\n\n // TODO: remove v12, deprecated\n function initHighlightingOnLoad() {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlightingOnLoad() deprecated. Use highlightAll() now.\");\n }\n\n let wantsHighlight = false;\n\n /**\n * auto-highlights all pre>code elements on the page\n */\n function highlightAll() {\n // if we are called too early in the loading process\n if (document.readyState === \"loading\") {\n wantsHighlight = true;\n return;\n }\n\n const blocks = document.querySelectorAll(options.cssSelector);\n blocks.forEach(highlightElement);\n }\n\n function boot() {\n // if a highlight was requested before DOM was loaded, do now\n if (wantsHighlight) highlightAll();\n }\n\n // make sure we are in the browser environment\n if (typeof window !== 'undefined' && window.addEventListener) {\n window.addEventListener('DOMContentLoaded', boot, false);\n }\n\n /**\n * Register a language grammar module\n *\n * @param {string} languageName\n * @param {LanguageFn} languageDefinition\n */\n function registerLanguage(languageName, languageDefinition) {\n let lang = null;\n try {\n lang = languageDefinition(hljs);\n } catch (error$1) {\n error(\"Language definition for '{}' could not be registered.\".replace(\"{}\", languageName));\n // hard or soft error\n if (!SAFE_MODE) { throw error$1; } else { error(error$1); }\n // languages that have serious errors are replaced with essentially a\n // \"plaintext\" stand-in so that the code blocks will still get normal\n // css classes applied to them - and one bad language won't break the\n // entire highlighter\n lang = PLAINTEXT_LANGUAGE;\n }\n // give it a temporary name if it doesn't have one in the meta-data\n if (!lang.name) lang.name = languageName;\n languages[languageName] = lang;\n lang.rawDefinition = languageDefinition.bind(null, hljs);\n\n if (lang.aliases) {\n registerAliases(lang.aliases, { languageName });\n }\n }\n\n /**\n * Remove a language grammar module\n *\n * @param {string} languageName\n */\n function unregisterLanguage(languageName) {\n delete languages[languageName];\n for (const alias of Object.keys(aliases)) {\n if (aliases[alias] === languageName) {\n delete aliases[alias];\n }\n }\n }\n\n /**\n * @returns {string[]} List of language internal names\n */\n function listLanguages() {\n return Object.keys(languages);\n }\n\n /**\n * @param {string} name - name of the language to retrieve\n * @returns {Language | undefined}\n */\n function getLanguage(name) {\n name = (name || '').toLowerCase();\n return languages[name] || languages[aliases[name]];\n }\n\n /**\n *\n * @param {string|string[]} aliasList - single alias or list of aliases\n * @param {{languageName: string}} opts\n */\n function registerAliases(aliasList, { languageName }) {\n if (typeof aliasList === 'string') {\n aliasList = [aliasList];\n }\n aliasList.forEach(alias => { aliases[alias.toLowerCase()] = languageName; });\n }\n\n /**\n * Determines if a given language has auto-detection enabled\n * @param {string} name - name of the language\n */\n function autoDetection(name) {\n const lang = getLanguage(name);\n return lang && !lang.disableAutodetect;\n }\n\n /**\n * Upgrades the old highlightBlock plugins to the new\n * highlightElement API\n * @param {HLJSPlugin} plugin\n */\n function upgradePluginAPI(plugin) {\n // TODO: remove with v12\n if (plugin[\"before:highlightBlock\"] && !plugin[\"before:highlightElement\"]) {\n plugin[\"before:highlightElement\"] = (data) => {\n plugin[\"before:highlightBlock\"](\n Object.assign({ block: data.el }, data)\n );\n };\n }\n if (plugin[\"after:highlightBlock\"] && !plugin[\"after:highlightElement\"]) {\n plugin[\"after:highlightElement\"] = (data) => {\n plugin[\"after:highlightBlock\"](\n Object.assign({ block: data.el }, data)\n );\n };\n }\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function addPlugin(plugin) {\n upgradePluginAPI(plugin);\n plugins.push(plugin);\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function removePlugin(plugin) {\n const index = plugins.indexOf(plugin);\n if (index !== -1) {\n plugins.splice(index, 1);\n }\n }\n\n /**\n *\n * @param {PluginEvent} event\n * @param {any} args\n */\n function fire(event, args) {\n const cb = event;\n plugins.forEach(function(plugin) {\n if (plugin[cb]) {\n plugin[cb](args);\n }\n });\n }\n\n /**\n * DEPRECATED\n * @param {HighlightedHTMLElement} el\n */\n function deprecateHighlightBlock(el) {\n deprecated(\"10.7.0\", \"highlightBlock will be removed entirely in v12.0\");\n deprecated(\"10.7.0\", \"Please use highlightElement now.\");\n\n return highlightElement(el);\n }\n\n /* Interface definition */\n Object.assign(hljs, {\n highlight,\n highlightAuto,\n highlightAll,\n highlightElement,\n // TODO: Remove with v12 API\n highlightBlock: deprecateHighlightBlock,\n configure,\n initHighlighting,\n initHighlightingOnLoad,\n registerLanguage,\n unregisterLanguage,\n listLanguages,\n getLanguage,\n registerAliases,\n autoDetection,\n inherit,\n addPlugin,\n removePlugin\n });\n\n hljs.debugMode = function() { SAFE_MODE = false; };\n hljs.safeMode = function() { SAFE_MODE = true; };\n hljs.versionString = version;\n\n hljs.regex = {\n concat: concat,\n lookahead: lookahead,\n either: either,\n optional: optional,\n anyNumberOfTimes: anyNumberOfTimes\n };\n\n for (const key in MODES) {\n // @ts-ignore\n if (typeof MODES[key] === \"object\") {\n // @ts-ignore\n deepFreeze(MODES[key]);\n }\n }\n\n // merge all the modes/regexes into our main object\n Object.assign(hljs, MODES);\n\n return hljs;\n};\n\n// Other names for the variable may break build script\nconst highlight = HLJS({});\n\n// returns a new instance of the highlighter to be used for extensions\n// check https://github.com/wooorm/lowlight/issues/47\nhighlight.newInstance = () => HLJS({});\n\nmodule.exports = highlight;\nhighlight.HighlightJS = highlight;\nhighlight.default = highlight;\n",null,null,null,null,null,null,null,null,"/*! https://mths.be/punycode v1.4.1 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow new RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see \n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * https://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.4.1',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see \n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) {\n\t\t\t// in Node.js, io.js, or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else {\n\t\t\t// in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n","'use strict';\n\n/** @type {import('.')} */\nmodule.exports = Error;\n","'use strict';\n\n/** @type {import('./eval')} */\nmodule.exports = EvalError;\n","'use strict';\n\n/** @type {import('./range')} */\nmodule.exports = RangeError;\n","'use strict';\n\n/** @type {import('./ref')} */\nmodule.exports = ReferenceError;\n","'use strict';\n\n/** @type {import('./syntax')} */\nmodule.exports = SyntaxError;\n","'use strict';\n\n/** @type {import('./type')} */\nmodule.exports = TypeError;\n","'use strict';\n\n/** @type {import('./uri')} */\nmodule.exports = URIError;\n","'use strict';\n\n/* eslint complexity: [2, 18], max-statements: [2, 33] */\nmodule.exports = function hasSymbols() {\n\tif (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }\n\tif (typeof Symbol.iterator === 'symbol') { return true; }\n\n\tvar obj = {};\n\tvar sym = Symbol('test');\n\tvar symObj = Object(sym);\n\tif (typeof sym === 'string') { return false; }\n\n\tif (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }\n\tif (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }\n\n\t// temp disabled per https://github.com/ljharb/object.assign/issues/17\n\t// if (sym instanceof Symbol) { return false; }\n\t// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4\n\t// if (!(symObj instanceof Symbol)) { return false; }\n\n\t// if (typeof Symbol.prototype.toString !== 'function') { return false; }\n\t// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }\n\n\tvar symVal = 42;\n\tobj[sym] = symVal;\n\tfor (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop\n\tif (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }\n\n\tif (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }\n\n\tvar syms = Object.getOwnPropertySymbols(obj);\n\tif (syms.length !== 1 || syms[0] !== sym) { return false; }\n\n\tif (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }\n\n\tif (typeof Object.getOwnPropertyDescriptor === 'function') {\n\t\tvar descriptor = Object.getOwnPropertyDescriptor(obj, sym);\n\t\tif (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }\n\t}\n\n\treturn true;\n};\n","'use strict';\n\nvar origSymbol = typeof Symbol !== 'undefined' && Symbol;\nvar hasSymbolSham = require('./shams');\n\nmodule.exports = function hasNativeSymbols() {\n\tif (typeof origSymbol !== 'function') { return false; }\n\tif (typeof Symbol !== 'function') { return false; }\n\tif (typeof origSymbol('foo') !== 'symbol') { return false; }\n\tif (typeof Symbol('bar') !== 'symbol') { return false; }\n\n\treturn hasSymbolSham();\n};\n","'use strict';\n\nvar test = {\n\t__proto__: null,\n\tfoo: {}\n};\n\nvar $Object = Object;\n\n/** @type {import('.')} */\nmodule.exports = function hasProto() {\n\t// @ts-expect-error: TS errors on an inherited property for some reason\n\treturn { __proto__: test }.foo === test.foo\n\t\t&& !(test instanceof $Object);\n};\n","'use strict';\n\n/* eslint no-invalid-this: 1 */\n\nvar ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';\nvar toStr = Object.prototype.toString;\nvar max = Math.max;\nvar funcType = '[object Function]';\n\nvar concatty = function concatty(a, b) {\n var arr = [];\n\n for (var i = 0; i < a.length; i += 1) {\n arr[i] = a[i];\n }\n for (var j = 0; j < b.length; j += 1) {\n arr[j + a.length] = b[j];\n }\n\n return arr;\n};\n\nvar slicy = function slicy(arrLike, offset) {\n var arr = [];\n for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {\n arr[j] = arrLike[i];\n }\n return arr;\n};\n\nvar joiny = function (arr, joiner) {\n var str = '';\n for (var i = 0; i < arr.length; i += 1) {\n str += arr[i];\n if (i + 1 < arr.length) {\n str += joiner;\n }\n }\n return str;\n};\n\nmodule.exports = function bind(that) {\n var target = this;\n if (typeof target !== 'function' || toStr.apply(target) !== funcType) {\n throw new TypeError(ERROR_MESSAGE + target);\n }\n var args = slicy(arguments, 1);\n\n var bound;\n var binder = function () {\n if (this instanceof bound) {\n var result = target.apply(\n this,\n concatty(args, arguments)\n );\n if (Object(result) === result) {\n return result;\n }\n return this;\n }\n return target.apply(\n that,\n concatty(args, arguments)\n );\n\n };\n\n var boundLength = max(0, target.length - args.length);\n var boundArgs = [];\n for (var i = 0; i < boundLength; i++) {\n boundArgs[i] = '$' + i;\n }\n\n bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);\n\n if (target.prototype) {\n var Empty = function Empty() {};\n Empty.prototype = target.prototype;\n bound.prototype = new Empty();\n Empty.prototype = null;\n }\n\n return bound;\n};\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = Function.prototype.bind || implementation;\n","'use strict';\n\nvar call = Function.prototype.call;\nvar $hasOwn = Object.prototype.hasOwnProperty;\nvar bind = require('function-bind');\n\n/** @type {import('.')} */\nmodule.exports = bind.call(call, $hasOwn);\n","'use strict';\n\nvar undefined;\n\nvar $Error = require('es-errors');\nvar $EvalError = require('es-errors/eval');\nvar $RangeError = require('es-errors/range');\nvar $ReferenceError = require('es-errors/ref');\nvar $SyntaxError = require('es-errors/syntax');\nvar $TypeError = require('es-errors/type');\nvar $URIError = require('es-errors/uri');\n\nvar $Function = Function;\n\n// eslint-disable-next-line consistent-return\nvar getEvalledConstructor = function (expressionSyntax) {\n\ttry {\n\t\treturn $Function('\"use strict\"; return (' + expressionSyntax + ').constructor;')();\n\t} catch (e) {}\n};\n\nvar $gOPD = Object.getOwnPropertyDescriptor;\nif ($gOPD) {\n\ttry {\n\t\t$gOPD({}, '');\n\t} catch (e) {\n\t\t$gOPD = null; // this is IE 8, which has a broken gOPD\n\t}\n}\n\nvar throwTypeError = function () {\n\tthrow new $TypeError();\n};\nvar ThrowTypeError = $gOPD\n\t? (function () {\n\t\ttry {\n\t\t\t// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties\n\t\t\targuments.callee; // IE 8 does not throw here\n\t\t\treturn throwTypeError;\n\t\t} catch (calleeThrows) {\n\t\t\ttry {\n\t\t\t\t// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')\n\t\t\t\treturn $gOPD(arguments, 'callee').get;\n\t\t\t} catch (gOPDthrows) {\n\t\t\t\treturn throwTypeError;\n\t\t\t}\n\t\t}\n\t}())\n\t: throwTypeError;\n\nvar hasSymbols = require('has-symbols')();\nvar hasProto = require('has-proto')();\n\nvar getProto = Object.getPrototypeOf || (\n\thasProto\n\t\t? function (x) { return x.__proto__; } // eslint-disable-line no-proto\n\t\t: null\n);\n\nvar needsEval = {};\n\nvar TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array);\n\nvar INTRINSICS = {\n\t__proto__: null,\n\t'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,\n\t'%Array%': Array,\n\t'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,\n\t'%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined,\n\t'%AsyncFromSyncIteratorPrototype%': undefined,\n\t'%AsyncFunction%': needsEval,\n\t'%AsyncGenerator%': needsEval,\n\t'%AsyncGeneratorFunction%': needsEval,\n\t'%AsyncIteratorPrototype%': needsEval,\n\t'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,\n\t'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,\n\t'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,\n\t'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,\n\t'%Boolean%': Boolean,\n\t'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,\n\t'%Date%': Date,\n\t'%decodeURI%': decodeURI,\n\t'%decodeURIComponent%': decodeURIComponent,\n\t'%encodeURI%': encodeURI,\n\t'%encodeURIComponent%': encodeURIComponent,\n\t'%Error%': $Error,\n\t'%eval%': eval, // eslint-disable-line no-eval\n\t'%EvalError%': $EvalError,\n\t'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,\n\t'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,\n\t'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,\n\t'%Function%': $Function,\n\t'%GeneratorFunction%': needsEval,\n\t'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,\n\t'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,\n\t'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,\n\t'%isFinite%': isFinite,\n\t'%isNaN%': isNaN,\n\t'%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined,\n\t'%JSON%': typeof JSON === 'object' ? JSON : undefined,\n\t'%Map%': typeof Map === 'undefined' ? undefined : Map,\n\t'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()),\n\t'%Math%': Math,\n\t'%Number%': Number,\n\t'%Object%': Object,\n\t'%parseFloat%': parseFloat,\n\t'%parseInt%': parseInt,\n\t'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,\n\t'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,\n\t'%RangeError%': $RangeError,\n\t'%ReferenceError%': $ReferenceError,\n\t'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,\n\t'%RegExp%': RegExp,\n\t'%Set%': typeof Set === 'undefined' ? undefined : Set,\n\t'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()),\n\t'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,\n\t'%String%': String,\n\t'%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined,\n\t'%Symbol%': hasSymbols ? Symbol : undefined,\n\t'%SyntaxError%': $SyntaxError,\n\t'%ThrowTypeError%': ThrowTypeError,\n\t'%TypedArray%': TypedArray,\n\t'%TypeError%': $TypeError,\n\t'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,\n\t'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,\n\t'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,\n\t'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,\n\t'%URIError%': $URIError,\n\t'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,\n\t'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,\n\t'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet\n};\n\nif (getProto) {\n\ttry {\n\t\tnull.error; // eslint-disable-line no-unused-expressions\n\t} catch (e) {\n\t\t// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229\n\t\tvar errorProto = getProto(getProto(e));\n\t\tINTRINSICS['%Error.prototype%'] = errorProto;\n\t}\n}\n\nvar doEval = function doEval(name) {\n\tvar value;\n\tif (name === '%AsyncFunction%') {\n\t\tvalue = getEvalledConstructor('async function () {}');\n\t} else if (name === '%GeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('function* () {}');\n\t} else if (name === '%AsyncGeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('async function* () {}');\n\t} else if (name === '%AsyncGenerator%') {\n\t\tvar fn = doEval('%AsyncGeneratorFunction%');\n\t\tif (fn) {\n\t\t\tvalue = fn.prototype;\n\t\t}\n\t} else if (name === '%AsyncIteratorPrototype%') {\n\t\tvar gen = doEval('%AsyncGenerator%');\n\t\tif (gen && getProto) {\n\t\t\tvalue = getProto(gen.prototype);\n\t\t}\n\t}\n\n\tINTRINSICS[name] = value;\n\n\treturn value;\n};\n\nvar LEGACY_ALIASES = {\n\t__proto__: null,\n\t'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],\n\t'%ArrayPrototype%': ['Array', 'prototype'],\n\t'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],\n\t'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],\n\t'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],\n\t'%ArrayProto_values%': ['Array', 'prototype', 'values'],\n\t'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],\n\t'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],\n\t'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],\n\t'%BooleanPrototype%': ['Boolean', 'prototype'],\n\t'%DataViewPrototype%': ['DataView', 'prototype'],\n\t'%DatePrototype%': ['Date', 'prototype'],\n\t'%ErrorPrototype%': ['Error', 'prototype'],\n\t'%EvalErrorPrototype%': ['EvalError', 'prototype'],\n\t'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],\n\t'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],\n\t'%FunctionPrototype%': ['Function', 'prototype'],\n\t'%Generator%': ['GeneratorFunction', 'prototype'],\n\t'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],\n\t'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],\n\t'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],\n\t'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],\n\t'%JSONParse%': ['JSON', 'parse'],\n\t'%JSONStringify%': ['JSON', 'stringify'],\n\t'%MapPrototype%': ['Map', 'prototype'],\n\t'%NumberPrototype%': ['Number', 'prototype'],\n\t'%ObjectPrototype%': ['Object', 'prototype'],\n\t'%ObjProto_toString%': ['Object', 'prototype', 'toString'],\n\t'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],\n\t'%PromisePrototype%': ['Promise', 'prototype'],\n\t'%PromiseProto_then%': ['Promise', 'prototype', 'then'],\n\t'%Promise_all%': ['Promise', 'all'],\n\t'%Promise_reject%': ['Promise', 'reject'],\n\t'%Promise_resolve%': ['Promise', 'resolve'],\n\t'%RangeErrorPrototype%': ['RangeError', 'prototype'],\n\t'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],\n\t'%RegExpPrototype%': ['RegExp', 'prototype'],\n\t'%SetPrototype%': ['Set', 'prototype'],\n\t'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],\n\t'%StringPrototype%': ['String', 'prototype'],\n\t'%SymbolPrototype%': ['Symbol', 'prototype'],\n\t'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],\n\t'%TypedArrayPrototype%': ['TypedArray', 'prototype'],\n\t'%TypeErrorPrototype%': ['TypeError', 'prototype'],\n\t'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],\n\t'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],\n\t'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],\n\t'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],\n\t'%URIErrorPrototype%': ['URIError', 'prototype'],\n\t'%WeakMapPrototype%': ['WeakMap', 'prototype'],\n\t'%WeakSetPrototype%': ['WeakSet', 'prototype']\n};\n\nvar bind = require('function-bind');\nvar hasOwn = require('hasown');\nvar $concat = bind.call(Function.call, Array.prototype.concat);\nvar $spliceApply = bind.call(Function.apply, Array.prototype.splice);\nvar $replace = bind.call(Function.call, String.prototype.replace);\nvar $strSlice = bind.call(Function.call, String.prototype.slice);\nvar $exec = bind.call(Function.call, RegExp.prototype.exec);\n\n/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */\nvar rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\nvar reEscapeChar = /\\\\(\\\\)?/g; /** Used to match backslashes in property paths. */\nvar stringToPath = function stringToPath(string) {\n\tvar first = $strSlice(string, 0, 1);\n\tvar last = $strSlice(string, -1);\n\tif (first === '%' && last !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected closing `%`');\n\t} else if (last === '%' && first !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected opening `%`');\n\t}\n\tvar result = [];\n\t$replace(string, rePropName, function (match, number, quote, subString) {\n\t\tresult[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;\n\t});\n\treturn result;\n};\n/* end adaptation */\n\nvar getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {\n\tvar intrinsicName = name;\n\tvar alias;\n\tif (hasOwn(LEGACY_ALIASES, intrinsicName)) {\n\t\talias = LEGACY_ALIASES[intrinsicName];\n\t\tintrinsicName = '%' + alias[0] + '%';\n\t}\n\n\tif (hasOwn(INTRINSICS, intrinsicName)) {\n\t\tvar value = INTRINSICS[intrinsicName];\n\t\tif (value === needsEval) {\n\t\t\tvalue = doEval(intrinsicName);\n\t\t}\n\t\tif (typeof value === 'undefined' && !allowMissing) {\n\t\t\tthrow new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');\n\t\t}\n\n\t\treturn {\n\t\t\talias: alias,\n\t\t\tname: intrinsicName,\n\t\t\tvalue: value\n\t\t};\n\t}\n\n\tthrow new $SyntaxError('intrinsic ' + name + ' does not exist!');\n};\n\nmodule.exports = function GetIntrinsic(name, allowMissing) {\n\tif (typeof name !== 'string' || name.length === 0) {\n\t\tthrow new $TypeError('intrinsic name must be a non-empty string');\n\t}\n\tif (arguments.length > 1 && typeof allowMissing !== 'boolean') {\n\t\tthrow new $TypeError('\"allowMissing\" argument must be a boolean');\n\t}\n\n\tif ($exec(/^%?[^%]*%?$/, name) === null) {\n\t\tthrow new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');\n\t}\n\tvar parts = stringToPath(name);\n\tvar intrinsicBaseName = parts.length > 0 ? parts[0] : '';\n\n\tvar intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);\n\tvar intrinsicRealName = intrinsic.name;\n\tvar value = intrinsic.value;\n\tvar skipFurtherCaching = false;\n\n\tvar alias = intrinsic.alias;\n\tif (alias) {\n\t\tintrinsicBaseName = alias[0];\n\t\t$spliceApply(parts, $concat([0, 1], alias));\n\t}\n\n\tfor (var i = 1, isOwn = true; i < parts.length; i += 1) {\n\t\tvar part = parts[i];\n\t\tvar first = $strSlice(part, 0, 1);\n\t\tvar last = $strSlice(part, -1);\n\t\tif (\n\t\t\t(\n\t\t\t\t(first === '\"' || first === \"'\" || first === '`')\n\t\t\t\t|| (last === '\"' || last === \"'\" || last === '`')\n\t\t\t)\n\t\t\t&& first !== last\n\t\t) {\n\t\t\tthrow new $SyntaxError('property names with quotes must have matching quotes');\n\t\t}\n\t\tif (part === 'constructor' || !isOwn) {\n\t\t\tskipFurtherCaching = true;\n\t\t}\n\n\t\tintrinsicBaseName += '.' + part;\n\t\tintrinsicRealName = '%' + intrinsicBaseName + '%';\n\n\t\tif (hasOwn(INTRINSICS, intrinsicRealName)) {\n\t\t\tvalue = INTRINSICS[intrinsicRealName];\n\t\t} else if (value != null) {\n\t\t\tif (!(part in value)) {\n\t\t\t\tif (!allowMissing) {\n\t\t\t\t\tthrow new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');\n\t\t\t\t}\n\t\t\t\treturn void undefined;\n\t\t\t}\n\t\t\tif ($gOPD && (i + 1) >= parts.length) {\n\t\t\t\tvar desc = $gOPD(value, part);\n\t\t\t\tisOwn = !!desc;\n\n\t\t\t\t// By convention, when a data property is converted to an accessor\n\t\t\t\t// property to emulate a data property that does not suffer from\n\t\t\t\t// the override mistake, that accessor's getter is marked with\n\t\t\t\t// an `originalValue` property. Here, when we detect this, we\n\t\t\t\t// uphold the illusion by pretending to see that original data\n\t\t\t\t// property, i.e., returning the value rather than the getter\n\t\t\t\t// itself.\n\t\t\t\tif (isOwn && 'get' in desc && !('originalValue' in desc.get)) {\n\t\t\t\t\tvalue = desc.get;\n\t\t\t\t} else {\n\t\t\t\t\tvalue = value[part];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tisOwn = hasOwn(value, part);\n\t\t\t\tvalue = value[part];\n\t\t\t}\n\n\t\t\tif (isOwn && !skipFurtherCaching) {\n\t\t\t\tINTRINSICS[intrinsicRealName] = value;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\n/** @type {import('.')} */\nvar $defineProperty = GetIntrinsic('%Object.defineProperty%', true) || false;\nif ($defineProperty) {\n\ttry {\n\t\t$defineProperty({}, 'a', { value: 1 });\n\t} catch (e) {\n\t\t// IE 8 has a broken defineProperty\n\t\t$defineProperty = false;\n\t}\n}\n\nmodule.exports = $defineProperty;\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\n\nif ($gOPD) {\n\ttry {\n\t\t$gOPD([], 'length');\n\t} catch (e) {\n\t\t// IE 8 has a broken gOPD\n\t\t$gOPD = null;\n\t}\n}\n\nmodule.exports = $gOPD;\n","'use strict';\n\nvar $defineProperty = require('es-define-property');\n\nvar $SyntaxError = require('es-errors/syntax');\nvar $TypeError = require('es-errors/type');\n\nvar gopd = require('gopd');\n\n/** @type {import('.')} */\nmodule.exports = function defineDataProperty(\n\tobj,\n\tproperty,\n\tvalue\n) {\n\tif (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {\n\t\tthrow new $TypeError('`obj` must be an object or a function`');\n\t}\n\tif (typeof property !== 'string' && typeof property !== 'symbol') {\n\t\tthrow new $TypeError('`property` must be a string or a symbol`');\n\t}\n\tif (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {\n\t\tthrow new $TypeError('`nonEnumerable`, if provided, must be a boolean or null');\n\t}\n\tif (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {\n\t\tthrow new $TypeError('`nonWritable`, if provided, must be a boolean or null');\n\t}\n\tif (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {\n\t\tthrow new $TypeError('`nonConfigurable`, if provided, must be a boolean or null');\n\t}\n\tif (arguments.length > 6 && typeof arguments[6] !== 'boolean') {\n\t\tthrow new $TypeError('`loose`, if provided, must be a boolean');\n\t}\n\n\tvar nonEnumerable = arguments.length > 3 ? arguments[3] : null;\n\tvar nonWritable = arguments.length > 4 ? arguments[4] : null;\n\tvar nonConfigurable = arguments.length > 5 ? arguments[5] : null;\n\tvar loose = arguments.length > 6 ? arguments[6] : false;\n\n\t/* @type {false | TypedPropertyDescriptor} */\n\tvar desc = !!gopd && gopd(obj, property);\n\n\tif ($defineProperty) {\n\t\t$defineProperty(obj, property, {\n\t\t\tconfigurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,\n\t\t\tenumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,\n\t\t\tvalue: value,\n\t\t\twritable: nonWritable === null && desc ? desc.writable : !nonWritable\n\t\t});\n\t} else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {\n\t\t// must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable\n\t\tobj[property] = value; // eslint-disable-line no-param-reassign\n\t} else {\n\t\tthrow new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');\n\t}\n};\n","'use strict';\n\nvar $defineProperty = require('es-define-property');\n\nvar hasPropertyDescriptors = function hasPropertyDescriptors() {\n\treturn !!$defineProperty;\n};\n\nhasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {\n\t// node v0.6 has a bug where array lengths can be Set but not Defined\n\tif (!$defineProperty) {\n\t\treturn null;\n\t}\n\ttry {\n\t\treturn $defineProperty([], 'length', { value: 1 }).length !== 1;\n\t} catch (e) {\n\t\t// In Firefox 4-22, defining length on an array throws an exception.\n\t\treturn true;\n\t}\n};\n\nmodule.exports = hasPropertyDescriptors;\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\nvar define = require('define-data-property');\nvar hasDescriptors = require('has-property-descriptors')();\nvar gOPD = require('gopd');\n\nvar $TypeError = require('es-errors/type');\nvar $floor = GetIntrinsic('%Math.floor%');\n\n/** @type {import('.')} */\nmodule.exports = function setFunctionLength(fn, length) {\n\tif (typeof fn !== 'function') {\n\t\tthrow new $TypeError('`fn` is not a function');\n\t}\n\tif (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) {\n\t\tthrow new $TypeError('`length` must be a positive 32-bit integer');\n\t}\n\n\tvar loose = arguments.length > 2 && !!arguments[2];\n\n\tvar functionLengthIsConfigurable = true;\n\tvar functionLengthIsWritable = true;\n\tif ('length' in fn && gOPD) {\n\t\tvar desc = gOPD(fn, 'length');\n\t\tif (desc && !desc.configurable) {\n\t\t\tfunctionLengthIsConfigurable = false;\n\t\t}\n\t\tif (desc && !desc.writable) {\n\t\t\tfunctionLengthIsWritable = false;\n\t\t}\n\t}\n\n\tif (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {\n\t\tif (hasDescriptors) {\n\t\t\tdefine(/** @type {Parameters[0]} */ (fn), 'length', length, true, true);\n\t\t} else {\n\t\t\tdefine(/** @type {Parameters[0]} */ (fn), 'length', length);\n\t\t}\n\t}\n\treturn fn;\n};\n","'use strict';\n\nvar bind = require('function-bind');\nvar GetIntrinsic = require('get-intrinsic');\nvar setFunctionLength = require('set-function-length');\n\nvar $TypeError = require('es-errors/type');\nvar $apply = GetIntrinsic('%Function.prototype.apply%');\nvar $call = GetIntrinsic('%Function.prototype.call%');\nvar $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);\n\nvar $defineProperty = require('es-define-property');\nvar $max = GetIntrinsic('%Math.max%');\n\nmodule.exports = function callBind(originalFunction) {\n\tif (typeof originalFunction !== 'function') {\n\t\tthrow new $TypeError('a function is required');\n\t}\n\tvar func = $reflectApply(bind, $call, arguments);\n\treturn setFunctionLength(\n\t\tfunc,\n\t\t1 + $max(0, originalFunction.length - (arguments.length - 1)),\n\t\ttrue\n\t);\n};\n\nvar applyBind = function applyBind() {\n\treturn $reflectApply(bind, $apply, arguments);\n};\n\nif ($defineProperty) {\n\t$defineProperty(module.exports, 'apply', { value: applyBind });\n} else {\n\tmodule.exports.apply = applyBind;\n}\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar callBind = require('./');\n\nvar $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));\n\nmodule.exports = function callBoundIntrinsic(name, allowMissing) {\n\tvar intrinsic = GetIntrinsic(name, !!allowMissing);\n\tif (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {\n\t\treturn callBind(intrinsic);\n\t}\n\treturn intrinsic;\n};\n","module.exports = require('util').inspect;\n","var hasMap = typeof Map === 'function' && Map.prototype;\nvar mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;\nvar mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;\nvar mapForEach = hasMap && Map.prototype.forEach;\nvar hasSet = typeof Set === 'function' && Set.prototype;\nvar setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;\nvar setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;\nvar setForEach = hasSet && Set.prototype.forEach;\nvar hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;\nvar weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;\nvar hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;\nvar weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;\nvar hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;\nvar weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;\nvar booleanValueOf = Boolean.prototype.valueOf;\nvar objectToString = Object.prototype.toString;\nvar functionToString = Function.prototype.toString;\nvar $match = String.prototype.match;\nvar $slice = String.prototype.slice;\nvar $replace = String.prototype.replace;\nvar $toUpperCase = String.prototype.toUpperCase;\nvar $toLowerCase = String.prototype.toLowerCase;\nvar $test = RegExp.prototype.test;\nvar $concat = Array.prototype.concat;\nvar $join = Array.prototype.join;\nvar $arrSlice = Array.prototype.slice;\nvar $floor = Math.floor;\nvar bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;\nvar gOPS = Object.getOwnPropertySymbols;\nvar symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;\nvar hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';\n// ie, `has-tostringtag/shams\nvar toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')\n ? Symbol.toStringTag\n : null;\nvar isEnumerable = Object.prototype.propertyIsEnumerable;\n\nvar gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (\n [].__proto__ === Array.prototype // eslint-disable-line no-proto\n ? function (O) {\n return O.__proto__; // eslint-disable-line no-proto\n }\n : null\n);\n\nfunction addNumericSeparator(num, str) {\n if (\n num === Infinity\n || num === -Infinity\n || num !== num\n || (num && num > -1000 && num < 1000)\n || $test.call(/e/, str)\n ) {\n return str;\n }\n var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;\n if (typeof num === 'number') {\n var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)\n if (int !== num) {\n var intStr = String(int);\n var dec = $slice.call(str, intStr.length + 1);\n return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');\n }\n }\n return $replace.call(str, sepRegex, '$&_');\n}\n\nvar utilInspect = require('./util.inspect');\nvar inspectCustom = utilInspect.custom;\nvar inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;\n\nmodule.exports = function inspect_(obj, options, depth, seen) {\n var opts = options || {};\n\n if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {\n throw new TypeError('option \"quoteStyle\" must be \"single\" or \"double\"');\n }\n if (\n has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'\n ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity\n : opts.maxStringLength !== null\n )\n ) {\n throw new TypeError('option \"maxStringLength\", if provided, must be a positive integer, Infinity, or `null`');\n }\n var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;\n if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {\n throw new TypeError('option \"customInspect\", if provided, must be `true`, `false`, or `\\'symbol\\'`');\n }\n\n if (\n has(opts, 'indent')\n && opts.indent !== null\n && opts.indent !== '\\t'\n && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)\n ) {\n throw new TypeError('option \"indent\" must be \"\\\\t\", an integer > 0, or `null`');\n }\n if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {\n throw new TypeError('option \"numericSeparator\", if provided, must be `true` or `false`');\n }\n var numericSeparator = opts.numericSeparator;\n\n if (typeof obj === 'undefined') {\n return 'undefined';\n }\n if (obj === null) {\n return 'null';\n }\n if (typeof obj === 'boolean') {\n return obj ? 'true' : 'false';\n }\n\n if (typeof obj === 'string') {\n return inspectString(obj, opts);\n }\n if (typeof obj === 'number') {\n if (obj === 0) {\n return Infinity / obj > 0 ? '0' : '-0';\n }\n var str = String(obj);\n return numericSeparator ? addNumericSeparator(obj, str) : str;\n }\n if (typeof obj === 'bigint') {\n var bigIntStr = String(obj) + 'n';\n return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;\n }\n\n var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;\n if (typeof depth === 'undefined') { depth = 0; }\n if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {\n return isArray(obj) ? '[Array]' : '[Object]';\n }\n\n var indent = getIndent(opts, depth);\n\n if (typeof seen === 'undefined') {\n seen = [];\n } else if (indexOf(seen, obj) >= 0) {\n return '[Circular]';\n }\n\n function inspect(value, from, noIndent) {\n if (from) {\n seen = $arrSlice.call(seen);\n seen.push(from);\n }\n if (noIndent) {\n var newOpts = {\n depth: opts.depth\n };\n if (has(opts, 'quoteStyle')) {\n newOpts.quoteStyle = opts.quoteStyle;\n }\n return inspect_(value, newOpts, depth + 1, seen);\n }\n return inspect_(value, opts, depth + 1, seen);\n }\n\n if (typeof obj === 'function' && !isRegExp(obj)) { // in older engines, regexes are callable\n var name = nameOf(obj);\n var keys = arrObjKeys(obj, inspect);\n return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');\n }\n if (isSymbol(obj)) {\n var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\\(.*\\))_[^)]*$/, '$1') : symToString.call(obj);\n return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;\n }\n if (isElement(obj)) {\n var s = '<' + $toLowerCase.call(String(obj.nodeName));\n var attrs = obj.attributes || [];\n for (var i = 0; i < attrs.length; i++) {\n s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);\n }\n s += '>';\n if (obj.childNodes && obj.childNodes.length) { s += '...'; }\n s += '';\n return s;\n }\n if (isArray(obj)) {\n if (obj.length === 0) { return '[]'; }\n var xs = arrObjKeys(obj, inspect);\n if (indent && !singleLineValues(xs)) {\n return '[' + indentedJoin(xs, indent) + ']';\n }\n return '[ ' + $join.call(xs, ', ') + ' ]';\n }\n if (isError(obj)) {\n var parts = arrObjKeys(obj, inspect);\n if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {\n return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';\n }\n if (parts.length === 0) { return '[' + String(obj) + ']'; }\n return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';\n }\n if (typeof obj === 'object' && customInspect) {\n if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {\n return utilInspect(obj, { depth: maxDepth - depth });\n } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {\n return obj.inspect();\n }\n }\n if (isMap(obj)) {\n var mapParts = [];\n if (mapForEach) {\n mapForEach.call(obj, function (value, key) {\n mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));\n });\n }\n return collectionOf('Map', mapSize.call(obj), mapParts, indent);\n }\n if (isSet(obj)) {\n var setParts = [];\n if (setForEach) {\n setForEach.call(obj, function (value) {\n setParts.push(inspect(value, obj));\n });\n }\n return collectionOf('Set', setSize.call(obj), setParts, indent);\n }\n if (isWeakMap(obj)) {\n return weakCollectionOf('WeakMap');\n }\n if (isWeakSet(obj)) {\n return weakCollectionOf('WeakSet');\n }\n if (isWeakRef(obj)) {\n return weakCollectionOf('WeakRef');\n }\n if (isNumber(obj)) {\n return markBoxed(inspect(Number(obj)));\n }\n if (isBigInt(obj)) {\n return markBoxed(inspect(bigIntValueOf.call(obj)));\n }\n if (isBoolean(obj)) {\n return markBoxed(booleanValueOf.call(obj));\n }\n if (isString(obj)) {\n return markBoxed(inspect(String(obj)));\n }\n // note: in IE 8, sometimes `global !== window` but both are the prototypes of each other\n /* eslint-env browser */\n if (typeof window !== 'undefined' && obj === window) {\n return '{ [object Window] }';\n }\n if (obj === global) {\n return '{ [object globalThis] }';\n }\n if (!isDate(obj) && !isRegExp(obj)) {\n var ys = arrObjKeys(obj, inspect);\n var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;\n var protoTag = obj instanceof Object ? '' : 'null prototype';\n var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';\n var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';\n var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');\n if (ys.length === 0) { return tag + '{}'; }\n if (indent) {\n return tag + '{' + indentedJoin(ys, indent) + '}';\n }\n return tag + '{ ' + $join.call(ys, ', ') + ' }';\n }\n return String(obj);\n};\n\nfunction wrapQuotes(s, defaultStyle, opts) {\n var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '\"' : \"'\";\n return quoteChar + s + quoteChar;\n}\n\nfunction quote(s) {\n return $replace.call(String(s), /\"/g, '"');\n}\n\nfunction isArray(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isRegExp(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\n\n// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives\nfunction isSymbol(obj) {\n if (hasShammedSymbols) {\n return obj && typeof obj === 'object' && obj instanceof Symbol;\n }\n if (typeof obj === 'symbol') {\n return true;\n }\n if (!obj || typeof obj !== 'object' || !symToString) {\n return false;\n }\n try {\n symToString.call(obj);\n return true;\n } catch (e) {}\n return false;\n}\n\nfunction isBigInt(obj) {\n if (!obj || typeof obj !== 'object' || !bigIntValueOf) {\n return false;\n }\n try {\n bigIntValueOf.call(obj);\n return true;\n } catch (e) {}\n return false;\n}\n\nvar hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };\nfunction has(obj, key) {\n return hasOwn.call(obj, key);\n}\n\nfunction toStr(obj) {\n return objectToString.call(obj);\n}\n\nfunction nameOf(f) {\n if (f.name) { return f.name; }\n var m = $match.call(functionToString.call(f), /^function\\s*([\\w$]+)/);\n if (m) { return m[1]; }\n return null;\n}\n\nfunction indexOf(xs, x) {\n if (xs.indexOf) { return xs.indexOf(x); }\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) { return i; }\n }\n return -1;\n}\n\nfunction isMap(x) {\n if (!mapSize || !x || typeof x !== 'object') {\n return false;\n }\n try {\n mapSize.call(x);\n try {\n setSize.call(x);\n } catch (s) {\n return true;\n }\n return x instanceof Map; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isWeakMap(x) {\n if (!weakMapHas || !x || typeof x !== 'object') {\n return false;\n }\n try {\n weakMapHas.call(x, weakMapHas);\n try {\n weakSetHas.call(x, weakSetHas);\n } catch (s) {\n return true;\n }\n return x instanceof WeakMap; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isWeakRef(x) {\n if (!weakRefDeref || !x || typeof x !== 'object') {\n return false;\n }\n try {\n weakRefDeref.call(x);\n return true;\n } catch (e) {}\n return false;\n}\n\nfunction isSet(x) {\n if (!setSize || !x || typeof x !== 'object') {\n return false;\n }\n try {\n setSize.call(x);\n try {\n mapSize.call(x);\n } catch (m) {\n return true;\n }\n return x instanceof Set; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isWeakSet(x) {\n if (!weakSetHas || !x || typeof x !== 'object') {\n return false;\n }\n try {\n weakSetHas.call(x, weakSetHas);\n try {\n weakMapHas.call(x, weakMapHas);\n } catch (s) {\n return true;\n }\n return x instanceof WeakSet; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isElement(x) {\n if (!x || typeof x !== 'object') { return false; }\n if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {\n return true;\n }\n return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';\n}\n\nfunction inspectString(str, opts) {\n if (str.length > opts.maxStringLength) {\n var remaining = str.length - opts.maxStringLength;\n var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');\n return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;\n }\n // eslint-disable-next-line no-control-regex\n var s = $replace.call($replace.call(str, /(['\\\\])/g, '\\\\$1'), /[\\x00-\\x1f]/g, lowbyte);\n return wrapQuotes(s, 'single', opts);\n}\n\nfunction lowbyte(c) {\n var n = c.charCodeAt(0);\n var x = {\n 8: 'b',\n 9: 't',\n 10: 'n',\n 12: 'f',\n 13: 'r'\n }[n];\n if (x) { return '\\\\' + x; }\n return '\\\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));\n}\n\nfunction markBoxed(str) {\n return 'Object(' + str + ')';\n}\n\nfunction weakCollectionOf(type) {\n return type + ' { ? }';\n}\n\nfunction collectionOf(type, size, entries, indent) {\n var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');\n return type + ' (' + size + ') {' + joinedEntries + '}';\n}\n\nfunction singleLineValues(xs) {\n for (var i = 0; i < xs.length; i++) {\n if (indexOf(xs[i], '\\n') >= 0) {\n return false;\n }\n }\n return true;\n}\n\nfunction getIndent(opts, depth) {\n var baseIndent;\n if (opts.indent === '\\t') {\n baseIndent = '\\t';\n } else if (typeof opts.indent === 'number' && opts.indent > 0) {\n baseIndent = $join.call(Array(opts.indent + 1), ' ');\n } else {\n return null;\n }\n return {\n base: baseIndent,\n prev: $join.call(Array(depth + 1), baseIndent)\n };\n}\n\nfunction indentedJoin(xs, indent) {\n if (xs.length === 0) { return ''; }\n var lineJoiner = '\\n' + indent.prev + indent.base;\n return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\\n' + indent.prev;\n}\n\nfunction arrObjKeys(obj, inspect) {\n var isArr = isArray(obj);\n var xs = [];\n if (isArr) {\n xs.length = obj.length;\n for (var i = 0; i < obj.length; i++) {\n xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';\n }\n }\n var syms = typeof gOPS === 'function' ? gOPS(obj) : [];\n var symMap;\n if (hasShammedSymbols) {\n symMap = {};\n for (var k = 0; k < syms.length; k++) {\n symMap['$' + syms[k]] = syms[k];\n }\n }\n\n for (var key in obj) { // eslint-disable-line no-restricted-syntax\n if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue\n if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue\n if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {\n // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section\n continue; // eslint-disable-line no-restricted-syntax, no-continue\n } else if ($test.call(/[^\\w$]/, key)) {\n xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));\n } else {\n xs.push(key + ': ' + inspect(obj[key], obj));\n }\n }\n if (typeof gOPS === 'function') {\n for (var j = 0; j < syms.length; j++) {\n if (isEnumerable.call(obj, syms[j])) {\n xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));\n }\n }\n }\n return xs;\n}\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\nvar callBound = require('call-bind/callBound');\nvar inspect = require('object-inspect');\n\nvar $TypeError = require('es-errors/type');\nvar $WeakMap = GetIntrinsic('%WeakMap%', true);\nvar $Map = GetIntrinsic('%Map%', true);\n\nvar $weakMapGet = callBound('WeakMap.prototype.get', true);\nvar $weakMapSet = callBound('WeakMap.prototype.set', true);\nvar $weakMapHas = callBound('WeakMap.prototype.has', true);\nvar $mapGet = callBound('Map.prototype.get', true);\nvar $mapSet = callBound('Map.prototype.set', true);\nvar $mapHas = callBound('Map.prototype.has', true);\n\n/*\n* This function traverses the list returning the node corresponding to the given key.\n*\n* That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list. By doing so, all the recently used nodes can be accessed relatively quickly.\n*/\n/** @type {import('.').listGetNode} */\nvar listGetNode = function (list, key) { // eslint-disable-line consistent-return\n\t/** @type {typeof list | NonNullable<(typeof list)['next']>} */\n\tvar prev = list;\n\t/** @type {(typeof list)['next']} */\n\tvar curr;\n\tfor (; (curr = prev.next) !== null; prev = curr) {\n\t\tif (curr.key === key) {\n\t\t\tprev.next = curr.next;\n\t\t\t// eslint-disable-next-line no-extra-parens\n\t\t\tcurr.next = /** @type {NonNullable} */ (list.next);\n\t\t\tlist.next = curr; // eslint-disable-line no-param-reassign\n\t\t\treturn curr;\n\t\t}\n\t}\n};\n\n/** @type {import('.').listGet} */\nvar listGet = function (objects, key) {\n\tvar node = listGetNode(objects, key);\n\treturn node && node.value;\n};\n/** @type {import('.').listSet} */\nvar listSet = function (objects, key, value) {\n\tvar node = listGetNode(objects, key);\n\tif (node) {\n\t\tnode.value = value;\n\t} else {\n\t\t// Prepend the new node to the beginning of the list\n\t\tobjects.next = /** @type {import('.').ListNode} */ ({ // eslint-disable-line no-param-reassign, no-extra-parens\n\t\t\tkey: key,\n\t\t\tnext: objects.next,\n\t\t\tvalue: value\n\t\t});\n\t}\n};\n/** @type {import('.').listHas} */\nvar listHas = function (objects, key) {\n\treturn !!listGetNode(objects, key);\n};\n\n/** @type {import('.')} */\nmodule.exports = function getSideChannel() {\n\t/** @type {WeakMap} */ var $wm;\n\t/** @type {Map} */ var $m;\n\t/** @type {import('.').RootNode} */ var $o;\n\n\t/** @type {import('.').Channel} */\n\tvar channel = {\n\t\tassert: function (key) {\n\t\t\tif (!channel.has(key)) {\n\t\t\t\tthrow new $TypeError('Side channel does not contain ' + inspect(key));\n\t\t\t}\n\t\t},\n\t\tget: function (key) { // eslint-disable-line consistent-return\n\t\t\tif ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {\n\t\t\t\tif ($wm) {\n\t\t\t\t\treturn $weakMapGet($wm, key);\n\t\t\t\t}\n\t\t\t} else if ($Map) {\n\t\t\t\tif ($m) {\n\t\t\t\t\treturn $mapGet($m, key);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ($o) { // eslint-disable-line no-lonely-if\n\t\t\t\t\treturn listGet($o, key);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\thas: function (key) {\n\t\t\tif ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {\n\t\t\t\tif ($wm) {\n\t\t\t\t\treturn $weakMapHas($wm, key);\n\t\t\t\t}\n\t\t\t} else if ($Map) {\n\t\t\t\tif ($m) {\n\t\t\t\t\treturn $mapHas($m, key);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ($o) { // eslint-disable-line no-lonely-if\n\t\t\t\t\treturn listHas($o, key);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\tset: function (key, value) {\n\t\t\tif ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {\n\t\t\t\tif (!$wm) {\n\t\t\t\t\t$wm = new $WeakMap();\n\t\t\t\t}\n\t\t\t\t$weakMapSet($wm, key, value);\n\t\t\t} else if ($Map) {\n\t\t\t\tif (!$m) {\n\t\t\t\t\t$m = new $Map();\n\t\t\t\t}\n\t\t\t\t$mapSet($m, key, value);\n\t\t\t} else {\n\t\t\t\tif (!$o) {\n\t\t\t\t\t// Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head\n\t\t\t\t\t$o = { key: {}, next: null };\n\t\t\t\t}\n\t\t\t\tlistSet($o, key, value);\n\t\t\t}\n\t\t}\n\t};\n\treturn channel;\n};\n","'use strict';\n\nvar replace = String.prototype.replace;\nvar percentTwenties = /%20/g;\n\nvar Format = {\n RFC1738: 'RFC1738',\n RFC3986: 'RFC3986'\n};\n\nmodule.exports = {\n 'default': Format.RFC3986,\n formatters: {\n RFC1738: function (value) {\n return replace.call(value, percentTwenties, '+');\n },\n RFC3986: function (value) {\n return String(value);\n }\n },\n RFC1738: Format.RFC1738,\n RFC3986: Format.RFC3986\n};\n","'use strict';\n\nvar formats = require('./formats');\n\nvar has = Object.prototype.hasOwnProperty;\nvar isArray = Array.isArray;\n\nvar hexTable = (function () {\n var array = [];\n for (var i = 0; i < 256; ++i) {\n array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());\n }\n\n return array;\n}());\n\nvar compactQueue = function compactQueue(queue) {\n while (queue.length > 1) {\n var item = queue.pop();\n var obj = item.obj[item.prop];\n\n if (isArray(obj)) {\n var compacted = [];\n\n for (var j = 0; j < obj.length; ++j) {\n if (typeof obj[j] !== 'undefined') {\n compacted.push(obj[j]);\n }\n }\n\n item.obj[item.prop] = compacted;\n }\n }\n};\n\nvar arrayToObject = function arrayToObject(source, options) {\n var obj = options && options.plainObjects ? Object.create(null) : {};\n for (var i = 0; i < source.length; ++i) {\n if (typeof source[i] !== 'undefined') {\n obj[i] = source[i];\n }\n }\n\n return obj;\n};\n\nvar merge = function merge(target, source, options) {\n /* eslint no-param-reassign: 0 */\n if (!source) {\n return target;\n }\n\n if (typeof source !== 'object') {\n if (isArray(target)) {\n target.push(source);\n } else if (target && typeof target === 'object') {\n if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) {\n target[source] = true;\n }\n } else {\n return [target, source];\n }\n\n return target;\n }\n\n if (!target || typeof target !== 'object') {\n return [target].concat(source);\n }\n\n var mergeTarget = target;\n if (isArray(target) && !isArray(source)) {\n mergeTarget = arrayToObject(target, options);\n }\n\n if (isArray(target) && isArray(source)) {\n source.forEach(function (item, i) {\n if (has.call(target, i)) {\n var targetItem = target[i];\n if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {\n target[i] = merge(targetItem, item, options);\n } else {\n target.push(item);\n }\n } else {\n target[i] = item;\n }\n });\n return target;\n }\n\n return Object.keys(source).reduce(function (acc, key) {\n var value = source[key];\n\n if (has.call(acc, key)) {\n acc[key] = merge(acc[key], value, options);\n } else {\n acc[key] = value;\n }\n return acc;\n }, mergeTarget);\n};\n\nvar assign = function assignSingleSource(target, source) {\n return Object.keys(source).reduce(function (acc, key) {\n acc[key] = source[key];\n return acc;\n }, target);\n};\n\nvar decode = function (str, decoder, charset) {\n var strWithoutPlus = str.replace(/\\+/g, ' ');\n if (charset === 'iso-8859-1') {\n // unescape never throws, no try...catch needed:\n return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);\n }\n // utf-8\n try {\n return decodeURIComponent(strWithoutPlus);\n } catch (e) {\n return strWithoutPlus;\n }\n};\n\nvar limit = 1024;\n\n/* eslint operator-linebreak: [2, \"before\"] */\n\nvar encode = function encode(str, defaultEncoder, charset, kind, format) {\n // This code was originally written by Brian White (mscdex) for the io.js core querystring library.\n // It has been adapted here for stricter adherence to RFC 3986\n if (str.length === 0) {\n return str;\n }\n\n var string = str;\n if (typeof str === 'symbol') {\n string = Symbol.prototype.toString.call(str);\n } else if (typeof str !== 'string') {\n string = String(str);\n }\n\n if (charset === 'iso-8859-1') {\n return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {\n return '%26%23' + parseInt($0.slice(2), 16) + '%3B';\n });\n }\n\n var out = '';\n for (var j = 0; j < string.length; j += limit) {\n var segment = string.length >= limit ? string.slice(j, j + limit) : string;\n var arr = [];\n\n for (var i = 0; i < segment.length; ++i) {\n var c = segment.charCodeAt(i);\n if (\n c === 0x2D // -\n || c === 0x2E // .\n || c === 0x5F // _\n || c === 0x7E // ~\n || (c >= 0x30 && c <= 0x39) // 0-9\n || (c >= 0x41 && c <= 0x5A) // a-z\n || (c >= 0x61 && c <= 0x7A) // A-Z\n || (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( )\n ) {\n arr[arr.length] = segment.charAt(i);\n continue;\n }\n\n if (c < 0x80) {\n arr[arr.length] = hexTable[c];\n continue;\n }\n\n if (c < 0x800) {\n arr[arr.length] = hexTable[0xC0 | (c >> 6)]\n + hexTable[0x80 | (c & 0x3F)];\n continue;\n }\n\n if (c < 0xD800 || c >= 0xE000) {\n arr[arr.length] = hexTable[0xE0 | (c >> 12)]\n + hexTable[0x80 | ((c >> 6) & 0x3F)]\n + hexTable[0x80 | (c & 0x3F)];\n continue;\n }\n\n i += 1;\n c = 0x10000 + (((c & 0x3FF) << 10) | (segment.charCodeAt(i) & 0x3FF));\n\n arr[arr.length] = hexTable[0xF0 | (c >> 18)]\n + hexTable[0x80 | ((c >> 12) & 0x3F)]\n + hexTable[0x80 | ((c >> 6) & 0x3F)]\n + hexTable[0x80 | (c & 0x3F)];\n }\n\n out += arr.join('');\n }\n\n return out;\n};\n\nvar compact = function compact(value) {\n var queue = [{ obj: { o: value }, prop: 'o' }];\n var refs = [];\n\n for (var i = 0; i < queue.length; ++i) {\n var item = queue[i];\n var obj = item.obj[item.prop];\n\n var keys = Object.keys(obj);\n for (var j = 0; j < keys.length; ++j) {\n var key = keys[j];\n var val = obj[key];\n if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {\n queue.push({ obj: obj, prop: key });\n refs.push(val);\n }\n }\n }\n\n compactQueue(queue);\n\n return value;\n};\n\nvar isRegExp = function isRegExp(obj) {\n return Object.prototype.toString.call(obj) === '[object RegExp]';\n};\n\nvar isBuffer = function isBuffer(obj) {\n if (!obj || typeof obj !== 'object') {\n return false;\n }\n\n return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));\n};\n\nvar combine = function combine(a, b) {\n return [].concat(a, b);\n};\n\nvar maybeMap = function maybeMap(val, fn) {\n if (isArray(val)) {\n var mapped = [];\n for (var i = 0; i < val.length; i += 1) {\n mapped.push(fn(val[i]));\n }\n return mapped;\n }\n return fn(val);\n};\n\nmodule.exports = {\n arrayToObject: arrayToObject,\n assign: assign,\n combine: combine,\n compact: compact,\n decode: decode,\n encode: encode,\n isBuffer: isBuffer,\n isRegExp: isRegExp,\n maybeMap: maybeMap,\n merge: merge\n};\n","'use strict';\n\nvar getSideChannel = require('side-channel');\nvar utils = require('./utils');\nvar formats = require('./formats');\nvar has = Object.prototype.hasOwnProperty;\n\nvar arrayPrefixGenerators = {\n brackets: function brackets(prefix) {\n return prefix + '[]';\n },\n comma: 'comma',\n indices: function indices(prefix, key) {\n return prefix + '[' + key + ']';\n },\n repeat: function repeat(prefix) {\n return prefix;\n }\n};\n\nvar isArray = Array.isArray;\nvar push = Array.prototype.push;\nvar pushToArray = function (arr, valueOrArray) {\n push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);\n};\n\nvar toISO = Date.prototype.toISOString;\n\nvar defaultFormat = formats['default'];\nvar defaults = {\n addQueryPrefix: false,\n allowDots: false,\n allowEmptyArrays: false,\n arrayFormat: 'indices',\n charset: 'utf-8',\n charsetSentinel: false,\n delimiter: '&',\n encode: true,\n encodeDotInKeys: false,\n encoder: utils.encode,\n encodeValuesOnly: false,\n format: defaultFormat,\n formatter: formats.formatters[defaultFormat],\n // deprecated\n indices: false,\n serializeDate: function serializeDate(date) {\n return toISO.call(date);\n },\n skipNulls: false,\n strictNullHandling: false\n};\n\nvar isNonNullishPrimitive = function isNonNullishPrimitive(v) {\n return typeof v === 'string'\n || typeof v === 'number'\n || typeof v === 'boolean'\n || typeof v === 'symbol'\n || typeof v === 'bigint';\n};\n\nvar sentinel = {};\n\nvar stringify = function stringify(\n object,\n prefix,\n generateArrayPrefix,\n commaRoundTrip,\n allowEmptyArrays,\n strictNullHandling,\n skipNulls,\n encodeDotInKeys,\n encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n format,\n formatter,\n encodeValuesOnly,\n charset,\n sideChannel\n) {\n var obj = object;\n\n var tmpSc = sideChannel;\n var step = 0;\n var findFlag = false;\n while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {\n // Where object last appeared in the ref tree\n var pos = tmpSc.get(object);\n step += 1;\n if (typeof pos !== 'undefined') {\n if (pos === step) {\n throw new RangeError('Cyclic object value');\n } else {\n findFlag = true; // Break while\n }\n }\n if (typeof tmpSc.get(sentinel) === 'undefined') {\n step = 0;\n }\n }\n\n if (typeof filter === 'function') {\n obj = filter(prefix, obj);\n } else if (obj instanceof Date) {\n obj = serializeDate(obj);\n } else if (generateArrayPrefix === 'comma' && isArray(obj)) {\n obj = utils.maybeMap(obj, function (value) {\n if (value instanceof Date) {\n return serializeDate(value);\n }\n return value;\n });\n }\n\n if (obj === null) {\n if (strictNullHandling) {\n return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix;\n }\n\n obj = '';\n }\n\n if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {\n if (encoder) {\n var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);\n return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];\n }\n return [formatter(prefix) + '=' + formatter(String(obj))];\n }\n\n var values = [];\n\n if (typeof obj === 'undefined') {\n return values;\n }\n\n var objKeys;\n if (generateArrayPrefix === 'comma' && isArray(obj)) {\n // we need to join elements in\n if (encodeValuesOnly && encoder) {\n obj = utils.maybeMap(obj, encoder);\n }\n objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];\n } else if (isArray(filter)) {\n objKeys = filter;\n } else {\n var keys = Object.keys(obj);\n objKeys = sort ? keys.sort(sort) : keys;\n }\n\n var encodedPrefix = encodeDotInKeys ? prefix.replace(/\\./g, '%2E') : prefix;\n\n var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + '[]' : encodedPrefix;\n\n if (allowEmptyArrays && isArray(obj) && obj.length === 0) {\n return adjustedPrefix + '[]';\n }\n\n for (var j = 0; j < objKeys.length; ++j) {\n var key = objKeys[j];\n var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];\n\n if (skipNulls && value === null) {\n continue;\n }\n\n var encodedKey = allowDots && encodeDotInKeys ? key.replace(/\\./g, '%2E') : key;\n var keyPrefix = isArray(obj)\n ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix\n : adjustedPrefix + (allowDots ? '.' + encodedKey : '[' + encodedKey + ']');\n\n sideChannel.set(object, step);\n var valueSideChannel = getSideChannel();\n valueSideChannel.set(sentinel, sideChannel);\n pushToArray(values, stringify(\n value,\n keyPrefix,\n generateArrayPrefix,\n commaRoundTrip,\n allowEmptyArrays,\n strictNullHandling,\n skipNulls,\n encodeDotInKeys,\n generateArrayPrefix === 'comma' && encodeValuesOnly && isArray(obj) ? null : encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n format,\n formatter,\n encodeValuesOnly,\n charset,\n valueSideChannel\n ));\n }\n\n return values;\n};\n\nvar normalizeStringifyOptions = function normalizeStringifyOptions(opts) {\n if (!opts) {\n return defaults;\n }\n\n if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') {\n throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');\n }\n\n if (typeof opts.encodeDotInKeys !== 'undefined' && typeof opts.encodeDotInKeys !== 'boolean') {\n throw new TypeError('`encodeDotInKeys` option can only be `true` or `false`, when provided');\n }\n\n if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {\n throw new TypeError('Encoder has to be a function.');\n }\n\n var charset = opts.charset || defaults.charset;\n if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {\n throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');\n }\n\n var format = formats['default'];\n if (typeof opts.format !== 'undefined') {\n if (!has.call(formats.formatters, opts.format)) {\n throw new TypeError('Unknown format option provided.');\n }\n format = opts.format;\n }\n var formatter = formats.formatters[format];\n\n var filter = defaults.filter;\n if (typeof opts.filter === 'function' || isArray(opts.filter)) {\n filter = opts.filter;\n }\n\n var arrayFormat;\n if (opts.arrayFormat in arrayPrefixGenerators) {\n arrayFormat = opts.arrayFormat;\n } else if ('indices' in opts) {\n arrayFormat = opts.indices ? 'indices' : 'repeat';\n } else {\n arrayFormat = defaults.arrayFormat;\n }\n\n if ('commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {\n throw new TypeError('`commaRoundTrip` must be a boolean, or absent');\n }\n\n var allowDots = typeof opts.allowDots === 'undefined' ? opts.encodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;\n\n return {\n addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix,\n allowDots: allowDots,\n allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,\n arrayFormat: arrayFormat,\n charset: charset,\n charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,\n commaRoundTrip: opts.commaRoundTrip,\n delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter,\n encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode,\n encodeDotInKeys: typeof opts.encodeDotInKeys === 'boolean' ? opts.encodeDotInKeys : defaults.encodeDotInKeys,\n encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,\n encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,\n filter: filter,\n format: format,\n formatter: formatter,\n serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate,\n skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls,\n sort: typeof opts.sort === 'function' ? opts.sort : null,\n strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling\n };\n};\n\nmodule.exports = function (object, opts) {\n var obj = object;\n var options = normalizeStringifyOptions(opts);\n\n var objKeys;\n var filter;\n\n if (typeof options.filter === 'function') {\n filter = options.filter;\n obj = filter('', obj);\n } else if (isArray(options.filter)) {\n filter = options.filter;\n objKeys = filter;\n }\n\n var keys = [];\n\n if (typeof obj !== 'object' || obj === null) {\n return '';\n }\n\n var generateArrayPrefix = arrayPrefixGenerators[options.arrayFormat];\n var commaRoundTrip = generateArrayPrefix === 'comma' && options.commaRoundTrip;\n\n if (!objKeys) {\n objKeys = Object.keys(obj);\n }\n\n if (options.sort) {\n objKeys.sort(options.sort);\n }\n\n var sideChannel = getSideChannel();\n for (var i = 0; i < objKeys.length; ++i) {\n var key = objKeys[i];\n\n if (options.skipNulls && obj[key] === null) {\n continue;\n }\n pushToArray(keys, stringify(\n obj[key],\n key,\n generateArrayPrefix,\n commaRoundTrip,\n options.allowEmptyArrays,\n options.strictNullHandling,\n options.skipNulls,\n options.encodeDotInKeys,\n options.encode ? options.encoder : null,\n options.filter,\n options.sort,\n options.allowDots,\n options.serializeDate,\n options.format,\n options.formatter,\n options.encodeValuesOnly,\n options.charset,\n sideChannel\n ));\n }\n\n var joined = keys.join(options.delimiter);\n var prefix = options.addQueryPrefix === true ? '?' : '';\n\n if (options.charsetSentinel) {\n if (options.charset === 'iso-8859-1') {\n // encodeURIComponent('✓'), the \"numeric entity\" representation of a checkmark\n prefix += 'utf8=%26%2310003%3B&';\n } else {\n // encodeURIComponent('✓')\n prefix += 'utf8=%E2%9C%93&';\n }\n }\n\n return joined.length > 0 ? prefix + joined : '';\n};\n","'use strict';\n\nvar utils = require('./utils');\n\nvar has = Object.prototype.hasOwnProperty;\nvar isArray = Array.isArray;\n\nvar defaults = {\n allowDots: false,\n allowEmptyArrays: false,\n allowPrototypes: false,\n allowSparse: false,\n arrayLimit: 20,\n charset: 'utf-8',\n charsetSentinel: false,\n comma: false,\n decodeDotInKeys: false,\n decoder: utils.decode,\n delimiter: '&',\n depth: 5,\n duplicates: 'combine',\n ignoreQueryPrefix: false,\n interpretNumericEntities: false,\n parameterLimit: 1000,\n parseArrays: true,\n plainObjects: false,\n strictDepth: false,\n strictNullHandling: false\n};\n\nvar interpretNumericEntities = function (str) {\n return str.replace(/&#(\\d+);/g, function ($0, numberStr) {\n return String.fromCharCode(parseInt(numberStr, 10));\n });\n};\n\nvar parseArrayValue = function (val, options) {\n if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {\n return val.split(',');\n }\n\n return val;\n};\n\n// This is what browsers will submit when the ✓ character occurs in an\n// application/x-www-form-urlencoded body and the encoding of the page containing\n// the form is iso-8859-1, or when the submitted form has an accept-charset\n// attribute of iso-8859-1. Presumably also with other charsets that do not contain\n// the ✓ character, such as us-ascii.\nvar isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓')\n\n// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.\nvar charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')\n\nvar parseValues = function parseQueryStringValues(str, options) {\n var obj = { __proto__: null };\n\n var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\\?/, '') : str;\n cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');\n var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;\n var parts = cleanStr.split(options.delimiter, limit);\n var skipIndex = -1; // Keep track of where the utf8 sentinel was found\n var i;\n\n var charset = options.charset;\n if (options.charsetSentinel) {\n for (i = 0; i < parts.length; ++i) {\n if (parts[i].indexOf('utf8=') === 0) {\n if (parts[i] === charsetSentinel) {\n charset = 'utf-8';\n } else if (parts[i] === isoSentinel) {\n charset = 'iso-8859-1';\n }\n skipIndex = i;\n i = parts.length; // The eslint settings do not allow break;\n }\n }\n }\n\n for (i = 0; i < parts.length; ++i) {\n if (i === skipIndex) {\n continue;\n }\n var part = parts[i];\n\n var bracketEqualsPos = part.indexOf(']=');\n var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;\n\n var key, val;\n if (pos === -1) {\n key = options.decoder(part, defaults.decoder, charset, 'key');\n val = options.strictNullHandling ? null : '';\n } else {\n key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');\n val = utils.maybeMap(\n parseArrayValue(part.slice(pos + 1), options),\n function (encodedVal) {\n return options.decoder(encodedVal, defaults.decoder, charset, 'value');\n }\n );\n }\n\n if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {\n val = interpretNumericEntities(val);\n }\n\n if (part.indexOf('[]=') > -1) {\n val = isArray(val) ? [val] : val;\n }\n\n var existing = has.call(obj, key);\n if (existing && options.duplicates === 'combine') {\n obj[key] = utils.combine(obj[key], val);\n } else if (!existing || options.duplicates === 'last') {\n obj[key] = val;\n }\n }\n\n return obj;\n};\n\nvar parseObject = function (chain, val, options, valuesParsed) {\n var leaf = valuesParsed ? val : parseArrayValue(val, options);\n\n for (var i = chain.length - 1; i >= 0; --i) {\n var obj;\n var root = chain[i];\n\n if (root === '[]' && options.parseArrays) {\n obj = options.allowEmptyArrays && (leaf === '' || (options.strictNullHandling && leaf === null))\n ? []\n : [].concat(leaf);\n } else {\n obj = options.plainObjects ? Object.create(null) : {};\n var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;\n var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, '.') : cleanRoot;\n var index = parseInt(decodedRoot, 10);\n if (!options.parseArrays && decodedRoot === '') {\n obj = { 0: leaf };\n } else if (\n !isNaN(index)\n && root !== decodedRoot\n && String(index) === decodedRoot\n && index >= 0\n && (options.parseArrays && index <= options.arrayLimit)\n ) {\n obj = [];\n obj[index] = leaf;\n } else if (decodedRoot !== '__proto__') {\n obj[decodedRoot] = leaf;\n }\n }\n\n leaf = obj;\n }\n\n return leaf;\n};\n\nvar parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {\n if (!givenKey) {\n return;\n }\n\n // Transform dot notation to bracket notation\n var key = options.allowDots ? givenKey.replace(/\\.([^.[]+)/g, '[$1]') : givenKey;\n\n // The regex chunks\n\n var brackets = /(\\[[^[\\]]*])/;\n var child = /(\\[[^[\\]]*])/g;\n\n // Get the parent\n\n var segment = options.depth > 0 && brackets.exec(key);\n var parent = segment ? key.slice(0, segment.index) : key;\n\n // Stash the parent if it exists\n\n var keys = [];\n if (parent) {\n // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties\n if (!options.plainObjects && has.call(Object.prototype, parent)) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n\n keys.push(parent);\n }\n\n // Loop through children appending to the array until we hit depth\n\n var i = 0;\n while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {\n i += 1;\n if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n keys.push(segment[1]);\n }\n\n // If there's a remainder, check strictDepth option for throw, else just add whatever is left\n\n if (segment) {\n if (options.strictDepth === true) {\n throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');\n }\n keys.push('[' + key.slice(segment.index) + ']');\n }\n\n return parseObject(keys, val, options, valuesParsed);\n};\n\nvar normalizeParseOptions = function normalizeParseOptions(opts) {\n if (!opts) {\n return defaults;\n }\n\n if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') {\n throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');\n }\n\n if (typeof opts.decodeDotInKeys !== 'undefined' && typeof opts.decodeDotInKeys !== 'boolean') {\n throw new TypeError('`decodeDotInKeys` option can only be `true` or `false`, when provided');\n }\n\n if (opts.decoder !== null && typeof opts.decoder !== 'undefined' && typeof opts.decoder !== 'function') {\n throw new TypeError('Decoder has to be a function.');\n }\n\n if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {\n throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');\n }\n var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;\n\n var duplicates = typeof opts.duplicates === 'undefined' ? defaults.duplicates : opts.duplicates;\n\n if (duplicates !== 'combine' && duplicates !== 'first' && duplicates !== 'last') {\n throw new TypeError('The duplicates option must be either combine, first, or last');\n }\n\n var allowDots = typeof opts.allowDots === 'undefined' ? opts.decodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;\n\n return {\n allowDots: allowDots,\n allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,\n allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,\n allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,\n arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,\n charset: charset,\n charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,\n comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,\n decodeDotInKeys: typeof opts.decodeDotInKeys === 'boolean' ? opts.decodeDotInKeys : defaults.decodeDotInKeys,\n decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,\n delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,\n // eslint-disable-next-line no-implicit-coercion, no-extra-parens\n depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,\n duplicates: duplicates,\n ignoreQueryPrefix: opts.ignoreQueryPrefix === true,\n interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,\n parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,\n parseArrays: opts.parseArrays !== false,\n plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,\n strictDepth: typeof opts.strictDepth === 'boolean' ? !!opts.strictDepth : defaults.strictDepth,\n strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling\n };\n};\n\nmodule.exports = function (str, opts) {\n var options = normalizeParseOptions(opts);\n\n if (str === '' || str === null || typeof str === 'undefined') {\n return options.plainObjects ? Object.create(null) : {};\n }\n\n var tempObj = typeof str === 'string' ? parseValues(str, options) : str;\n var obj = options.plainObjects ? Object.create(null) : {};\n\n // Iterate over the keys and setup the new object\n\n var keys = Object.keys(tempObj);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');\n obj = utils.merge(obj, newObj, options);\n }\n\n if (options.allowSparse === true) {\n return obj;\n }\n\n return utils.compact(obj);\n};\n","'use strict';\n\nvar stringify = require('./stringify');\nvar parse = require('./parse');\nvar formats = require('./formats');\n\nmodule.exports = {\n formats: formats,\n parse: parse,\n stringify: stringify\n};\n","/*\n * Copyright Joyent, Inc. and other Node contributors.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to permit\n * persons to whom the Software is furnished to do so, subject to the\n * following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n * USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n'use strict';\n\nvar punycode = require('punycode/');\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n/*\n * define these here so at least they only have to be\n * compiled once on the first module load.\n */\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^?\\s]*)(\\?[^\\s]*)?$/,\n\n /*\n * RFC 2396: characters reserved for delimiting URLs.\n * We actually just auto-escape these.\n */\n delims = [\n '<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'\n ],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = [\n '{', '}', '|', '\\\\', '^', '`'\n ].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = ['\\''].concat(unwise),\n /*\n * Characters that are never ever allowed in a hostname.\n * Note that any invalid chars are also handled, but these\n * are the ones that are *expected* to be seen, so we fast-path\n * them.\n */\n nonHostChars = [\n '%', '/', '?', ';', '#'\n ].concat(autoEscape),\n hostEndingChars = [\n '/', '?', '#'\n ],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n unsafeProtocol = {\n javascript: true,\n 'javascript:': true\n },\n // protocols that never have a hostname.\n hostlessProtocol = {\n javascript: true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n http: true,\n https: true,\n ftp: true,\n gopher: true,\n file: true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n },\n querystring = require('qs');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && typeof url === 'object' && url instanceof Url) { return url; }\n\n var u = new Url();\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function (url, parseQueryString, slashesDenoteHost) {\n if (typeof url !== 'string') {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n }\n\n /*\n * Copy chrome, IE, opera backslash-handling behavior.\n * Back slashes before the query string get converted to forward slashes\n * See: https://code.google.com/p/chromium/issues/detail?id=25916\n */\n var queryIndex = url.indexOf('?'),\n splitter = queryIndex !== -1 && queryIndex < url.indexOf('#') ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n\n var rest = url;\n\n /*\n * trim before proceeding.\n * This is to support parse stuff like \" http://foo.com \\n\"\n */\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.path = rest;\n this.href = rest;\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n if (parseQueryString) {\n this.query = querystring.parse(this.search.substr(1));\n } else {\n this.query = this.search.substr(1);\n }\n } else if (parseQueryString) {\n this.search = '';\n this.query = {};\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n }\n\n /*\n * figure out if it's got a host\n * user@server is *always* interpreted as a hostname, and url\n * resolution will treat //foo/bar as host=foo,path=bar because that's\n * how the browser resolves relative URLs.\n */\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@/]+@[^@/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] && (slashes || (proto && !slashedProtocol[proto]))) {\n\n /*\n * there's a hostname.\n * the first instance of /, ?, ;, or # ends the host.\n *\n * If there is an @ in the hostname, then non-host chars *are* allowed\n * to the left of the last @ sign, unless some host-ending character\n * comes *before* the @-sign.\n * URLs are obnoxious.\n *\n * ex:\n * http://a@b@c/ => user:a@b host:c\n * http://a@b?@c => user:a host:c path:/?@c\n */\n\n /*\n * v0.12 TODO(isaacs): This is not quite how Chrome does things.\n * Review our test case against browsers more comprehensively.\n */\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) { hostEnd = hec; }\n }\n\n /*\n * at this point, either we have an explicit point where the\n * auth portion cannot go past, or the last @ char is the decider.\n */\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n /*\n * atSign must be in auth portion.\n * http://a@b/c@d => host:b auth:a path:/c@d\n */\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n /*\n * Now we have a portion which is definitely the auth.\n * Pull that off.\n */\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) { hostEnd = hec; }\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1) { hostEnd = rest.length; }\n\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost();\n\n /*\n * we've indicated that there is a hostname,\n * so even if it's empty, it has to be present.\n */\n this.hostname = this.hostname || '';\n\n /*\n * if hostname begins with [ and ends with ]\n * assume that it's an IPv6 address.\n */\n var ipv6Hostname = this.hostname[0] === '[' && this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) { continue; }\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n /*\n * we replace non-ASCII char with a temporary placeholder\n * we need this to make sure size of hostname is not\n * broken by replacing non-ASCII by nothing\n */\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n /*\n * IDNA Support: Returns a punycoded representation of \"domain\".\n * It only converts parts of the domain name that\n * have non-ASCII characters, i.e. it doesn't matter if\n * you call it with a domain that already is ASCII-only.\n */\n this.hostname = punycode.toASCII(this.hostname);\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host;\n\n /*\n * strip [ and ] from the hostname\n * the host field still retains them, though\n */\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n }\n\n /*\n * now rest is set to the post-host stuff.\n * chop off any delim chars.\n */\n if (!unsafeProtocol[lowerProto]) {\n\n /*\n * First, make 100% sure that any \"autoEscape\" chars get\n * escaped, even if encodeURIComponent doesn't think they\n * need to be.\n */\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1) { continue; }\n var esc = encodeURIComponent(ae);\n if (esc === ae) {\n esc = escape(ae);\n }\n rest = rest.split(ae).join(esc);\n }\n }\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n if (rest) { this.pathname = rest; }\n if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {\n this.pathname = '/';\n }\n\n // to support http.request\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n }\n\n // finally, reconstruct the href based on what has been validated.\n this.href = this.format();\n return this;\n};\n\n// format a parsed object into a url string\nfunction urlFormat(obj) {\n /*\n * ensure it's an object, and not a string url.\n * If it's an obj, this is a no-op.\n * this way, you can call url_format() on strings\n * to clean up potentially wonky urls.\n */\n if (typeof obj === 'string') { obj = urlParse(obj); }\n if (!(obj instanceof Url)) { return Url.prototype.format.call(obj); }\n return obj.format();\n}\n\nUrl.prototype.format = function () {\n var auth = this.auth || '';\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ? this.hostname : '[' + this.hostname + ']');\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query && typeof this.query === 'object' && Object.keys(this.query).length) {\n query = querystring.stringify(this.query, {\n arrayFormat: 'repeat',\n addQueryPrefix: false\n });\n }\n\n var search = this.search || (query && ('?' + query)) || '';\n\n if (protocol && protocol.substr(-1) !== ':') { protocol += ':'; }\n\n /*\n * only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n * unless they had them to begin with.\n */\n if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') { pathname = '/' + pathname; }\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') { hash = '#' + hash; }\n if (search && search.charAt(0) !== '?') { search = '?' + search; }\n\n pathname = pathname.replace(/[?#]/g, function (match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function (relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) { return relative; }\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function (relative) {\n if (typeof relative === 'string') {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n\n /*\n * hash is always overridden, no matter what.\n * even href=\"\" will remove it.\n */\n result.hash = relative.hash;\n\n // if the relative url is empty, then there's nothing left to do here.\n if (relative.href === '') {\n result.href = result.format();\n return result;\n }\n\n // hrefs like //foo/bar always cut to the protocol.\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol') { result[rkey] = relative[rkey]; }\n }\n\n // urlParse appends trailing / to urls like http://www.example.com\n if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {\n result.pathname = '/';\n result.path = result.pathname;\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n /*\n * if it's a known url protocol, then changing\n * the protocol does weird things\n * first, if it's not file:, then we MUST have a host,\n * and if there was a path\n * to begin with, then we MUST have a path.\n * if it is file:, then the host is dropped,\n * because that's known to be hostless.\n * anything else is assumed to be absolute.\n */\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n while (relPath.length && !(relative.host = relPath.shift())) { }\n if (!relative.host) { relative.host = ''; }\n if (!relative.hostname) { relative.hostname = ''; }\n if (relPath[0] !== '') { relPath.unshift(''); }\n if (relPath.length < 2) { relPath.unshift(''); }\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port;\n // to support http.request\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = result.pathname && result.pathname.charAt(0) === '/',\n isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === '/',\n mustEndAbs = isRelAbs || isSourceAbs || (result.host && relative.pathname),\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n /*\n * if the url is a non-slashed url, then relative\n * links like ../.. should be able\n * to crawl up to the hostname, as well. This is strange.\n * result.protocol has already been set by now.\n * Later on, put the first path part into the host field.\n */\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n if (result.host) {\n if (srcPath[0] === '') { srcPath[0] = result.host; } else { srcPath.unshift(result.host); }\n }\n result.host = '';\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n if (relative.host) {\n if (relPath[0] === '') { relPath[0] = relative.host; } else { relPath.unshift(relative.host); }\n }\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = relative.host || relative.host === '' ? relative.host : result.host;\n result.hostname = relative.hostname || relative.hostname === '' ? relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath;\n // fall through to the dot-handling below.\n } else if (relPath.length) {\n /*\n * it's relative\n * throw away the existing file, and take the new path instead.\n */\n if (!srcPath) { srcPath = []; }\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (relative.search != null) {\n /*\n * just pull out the search.\n * like href='?foo'.\n * Put this after the other two cases because it simplifies the booleans\n */\n if (psychotic) {\n result.host = srcPath.shift();\n result.hostname = result.host;\n /*\n * occationaly the auth can get stuck only in host\n * this especially happens in cases like\n * url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n */\n var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.hostname = authInHost.shift();\n result.host = result.hostname;\n }\n }\n result.search = relative.search;\n result.query = relative.query;\n // to support http.request\n if (result.pathname !== null || result.search !== null) {\n result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');\n }\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n /*\n * no path at all. easy.\n * we've already handled the other stuff above.\n */\n result.pathname = null;\n // to support http.request\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n result.href = result.format();\n return result;\n }\n\n /*\n * if a url ENDs in . or .., then it must get a trailing slash.\n * however, if it ends in anything else non-slashy,\n * then it must NOT get a trailing slash.\n */\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === '.' || last === '..') || last === '';\n\n /*\n * strip single dots, resolve double dots to parent dir\n * if the path tries to go above the root, `up` ends up > 0\n */\n var up = 0;\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' && (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' || (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n // put the host back\n if (psychotic) {\n result.hostname = isAbsolute ? '' : srcPath.length ? srcPath.shift() : '';\n result.host = result.hostname;\n /*\n * occationaly the auth can get stuck only in host\n * this especially happens in cases like\n * url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n */\n var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.hostname = authInHost.shift();\n result.host = result.hostname;\n }\n }\n\n mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (srcPath.length > 0) {\n result.pathname = srcPath.join('/');\n } else {\n result.pathname = null;\n result.path = null;\n }\n\n // to support request.http\n if (result.pathname !== null || result.search !== null) {\n result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');\n }\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function () {\n var host = this.host;\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) { this.hostname = host; }\n};\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\n",null,null,null,null,null,null,null,null,"'use strict'\nmodule.exports = function (Yallist) {\n Yallist.prototype[Symbol.iterator] = function* () {\n for (let walker = this.head; walker; walker = walker.next) {\n yield walker.value\n }\n }\n}\n","'use strict'\nmodule.exports = Yallist\n\nYallist.Node = Node\nYallist.create = Yallist\n\nfunction Yallist (list) {\n var self = this\n if (!(self instanceof Yallist)) {\n self = new Yallist()\n }\n\n self.tail = null\n self.head = null\n self.length = 0\n\n if (list && typeof list.forEach === 'function') {\n list.forEach(function (item) {\n self.push(item)\n })\n } else if (arguments.length > 0) {\n for (var i = 0, l = arguments.length; i < l; i++) {\n self.push(arguments[i])\n }\n }\n\n return self\n}\n\nYallist.prototype.removeNode = function (node) {\n if (node.list !== this) {\n throw new Error('removing node which does not belong to this list')\n }\n\n var next = node.next\n var prev = node.prev\n\n if (next) {\n next.prev = prev\n }\n\n if (prev) {\n prev.next = next\n }\n\n if (node === this.head) {\n this.head = next\n }\n if (node === this.tail) {\n this.tail = prev\n }\n\n node.list.length--\n node.next = null\n node.prev = null\n node.list = null\n\n return next\n}\n\nYallist.prototype.unshiftNode = function (node) {\n if (node === this.head) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n var head = this.head\n node.list = this\n node.next = head\n if (head) {\n head.prev = node\n }\n\n this.head = node\n if (!this.tail) {\n this.tail = node\n }\n this.length++\n}\n\nYallist.prototype.pushNode = function (node) {\n if (node === this.tail) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n var tail = this.tail\n node.list = this\n node.prev = tail\n if (tail) {\n tail.next = node\n }\n\n this.tail = node\n if (!this.head) {\n this.head = node\n }\n this.length++\n}\n\nYallist.prototype.push = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n push(this, arguments[i])\n }\n return this.length\n}\n\nYallist.prototype.unshift = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n unshift(this, arguments[i])\n }\n return this.length\n}\n\nYallist.prototype.pop = function () {\n if (!this.tail) {\n return undefined\n }\n\n var res = this.tail.value\n this.tail = this.tail.prev\n if (this.tail) {\n this.tail.next = null\n } else {\n this.head = null\n }\n this.length--\n return res\n}\n\nYallist.prototype.shift = function () {\n if (!this.head) {\n return undefined\n }\n\n var res = this.head.value\n this.head = this.head.next\n if (this.head) {\n this.head.prev = null\n } else {\n this.tail = null\n }\n this.length--\n return res\n}\n\nYallist.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = this.head, i = 0; walker !== null; i++) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.next\n }\n}\n\nYallist.prototype.forEachReverse = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.prev\n }\n}\n\nYallist.prototype.get = function (n) {\n for (var i = 0, walker = this.head; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.next\n }\n if (i === n && walker !== null) {\n return walker.value\n }\n}\n\nYallist.prototype.getReverse = function (n) {\n for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.prev\n }\n if (i === n && walker !== null) {\n return walker.value\n }\n}\n\nYallist.prototype.map = function (fn, thisp) {\n thisp = thisp || this\n var res = new Yallist()\n for (var walker = this.head; walker !== null;) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.next\n }\n return res\n}\n\nYallist.prototype.mapReverse = function (fn, thisp) {\n thisp = thisp || this\n var res = new Yallist()\n for (var walker = this.tail; walker !== null;) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.prev\n }\n return res\n}\n\nYallist.prototype.reduce = function (fn, initial) {\n var acc\n var walker = this.head\n if (arguments.length > 1) {\n acc = initial\n } else if (this.head) {\n walker = this.head.next\n acc = this.head.value\n } else {\n throw new TypeError('Reduce of empty list with no initial value')\n }\n\n for (var i = 0; walker !== null; i++) {\n acc = fn(acc, walker.value, i)\n walker = walker.next\n }\n\n return acc\n}\n\nYallist.prototype.reduceReverse = function (fn, initial) {\n var acc\n var walker = this.tail\n if (arguments.length > 1) {\n acc = initial\n } else if (this.tail) {\n walker = this.tail.prev\n acc = this.tail.value\n } else {\n throw new TypeError('Reduce of empty list with no initial value')\n }\n\n for (var i = this.length - 1; walker !== null; i--) {\n acc = fn(acc, walker.value, i)\n walker = walker.prev\n }\n\n return acc\n}\n\nYallist.prototype.toArray = function () {\n var arr = new Array(this.length)\n for (var i = 0, walker = this.head; walker !== null; i++) {\n arr[i] = walker.value\n walker = walker.next\n }\n return arr\n}\n\nYallist.prototype.toArrayReverse = function () {\n var arr = new Array(this.length)\n for (var i = 0, walker = this.tail; walker !== null; i++) {\n arr[i] = walker.value\n walker = walker.prev\n }\n return arr\n}\n\nYallist.prototype.slice = function (from, to) {\n to = to || this.length\n if (to < 0) {\n to += this.length\n }\n from = from || 0\n if (from < 0) {\n from += this.length\n }\n var ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n for (var i = 0, walker = this.head; walker !== null && i < from; i++) {\n walker = walker.next\n }\n for (; walker !== null && i < to; i++, walker = walker.next) {\n ret.push(walker.value)\n }\n return ret\n}\n\nYallist.prototype.sliceReverse = function (from, to) {\n to = to || this.length\n if (to < 0) {\n to += this.length\n }\n from = from || 0\n if (from < 0) {\n from += this.length\n }\n var ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {\n walker = walker.prev\n }\n for (; walker !== null && i > from; i--, walker = walker.prev) {\n ret.push(walker.value)\n }\n return ret\n}\n\nYallist.prototype.splice = function (start, deleteCount, ...nodes) {\n if (start > this.length) {\n start = this.length - 1\n }\n if (start < 0) {\n start = this.length + start;\n }\n\n for (var i = 0, walker = this.head; walker !== null && i < start; i++) {\n walker = walker.next\n }\n\n var ret = []\n for (var i = 0; walker && i < deleteCount; i++) {\n ret.push(walker.value)\n walker = this.removeNode(walker)\n }\n if (walker === null) {\n walker = this.tail\n }\n\n if (walker !== this.head && walker !== this.tail) {\n walker = walker.prev\n }\n\n for (var i = 0; i < nodes.length; i++) {\n walker = insert(this, walker, nodes[i])\n }\n return ret;\n}\n\nYallist.prototype.reverse = function () {\n var head = this.head\n var tail = this.tail\n for (var walker = head; walker !== null; walker = walker.prev) {\n var p = walker.prev\n walker.prev = walker.next\n walker.next = p\n }\n this.head = tail\n this.tail = head\n return this\n}\n\nfunction insert (self, node, value) {\n var inserted = node === self.head ?\n new Node(value, null, node, self) :\n new Node(value, node, node.next, self)\n\n if (inserted.next === null) {\n self.tail = inserted\n }\n if (inserted.prev === null) {\n self.head = inserted\n }\n\n self.length++\n\n return inserted\n}\n\nfunction push (self, item) {\n self.tail = new Node(item, self.tail, null, self)\n if (!self.head) {\n self.head = self.tail\n }\n self.length++\n}\n\nfunction unshift (self, item) {\n self.head = new Node(item, null, self.head, self)\n if (!self.tail) {\n self.tail = self.head\n }\n self.length++\n}\n\nfunction Node (value, prev, next, list) {\n if (!(this instanceof Node)) {\n return new Node(value, prev, next, list)\n }\n\n this.list = list\n this.value = value\n\n if (prev) {\n prev.next = this\n this.prev = prev\n } else {\n this.prev = null\n }\n\n if (next) {\n next.prev = this\n this.next = next\n } else {\n this.next = null\n }\n}\n\ntry {\n // add if support for Symbol.iterator is present\n require('./iterator.js')(Yallist)\n} catch (er) {}\n","'use strict'\n\n// A linked list to keep track of recently-used-ness\nconst Yallist = require('yallist')\n\nconst MAX = Symbol('max')\nconst LENGTH = Symbol('length')\nconst LENGTH_CALCULATOR = Symbol('lengthCalculator')\nconst ALLOW_STALE = Symbol('allowStale')\nconst MAX_AGE = Symbol('maxAge')\nconst DISPOSE = Symbol('dispose')\nconst NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')\nconst LRU_LIST = Symbol('lruList')\nconst CACHE = Symbol('cache')\nconst UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')\n\nconst naiveLength = () => 1\n\n// lruList is a yallist where the head is the youngest\n// item, and the tail is the oldest. the list contains the Hit\n// objects as the entries.\n// Each Hit object has a reference to its Yallist.Node. This\n// never changes.\n//\n// cache is a Map (or PseudoMap) that matches the keys to\n// the Yallist.Node object.\nclass LRUCache {\n constructor (options) {\n if (typeof options === 'number')\n options = { max: options }\n\n if (!options)\n options = {}\n\n if (options.max && (typeof options.max !== 'number' || options.max < 0))\n throw new TypeError('max must be a non-negative number')\n // Kind of weird to have a default max of Infinity, but oh well.\n const max = this[MAX] = options.max || Infinity\n\n const lc = options.length || naiveLength\n this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc\n this[ALLOW_STALE] = options.stale || false\n if (options.maxAge && typeof options.maxAge !== 'number')\n throw new TypeError('maxAge must be a number')\n this[MAX_AGE] = options.maxAge || 0\n this[DISPOSE] = options.dispose\n this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false\n this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false\n this.reset()\n }\n\n // resize the cache when the max changes.\n set max (mL) {\n if (typeof mL !== 'number' || mL < 0)\n throw new TypeError('max must be a non-negative number')\n\n this[MAX] = mL || Infinity\n trim(this)\n }\n get max () {\n return this[MAX]\n }\n\n set allowStale (allowStale) {\n this[ALLOW_STALE] = !!allowStale\n }\n get allowStale () {\n return this[ALLOW_STALE]\n }\n\n set maxAge (mA) {\n if (typeof mA !== 'number')\n throw new TypeError('maxAge must be a non-negative number')\n\n this[MAX_AGE] = mA\n trim(this)\n }\n get maxAge () {\n return this[MAX_AGE]\n }\n\n // resize the cache when the lengthCalculator changes.\n set lengthCalculator (lC) {\n if (typeof lC !== 'function')\n lC = naiveLength\n\n if (lC !== this[LENGTH_CALCULATOR]) {\n this[LENGTH_CALCULATOR] = lC\n this[LENGTH] = 0\n this[LRU_LIST].forEach(hit => {\n hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)\n this[LENGTH] += hit.length\n })\n }\n trim(this)\n }\n get lengthCalculator () { return this[LENGTH_CALCULATOR] }\n\n get length () { return this[LENGTH] }\n get itemCount () { return this[LRU_LIST].length }\n\n rforEach (fn, thisp) {\n thisp = thisp || this\n for (let walker = this[LRU_LIST].tail; walker !== null;) {\n const prev = walker.prev\n forEachStep(this, fn, walker, thisp)\n walker = prev\n }\n }\n\n forEach (fn, thisp) {\n thisp = thisp || this\n for (let walker = this[LRU_LIST].head; walker !== null;) {\n const next = walker.next\n forEachStep(this, fn, walker, thisp)\n walker = next\n }\n }\n\n keys () {\n return this[LRU_LIST].toArray().map(k => k.key)\n }\n\n values () {\n return this[LRU_LIST].toArray().map(k => k.value)\n }\n\n reset () {\n if (this[DISPOSE] &&\n this[LRU_LIST] &&\n this[LRU_LIST].length) {\n this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))\n }\n\n this[CACHE] = new Map() // hash of items by key\n this[LRU_LIST] = new Yallist() // list of items in order of use recency\n this[LENGTH] = 0 // length of items in the list\n }\n\n dump () {\n return this[LRU_LIST].map(hit =>\n isStale(this, hit) ? false : {\n k: hit.key,\n v: hit.value,\n e: hit.now + (hit.maxAge || 0)\n }).toArray().filter(h => h)\n }\n\n dumpLru () {\n return this[LRU_LIST]\n }\n\n set (key, value, maxAge) {\n maxAge = maxAge || this[MAX_AGE]\n\n if (maxAge && typeof maxAge !== 'number')\n throw new TypeError('maxAge must be a number')\n\n const now = maxAge ? Date.now() : 0\n const len = this[LENGTH_CALCULATOR](value, key)\n\n if (this[CACHE].has(key)) {\n if (len > this[MAX]) {\n del(this, this[CACHE].get(key))\n return false\n }\n\n const node = this[CACHE].get(key)\n const item = node.value\n\n // dispose of the old one before overwriting\n // split out into 2 ifs for better coverage tracking\n if (this[DISPOSE]) {\n if (!this[NO_DISPOSE_ON_SET])\n this[DISPOSE](key, item.value)\n }\n\n item.now = now\n item.maxAge = maxAge\n item.value = value\n this[LENGTH] += len - item.length\n item.length = len\n this.get(key)\n trim(this)\n return true\n }\n\n const hit = new Entry(key, value, len, now, maxAge)\n\n // oversized objects fall out of cache automatically.\n if (hit.length > this[MAX]) {\n if (this[DISPOSE])\n this[DISPOSE](key, value)\n\n return false\n }\n\n this[LENGTH] += hit.length\n this[LRU_LIST].unshift(hit)\n this[CACHE].set(key, this[LRU_LIST].head)\n trim(this)\n return true\n }\n\n has (key) {\n if (!this[CACHE].has(key)) return false\n const hit = this[CACHE].get(key).value\n return !isStale(this, hit)\n }\n\n get (key) {\n return get(this, key, true)\n }\n\n peek (key) {\n return get(this, key, false)\n }\n\n pop () {\n const node = this[LRU_LIST].tail\n if (!node)\n return null\n\n del(this, node)\n return node.value\n }\n\n del (key) {\n del(this, this[CACHE].get(key))\n }\n\n load (arr) {\n // reset the cache\n this.reset()\n\n const now = Date.now()\n // A previous serialized cache has the most recent items first\n for (let l = arr.length - 1; l >= 0; l--) {\n const hit = arr[l]\n const expiresAt = hit.e || 0\n if (expiresAt === 0)\n // the item was created without expiration in a non aged cache\n this.set(hit.k, hit.v)\n else {\n const maxAge = expiresAt - now\n // dont add already expired items\n if (maxAge > 0) {\n this.set(hit.k, hit.v, maxAge)\n }\n }\n }\n }\n\n prune () {\n this[CACHE].forEach((value, key) => get(this, key, false))\n }\n}\n\nconst get = (self, key, doUse) => {\n const node = self[CACHE].get(key)\n if (node) {\n const hit = node.value\n if (isStale(self, hit)) {\n del(self, node)\n if (!self[ALLOW_STALE])\n return undefined\n } else {\n if (doUse) {\n if (self[UPDATE_AGE_ON_GET])\n node.value.now = Date.now()\n self[LRU_LIST].unshiftNode(node)\n }\n }\n return hit.value\n }\n}\n\nconst isStale = (self, hit) => {\n if (!hit || (!hit.maxAge && !self[MAX_AGE]))\n return false\n\n const diff = Date.now() - hit.now\n return hit.maxAge ? diff > hit.maxAge\n : self[MAX_AGE] && (diff > self[MAX_AGE])\n}\n\nconst trim = self => {\n if (self[LENGTH] > self[MAX]) {\n for (let walker = self[LRU_LIST].tail;\n self[LENGTH] > self[MAX] && walker !== null;) {\n // We know that we're about to delete this one, and also\n // what the next least recently used key will be, so just\n // go ahead and set it now.\n const prev = walker.prev\n del(self, walker)\n walker = prev\n }\n }\n}\n\nconst del = (self, node) => {\n if (node) {\n const hit = node.value\n if (self[DISPOSE])\n self[DISPOSE](hit.key, hit.value)\n\n self[LENGTH] -= hit.length\n self[CACHE].delete(hit.key)\n self[LRU_LIST].removeNode(node)\n }\n}\n\nclass Entry {\n constructor (key, value, length, now, maxAge) {\n this.key = key\n this.value = value\n this.length = length\n this.now = now\n this.maxAge = maxAge || 0\n }\n}\n\nconst forEachStep = (self, fn, node, thisp) => {\n let hit = node.value\n if (isStale(self, hit)) {\n del(self, node)\n if (!self[ALLOW_STALE])\n hit = undefined\n }\n if (hit)\n fn.call(thisp, hit.value, hit.key, self)\n}\n\nmodule.exports = LRUCache\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.merge = void 0;\nconst sha256_js_1 = __importDefault(require(\"crypto-js/sha256.js\"));\nconst lru_cache_1 = __importDefault(require(\"lru-cache\"));\nconst types_1 = require(\"./types\");\nconst sha256Cache = new lru_cache_1.default({ max: 3000 });\nfunction buildDigest(actions) {\n const sha256Input = actions.map((action) => action.subtreeDigest).join('\\n');\n let result = sha256Cache.get(sha256Input);\n if (!result) {\n result = (0, sha256_js_1.default)(sha256Input).toString();\n sha256Cache.set(sha256Input, result);\n }\n return result;\n}\nfunction countDigests(actions, windowSize) {\n const digestCount = new Map();\n for (let index = 0; index + windowSize <= actions.length; index++) {\n const range = actions.slice(index, index + windowSize);\n const digest = buildDigest(range);\n const count = digestCount.get(digest);\n if (count !== undefined)\n digestCount.set(digest, count + 1);\n else\n digestCount.set(digest, 1);\n }\n return digestCount;\n}\nconst isMerge = (item) => item.constructor === Array;\nconst buildLoop = (merge) => {\n const digest = buildDigest(merge[0]);\n // Since we are going to use merge[0] as the children of the loop, the event ids and elapsed time from the\n // loop actions that will be discarded need to be merged into merge[0]. This needs to happen\n // recursively in order to avoid losing event ids and elapsed time data from nested loops.\n const aggregateLoopMemberData = (action, duplicates) => {\n action.eventIds = [...action.eventIds, ...duplicates.map((d) => d.eventIds).flat()].sort((a, b) => a - b);\n action.elapsed =\n (action.elapsed || 0) + duplicates.reduce((sum, d) => sum + (d.elapsed || 0), 0);\n action.children.forEach((child, index) => {\n aggregateLoopMemberData(child, duplicates.map((d) => d.children[index]));\n });\n };\n merge[0].forEach((member, index) => {\n aggregateLoopMemberData(member, merge.slice(1).map((m) => m[index]));\n });\n return {\n nodeType: types_1.NodeType.Loop,\n count: merge.length,\n digest: 'loop',\n subtreeDigest: ['loop', digest].join(':'),\n children: merge[0],\n elapsed: merge[0].reduce((sum, action) => sum + (action.elapsed || 0), 0),\n eventIds: [],\n };\n};\nconst unroll = (items) => {\n const result = [];\n items.forEach((item) => {\n if (isMerge(item)) {\n if (item.length > 1)\n result.push(buildLoop(item));\n else\n result.push(...item[0]);\n }\n else\n result.push(item);\n });\n return result;\n};\nfunction merge(actions, windowSize) {\n const digestCount = countDigests(actions, windowSize);\n const digestsSorted = [...digestCount.keys()]\n .filter((key) => digestCount.get(key) > 1)\n .sort((a, b) => digestCount.get(b) - digestCount.get(a));\n if (digestsSorted.length === 0)\n return;\n for (let digestIndex = 0; digestIndex < digestsSorted.length; digestIndex++) {\n const referenceDigest = digestsSorted[digestIndex];\n const result = [];\n let merge = undefined;\n for (let actionIndex = 0; actionIndex + windowSize <= actions.length;) {\n const window = actions.slice(actionIndex, actionIndex + windowSize);\n const windowDigest = buildDigest(window);\n if (windowDigest === referenceDigest) {\n if (merge) {\n merge.push(window);\n }\n else {\n merge = [window];\n result.push(merge);\n }\n actionIndex += windowSize;\n }\n else {\n merge = undefined;\n result.push(window[0]);\n actionIndex += 1;\n }\n }\n const hasLoop = result.filter((item) => isMerge(item) && item.length > 1).length > 0;\n if (hasLoop)\n return unroll(result);\n }\n}\nexports.merge = merge;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.selectEvents = void 0;\nfunction selectEvents(appmap, specification) {\n const isIncludedCodeObject = (event) => !!specification.isIncludedCodeObject(event.codeObject);\n const hasRequiredCodeObjectAncestor = () => {\n if (!specification.hasRequiredCodeObjects)\n throw Error('Expecting at least one required code object id');\n const stack = [];\n let numberOfRequiredCodeObjectsInStack = 0;\n const includedStackEvents = new Set();\n appmap.events.forEach((event) => {\n if (event.isCall()) {\n if (specification.isRequiredCodeObject(event.codeObject)) {\n if (numberOfRequiredCodeObjectsInStack === 0) {\n // Mark ancestors as included\n stack.forEach((event) => includedStackEvents.add(event));\n }\n numberOfRequiredCodeObjectsInStack += 1;\n }\n if (numberOfRequiredCodeObjectsInStack > 0) {\n includedStackEvents.add(event);\n }\n stack.push(event);\n }\n else {\n stack.pop();\n if (specification.isRequiredCodeObject(event.codeObject)) {\n numberOfRequiredCodeObjectsInStack -= 1;\n }\n }\n });\n return (event) => includedStackEvents.has(event.callEvent);\n };\n // Event code object id must be in the user-requested set.\n let includedEvents = appmap.events.filter(isIncludedCodeObject);\n // Event stack must include at least one required code object id, unless\n // none are required.\n if (specification.hasRequiredCodeObjects) {\n includedEvents = includedEvents.filter(hasRequiredCodeObjectAncestor());\n }\n return includedEvents;\n}\nexports.selectEvents = selectEvents;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getActors = void 0;\nconst openapi_1 = require(\"@appland/openapi\");\nconst sha256_js_1 = __importDefault(require(\"crypto-js/sha256.js\"));\nconst lru_cache_1 = __importDefault(require(\"lru-cache\"));\nconst mergeWindow_1 = require(\"./mergeWindow\");\nconst selectEvents_1 = require(\"./selectEvents\");\nconst types_1 = require(\"./types\");\nconst MAX_WINDOW_SIZE = 5;\nconst parsedSqlCache = new lru_cache_1.default({ max: 1000 });\nconst sha256Cache = new lru_cache_1.default({ max: 1000 });\nclass ActorManager {\n constructor(specification) {\n this.specification = specification;\n this._actorsByCodeObjectId = new Map();\n this._actors = [];\n }\n findOrCreateActor(event) {\n const actorCodeObject = this.specification.isIncludedCodeObject(event.codeObject);\n if (!actorCodeObject)\n throw Error('actor code object not found');\n const order = this.specification.priorityOf(actorCodeObject);\n const actorKey = actorCodeObject.fqid;\n let actor = this._actorsByCodeObjectId.get(actorKey);\n if (actor)\n return actor;\n actor = {\n id: actorCodeObject.fqid,\n name: actorCodeObject.name,\n order,\n };\n this._actors.push(actor);\n this._actorsByCodeObjectId.set(actorKey, actor);\n return actor;\n }\n getSortedActors() {\n return this._actors.sort((a, b) => a.order - b.order);\n }\n}\nfunction buildDiagram(_appmapFile, appmap, specification) {\n const events = (0, selectEvents_1.selectEvents)(appmap, specification);\n const actorManager = new ActorManager(specification);\n function buildRequest(caller, callee) {\n if ((callee === null || callee === void 0 ? void 0 : callee.httpServerRequest) && (callee === null || callee === void 0 ? void 0 : callee.httpServerResponse)) {\n if (!callee.route)\n throw Error('callee.route not found');\n const response = callee.httpServerResponse;\n return {\n nodeType: types_1.NodeType.ServerRPC,\n callee: actorManager.findOrCreateActor(callee),\n route: callee.route,\n status: response.status || response.status_code,\n digest: callee.buildStableHash(parsedSqlCache).digest(),\n subtreeDigest: 'undefined',\n children: [],\n elapsed: callee.elapsedTime,\n eventIds: [callee.id],\n };\n }\n else if ((callee === null || callee === void 0 ? void 0 : callee.httpClientRequest) && (callee === null || callee === void 0 ? void 0 : callee.httpClientResponse)) {\n if (!callee.route)\n throw Error('callee.route not found');\n const response = callee.httpClientResponse;\n return {\n nodeType: types_1.NodeType.ClientRPC,\n caller: caller ? actorManager.findOrCreateActor(caller) : undefined,\n callee: actorManager.findOrCreateActor(callee),\n route: callee.route,\n status: response.status || response.status_code,\n digest: callee.buildStableHash(parsedSqlCache).digest(),\n subtreeDigest: 'undefined',\n children: [],\n elapsed: callee.elapsedTime,\n eventIds: [callee.id],\n };\n }\n else if (callee === null || callee === void 0 ? void 0 : callee.sqlQuery) {\n const truncatedQuery = callee.sqlQuery.endsWith('...');\n return {\n nodeType: types_1.NodeType.Query,\n caller: caller ? actorManager.findOrCreateActor(caller) : undefined,\n callee: actorManager.findOrCreateActor(callee),\n query: callee.sqlQuery,\n digest: truncatedQuery ? 'truncatedQuery' : callee.buildStableHash(parsedSqlCache).digest(),\n subtreeDigest: 'undefined',\n children: [],\n elapsed: callee.elapsedTime,\n eventIds: [callee.id],\n };\n }\n else if (callee) {\n return {\n nodeType: types_1.NodeType.Function,\n caller: caller ? actorManager.findOrCreateActor(caller) : undefined,\n callee: actorManager.findOrCreateActor(callee),\n name: callee.codeObject.name,\n static: callee.codeObject.static,\n digest: callee.buildStableHash(parsedSqlCache).digest(),\n subtreeDigest: 'undefined',\n stableProperties: Object.assign({}, callee.stableProperties),\n returnValue: buildReturnValue(callee),\n children: [],\n elapsed: callee.elapsedTime,\n eventIds: [callee.id],\n };\n }\n }\n function buildReturnValue(callee) {\n var _a;\n const { returnEvent } = callee;\n if (!returnEvent)\n return;\n const voidReturn = {\n returnValueType: {\n name: 'void',\n },\n raisesException: false,\n };\n let returnValueType;\n const raisesException = ((_a = returnEvent.exceptions) === null || _a === void 0 ? void 0 : _a.length) > 0;\n if (!returnEvent.returnValue && !raisesException)\n return voidReturn;\n if (returnEvent.returnValue) {\n let propertyNames;\n if (returnEvent.returnValue.properties) {\n propertyNames = returnEvent.returnValue.properties\n .map((p) => [p.name, p.class].join(':'))\n .sort();\n }\n const typeName = (0, openapi_1.classNameToOpenAPIType)(returnEvent.returnValue.class, { strict: true }) ||\n returnEvent.returnValue.class;\n returnValueType = {\n name: typeName,\n properties: propertyNames,\n };\n }\n return {\n returnValueType,\n raisesException,\n };\n }\n const codeObjectIds = new Set();\n const codeObjectSequence = new Map();\n const requestStack = [];\n const rootActions = [];\n const eventStack = [];\n const allMessages = new Array();\n events.forEach((event) => {\n if (!codeObjectIds.has(event.codeObject.fqid)) {\n codeObjectSequence.set(event.codeObject.fqid, codeObjectSequence.size);\n codeObjectIds.add(event.codeObject.fqid);\n }\n if (event.isCall()) {\n eventStack.push(event);\n const caller = eventStack[eventStack.length - 2];\n const request = buildRequest(caller, event);\n if (request) {\n const parent = requestStack[requestStack.length - 1];\n if (parent) {\n parent.children.push(request);\n }\n else {\n rootActions.push(request);\n }\n allMessages.push(request);\n }\n requestStack.push(request);\n }\n else {\n requestStack.pop();\n eventStack.pop();\n }\n });\n // Combine the digests of children into the parent digest.\n // Do this recursively.\n const buildSubtreeDigests = (node) => {\n const hashEntries = [node.digest];\n node.children.forEach((child) => {\n buildSubtreeDigests(child);\n hashEntries.push(child.subtreeDigest);\n });\n const hashInput = hashEntries.join('\\n');\n let sha256Digest = sha256Cache.get(hashInput);\n if (!sha256Digest) {\n sha256Digest = (0, sha256_js_1.default)(hashInput).toString();\n sha256Cache.set(hashInput, sha256Digest);\n }\n node.subtreeDigest = sha256Digest;\n };\n const detectLoops = (node) => {\n node.children.forEach((child) => detectLoops(child));\n if (node.children.length < 2)\n return;\n let windowSize = 1;\n while (windowSize <= MAX_WINDOW_SIZE) {\n const mergedChildren = (0, mergeWindow_1.merge)(node.children, windowSize);\n if (mergedChildren) {\n node.children = mergedChildren;\n }\n else {\n windowSize += 1;\n }\n }\n };\n rootActions.forEach((root) => buildSubtreeDigests(root));\n if (specification.loops)\n rootActions.forEach((root) => detectLoops(root));\n rootActions.forEach((root) => (0, types_1.setParent)(root));\n return {\n actors: actorManager.getSortedActors(),\n rootActions,\n };\n}\nexports.default = buildDiagram;\nfunction getActors(appmap, specification) {\n const actorManager = new ActorManager(specification);\n const events = (0, selectEvents_1.selectEvents)(appmap, specification);\n events.forEach((event) => actorManager.findOrCreateActor(event));\n return actorManager.getSortedActors();\n}\nexports.getActors = getActors;\n","/**\n * @license MIT\n * @copyright 2020 Eyas Ranjous \n *\n * @class\n */\nclass Heap {\n /**\n * @param {function} compare\n * @param {array} [_values]\n * @param {number|string|object} [_leaf]\n */\n constructor(compare, _values, _leaf) {\n if (typeof compare !== 'function') {\n throw new Error('Heap constructor expects a compare function');\n }\n this._compare = compare;\n this._nodes = Array.isArray(_values) ? _values : [];\n this._leaf = _leaf || null;\n }\n\n /**\n * Converts the heap to a cloned array without sorting.\n * @public\n * @returns {Array}\n */\n toArray() {\n return Array.from(this._nodes);\n }\n\n /**\n * Checks if a parent has a left child\n * @private\n */\n _hasLeftChild(parentIndex) {\n const leftChildIndex = (parentIndex * 2) + 1;\n return leftChildIndex < this.size();\n }\n\n /**\n * Checks if a parent has a right child\n * @private\n */\n _hasRightChild(parentIndex) {\n const rightChildIndex = (parentIndex * 2) + 2;\n return rightChildIndex < this.size();\n }\n\n /**\n * Compares two nodes\n * @private\n */\n _compareAt(i, j) {\n return this._compare(this._nodes[i], this._nodes[j]);\n }\n\n /**\n * Swaps two nodes in the heap\n * @private\n */\n _swap(i, j) {\n const temp = this._nodes[i];\n this._nodes[i] = this._nodes[j];\n this._nodes[j] = temp;\n }\n\n /**\n * Checks if parent and child should be swapped\n * @private\n */\n _shouldSwap(parentIndex, childIndex) {\n if (parentIndex < 0 || parentIndex >= this.size()) {\n return false;\n }\n\n if (childIndex < 0 || childIndex >= this.size()) {\n return false;\n }\n\n return this._compareAt(parentIndex, childIndex) > 0;\n }\n\n /**\n * Compares children of a parent\n * @private\n */\n _compareChildrenOf(parentIndex) {\n if (!this._hasLeftChild(parentIndex) && !this._hasRightChild(parentIndex)) {\n return -1;\n }\n\n const leftChildIndex = (parentIndex * 2) + 1;\n const rightChildIndex = (parentIndex * 2) + 2;\n\n if (!this._hasLeftChild(parentIndex)) {\n return rightChildIndex;\n }\n\n if (!this._hasRightChild(parentIndex)) {\n return leftChildIndex;\n }\n\n const compare = this._compareAt(leftChildIndex, rightChildIndex);\n return compare > 0 ? rightChildIndex : leftChildIndex;\n }\n\n /**\n * Compares two children before a position\n * @private\n */\n _compareChildrenBefore(index, leftChildIndex, rightChildIndex) {\n const compare = this._compareAt(rightChildIndex, leftChildIndex);\n\n if (compare <= 0 && rightChildIndex < index) {\n return rightChildIndex;\n }\n\n return leftChildIndex;\n }\n\n /**\n * Recursively bubbles up a node if it's in a wrong position\n * @private\n */\n _heapifyUp(startIndex) {\n let childIndex = startIndex;\n let parentIndex = Math.floor((childIndex - 1) / 2);\n\n while (this._shouldSwap(parentIndex, childIndex)) {\n this._swap(parentIndex, childIndex);\n childIndex = parentIndex;\n parentIndex = Math.floor((childIndex - 1) / 2);\n }\n }\n\n /**\n * Recursively bubbles down a node if it's in a wrong position\n * @private\n */\n _heapifyDown(startIndex) {\n let parentIndex = startIndex;\n let childIndex = this._compareChildrenOf(parentIndex);\n\n while (this._shouldSwap(parentIndex, childIndex)) {\n this._swap(parentIndex, childIndex);\n parentIndex = childIndex;\n childIndex = this._compareChildrenOf(parentIndex);\n }\n }\n\n /**\n * Recursively bubbles down a node before a given index\n * @private\n */\n _heapifyDownUntil(index) {\n let parentIndex = 0;\n let leftChildIndex = 1;\n let rightChildIndex = 2;\n let childIndex;\n\n while (leftChildIndex < index) {\n childIndex = this._compareChildrenBefore(\n index,\n leftChildIndex,\n rightChildIndex\n );\n\n if (this._shouldSwap(parentIndex, childIndex)) {\n this._swap(parentIndex, childIndex);\n }\n\n parentIndex = childIndex;\n leftChildIndex = (parentIndex * 2) + 1;\n rightChildIndex = (parentIndex * 2) + 2;\n }\n }\n\n /**\n * Inserts a new value into the heap\n * @public\n * @param {number|string|object} value\n * @returns {Heap}\n */\n insert(value) {\n this._nodes.push(value);\n this._heapifyUp(this.size() - 1);\n if (this._leaf === null || this._compare(value, this._leaf) > 0) {\n this._leaf = value;\n }\n return this;\n }\n\n /**\n * Inserts a new value into the heap\n * @public\n * @param {number|string|object} value\n * @returns {Heap}\n */\n push(value) {\n return this.insert(value);\n }\n\n /**\n * Removes and returns the root node in the heap\n * @public\n * @returns {number|string|object}\n */\n extractRoot() {\n if (this.isEmpty()) {\n return null;\n }\n\n const root = this.root();\n this._nodes[0] = this._nodes[this.size() - 1];\n this._nodes.pop();\n this._heapifyDown(0);\n\n if (root === this._leaf) {\n this._leaf = this.root();\n }\n\n return root;\n }\n\n /**\n * Removes and returns the root node in the heap\n * @public\n * @returns {number|string|object}\n */\n pop() {\n return this.extractRoot();\n }\n\n /**\n * Applies heap sort and return the values sorted by priority\n * @public\n * @returns {array}\n */\n sort() {\n for (let i = this.size() - 1; i > 0; i -= 1) {\n this._swap(0, i);\n this._heapifyDownUntil(i);\n }\n return this._nodes;\n }\n\n /**\n * Fixes node positions in the heap\n * @public\n * @returns {Heap}\n */\n fix() {\n // fix node positions\n for (let i = Math.floor(this.size() / 2) - 1; i >= 0; i -= 1) {\n this._heapifyDown(i);\n }\n\n // fix leaf value\n for (let i = Math.floor(this.size() / 2); i < this.size(); i += 1) {\n const value = this._nodes[i];\n if (this._leaf === null || this._compare(value, this._leaf) > 0) {\n this._leaf = value;\n }\n }\n\n return this;\n }\n\n /**\n * Verifies that all heap nodes are in the right position\n * @public\n * @returns {boolean}\n */\n isValid() {\n const isValidRecursive = (parentIndex) => {\n let isValidLeft = true;\n let isValidRight = true;\n\n if (this._hasLeftChild(parentIndex)) {\n const leftChildIndex = (parentIndex * 2) + 1;\n if (this._compareAt(parentIndex, leftChildIndex) > 0) {\n return false;\n }\n isValidLeft = isValidRecursive(leftChildIndex);\n }\n\n if (this._hasRightChild(parentIndex)) {\n const rightChildIndex = (parentIndex * 2) + 2;\n if (this._compareAt(parentIndex, rightChildIndex) > 0) {\n return false;\n }\n isValidRight = isValidRecursive(rightChildIndex);\n }\n\n return isValidLeft && isValidRight;\n };\n\n return isValidRecursive(0);\n }\n\n /**\n * Returns a shallow copy of the heap\n * @public\n * @returns {Heap}\n */\n clone() {\n return new Heap(this._compare, this._nodes.slice(), this._leaf);\n }\n\n /**\n * Returns the root node in the heap\n * @public\n * @returns {number|string|object}\n */\n root() {\n if (this.isEmpty()) {\n return null;\n }\n\n return this._nodes[0];\n }\n\n /**\n * Returns the root node in the heap\n * @public\n * @returns {number|string|object}\n */\n top() {\n return this.root();\n }\n\n /**\n * Returns a leaf node in the heap\n * @public\n * @returns {number|string|object}\n */\n leaf() {\n return this._leaf;\n }\n\n /**\n * Returns the number of nodes in the heap\n * @public\n * @returns {number}\n */\n size() {\n return this._nodes.length;\n }\n\n /**\n * Checks if the heap is empty\n * @public\n * @returns {boolean}\n */\n isEmpty() {\n return this.size() === 0;\n }\n\n /**\n * Clears the heap\n * @public\n */\n clear() {\n this._nodes = [];\n this._leaf = null;\n }\n\n /**\n * Implements an iterable on the heap\n * @public\n */\n [Symbol.iterator]() {\n let size = this.size();\n return {\n next: () => {\n size -= 1;\n return {\n value: this.pop(),\n done: size === -1\n };\n }\n };\n }\n\n /**\n * Builds a heap from a array of values\n * @public\n * @static\n * @param {array} values\n * @param {function} compare\n * @returns {Heap}\n */\n static heapify(values, compare) {\n if (!Array.isArray(values)) {\n throw new Error('Heap.heapify expects an array of values');\n }\n\n if (typeof compare !== 'function') {\n throw new Error('Heap.heapify expects a compare function');\n }\n\n return new Heap(compare, values).fix();\n }\n\n /**\n * Checks if a list of values is a valid heap\n * @public\n * @static\n * @param {array} values\n * @param {function} compare\n * @returns {boolean}\n */\n static isHeapified(values, compare) {\n return new Heap(compare, values).isValid();\n }\n}\n\nexports.Heap = Heap;\n","/**\n * @license MIT\n * @copyright 2020 Eyas Ranjous \n */\n\nconst { Heap } = require('./heap');\n\nconst getMinCompare = (getCompareValue) => (a, b) => {\n const aVal = typeof getCompareValue === 'function' ? getCompareValue(a) : a;\n const bVal = typeof getCompareValue === 'function' ? getCompareValue(b) : b;\n return aVal <= bVal ? -1 : 1;\n};\n\n/**\n * @class MinHeap\n * @extends Heap\n */\nclass MinHeap {\n /**\n * @param {function} [getCompareValue]\n * @param {Heap} [_heap]\n */\n constructor(getCompareValue, _heap) {\n this._getCompareValue = getCompareValue;\n this._heap = _heap || new Heap(getMinCompare(getCompareValue));\n }\n\n /**\n * Converts the heap to a cloned array without sorting.\n * @public\n * @returns {Array}\n */\n toArray() {\n return Array.from(this._heap._nodes);\n }\n\n /**\n * Inserts a new value into the heap\n * @public\n * @param {number|string|object} value\n * @returns {MinHeap}\n */\n insert(value) {\n return this._heap.insert(value);\n }\n\n /**\n * Inserts a new value into the heap\n * @public\n * @param {number|string|object} value\n * @returns {Heap}\n */\n push(value) {\n return this.insert(value);\n }\n\n /**\n * Removes and returns the root node in the heap\n * @public\n * @returns {number|string|object}\n */\n extractRoot() {\n return this._heap.extractRoot();\n }\n\n /**\n * Removes and returns the root node in the heap\n * @public\n * @returns {number|string|object}\n */\n pop() {\n return this.extractRoot();\n }\n\n /**\n * Applies heap sort and return the values sorted by priority\n * @public\n * @returns {array}\n */\n sort() {\n return this._heap.sort();\n }\n\n /**\n * Fixes node positions in the heap\n * @public\n * @returns {MinHeap}\n */\n fix() {\n return this._heap.fix();\n }\n\n /**\n * Verifies that all heap nodes are in the right position\n * @public\n * @returns {boolean}\n */\n isValid() {\n return this._heap.isValid();\n }\n\n /**\n * Returns the root node in the heap\n * @public\n * @returns {number|string|object}\n */\n root() {\n return this._heap.root();\n }\n\n /**\n * Returns the root node in the heap\n * @public\n * @returns {number|string|object}\n */\n top() {\n return this.root();\n }\n\n /**\n * Returns a leaf node in the heap\n * @public\n * @returns {number|string|object}\n */\n leaf() {\n return this._heap.leaf();\n }\n\n /**\n * Returns the number of nodes in the heap\n * @public\n * @returns {number}\n */\n size() {\n return this._heap.size();\n }\n\n /**\n * Checks if the heap is empty\n * @public\n * @returns {boolean}\n */\n isEmpty() {\n return this._heap.isEmpty();\n }\n\n /**\n * Clears the heap\n * @public\n */\n clear() {\n this._heap.clear();\n }\n\n /**\n * Returns a shallow copy of the MinHeap\n * @public\n * @returns {MinHeap}\n */\n clone() {\n return new MinHeap(this._getCompareValue, this._heap.clone());\n }\n\n /**\n * Implements an iterable on the heap\n * @public\n */\n [Symbol.iterator]() {\n let size = this.size();\n return {\n next: () => {\n size -= 1;\n return {\n value: this.pop(),\n done: size === -1\n };\n }\n };\n }\n\n /**\n * Builds a MinHeap from an array\n * @public\n * @static\n * @param {array} values\n * @param {function} [getCompareValue]\n * @returns {MinHeap}\n */\n static heapify(values, getCompareValue) {\n if (!Array.isArray(values)) {\n throw new Error('MinHeap.heapify expects an array');\n }\n const heap = new Heap(getMinCompare(getCompareValue), values);\n return new MinHeap(getCompareValue, heap).fix();\n }\n\n /**\n * Checks if a list of values is a valid min heap\n * @public\n * @static\n * @param {array} values\n * @param {function} [getCompareValue]\n * @returns {boolean}\n */\n static isHeapified(values, getCompareValue) {\n const heap = new Heap(getMinCompare(getCompareValue), values);\n return new MinHeap(getCompareValue, heap).isValid();\n }\n}\n\nexports.MinHeap = MinHeap;\n","/**\n * @license MIT\n * @copyright 2020 Eyas Ranjous \n */\n\nconst { Heap } = require('./heap');\n\nconst getMaxCompare = (getCompareValue) => (a, b) => {\n const aVal = typeof getCompareValue === 'function' ? getCompareValue(a) : a;\n const bVal = typeof getCompareValue === 'function' ? getCompareValue(b) : b;\n return aVal < bVal ? 1 : -1;\n};\n\n/**\n * @class MaxHeap\n * @extends Heap\n */\nclass MaxHeap {\n /**\n * @param {function} [getCompareValue]\n * @param {Heap} [_heap]\n */\n constructor(getCompareValue, _heap) {\n this._getCompareValue = getCompareValue;\n this._heap = _heap || new Heap(getMaxCompare(getCompareValue));\n }\n\n /**\n * Inserts a new value into the heap\n * @public\n * @param {number|string|object} value\n * @returns {MaxHeap}\n */\n insert(value) {\n return this._heap.insert(value);\n }\n\n /**\n * Inserts a new value into the heap\n * @public\n * @param {number|string|object} value\n * @returns {Heap}\n */\n push(value) {\n return this.insert(value);\n }\n\n /**\n * Removes and returns the root node in the heap\n * @public\n * @returns {number|string|object}\n */\n extractRoot() {\n return this._heap.extractRoot();\n }\n\n /**\n * Removes and returns the root node in the heap\n * @public\n * @returns {number|string|object}\n */\n pop() {\n return this.extractRoot();\n }\n\n /**\n * Applies heap sort and return the values sorted by priority\n * @public\n * @returns {array}\n */\n sort() {\n return this._heap.sort();\n }\n\n /**\n * Converts the heap to a cloned array without sorting.\n * @public\n * @returns {Array}\n */\n toArray() {\n return Array.from(this._heap._nodes);\n }\n\n /**\n * Fixes node positions in the heap\n * @public\n * @returns {MaxHeap}\n */\n fix() {\n return this._heap.fix();\n }\n\n /**\n * Verifies that all heap nodes are in the right position\n * @public\n * @returns {boolean}\n */\n isValid() {\n return this._heap.isValid();\n }\n\n /**\n * Returns the root node in the heap\n * @public\n * @returns {number|string|object}\n */\n root() {\n return this._heap.root();\n }\n\n /**\n * Returns the root node in the heap\n * @public\n * @returns {number|string|object}\n */\n top() {\n return this.root();\n }\n\n /**\n * Returns a leaf node in the heap\n * @public\n * @returns {number|string|object}\n */\n leaf() {\n return this._heap.leaf();\n }\n\n /**\n * Returns the number of nodes in the heap\n * @public\n * @returns {number}\n */\n size() {\n return this._heap.size();\n }\n\n /**\n * Checks if the heap is empty\n * @public\n * @returns {boolean}\n */\n isEmpty() {\n return this._heap.isEmpty();\n }\n\n /**\n * Clears the heap\n * @public\n */\n clear() {\n this._heap.clear();\n }\n\n /**\n * Returns a shallow copy of the MaxHeap\n * @public\n * @returns {MaxHeap}\n */\n clone() {\n return new MaxHeap(this._getCompareValue, this._heap.clone());\n }\n\n /**\n * Implements an iterable on the heap\n * @public\n */\n [Symbol.iterator]() {\n let size = this.size();\n return {\n next: () => {\n size -= 1;\n return {\n value: this.pop(),\n done: size === -1\n };\n }\n };\n }\n\n /**\n * Builds a MaxHeap from an array\n * @public\n * @static\n * @param {array} values\n * @param {function} [getCompareValue]\n * @returns {MaxHeap}\n */\n static heapify(values, getCompareValue) {\n if (!Array.isArray(values)) {\n throw new Error('MaxHeap.heapify expects an array');\n }\n const heap = new Heap(getMaxCompare(getCompareValue), values);\n return new MaxHeap(getCompareValue, heap).fix();\n }\n\n /**\n * Checks if a list of values is a valid max heap\n * @public\n * @static\n * @param {array} values\n * @param {function} [getCompareValue]\n * @returns {boolean}\n */\n static isHeapified(values, getCompareValue) {\n const heap = new Heap(getMaxCompare(getCompareValue), values);\n return new MaxHeap(getCompareValue, heap).isValid();\n }\n}\n\nexports.MaxHeap = MaxHeap;\n","const { Heap } = require('./src/heap');\nconst { MinHeap } = require('./src/minHeap');\nconst { MaxHeap } = require('./src/maxHeap');\n\nexports.Heap = Heap;\nexports.MinHeap = MinHeap;\nexports.MaxHeap = MaxHeap;\n","/**\n * @copyright 2020 Eyas Ranjous \n * @license MIT\n */\n\nconst { Heap, MinHeap } = require('@datastructures-js/heap');\n\nconst getMinCompare = (getCompareValue) => (a, b) => {\n const aVal = typeof getCompareValue === 'function' ? getCompareValue(a) : a;\n const bVal = typeof getCompareValue === 'function' ? getCompareValue(b) : b;\n return aVal <= bVal ? -1 : 1;\n};\n\n/**\n * @class MinPriorityQueue\n */\nclass MinPriorityQueue {\n constructor(getCompareValue, _heap) {\n if (getCompareValue && typeof getCompareValue !== 'function') {\n throw new Error('MinPriorityQueue constructor requires a callback for object values');\n }\n this._heap = _heap || new MinHeap(getCompareValue);\n }\n\n /**\n * Returns an element with highest priority in the queue\n * @public\n * @returns {number|string|object}\n */\n front() {\n return this._heap.root();\n }\n\n /**\n * Returns an element with lowest priority in the queue\n * @public\n * @returns {number|string|object}\n */\n back() {\n return this._heap.leaf();\n }\n\n /**\n * Adds a value to the queue\n * @public\n * @param {number|string|object} value\n * @returns {MinPriorityQueue}\n */\n enqueue(value) {\n return this._heap.insert(value);\n }\n\n /**\n * Adds a value to the queue\n * @public\n * @param {number|string|object} value\n * @returns {MinPriorityQueue}\n */\n push(value) {\n return this.enqueue(value);\n }\n\n /**\n * Removes and returns an element with highest priority in the queue\n * @public\n * @returns {number|string|object}\n */\n dequeue() {\n return this._heap.extractRoot();\n }\n\n /**\n * Removes and returns an element with highest priority in the queue\n * @public\n * @returns {number|string|object}\n */\n pop() {\n return this.dequeue();\n }\n\n /**\n * Removes all elements that match a criteria in the callback\n * @public\n * @param {function} cb\n * @returns {array}\n */\n remove(cb) {\n if (typeof cb !== 'function') {\n throw new Error('MinPriorityQueue remove expects a callback');\n }\n\n const removed = [];\n const dequeued = [];\n while (!this.isEmpty()) {\n const popped = this.pop();\n if (cb(popped)) {\n removed.push(popped);\n } else {\n dequeued.push(popped);\n }\n }\n\n dequeued.forEach((val) => this.push(val));\n return removed;\n }\n\n /**\n * Returns the number of elements in the queue\n * @public\n * @returns {number}\n */\n size() {\n return this._heap.size();\n }\n\n /**\n * Checks if the queue is empty\n * @public\n * @returns {boolean}\n */\n isEmpty() {\n return this._heap.isEmpty();\n }\n\n /**\n * Clears the queue\n * @public\n */\n clear() {\n this._heap.clear();\n }\n\n /**\n * Returns a sorted list of elements from highest to lowest priority\n * @public\n * @returns {array}\n */\n toArray() {\n return this._heap.clone().sort().reverse();\n }\n\n /**\n * Implements an iterable on the min priority queue\n * @public\n */\n [Symbol.iterator]() {\n let size = this.size();\n return {\n next: () => {\n size -= 1;\n return {\n value: this.pop(),\n done: size === -1\n };\n }\n };\n }\n\n /**\n * Creates a priority queue from an existing array\n * @public\n * @static\n * @returns {MinPriorityQueue}\n */\n static fromArray(values, getCompareValue) {\n const heap = new Heap(getMinCompare(getCompareValue), values);\n return new MinPriorityQueue(\n getCompareValue,\n new MinHeap(getCompareValue, heap).fix()\n );\n }\n}\n\nexports.MinPriorityQueue = MinPriorityQueue;\n","/**\n * @copyright 2020 Eyas Ranjous \n * @license MIT\n */\n\nconst { Heap, MaxHeap } = require('@datastructures-js/heap');\n\nconst getMaxCompare = (getCompareValue) => (a, b) => {\n const aVal = typeof getCompareValue === 'function' ? getCompareValue(a) : a;\n const bVal = typeof getCompareValue === 'function' ? getCompareValue(b) : b;\n return aVal < bVal ? 1 : -1;\n};\n\n/**\n * @class MaxPriorityQueue\n * @extends MaxHeap\n */\nclass MaxPriorityQueue {\n constructor(getCompareValue, _heap) {\n if (getCompareValue && typeof getCompareValue !== 'function') {\n throw new Error('MaxPriorityQueue constructor requires a callback for object values');\n }\n this._heap = _heap || new MaxHeap(getCompareValue);\n }\n\n /**\n * Returns an element with highest priority in the queue\n * @public\n * @returns {number|string|object}\n */\n front() {\n return this._heap.root();\n }\n\n /**\n * Returns an element with lowest priority in the queue\n * @public\n * @returns {number|string|object}\n */\n back() {\n return this._heap.leaf();\n }\n\n /**\n * Adds a value to the queue\n * @public\n * @param {number|string|object} value\n * @returns {MaxPriorityQueue}\n */\n enqueue(value) {\n return this._heap.insert(value);\n }\n\n /**\n * Adds a value to the queue\n * @public\n * @param {number|string|object} value\n * @returns {MaxPriorityQueue}\n */\n push(value) {\n return this.enqueue(value);\n }\n\n /**\n * Removes and returns an element with highest priority in the queue\n * @public\n * @returns {number|string|object}\n */\n dequeue() {\n return this._heap.extractRoot();\n }\n\n /**\n * Removes and returns an element with highest priority in the queue\n * @public\n * @returns {number|string|object}\n */\n pop() {\n return this.dequeue();\n }\n\n /**\n * Removes all elements that match a criteria in the callback\n * @public\n * @param {function} cb\n * @returns {array}\n */\n remove(cb) {\n if (typeof cb !== 'function') {\n throw new Error('MaxPriorityQueue remove expects a callback');\n }\n\n const removed = [];\n const dequeued = [];\n while (!this.isEmpty()) {\n const popped = this.pop();\n if (cb(popped)) {\n removed.push(popped);\n } else {\n dequeued.push(popped);\n }\n }\n\n dequeued.forEach((val) => this.push(val));\n return removed;\n }\n\n /**\n * Returns the number of elements in the queue\n * @public\n * @returns {number}\n */\n size() {\n return this._heap.size();\n }\n\n /**\n * Checks if the queue is empty\n * @public\n * @returns {boolean}\n */\n isEmpty() {\n return this._heap.isEmpty();\n }\n\n /**\n * Clears the queue\n * @public\n */\n clear() {\n this._heap.clear();\n }\n\n /**\n * Returns a sorted list of elements from highest to lowest priority\n * @public\n * @returns {array}\n */\n toArray() {\n return this._heap.clone().sort().reverse();\n }\n\n /**\n * Implements an iterable on the min priority queue\n * @public\n */\n [Symbol.iterator]() {\n let size = this.size();\n return {\n next: () => {\n size -= 1;\n return {\n value: this.pop(),\n done: size === -1\n };\n }\n };\n }\n\n /**\n * Creates a priority queue from an existing array\n * @public\n * @static\n * @returns {MaxPriorityQueue}\n */\n static fromArray(values, getCompareValue) {\n const heap = new Heap(getMaxCompare(getCompareValue), values);\n return new MaxPriorityQueue(\n getCompareValue,\n new MaxHeap(getCompareValue, heap).fix()\n );\n }\n}\n\nexports.MaxPriorityQueue = MaxPriorityQueue;\n","/**\n * @copyright 2020 Eyas Ranjous \n * @license MIT\n */\n\nconst { Heap } = require('@datastructures-js/heap');\n\n/**\n * @class PriorityQueue\n */\nclass PriorityQueue {\n /**\n * Creates a priority queue\n * @params {function} compare\n */\n constructor(compare, _values) {\n if (typeof compare !== 'function') {\n throw new Error('PriorityQueue constructor expects a compare function');\n }\n this._heap = new Heap(compare, _values);\n if (_values) {\n this._heap.fix();\n }\n }\n\n /**\n * Returns an element with highest priority in the queue\n * @public\n * @returns {number|string|object}\n */\n front() {\n return this._heap.root();\n }\n\n /**\n * Returns an element with lowest priority in the queue\n * @public\n * @returns {number|string|object}\n */\n back() {\n return this._heap.leaf();\n }\n\n /**\n * Adds a value to the queue\n * @public\n * @param {number|string|object} value\n * @returns {PriorityQueue}\n */\n enqueue(value) {\n return this._heap.insert(value);\n }\n\n /**\n * Adds a value to the queue\n * @public\n * @param {number|string|object} value\n * @returns {PriorityQueue}\n */\n push(value) {\n return this.enqueue(value);\n }\n\n /**\n * Removes and returns an element with highest priority in the queue\n * @public\n * @returns {number|string|object}\n */\n dequeue() {\n return this._heap.extractRoot();\n }\n\n /**\n * Removes and returns an element with highest priority in the queue\n * @public\n * @returns {number|string|object}\n */\n pop() {\n return this.dequeue();\n }\n\n /**\n * Removes all elements that match a criteria in the callback\n * @public\n * @param {function} cb\n * @returns {array}\n */\n remove(cb) {\n if (typeof cb !== 'function') {\n throw new Error('PriorityQueue remove expects a callback');\n }\n\n const removed = [];\n const dequeued = [];\n while (!this.isEmpty()) {\n const popped = this.pop();\n if (cb(popped)) {\n removed.push(popped);\n } else {\n dequeued.push(popped);\n }\n }\n\n dequeued.forEach((val) => this.push(val));\n return removed;\n }\n\n /**\n * Returns the number of elements in the queue\n * @public\n * @returns {number}\n */\n size() {\n return this._heap.size();\n }\n\n /**\n * Checks if the queue is empty\n * @public\n * @returns {boolean}\n */\n isEmpty() {\n return this._heap.isEmpty();\n }\n\n /**\n * Clears the queue\n * @public\n */\n clear() {\n this._heap.clear();\n }\n\n /**\n * Returns a sorted list of elements from highest to lowest priority\n * @public\n * @returns {array}\n */\n toArray() {\n return this._heap.clone().sort().reverse();\n }\n\n /**\n * Implements an iterable on the priority queue\n * @public\n */\n [Symbol.iterator]() {\n let size = this.size();\n return {\n next: () => {\n size -= 1;\n return {\n value: this.pop(),\n done: size === -1\n };\n }\n };\n }\n\n /**\n * Creates a priority queue from an existing array\n * @public\n * @static\n * @returns {PriorityQueue}\n */\n static fromArray(values, compare) {\n return new PriorityQueue(compare, values);\n }\n}\n\nexports.PriorityQueue = PriorityQueue;\n","const { MinPriorityQueue } = require('./src/minPriorityQueue');\nconst { MaxPriorityQueue } = require('./src/maxPriorityQueue');\nconst { PriorityQueue } = require('./src/priorityQueue')\n\nmodule.exports = { MinPriorityQueue, MaxPriorityQueue, PriorityQueue };\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Move = exports.MoveType = void 0;\nconst priority_queue_1 = require(\"@datastructures-js/priority-queue\");\nconst types_1 = require(\"./types\");\nvar MoveType;\n(function (MoveType) {\n MoveType[MoveType[\"AdvanceBoth\"] = 1] = \"AdvanceBoth\";\n MoveType[MoveType[\"DeleteLeft\"] = 2] = \"DeleteLeft\";\n MoveType[MoveType[\"InsertRight\"] = 3] = \"InsertRight\";\n MoveType[MoveType[\"Change\"] = 4] = \"Change\";\n})(MoveType = exports.MoveType || (exports.MoveType = {}));\nconst Costs = new Map();\nCosts.set(MoveType.AdvanceBoth, 0);\nCosts.set(MoveType.Change, 1.0);\nCosts.set(MoveType.InsertRight, 2.0);\nCosts.set(MoveType.DeleteLeft, 2.0);\nclass Move {\n constructor(position, moveType) {\n this.moveType = moveType;\n this.lNode = position.lNode;\n this.rNode = position.rNode;\n const cost = Costs.get(moveType);\n if (cost === undefined)\n throw Error(`No cost for ${moveType}`);\n this.cost = cost;\n }\n}\nexports.Move = Move;\nfunction positionKey(position) {\n return `${position.lNode},${position.rNode}`;\n}\nfunction moveTypeName(moveType) {\n switch (moveType) {\n case MoveType.AdvanceBoth:\n return 'advance both';\n case MoveType.DeleteLeft:\n return 'delete left';\n case MoveType.InsertRight:\n return 'insert right';\n case MoveType.Change:\n return 'change';\n }\n}\n/**\n * Start with the graph state (-1, -1) of each Diagram.\n * Enqueue moves from the inital state.\n * Pull the lowest cost move from the queue\n * If the known cost to the new location is undefined, or if the cost via this move is less than the known cost\n * Store the step to the new state\n * Store the total cost as the minimum cost\n * Enqueue the possible next moves\n */\nfunction diff(baseDiagram, headDiagram, diffOptions = {}) {\n var _a, _b;\n const buildActions = (diagram) => {\n const result = [];\n const collectAction = (action) => {\n result.push(action);\n action.children.forEach((child) => collectAction(child));\n };\n diagram.rootActions.forEach((action) => collectAction(action));\n return result;\n };\n const lActions = buildActions(baseDiagram);\n const rActions = buildActions(headDiagram);\n const advance = (diagram, action) => {\n if (action < diagram.length)\n return action + 1;\n };\n const advanceBoth = (move) => {\n const [lNode, rNode] = [advance(lActions, move.lNode), advance(rActions, move.rNode)];\n if (lNode === undefined || rNode === undefined)\n return;\n const lDigest = digestOf(lActions, lNode);\n const rDigest = digestOf(rActions, rNode);\n // Advancing both is only a legal move if both resulting actions have the same digest.\n if (lDigest !== rDigest)\n return;\n return new Move({\n lNode: lNode,\n rNode: rNode,\n }, MoveType.AdvanceBoth);\n };\n const change = (move) => {\n var _a, _b, _c, _d;\n const [lNode, rNode] = [advance(lActions, move.lNode), advance(rActions, move.rNode)];\n // The change can't move beyond the bounds of the graph.\n if (lNode === undefined || rNode === undefined)\n return;\n // The change needs to originate from the same actor.\n if (((_a = (0, types_1.actionActors)(lActions[move.lNode])[0]) === null || _a === void 0 ? void 0 : _a.id) !== ((_b = (0, types_1.actionActors)(rActions[move.rNode])[0]) === null || _b === void 0 ? void 0 : _b.id))\n return;\n // The change cannot change the type of the node.\n if (((_c = lActions[lNode]) === null || _c === void 0 ? void 0 : _c.nodeType) !== ((_d = rActions[rNode]) === null || _d === void 0 ? void 0 : _d.nodeType))\n return;\n return new Move({\n lNode: lNode,\n rNode: rNode,\n }, MoveType.Change);\n };\n const deleteLeft = (move) => {\n const lNode = advance(lActions, move.lNode);\n if (lNode === undefined)\n return;\n return new Move({ lNode: lNode, rNode: move.rNode }, MoveType.DeleteLeft);\n };\n const insertRight = (move) => {\n const rNode = advance(rActions, move.rNode);\n if (rNode === undefined)\n return;\n return new Move({\n lNode: move.lNode,\n rNode: rNode,\n }, MoveType.InsertRight);\n };\n const digestOf = (actions, action) => {\n if (action === -1)\n return 'head';\n else if (action === actions.length)\n return 'tail';\n else\n return actions[action].digest;\n };\n /**\n * Possible moves are:\n * - If both nodes have the same digest, advance both nodes.\n * - If nodes have non-equal digest\n * The left node is a removal\n * The right node is an insertion\n */\n const possibleMoves = (move) => {\n return [advanceBoth(move), change(move), deleteLeft(move), insertRight(move)].filter(Boolean);\n };\n const pq = new priority_queue_1.MinPriorityQueue((entry) => entry.cost);\n const distances = new Map();\n const stateMoves = new Map();\n const statePreceding = new Map();\n const initialState = { lNode: -1, rNode: -1, moveType: MoveType.AdvanceBoth };\n possibleMoves(initialState).forEach((position) => pq.enqueue({ position, preceding: initialState, cost: position.cost }));\n while (!pq.isEmpty()) {\n const { position, preceding, cost: totalCost } = pq.dequeue();\n if (!position)\n throw Error('next position not found');\n if (position.lNode === lActions.length && position.rNode === rActions.length)\n break;\n if (distances.get(positionKey(position)) === undefined ||\n totalCost < distances.get(positionKey(position))) {\n if (diffOptions.verbose) {\n console.log(moveTypeName(position.moveType) +\n ` from ${(0, types_1.nodeName)(lActions[preceding.lNode])}, ${(_a = rActions[preceding.rNode]) === null || _a === void 0 ? void 0 : _a.name} to ${(0, types_1.nodeName)(lActions[position.lNode])}, ${(_b = rActions[position.rNode]) === null || _b === void 0 ? void 0 : _b.name}`);\n console.log(`Min cost to ${positionKey(position)} is ${totalCost} via ${moveTypeName(position.moveType)} from ${positionKey(preceding)}`);\n }\n distances.set(positionKey(position), totalCost);\n stateMoves.set(positionKey(position), position.moveType);\n if (preceding)\n statePreceding.set(positionKey(position), positionKey(preceding));\n possibleMoves(position).forEach((newPosition) => pq.enqueue({\n position: newPosition,\n preceding: position,\n cost: totalCost + newPosition.cost,\n }));\n }\n }\n const moves = [];\n {\n let reachedState = [lActions.length - 1, rActions.length - 1].join(',');\n while (reachedState !== '-1,-1') {\n if (!reachedState)\n throw Error('reachedState not found');\n const [lNode, rNode] = reachedState.split(',').map(Number);\n const move = stateMoves.get(reachedState);\n const state = { lNode: lNode, rNode: rNode, moveType: move };\n moves.push(state);\n reachedState = statePreceding.get(reachedState);\n }\n }\n return { baseActions: lActions, headActions: rActions, moves: moves.reverse() };\n}\nexports.default = diff;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst diff_1 = require(\"./diff\");\nconst types_1 = require(\"./types\");\nfunction cloneAction(action) {\n const parent = action.parent;\n const children = action.children;\n const subtreeDigest = action.subtreeDigest;\n action.parent = undefined;\n action.children = [];\n action.subtreeDigest = 'unknown';\n const result = JSON.parse(JSON.stringify(action));\n action.parent = parent;\n action.children = children;\n action.subtreeDigest = subtreeDigest;\n return result;\n}\nfunction buildDiffDiagram(diff) {\n const diffActionsByAction = new Map();\n const buildActions = (state) => {\n const lAction = diff.baseActions[state.lNode];\n const rAction = diff.headActions[state.rNode];\n switch (state.moveType) {\n case diff_1.MoveType.AdvanceBoth: {\n const action = cloneAction(rAction);\n if (rAction.parent) {\n const parent = diffActionsByAction.get(rAction.parent);\n parent === null || parent === void 0 ? void 0 : parent.children.push(action);\n action.parent = parent;\n }\n diffActionsByAction.set(rAction, action);\n diffActionsByAction.set(lAction, action);\n return action;\n }\n case diff_1.MoveType.Change: {\n const action = cloneAction(rAction);\n action.diffMode = types_1.DiffMode.Change;\n action.formerName = (0, types_1.nodeName)(lAction);\n action.formerResult = (0, types_1.nodeResult)(lAction);\n if (rAction.parent) {\n const parent = diffActionsByAction.get(rAction.parent);\n parent === null || parent === void 0 ? void 0 : parent.children.push(action);\n action.parent = parent;\n }\n diffActionsByAction.set(rAction, action);\n diffActionsByAction.set(lAction, action);\n return action;\n }\n case diff_1.MoveType.DeleteLeft: {\n const action = cloneAction(lAction);\n action.diffMode = types_1.DiffMode.Delete;\n action.digest = ['delete', action.digest].join(':');\n // The parent of a deleted action is the cloned action of:\n //\n // a) If the deleted action is a child of a deleted action, the deleted action's parent.\n // Append to the children.\n // b) If the deleted action is not a child of a deleted action, the Head equivalent of the\n // deleted action's parent.\n // Case a)\n const deletedActionsParent = () => {\n if (!lAction.parent)\n return undefined;\n return diffActionsByAction.get(lAction.parent);\n };\n // Case b)\n const headEquivalentOfDeletedActionsParent = () => {\n if (!(rAction === null || rAction === void 0 ? void 0 : rAction.parent))\n return undefined;\n return diffActionsByAction.get(rAction.parent);\n };\n const parent = deletedActionsParent() || headEquivalentOfDeletedActionsParent();\n if (parent) {\n parent.children.splice(parent.children.length, 0, action);\n action.parent = parent;\n }\n diffActionsByAction.set(lAction, action);\n return action;\n }\n case diff_1.MoveType.InsertRight: {\n const action = cloneAction(rAction);\n action.diffMode = types_1.DiffMode.Insert;\n if (rAction.parent) {\n const parent = diffActionsByAction.get(rAction.parent);\n parent === null || parent === void 0 ? void 0 : parent.children.push(action);\n action.parent = parent;\n }\n diffActionsByAction.set(rAction, action);\n return action;\n }\n }\n };\n const actions = diff.moves.map((state) => buildActions(state));\n const uniqueActorIds = new Set();\n const actors = [];\n actions\n .map((action) => (0, types_1.actionActors)(action))\n .flat()\n .filter(Boolean)\n .forEach((actor) => {\n if (!actor)\n throw Error('actor not found');\n if (!uniqueActorIds.has(actor.id)) {\n uniqueActorIds.add(actor.id);\n actors.push(actor);\n }\n });\n actors.sort((a, b) => a.order - b.order);\n const rootActions = actions.filter((action) => !action.parent);\n return {\n actors,\n rootActions,\n };\n}\nexports.default = buildDiffDiagram;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst types_1 = require(\"./types\");\nfunction unparseDiagram(diagramData) {\n const diagram = diagramData;\n const actors = new Map();\n diagram.actors.forEach((actor) => actors.set(actor.id, actor));\n const resolveActors = (action) => {\n if (action.caller)\n action.caller = actors.get(action.caller);\n if (action.callee)\n action.callee = actors.get(action.callee);\n if (action.children)\n action.children.forEach((child) => resolveActors(child));\n };\n diagram.rootActions.forEach((action) => (0, types_1.setParent)(action));\n diagram.rootActions.forEach((action) => resolveActors(action));\n return diagram;\n}\nexports.default = unparseDiagram;\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst types_1 = require(\"./types\");\nfunction validateDiagram(diagramData) {\n return __awaiter(this, void 0, void 0, function* () {\n // Check if it's likely an AppMap object\n if (diagramData &&\n Object.prototype.hasOwnProperty.call(diagramData, 'metadata') &&\n Object.prototype.hasOwnProperty.call(diagramData, 'classMap') &&\n Object.prototype.hasOwnProperty.call(diagramData, 'events')) {\n return types_1.ValidationResult.AppMap;\n }\n if (!Array.isArray(diagramData.actors) || !Array.isArray(diagramData.rootActions)) {\n console.error('Invalid Diagram: actors and rootActions must be arrays.');\n return types_1.ValidationResult.Invalid;\n }\n const validateActor = (actor) => {\n if (typeof actor.id !== 'string' ||\n typeof actor.name !== 'string' ||\n typeof actor.order !== 'number') {\n console.error('Invalid Actor:', actor);\n return false;\n }\n return true;\n };\n const validateAction = (action) => {\n if (!action ||\n !Object.values(types_1.NodeType).includes(action.nodeType) ||\n typeof action.digest !== 'string' ||\n typeof action.subtreeDigest !== 'string' ||\n !Array.isArray(action.children) ||\n !Array.isArray(action.eventIds)) {\n console.error('Invalid Action:', action);\n return false;\n }\n // Validate children recursively\n for (const child of action.children) {\n if (!validateAction(child)) {\n return false;\n }\n }\n // Validate specific nodeType cases\n if ((0, types_1.isLoop)(action) && typeof action.count !== 'number') {\n console.error('Invalid Loop:', action);\n return false;\n }\n if (((0, types_1.isFunction)(action) || (0, types_1.isServerRPC)(action) || (0, types_1.isClientRPC)(action) || (0, types_1.isQuery)(action)) &&\n typeof action.callee !== 'string') {\n console.error(`Invalid ${types_1.NodeType[action.nodeType]}:`, action);\n return false;\n }\n return true;\n };\n for (const actor of diagramData.actors) {\n if (!validateActor(actor)) {\n return types_1.ValidationResult.Invalid;\n }\n }\n for (const action of diagramData.rootActions) {\n if (!validateAction(action)) {\n return types_1.ValidationResult.Invalid;\n }\n }\n return types_1.ValidationResult.Valid;\n });\n}\nexports.default = validateDiagram;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.format = exports.extension = void 0;\nexports.extension = '.json';\nfunction filterFields(key, value) {\n if (key === 'parent')\n return;\n if (value === undefined)\n return;\n if (['caller', 'callee'].includes(key))\n return value.id;\n return value;\n}\nfunction format(diagram) {\n return JSON.stringify(diagram, filterFields, 2);\n}\nexports.format = format;\n","export default function Diff() {}\n\nDiff.prototype = {\n diff(oldString, newString, options = {}) {\n let callback = options.callback;\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n this.options = options;\n\n let self = this;\n\n function done(value) {\n if (callback) {\n setTimeout(function() { callback(undefined, value); }, 0);\n return true;\n } else {\n return value;\n }\n }\n\n // Allow subclasses to massage the input prior to running\n oldString = this.castInput(oldString);\n newString = this.castInput(newString);\n\n oldString = this.removeEmpty(this.tokenize(oldString));\n newString = this.removeEmpty(this.tokenize(newString));\n\n let newLen = newString.length, oldLen = oldString.length;\n let editLength = 1;\n let maxEditLength = newLen + oldLen;\n if(options.maxEditLength) {\n maxEditLength = Math.min(maxEditLength, options.maxEditLength);\n }\n const maxExecutionTime = options.timeout ?? Infinity;\n const abortAfterTimestamp = Date.now() + maxExecutionTime;\n\n let bestPath = [{ oldPos: -1, lastComponent: undefined }];\n\n // Seed editLength = 0, i.e. the content starts with the same values\n let newPos = this.extractCommon(bestPath[0], newString, oldString, 0);\n if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {\n // Identity per the equality and tokenizer\n return done([{value: this.join(newString), count: newString.length}]);\n }\n\n // Once we hit the right edge of the edit graph on some diagonal k, we can\n // definitely reach the end of the edit graph in no more than k edits, so\n // there's no point in considering any moves to diagonal k+1 any more (from\n // which we're guaranteed to need at least k+1 more edits).\n // Similarly, once we've reached the bottom of the edit graph, there's no\n // point considering moves to lower diagonals.\n // We record this fact by setting minDiagonalToConsider and\n // maxDiagonalToConsider to some finite value once we've hit the edge of\n // the edit graph.\n // This optimization is not faithful to the original algorithm presented in\n // Myers's paper, which instead pointlessly extends D-paths off the end of\n // the edit graph - see page 7 of Myers's paper which notes this point\n // explicitly and illustrates it with a diagram. This has major performance\n // implications for some common scenarios. For instance, to compute a diff\n // where the new text simply appends d characters on the end of the\n // original text of length n, the true Myers algorithm will take O(n+d^2)\n // time while this optimization needs only O(n+d) time.\n let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;\n\n // Main worker method. checks all permutations of a given edit length for acceptance.\n function execEditLength() {\n for (\n let diagonalPath = Math.max(minDiagonalToConsider, -editLength);\n diagonalPath <= Math.min(maxDiagonalToConsider, editLength);\n diagonalPath += 2\n ) {\n let basePath;\n let removePath = bestPath[diagonalPath - 1],\n addPath = bestPath[diagonalPath + 1];\n if (removePath) {\n // No one else is going to attempt to use this value, clear it\n bestPath[diagonalPath - 1] = undefined;\n }\n\n let canAdd = false;\n if (addPath) {\n // what newPos will be after we do an insertion:\n const addPathNewPos = addPath.oldPos - diagonalPath;\n canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;\n }\n\n let canRemove = removePath && removePath.oldPos + 1 < oldLen;\n if (!canAdd && !canRemove) {\n // If this path is a terminal then prune\n bestPath[diagonalPath] = undefined;\n continue;\n }\n\n // Select the diagonal that we want to branch from. We select the prior\n // path whose position in the old string is the farthest from the origin\n // and does not pass the bounds of the diff graph\n // TODO: Remove the `+ 1` here to make behavior match Myers algorithm\n // and prefer to order removals before insertions.\n if (!canRemove || (canAdd && removePath.oldPos + 1 < addPath.oldPos)) {\n basePath = self.addToPath(addPath, true, undefined, 0);\n } else {\n basePath = self.addToPath(removePath, undefined, true, 1);\n }\n\n newPos = self.extractCommon(basePath, newString, oldString, diagonalPath);\n\n if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {\n // If we have hit the end of both strings, then we are done\n return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));\n } else {\n bestPath[diagonalPath] = basePath;\n if (basePath.oldPos + 1 >= oldLen) {\n maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);\n }\n if (newPos + 1 >= newLen) {\n minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);\n }\n }\n }\n\n editLength++;\n }\n\n // Performs the length of edit iteration. Is a bit fugly as this has to support the\n // sync and async mode which is never fun. Loops over execEditLength until a value\n // is produced, or until the edit length exceeds options.maxEditLength (if given),\n // in which case it will return undefined.\n if (callback) {\n (function exec() {\n setTimeout(function() {\n if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {\n return callback();\n }\n\n if (!execEditLength()) {\n exec();\n }\n }, 0);\n }());\n } else {\n while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {\n let ret = execEditLength();\n if (ret) {\n return ret;\n }\n }\n }\n },\n\n addToPath(path, added, removed, oldPosInc) {\n let last = path.lastComponent;\n if (last && last.added === added && last.removed === removed) {\n return {\n oldPos: path.oldPos + oldPosInc,\n lastComponent: {count: last.count + 1, added: added, removed: removed, previousComponent: last.previousComponent }\n };\n } else {\n return {\n oldPos: path.oldPos + oldPosInc,\n lastComponent: {count: 1, added: added, removed: removed, previousComponent: last }\n };\n }\n },\n extractCommon(basePath, newString, oldString, diagonalPath) {\n let newLen = newString.length,\n oldLen = oldString.length,\n oldPos = basePath.oldPos,\n newPos = oldPos - diagonalPath,\n\n commonCount = 0;\n while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {\n newPos++;\n oldPos++;\n commonCount++;\n }\n\n if (commonCount) {\n basePath.lastComponent = {count: commonCount, previousComponent: basePath.lastComponent};\n }\n\n basePath.oldPos = oldPos;\n return newPos;\n },\n\n equals(left, right) {\n if (this.options.comparator) {\n return this.options.comparator(left, right);\n } else {\n return left === right\n || (this.options.ignoreCase && left.toLowerCase() === right.toLowerCase());\n }\n },\n removeEmpty(array) {\n let ret = [];\n for (let i = 0; i < array.length; i++) {\n if (array[i]) {\n ret.push(array[i]);\n }\n }\n return ret;\n },\n castInput(value) {\n return value;\n },\n tokenize(value) {\n return value.split('');\n },\n join(chars) {\n return chars.join('');\n }\n};\n\nfunction buildValues(diff, lastComponent, newString, oldString, useLongestToken) {\n // First we convert our linked list of components in reverse order to an\n // array in the right order:\n const components = [];\n let nextComponent;\n while (lastComponent) {\n components.push(lastComponent);\n nextComponent = lastComponent.previousComponent;\n delete lastComponent.previousComponent;\n lastComponent = nextComponent;\n }\n components.reverse();\n\n let componentPos = 0,\n componentLen = components.length,\n newPos = 0,\n oldPos = 0;\n\n for (; componentPos < componentLen; componentPos++) {\n let component = components[componentPos];\n if (!component.removed) {\n if (!component.added && useLongestToken) {\n let value = newString.slice(newPos, newPos + component.count);\n value = value.map(function(value, i) {\n let oldValue = oldString[oldPos + i];\n return oldValue.length > value.length ? oldValue : value;\n });\n\n component.value = diff.join(value);\n } else {\n component.value = diff.join(newString.slice(newPos, newPos + component.count));\n }\n newPos += component.count;\n\n // Common case\n if (!component.added) {\n oldPos += component.count;\n }\n } else {\n component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));\n oldPos += component.count;\n\n // Reverse add and remove so removes are output first to match common convention\n // The diffing algorithm is tied to add then remove output and this is the simplest\n // route to get the desired output with minimal overhead.\n if (componentPos && components[componentPos - 1].added) {\n let tmp = components[componentPos - 1];\n components[componentPos - 1] = components[componentPos];\n components[componentPos] = tmp;\n }\n }\n }\n\n // Special case handle for when one terminal is ignored (i.e. whitespace).\n // For this case we merge the terminal into the prior string and drop the change.\n // This is only available for string mode.\n let finalComponent = components[componentLen - 1];\n if (componentLen > 1\n && typeof finalComponent.value === 'string'\n && (finalComponent.added || finalComponent.removed)\n && diff.equals('', finalComponent.value)) {\n components[componentLen - 2].value += finalComponent.value;\n components.pop();\n }\n\n return components;\n}\n","import Diff from './base';\n\nexport const characterDiff = new Diff();\nexport function diffChars(oldStr, newStr, options) { return characterDiff.diff(oldStr, newStr, options); }\n","export function generateOptions(options, defaults) {\n if (typeof options === 'function') {\n defaults.callback = options;\n } else if (options) {\n for (let name in options) {\n /* istanbul ignore else */\n if (options.hasOwnProperty(name)) {\n defaults[name] = options[name];\n }\n }\n }\n return defaults;\n}\n","import Diff from './base';\nimport {generateOptions} from '../util/params';\n\n// Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode\n//\n// Ranges and exceptions:\n// Latin-1 Supplement, 0080–00FF\n// - U+00D7 × Multiplication sign\n// - U+00F7 ÷ Division sign\n// Latin Extended-A, 0100–017F\n// Latin Extended-B, 0180–024F\n// IPA Extensions, 0250–02AF\n// Spacing Modifier Letters, 02B0–02FF\n// - U+02C7 ˇ ˇ Caron\n// - U+02D8 ˘ ˘ Breve\n// - U+02D9 ˙ ˙ Dot Above\n// - U+02DA ˚ ˚ Ring Above\n// - U+02DB ˛ ˛ Ogonek\n// - U+02DC ˜ ˜ Small Tilde\n// - U+02DD ˝ ˝ Double Acute Accent\n// Latin Extended Additional, 1E00–1EFF\nconst extendedWordChars = /^[a-zA-Z\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}]+$/u;\n\nconst reWhitespace = /\\S/;\n\nexport const wordDiff = new Diff();\nwordDiff.equals = function(left, right) {\n if (this.options.ignoreCase) {\n left = left.toLowerCase();\n right = right.toLowerCase();\n }\n return left === right || (this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right));\n};\nwordDiff.tokenize = function(value) {\n // All whitespace symbols except newline group into one token, each newline - in separate token\n let tokens = value.split(/([^\\S\\r\\n]+|[()[\\]{}'\"\\r\\n]|\\b)/);\n\n // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.\n for (let i = 0; i < tokens.length - 1; i++) {\n // If we have an empty string in the next field and we have only word chars before and after, merge\n if (!tokens[i + 1] && tokens[i + 2]\n && extendedWordChars.test(tokens[i])\n && extendedWordChars.test(tokens[i + 2])) {\n tokens[i] += tokens[i + 2];\n tokens.splice(i + 1, 2);\n i--;\n }\n }\n\n return tokens;\n};\n\nexport function diffWords(oldStr, newStr, options) {\n options = generateOptions(options, {ignoreWhitespace: true});\n return wordDiff.diff(oldStr, newStr, options);\n}\n\nexport function diffWordsWithSpace(oldStr, newStr, options) {\n return wordDiff.diff(oldStr, newStr, options);\n}\n","import Diff from './base';\nimport {generateOptions} from '../util/params';\n\nexport const lineDiff = new Diff();\nlineDiff.tokenize = function(value) {\n if(this.options.stripTrailingCr) {\n // remove one \\r before \\n to match GNU diff's --strip-trailing-cr behavior\n value = value.replace(/\\r\\n/g, '\\n');\n }\n\n let retLines = [],\n linesAndNewlines = value.split(/(\\n|\\r\\n)/);\n\n // Ignore the final empty token that occurs if the string ends with a new line\n if (!linesAndNewlines[linesAndNewlines.length - 1]) {\n linesAndNewlines.pop();\n }\n\n // Merge the content and line separators into single tokens\n for (let i = 0; i < linesAndNewlines.length; i++) {\n let line = linesAndNewlines[i];\n\n if (i % 2 && !this.options.newlineIsToken) {\n retLines[retLines.length - 1] += line;\n } else {\n if (this.options.ignoreWhitespace) {\n line = line.trim();\n }\n retLines.push(line);\n }\n }\n\n return retLines;\n};\n\nexport function diffLines(oldStr, newStr, callback) { return lineDiff.diff(oldStr, newStr, callback); }\nexport function diffTrimmedLines(oldStr, newStr, callback) {\n let options = generateOptions(callback, {ignoreWhitespace: true});\n return lineDiff.diff(oldStr, newStr, options);\n}\n","import Diff from './base';\n\n\nexport const sentenceDiff = new Diff();\nsentenceDiff.tokenize = function(value) {\n return value.split(/(\\S.+?[.!?])(?=\\s+|$)/);\n};\n\nexport function diffSentences(oldStr, newStr, callback) { return sentenceDiff.diff(oldStr, newStr, callback); }\n","import Diff from './base';\n\nexport const cssDiff = new Diff();\ncssDiff.tokenize = function(value) {\n return value.split(/([{}:;,]|\\s+)/);\n};\n\nexport function diffCss(oldStr, newStr, callback) { return cssDiff.diff(oldStr, newStr, callback); }\n","import Diff from './base';\nimport {lineDiff} from './line';\n\nconst objectPrototypeToString = Object.prototype.toString;\n\n\nexport const jsonDiff = new Diff();\n// Discriminate between two lines of pretty-printed, serialized JSON where one of them has a\n// dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:\njsonDiff.useLongestToken = true;\n\njsonDiff.tokenize = lineDiff.tokenize;\njsonDiff.castInput = function(value) {\n const {undefinedReplacement, stringifyReplacer = (k, v) => typeof v === 'undefined' ? undefinedReplacement : v} = this.options;\n\n return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');\n};\njsonDiff.equals = function(left, right) {\n return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\\r\\n])/g, '$1'), right.replace(/,([\\r\\n])/g, '$1'));\n};\n\nexport function diffJson(oldObj, newObj, options) { return jsonDiff.diff(oldObj, newObj, options); }\n\n// This function handles the presence of circular references by bailing out when encountering an\n// object that is already on the \"stack\" of items being processed. Accepts an optional replacer\nexport function canonicalize(obj, stack, replacementStack, replacer, key) {\n stack = stack || [];\n replacementStack = replacementStack || [];\n\n if (replacer) {\n obj = replacer(key, obj);\n }\n\n let i;\n\n for (i = 0; i < stack.length; i += 1) {\n if (stack[i] === obj) {\n return replacementStack[i];\n }\n }\n\n let canonicalizedObj;\n\n if ('[object Array]' === objectPrototypeToString.call(obj)) {\n stack.push(obj);\n canonicalizedObj = new Array(obj.length);\n replacementStack.push(canonicalizedObj);\n for (i = 0; i < obj.length; i += 1) {\n canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);\n }\n stack.pop();\n replacementStack.pop();\n return canonicalizedObj;\n }\n\n if (obj && obj.toJSON) {\n obj = obj.toJSON();\n }\n\n if (typeof obj === 'object' && obj !== null) {\n stack.push(obj);\n canonicalizedObj = {};\n replacementStack.push(canonicalizedObj);\n let sortedKeys = [],\n key;\n for (key in obj) {\n /* istanbul ignore else */\n if (obj.hasOwnProperty(key)) {\n sortedKeys.push(key);\n }\n }\n sortedKeys.sort();\n for (i = 0; i < sortedKeys.length; i += 1) {\n key = sortedKeys[i];\n canonicalizedObj[key] = canonicalize(obj[key], stack, replacementStack, replacer, key);\n }\n stack.pop();\n replacementStack.pop();\n } else {\n canonicalizedObj = obj;\n }\n return canonicalizedObj;\n}\n","import Diff from './base';\n\nexport const arrayDiff = new Diff();\narrayDiff.tokenize = function(value) {\n return value.slice();\n};\narrayDiff.join = arrayDiff.removeEmpty = function(value) {\n return value;\n};\n\nexport function diffArrays(oldArr, newArr, callback) { return arrayDiff.diff(oldArr, newArr, callback); }\n","export function parsePatch(uniDiff, options = {}) {\n let diffstr = uniDiff.split(/\\r\\n|[\\n\\v\\f\\r\\x85]/),\n delimiters = uniDiff.match(/\\r\\n|[\\n\\v\\f\\r\\x85]/g) || [],\n list = [],\n i = 0;\n\n function parseIndex() {\n let index = {};\n list.push(index);\n\n // Parse diff metadata\n while (i < diffstr.length) {\n let line = diffstr[i];\n\n // File header found, end parsing diff metadata\n if ((/^(\\-\\-\\-|\\+\\+\\+|@@)\\s/).test(line)) {\n break;\n }\n\n // Diff index\n let header = (/^(?:Index:|diff(?: -r \\w+)+)\\s+(.+?)\\s*$/).exec(line);\n if (header) {\n index.index = header[1];\n }\n\n i++;\n }\n\n // Parse file headers if they are defined. Unified diff requires them, but\n // there's no technical issues to have an isolated hunk without file header\n parseFileHeader(index);\n parseFileHeader(index);\n\n // Parse hunks\n index.hunks = [];\n\n while (i < diffstr.length) {\n let line = diffstr[i];\n\n if ((/^(Index:|diff|\\-\\-\\-|\\+\\+\\+)\\s/).test(line)) {\n break;\n } else if ((/^@@/).test(line)) {\n index.hunks.push(parseHunk());\n } else if (line && options.strict) {\n // Ignore unexpected content unless in strict mode\n throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(line));\n } else {\n i++;\n }\n }\n }\n\n // Parses the --- and +++ headers, if none are found, no lines\n // are consumed.\n function parseFileHeader(index) {\n const fileHeader = (/^(---|\\+\\+\\+)\\s+(.*)$/).exec(diffstr[i]);\n if (fileHeader) {\n let keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';\n const data = fileHeader[2].split('\\t', 2);\n let fileName = data[0].replace(/\\\\\\\\/g, '\\\\');\n if ((/^\".*\"$/).test(fileName)) {\n fileName = fileName.substr(1, fileName.length - 2);\n }\n index[keyPrefix + 'FileName'] = fileName;\n index[keyPrefix + 'Header'] = (data[1] || '').trim();\n\n i++;\n }\n }\n\n // Parses a hunk\n // This assumes that we are at the start of a hunk.\n function parseHunk() {\n let chunkHeaderIndex = i,\n chunkHeaderLine = diffstr[i++],\n chunkHeader = chunkHeaderLine.split(/@@ -(\\d+)(?:,(\\d+))? \\+(\\d+)(?:,(\\d+))? @@/);\n\n let hunk = {\n oldStart: +chunkHeader[1],\n oldLines: typeof chunkHeader[2] === 'undefined' ? 1 : +chunkHeader[2],\n newStart: +chunkHeader[3],\n newLines: typeof chunkHeader[4] === 'undefined' ? 1 : +chunkHeader[4],\n lines: [],\n linedelimiters: []\n };\n\n // Unified Diff Format quirk: If the chunk size is 0,\n // the first number is one lower than one would expect.\n // https://www.artima.com/weblogs/viewpost.jsp?thread=164293\n if (hunk.oldLines === 0) {\n hunk.oldStart += 1;\n }\n if (hunk.newLines === 0) {\n hunk.newStart += 1;\n }\n\n let addCount = 0,\n removeCount = 0;\n for (; i < diffstr.length; i++) {\n // Lines starting with '---' could be mistaken for the \"remove line\" operation\n // But they could be the header for the next file. Therefore prune such cases out.\n if (diffstr[i].indexOf('--- ') === 0\n && (i + 2 < diffstr.length)\n && diffstr[i + 1].indexOf('+++ ') === 0\n && diffstr[i + 2].indexOf('@@') === 0) {\n break;\n }\n let operation = (diffstr[i].length == 0 && i != (diffstr.length - 1)) ? ' ' : diffstr[i][0];\n\n if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\\\') {\n hunk.lines.push(diffstr[i]);\n hunk.linedelimiters.push(delimiters[i] || '\\n');\n\n if (operation === '+') {\n addCount++;\n } else if (operation === '-') {\n removeCount++;\n } else if (operation === ' ') {\n addCount++;\n removeCount++;\n }\n } else {\n break;\n }\n }\n\n // Handle the empty block count case\n if (!addCount && hunk.newLines === 1) {\n hunk.newLines = 0;\n }\n if (!removeCount && hunk.oldLines === 1) {\n hunk.oldLines = 0;\n }\n\n // Perform optional sanity checking\n if (options.strict) {\n if (addCount !== hunk.newLines) {\n throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));\n }\n if (removeCount !== hunk.oldLines) {\n throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));\n }\n }\n\n return hunk;\n }\n\n while (i < diffstr.length) {\n parseIndex();\n }\n\n return list;\n}\n","// Iterator that traverses in the range of [min, max], stepping\n// by distance from a given start position. I.e. for [0, 4], with\n// start of 2, this will iterate 2, 3, 1, 4, 0.\nexport default function(start, minLine, maxLine) {\n let wantForward = true,\n backwardExhausted = false,\n forwardExhausted = false,\n localOffset = 1;\n\n return function iterator() {\n if (wantForward && !forwardExhausted) {\n if (backwardExhausted) {\n localOffset++;\n } else {\n wantForward = false;\n }\n\n // Check if trying to fit beyond text length, and if not, check it fits\n // after offset location (or desired location on first iteration)\n if (start + localOffset <= maxLine) {\n return localOffset;\n }\n\n forwardExhausted = true;\n }\n\n if (!backwardExhausted) {\n if (!forwardExhausted) {\n wantForward = true;\n }\n\n // Check if trying to fit before text beginning, and if not, check it fits\n // before offset location\n if (minLine <= start - localOffset) {\n return -localOffset++;\n }\n\n backwardExhausted = true;\n return iterator();\n }\n\n // We tried to fit hunk before text beginning and beyond text length, then\n // hunk can't fit on the text. Return undefined\n };\n}\n","import {parsePatch} from './parse';\nimport distanceIterator from '../util/distance-iterator';\n\nexport function applyPatch(source, uniDiff, options = {}) {\n if (typeof uniDiff === 'string') {\n uniDiff = parsePatch(uniDiff);\n }\n\n if (Array.isArray(uniDiff)) {\n if (uniDiff.length > 1) {\n throw new Error('applyPatch only works with a single input.');\n }\n\n uniDiff = uniDiff[0];\n }\n\n // Apply the diff to the input\n let lines = source.split(/\\r\\n|[\\n\\v\\f\\r\\x85]/),\n delimiters = source.match(/\\r\\n|[\\n\\v\\f\\r\\x85]/g) || [],\n hunks = uniDiff.hunks,\n\n compareLine = options.compareLine || ((lineNumber, line, operation, patchContent) => line === patchContent),\n errorCount = 0,\n fuzzFactor = options.fuzzFactor || 0,\n minLine = 0,\n offset = 0,\n\n removeEOFNL,\n addEOFNL;\n\n /**\n * Checks if the hunk exactly fits on the provided location\n */\n function hunkFits(hunk, toPos) {\n for (let j = 0; j < hunk.lines.length; j++) {\n let line = hunk.lines[j],\n operation = (line.length > 0 ? line[0] : ' '),\n content = (line.length > 0 ? line.substr(1) : line);\n\n if (operation === ' ' || operation === '-') {\n // Context sanity check\n if (!compareLine(toPos + 1, lines[toPos], operation, content)) {\n errorCount++;\n\n if (errorCount > fuzzFactor) {\n return false;\n }\n }\n toPos++;\n }\n }\n\n return true;\n }\n\n // Search best fit offsets for each hunk based on the previous ones\n for (let i = 0; i < hunks.length; i++) {\n let hunk = hunks[i],\n maxLine = lines.length - hunk.oldLines,\n localOffset = 0,\n toPos = offset + hunk.oldStart - 1;\n\n let iterator = distanceIterator(toPos, minLine, maxLine);\n\n for (; localOffset !== undefined; localOffset = iterator()) {\n if (hunkFits(hunk, toPos + localOffset)) {\n hunk.offset = offset += localOffset;\n break;\n }\n }\n\n if (localOffset === undefined) {\n return false;\n }\n\n // Set lower text limit to end of the current hunk, so next ones don't try\n // to fit over already patched text\n minLine = hunk.offset + hunk.oldStart + hunk.oldLines;\n }\n\n // Apply patch hunks\n let diffOffset = 0;\n for (let i = 0; i < hunks.length; i++) {\n let hunk = hunks[i],\n toPos = hunk.oldStart + hunk.offset + diffOffset - 1;\n diffOffset += hunk.newLines - hunk.oldLines;\n\n for (let j = 0; j < hunk.lines.length; j++) {\n let line = hunk.lines[j],\n operation = (line.length > 0 ? line[0] : ' '),\n content = (line.length > 0 ? line.substr(1) : line),\n delimiter = hunk.linedelimiters && hunk.linedelimiters[j] || '\\n';\n\n if (operation === ' ') {\n toPos++;\n } else if (operation === '-') {\n lines.splice(toPos, 1);\n delimiters.splice(toPos, 1);\n /* istanbul ignore else */\n } else if (operation === '+') {\n lines.splice(toPos, 0, content);\n delimiters.splice(toPos, 0, delimiter);\n toPos++;\n } else if (operation === '\\\\') {\n let previousOperation = hunk.lines[j - 1] ? hunk.lines[j - 1][0] : null;\n if (previousOperation === '+') {\n removeEOFNL = true;\n } else if (previousOperation === '-') {\n addEOFNL = true;\n }\n }\n }\n }\n\n // Handle EOFNL insertion/removal\n if (removeEOFNL) {\n while (!lines[lines.length - 1]) {\n lines.pop();\n delimiters.pop();\n }\n } else if (addEOFNL) {\n lines.push('');\n delimiters.push('\\n');\n }\n for (let _k = 0; _k < lines.length - 1; _k++) {\n lines[_k] = lines[_k] + delimiters[_k];\n }\n return lines.join('');\n}\n\n// Wrapper that supports multiple file patches via callbacks.\nexport function applyPatches(uniDiff, options) {\n if (typeof uniDiff === 'string') {\n uniDiff = parsePatch(uniDiff);\n }\n\n let currentIndex = 0;\n function processIndex() {\n let index = uniDiff[currentIndex++];\n if (!index) {\n return options.complete();\n }\n\n options.loadFile(index, function(err, data) {\n if (err) {\n return options.complete(err);\n }\n\n let updatedContent = applyPatch(data, index, options);\n options.patched(index, updatedContent, function(err) {\n if (err) {\n return options.complete(err);\n }\n\n processIndex();\n });\n });\n }\n processIndex();\n}\n","import {diffLines} from '../diff/line';\n\nexport function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {\n if (!options) {\n options = {};\n }\n if (typeof options.context === 'undefined') {\n options.context = 4;\n }\n\n const diff = diffLines(oldStr, newStr, options);\n if(!diff) {\n return;\n }\n\n diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier\n\n function contextLines(lines) {\n return lines.map(function(entry) { return ' ' + entry; });\n }\n\n let hunks = [];\n let oldRangeStart = 0, newRangeStart = 0, curRange = [],\n oldLine = 1, newLine = 1;\n for (let i = 0; i < diff.length; i++) {\n const current = diff[i],\n lines = current.lines || current.value.replace(/\\n$/, '').split('\\n');\n current.lines = lines;\n\n if (current.added || current.removed) {\n // If we have previous context, start with that\n if (!oldRangeStart) {\n const prev = diff[i - 1];\n oldRangeStart = oldLine;\n newRangeStart = newLine;\n\n if (prev) {\n curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];\n oldRangeStart -= curRange.length;\n newRangeStart -= curRange.length;\n }\n }\n\n // Output our changes\n curRange.push(... lines.map(function(entry) {\n return (current.added ? '+' : '-') + entry;\n }));\n\n // Track the updated file position\n if (current.added) {\n newLine += lines.length;\n } else {\n oldLine += lines.length;\n }\n } else {\n // Identical context lines. Track line changes\n if (oldRangeStart) {\n // Close out any changes that have been output (or join overlapping)\n if (lines.length <= options.context * 2 && i < diff.length - 2) {\n // Overlapping\n curRange.push(... contextLines(lines));\n } else {\n // end the range and output\n let contextSize = Math.min(lines.length, options.context);\n curRange.push(... contextLines(lines.slice(0, contextSize)));\n\n let hunk = {\n oldStart: oldRangeStart,\n oldLines: (oldLine - oldRangeStart + contextSize),\n newStart: newRangeStart,\n newLines: (newLine - newRangeStart + contextSize),\n lines: curRange\n };\n if (i >= diff.length - 2 && lines.length <= options.context) {\n // EOF is inside this hunk\n let oldEOFNewline = ((/\\n$/).test(oldStr));\n let newEOFNewline = ((/\\n$/).test(newStr));\n let noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines;\n if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) {\n // special case: old has no eol and no trailing context; no-nl can end up before adds\n // however, if the old file is empty, do not output the no-nl line\n curRange.splice(hunk.oldLines, 0, '\\\\ No newline at end of file');\n }\n if ((!oldEOFNewline && !noNlBeforeAdds) || !newEOFNewline) {\n curRange.push('\\\\ No newline at end of file');\n }\n }\n hunks.push(hunk);\n\n oldRangeStart = 0;\n newRangeStart = 0;\n curRange = [];\n }\n }\n oldLine += lines.length;\n newLine += lines.length;\n }\n }\n\n return {\n oldFileName: oldFileName, newFileName: newFileName,\n oldHeader: oldHeader, newHeader: newHeader,\n hunks: hunks\n };\n}\n\nexport function formatPatch(diff) {\n if (Array.isArray(diff)) {\n return diff.map(formatPatch).join('\\n');\n }\n\n const ret = [];\n if (diff.oldFileName == diff.newFileName) {\n ret.push('Index: ' + diff.oldFileName);\n }\n ret.push('===================================================================');\n ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\\t' + diff.oldHeader));\n ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\\t' + diff.newHeader));\n\n for (let i = 0; i < diff.hunks.length; i++) {\n const hunk = diff.hunks[i];\n // Unified Diff Format quirk: If the chunk size is 0,\n // the first number is one lower than one would expect.\n // https://www.artima.com/weblogs/viewpost.jsp?thread=164293\n if (hunk.oldLines === 0) {\n hunk.oldStart -= 1;\n }\n if (hunk.newLines === 0) {\n hunk.newStart -= 1;\n }\n ret.push(\n '@@ -' + hunk.oldStart + ',' + hunk.oldLines\n + ' +' + hunk.newStart + ',' + hunk.newLines\n + ' @@'\n );\n ret.push.apply(ret, hunk.lines);\n }\n\n return ret.join('\\n') + '\\n';\n}\n\nexport function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {\n return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options));\n}\n\nexport function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {\n return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);\n}\n","export function arrayEqual(a, b) {\n if (a.length !== b.length) {\n return false;\n }\n\n return arrayStartsWith(a, b);\n}\n\nexport function arrayStartsWith(array, start) {\n if (start.length > array.length) {\n return false;\n }\n\n for (let i = 0; i < start.length; i++) {\n if (start[i] !== array[i]) {\n return false;\n }\n }\n\n return true;\n}\n","import {structuredPatch} from './create';\nimport {parsePatch} from './parse';\n\nimport {arrayEqual, arrayStartsWith} from '../util/array';\n\nexport function calcLineCount(hunk) {\n const {oldLines, newLines} = calcOldNewLineCount(hunk.lines);\n\n if (oldLines !== undefined) {\n hunk.oldLines = oldLines;\n } else {\n delete hunk.oldLines;\n }\n\n if (newLines !== undefined) {\n hunk.newLines = newLines;\n } else {\n delete hunk.newLines;\n }\n}\n\nexport function merge(mine, theirs, base) {\n mine = loadPatch(mine, base);\n theirs = loadPatch(theirs, base);\n\n let ret = {};\n\n // For index we just let it pass through as it doesn't have any necessary meaning.\n // Leaving sanity checks on this to the API consumer that may know more about the\n // meaning in their own context.\n if (mine.index || theirs.index) {\n ret.index = mine.index || theirs.index;\n }\n\n if (mine.newFileName || theirs.newFileName) {\n if (!fileNameChanged(mine)) {\n // No header or no change in ours, use theirs (and ours if theirs does not exist)\n ret.oldFileName = theirs.oldFileName || mine.oldFileName;\n ret.newFileName = theirs.newFileName || mine.newFileName;\n ret.oldHeader = theirs.oldHeader || mine.oldHeader;\n ret.newHeader = theirs.newHeader || mine.newHeader;\n } else if (!fileNameChanged(theirs)) {\n // No header or no change in theirs, use ours\n ret.oldFileName = mine.oldFileName;\n ret.newFileName = mine.newFileName;\n ret.oldHeader = mine.oldHeader;\n ret.newHeader = mine.newHeader;\n } else {\n // Both changed... figure it out\n ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);\n ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);\n ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);\n ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);\n }\n }\n\n ret.hunks = [];\n\n let mineIndex = 0,\n theirsIndex = 0,\n mineOffset = 0,\n theirsOffset = 0;\n\n while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {\n let mineCurrent = mine.hunks[mineIndex] || {oldStart: Infinity},\n theirsCurrent = theirs.hunks[theirsIndex] || {oldStart: Infinity};\n\n if (hunkBefore(mineCurrent, theirsCurrent)) {\n // This patch does not overlap with any of the others, yay.\n ret.hunks.push(cloneHunk(mineCurrent, mineOffset));\n mineIndex++;\n theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;\n } else if (hunkBefore(theirsCurrent, mineCurrent)) {\n // This patch does not overlap with any of the others, yay.\n ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));\n theirsIndex++;\n mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;\n } else {\n // Overlap, merge as best we can\n let mergedHunk = {\n oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),\n oldLines: 0,\n newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),\n newLines: 0,\n lines: []\n };\n mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);\n theirsIndex++;\n mineIndex++;\n\n ret.hunks.push(mergedHunk);\n }\n }\n\n return ret;\n}\n\nfunction loadPatch(param, base) {\n if (typeof param === 'string') {\n if ((/^@@/m).test(param) || ((/^Index:/m).test(param))) {\n return parsePatch(param)[0];\n }\n\n if (!base) {\n throw new Error('Must provide a base reference or pass in a patch');\n }\n return structuredPatch(undefined, undefined, base, param);\n }\n\n return param;\n}\n\nfunction fileNameChanged(patch) {\n return patch.newFileName && patch.newFileName !== patch.oldFileName;\n}\n\nfunction selectField(index, mine, theirs) {\n if (mine === theirs) {\n return mine;\n } else {\n index.conflict = true;\n return {mine, theirs};\n }\n}\n\nfunction hunkBefore(test, check) {\n return test.oldStart < check.oldStart\n && (test.oldStart + test.oldLines) < check.oldStart;\n}\n\nfunction cloneHunk(hunk, offset) {\n return {\n oldStart: hunk.oldStart, oldLines: hunk.oldLines,\n newStart: hunk.newStart + offset, newLines: hunk.newLines,\n lines: hunk.lines\n };\n}\n\nfunction mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {\n // This will generally result in a conflicted hunk, but there are cases where the context\n // is the only overlap where we can successfully merge the content here.\n let mine = {offset: mineOffset, lines: mineLines, index: 0},\n their = {offset: theirOffset, lines: theirLines, index: 0};\n\n // Handle any leading content\n insertLeading(hunk, mine, their);\n insertLeading(hunk, their, mine);\n\n // Now in the overlap content. Scan through and select the best changes from each.\n while (mine.index < mine.lines.length && their.index < their.lines.length) {\n let mineCurrent = mine.lines[mine.index],\n theirCurrent = their.lines[their.index];\n\n if ((mineCurrent[0] === '-' || mineCurrent[0] === '+')\n && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {\n // Both modified ...\n mutualChange(hunk, mine, their);\n } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {\n // Mine inserted\n hunk.lines.push(... collectChange(mine));\n } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {\n // Theirs inserted\n hunk.lines.push(... collectChange(their));\n } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {\n // Mine removed or edited\n removal(hunk, mine, their);\n } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {\n // Their removed or edited\n removal(hunk, their, mine, true);\n } else if (mineCurrent === theirCurrent) {\n // Context identity\n hunk.lines.push(mineCurrent);\n mine.index++;\n their.index++;\n } else {\n // Context mismatch\n conflict(hunk, collectChange(mine), collectChange(their));\n }\n }\n\n // Now push anything that may be remaining\n insertTrailing(hunk, mine);\n insertTrailing(hunk, their);\n\n calcLineCount(hunk);\n}\n\nfunction mutualChange(hunk, mine, their) {\n let myChanges = collectChange(mine),\n theirChanges = collectChange(their);\n\n if (allRemoves(myChanges) && allRemoves(theirChanges)) {\n // Special case for remove changes that are supersets of one another\n if (arrayStartsWith(myChanges, theirChanges)\n && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {\n hunk.lines.push(... myChanges);\n return;\n } else if (arrayStartsWith(theirChanges, myChanges)\n && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {\n hunk.lines.push(... theirChanges);\n return;\n }\n } else if (arrayEqual(myChanges, theirChanges)) {\n hunk.lines.push(... myChanges);\n return;\n }\n\n conflict(hunk, myChanges, theirChanges);\n}\n\nfunction removal(hunk, mine, their, swap) {\n let myChanges = collectChange(mine),\n theirChanges = collectContext(their, myChanges);\n if (theirChanges.merged) {\n hunk.lines.push(... theirChanges.merged);\n } else {\n conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);\n }\n}\n\nfunction conflict(hunk, mine, their) {\n hunk.conflict = true;\n hunk.lines.push({\n conflict: true,\n mine: mine,\n theirs: their\n });\n}\n\nfunction insertLeading(hunk, insert, their) {\n while (insert.offset < their.offset && insert.index < insert.lines.length) {\n let line = insert.lines[insert.index++];\n hunk.lines.push(line);\n insert.offset++;\n }\n}\nfunction insertTrailing(hunk, insert) {\n while (insert.index < insert.lines.length) {\n let line = insert.lines[insert.index++];\n hunk.lines.push(line);\n }\n}\n\nfunction collectChange(state) {\n let ret = [],\n operation = state.lines[state.index][0];\n while (state.index < state.lines.length) {\n let line = state.lines[state.index];\n\n // Group additions that are immediately after subtractions and treat them as one \"atomic\" modify change.\n if (operation === '-' && line[0] === '+') {\n operation = '+';\n }\n\n if (operation === line[0]) {\n ret.push(line);\n state.index++;\n } else {\n break;\n }\n }\n\n return ret;\n}\nfunction collectContext(state, matchChanges) {\n let changes = [],\n merged = [],\n matchIndex = 0,\n contextChanges = false,\n conflicted = false;\n while (matchIndex < matchChanges.length\n && state.index < state.lines.length) {\n let change = state.lines[state.index],\n match = matchChanges[matchIndex];\n\n // Once we've hit our add, then we are done\n if (match[0] === '+') {\n break;\n }\n\n contextChanges = contextChanges || change[0] !== ' ';\n\n merged.push(match);\n matchIndex++;\n\n // Consume any additions in the other block as a conflict to attempt\n // to pull in the remaining context after this\n if (change[0] === '+') {\n conflicted = true;\n\n while (change[0] === '+') {\n changes.push(change);\n change = state.lines[++state.index];\n }\n }\n\n if (match.substr(1) === change.substr(1)) {\n changes.push(change);\n state.index++;\n } else {\n conflicted = true;\n }\n }\n\n if ((matchChanges[matchIndex] || '')[0] === '+'\n && contextChanges) {\n conflicted = true;\n }\n\n if (conflicted) {\n return changes;\n }\n\n while (matchIndex < matchChanges.length) {\n merged.push(matchChanges[matchIndex++]);\n }\n\n return {\n merged,\n changes\n };\n}\n\nfunction allRemoves(changes) {\n return changes.reduce(function(prev, change) {\n return prev && change[0] === '-';\n }, true);\n}\nfunction skipRemoveSuperset(state, removeChanges, delta) {\n for (let i = 0; i < delta; i++) {\n let changeContent = removeChanges[removeChanges.length - delta + i].substr(1);\n if (state.lines[state.index + i] !== ' ' + changeContent) {\n return false;\n }\n }\n\n state.index += delta;\n return true;\n}\n\nfunction calcOldNewLineCount(lines) {\n let oldLines = 0;\n let newLines = 0;\n\n lines.forEach(function(line) {\n if (typeof line !== 'string') {\n let myCount = calcOldNewLineCount(line.mine);\n let theirCount = calcOldNewLineCount(line.theirs);\n\n if (oldLines !== undefined) {\n if (myCount.oldLines === theirCount.oldLines) {\n oldLines += myCount.oldLines;\n } else {\n oldLines = undefined;\n }\n }\n\n if (newLines !== undefined) {\n if (myCount.newLines === theirCount.newLines) {\n newLines += myCount.newLines;\n } else {\n newLines = undefined;\n }\n }\n } else {\n if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {\n newLines++;\n }\n if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {\n oldLines++;\n }\n }\n });\n\n return {oldLines, newLines};\n}\n","export function reversePatch(structuredPatch) {\n if (Array.isArray(structuredPatch)) {\n return structuredPatch.map(reversePatch).reverse();\n }\n\n return {\n ...structuredPatch,\n oldFileName: structuredPatch.newFileName,\n oldHeader: structuredPatch.newHeader,\n newFileName: structuredPatch.oldFileName,\n newHeader: structuredPatch.oldHeader,\n hunks: structuredPatch.hunks.map(hunk => {\n return {\n oldLines: hunk.newLines,\n oldStart: hunk.newStart,\n newLines: hunk.oldLines,\n newStart: hunk.oldStart,\n linedelimiters: hunk.linedelimiters,\n lines: hunk.lines.map(l => {\n if (l.startsWith('-')) { return `+${l.slice(1)}`; }\n if (l.startsWith('+')) { return `-${l.slice(1)}`; }\n return l;\n })\n };\n })\n };\n}\n","// See: http://code.google.com/p/google-diff-match-patch/wiki/API\nexport function convertChangesToDMP(changes) {\n let ret = [],\n change,\n operation;\n for (let i = 0; i < changes.length; i++) {\n change = changes[i];\n if (change.added) {\n operation = 1;\n } else if (change.removed) {\n operation = -1;\n } else {\n operation = 0;\n }\n\n ret.push([operation, change.value]);\n }\n return ret;\n}\n","export function convertChangesToXML(changes) {\n let ret = [];\n for (let i = 0; i < changes.length; i++) {\n let change = changes[i];\n if (change.added) {\n ret.push('');\n } else if (change.removed) {\n ret.push('');\n }\n\n ret.push(escapeHTML(change.value));\n\n if (change.added) {\n ret.push('');\n } else if (change.removed) {\n ret.push('');\n }\n }\n return ret.join('');\n}\n\nfunction escapeHTML(s) {\n let n = s;\n n = n.replace(/&/g, '&');\n n = n.replace(//g, '>');\n n = n.replace(/\"/g, '"');\n\n return n;\n}\n","/* See LICENSE file for terms of use */\n\n/*\n * Text diff implementation.\n *\n * This library supports the following APIs:\n * Diff.diffChars: Character by character diff\n * Diff.diffWords: Word (as defined by \\b regex) diff which ignores whitespace\n * Diff.diffLines: Line based diff\n *\n * Diff.diffCss: Diff targeted at CSS content\n *\n * These methods are based on the implementation proposed in\n * \"An O(ND) Difference Algorithm and its Variations\" (Myers, 1986).\n * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927\n */\nimport Diff from './diff/base';\nimport {diffChars} from './diff/character';\nimport {diffWords, diffWordsWithSpace} from './diff/word';\nimport {diffLines, diffTrimmedLines} from './diff/line';\nimport {diffSentences} from './diff/sentence';\n\nimport {diffCss} from './diff/css';\nimport {diffJson, canonicalize} from './diff/json';\n\nimport {diffArrays} from './diff/array';\n\nimport {applyPatch, applyPatches} from './patch/apply';\nimport {parsePatch} from './patch/parse';\nimport {merge} from './patch/merge';\nimport {reversePatch} from './patch/reverse';\nimport {structuredPatch, createTwoFilesPatch, createPatch, formatPatch} from './patch/create';\n\nimport {convertChangesToDMP} from './convert/dmp';\nimport {convertChangesToXML} from './convert/xml';\n\nexport {\n Diff,\n\n diffChars,\n diffWords,\n diffWordsWithSpace,\n diffLines,\n diffTrimmedLines,\n diffSentences,\n\n diffCss,\n diffJson,\n\n diffArrays,\n\n structuredPatch,\n createTwoFilesPatch,\n createPatch,\n formatPatch,\n applyPatch,\n applyPatches,\n parsePatch,\n merge,\n reversePatch,\n convertChangesToDMP,\n convertChangesToXML,\n canonicalize\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.format = exports.extension = void 0;\nconst diff_1 = require(\"diff\");\nconst types_1 = require(\"../types\");\nconst DisplayCharLimit = 50;\nexports.extension = '.uml';\nfunction formatElapsed(elapsed, markupEnabled) {\n const timeStr = () => {\n return `${+(elapsed * 1000).toPrecision(3)} ms`;\n };\n if (markupEnabled)\n return ` ${timeStr()}`;\n else\n return `(${timeStr()})`;\n}\nfunction singleLine(str) {\n return str.replace(/\\n/g, '\\\\n').replace(/\\s{2,}/g, ' ');\n}\nclass Label {\n constructor(action) {\n this.action = action;\n }\n get actionNameIsTrimmed() {\n return (0, types_1.nodeName)(this.action).length > DisplayCharLimit;\n }\n requestLabel(markupEnabled) {\n const { action } = this;\n const label = singleLine((0, types_1.nodeName)(this.action)).slice(0, DisplayCharLimit);\n let formerLabel;\n if (action.formerName)\n formerLabel = singleLine(action.formerName).slice(0, DisplayCharLimit);\n const formattedLabel = this.formatDiffLabel(label, formerLabel);\n const tokens = [];\n // PlantUML / Creole doesn't successfully combine strikethrough with underline.\n // Only the underline ends up being rendered.\n if (markupEnabled && (0, types_1.isFunction)(action) && action.static && action.diffMode !== types_1.DiffMode.Delete)\n tokens.push('');\n tokens.push(formattedLabel);\n if (markupEnabled && (0, types_1.isFunction)(action) && action.static && action.diffMode !== types_1.DiffMode.Delete)\n tokens.push('');\n if (action.elapsed && action.diffMode !== types_1.DiffMode.Delete) {\n tokens.push(' ');\n tokens.push(formatElapsed(action.elapsed, markupEnabled));\n }\n return tokens.join('');\n }\n responseLabel(markupEnabled) {\n const response = actionResponse(this.action);\n if (!response)\n return;\n let label = (0, types_1.nodeResult)(this.action);\n if (!label)\n return;\n label = singleLine(label).slice(0, DisplayCharLimit);\n let formerLabel;\n if (this.action.formerResult)\n formerLabel = singleLine(this.action.formerResult).slice(0, DisplayCharLimit);\n const formattedLabel = this.formatDiffLabel(label, formerLabel);\n const tokens = [];\n if (markupEnabled && response.raisesException)\n tokens.push('');\n tokens.push(formattedLabel);\n if (markupEnabled && response.raisesException)\n tokens.push('');\n return tokens.join('');\n }\n note(foldLimit = 80) {\n const { action } = this;\n const label = fold((0, types_1.nodeName)(this.action), foldLimit);\n let formerLabel = [];\n if (action.formerName)\n formerLabel = fold(action.formerName, foldLimit);\n const result = [];\n for (let i = 0; i < Math.max(label.length, formerLabel.length); i += 1) {\n const line = this.formatDiffLabel(label[i], formerLabel[i]);\n result.push(line);\n }\n return result.join('\\n');\n }\n formatDiffLabel(label, formerLabel) {\n const tokens = [];\n const addedSegment = (text) => {\n tokens.push(``);\n tokens.push(text);\n tokens.push('');\n };\n const removedSegment = (text) => {\n tokens.push(`--`);\n tokens.push(text);\n tokens.push('--');\n };\n if (this.action.diffMode === types_1.DiffMode.Change && label && formerLabel && label !== formerLabel) {\n const diff = (0, diff_1.diffChars)(formerLabel, label);\n const changeCharsCount = diff.reduce((memo, change) => (change.added || change.removed ? memo + (change.count || 0) : memo), 0);\n if (changeCharsCount / Math.max(formerLabel.length, label.length) <\n Label.ChangedCharsThreshod) {\n for (const change of diff) {\n if (change.removed) {\n removedSegment(change.value);\n }\n else if (change.added) {\n addedSegment(change.value);\n }\n else {\n tokens.push(change.value);\n }\n }\n }\n else {\n removedSegment(formerLabel);\n tokens.push(' ');\n addedSegment(label);\n }\n }\n else if (this.action.diffMode && label && formerLabel && label === formerLabel) {\n tokens.push(label);\n }\n else if (label) {\n if (this.action.diffMode) {\n this.action.diffMode === types_1.DiffMode.Delete ? removedSegment(label) : addedSegment(label);\n }\n else {\n tokens.push(label);\n }\n }\n return tokens.join('');\n }\n}\nLabel.ChangedCharsThreshod = 0.25;\nLabel.GitHubDiffLightThemeRemovedColorBackground = '#FCECEA'; // [ 252, 236, 234 ];\nLabel.GitHubDiffLightThemeAddedColorBackground = '#EBFEEE'; // [ 235, 254, 238 ];\nLabel.GitHubDiffDarkThemeRemovedColorBackground = '#29201A'; // [ 41, 32, 26 ];\nLabel.GitHubDiffDarkThemeAddedColorBackground = '#172238'; // [ 23, 34, 56 ];\nLabel.RemovedColor = 'lightgray';\nLabel.AddedColor = 'lightgray';\nLabel.RemovedColorBackground = Label.GitHubDiffDarkThemeRemovedColorBackground;\nLabel.AddedColorBackground = Label.GitHubDiffDarkThemeAddedColorBackground;\nfunction actionResponse(action) {\n return (0, types_1.isFunction)(action)\n ? action.returnValue\n : (0, types_1.isServerRPC)(action) || (0, types_1.isClientRPC)(action)\n ? { status: action.status, raisesException: action.status >= 400 }\n : undefined;\n}\nfunction alias(id) {\n return id.replace(/[^a-zA-Z0-9]/g, '_');\n}\nfunction color(action, markupEnabled) {\n if (!markupEnabled)\n return;\n switch (action.diffMode) {\n case types_1.DiffMode.Delete:\n return 'red';\n case types_1.DiffMode.Insert:\n return 'green';\n case types_1.DiffMode.Change:\n return 'CA9C3F';\n }\n}\nfunction arrowColor(tail, head, action, markupEnabled) {\n let c = color(action, markupEnabled);\n if (c) {\n c = ['[#', c, ']'].join('');\n }\n return [tail, c, head].filter(Boolean).join('');\n}\nfunction fold(line, limit) {\n const output = [];\n let buffer = '';\n line\n .split('\\n')\n .map((line) => line.split(/\\s+/))\n .flat()\n .forEach((word) => {\n if (buffer.length === 0) {\n buffer += word;\n }\n else if (buffer.length + word.length < limit) {\n buffer += ' ';\n buffer += word;\n }\n else {\n output.push(buffer);\n buffer = word;\n }\n });\n output.push(buffer);\n return output;\n}\nconst requestArrow = (action, markupEnabled) => {\n const [caller, callee] = (0, types_1.actionActors)(action);\n let arrowTokens;\n if (caller && callee) {\n arrowTokens = { tail: '-', head: '>' };\n }\n else if (caller) {\n arrowTokens = { tail: '-', head: '>]' };\n }\n else {\n arrowTokens = { tail: '[-', head: '>' };\n }\n return arrowColor(arrowTokens.tail, arrowTokens.head, action, markupEnabled);\n};\nconst responseArrow = (action, markupEnabled) => {\n const [caller, callee] = (0, types_1.actionActors)(action);\n let arrowTokens;\n if (caller && callee) {\n arrowTokens = { head: '<', tail: '--' };\n }\n else if (caller) {\n arrowTokens = { head: '<', tail: '--]' };\n }\n else {\n arrowTokens = { head: '[<', tail: '--' };\n }\n return arrowColor(arrowTokens.head, arrowTokens.tail, action, markupEnabled);\n};\nclass EventLines {\n constructor() {\n this._indent = 1;\n this.lines = [];\n }\n indent() {\n this._indent += 1;\n }\n outdent() {\n this._indent -= 1;\n }\n printLeftAligned(...lines) {\n lines.forEach((line) => this.lines.push(line));\n }\n print(...lines) {\n lines.forEach((line) => this.lines.push([Array(this._indent).join(' '), line].join('')));\n }\n}\nfunction format(diagram, _source, options = {}) {\n const markupEnabled = options.disableMarkup !== true;\n const notesEnabled = options.disableNotes !== true;\n const events = new EventLines();\n const renderChildren = (action) => action.children.forEach((child) => renderAction(child));\n const renderAction = (action) => {\n events.indent();\n if ((0, types_1.isLoop)(action)) {\n const colorTag = color(action, markupEnabled) ? `#${color(action, markupEnabled)}` : '';\n let countStr = action.count.toString();\n if ((0, types_1.hasAncestor)(action, (action) => (0, types_1.isLoop)(action)))\n countStr = `~${countStr}`;\n const tokens = [`${countStr} times`];\n if (action.elapsed) {\n tokens.push(` ${formatElapsed(action.elapsed, markupEnabled)}`);\n }\n events.print(`Loop${colorTag} ${tokens.join('')}`);\n renderChildren(action);\n events.print(`End`);\n }\n else {\n const label = new Label(action);\n const actors = (0, types_1.actionActors)(action);\n {\n const incomingTokens = actors.map((actor) => (actor ? alias(actor.name) : ''));\n const arrow = requestArrow(action, markupEnabled);\n events.print([incomingTokens.join(arrow), label.requestLabel(markupEnabled)].join(': '));\n }\n {\n if (label.actionNameIsTrimmed && notesEnabled) {\n events.print('Note right');\n events.indent();\n events.printLeftAligned(label.note(80));\n events.outdent();\n events.print('End note');\n }\n }\n const response = actionResponse(action);\n const doActivate = response && actors[1];\n if (doActivate) {\n if (!actors[1])\n throw Error();\n events.print(`activate ${alias(actors[1].name)}`);\n }\n renderChildren(action);\n if (response) {\n const outgoingTokens = actors.map((actor) => (actor ? alias(actor.name) : ''));\n const arrow = responseArrow(action, markupEnabled);\n const responseLabel = label.responseLabel(markupEnabled);\n const tokens = [outgoingTokens.join(arrow)];\n if (responseLabel)\n tokens.push(responseLabel);\n events.print(tokens.join(': '));\n }\n if (doActivate) {\n if (!actors[1])\n throw Error();\n events.print(`deactivate ${alias(actors[1].name)}`);\n }\n }\n events.outdent();\n };\n diagram.rootActions.forEach((action) => renderAction(action));\n return `@startuml\n!includeurl https://raw.githubusercontent.com/getappmap/plantuml-theme/main/appmap-theme.puml\n${diagram.actors\n .map((actor) => `participant ${alias(actor.name)} as \"${singleLine(actor.name)}\"`)\n .join('\\n')}\n${events.lines.join('\\n')}\n@enduml`;\n}\nexports.format = format;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.format = exports.extension = void 0;\nconst types_1 = require(\"../types\");\nexports.extension = '.txt';\nfunction diffModeName(diffMode) {\n switch (diffMode) {\n case types_1.DiffMode.Change:\n return 'changed to';\n case types_1.DiffMode.Insert:\n return 'added';\n case types_1.DiffMode.Delete:\n return 'removed';\n }\n}\nfunction format(diagram, maxDepth = 4) {\n const lineCount = new Map();\n const lines = [];\n const describeChange = (action, depth = 1) => {\n if (depth > maxDepth)\n return;\n if (action.diffMode !== undefined) {\n const tokens = [];\n const actor = (0, types_1.actionActors)(action)[1];\n const normalizeName = (str) => {\n return str.replace(/\\n/g, ' ');\n };\n const qualifyAction = (str) => {\n if (!actor)\n return str;\n if ((0, types_1.isQuery)(action)) {\n return ['SQL', ['', str, ''].join('`')].join(' ');\n }\n else if ((0, types_1.isClientRPC)(action)) {\n return ['HTTP client request', ['', str, ''].join('`')].join(' ');\n }\n else if ((0, types_1.isServerRPC)(action)) {\n return ['HTTP server request', ['', str, ''].join('`')].join(' ');\n }\n else {\n const separator = (0, types_1.isFunction)(action) ? (action.static ? '.' : '#') : '#';\n return ['function call', ['', [actor.name, str].join(separator), ''].join('`')].join(' ');\n }\n };\n if (action.diffMode === types_1.DiffMode.Change) {\n const formerName = action.formerName\n ? qualifyAction(normalizeName(action.formerName))\n : undefined;\n const currentName = (0, types_1.nodeName)(action)\n ? qualifyAction(normalizeName((0, types_1.nodeName)(action)))\n : undefined;\n const formerResult = action.formerResult ? normalizeName(action.formerResult) : undefined;\n const currentResult = (0, types_1.nodeResult)(action) ? normalizeName((0, types_1.nodeResult)(action)) : undefined;\n if (formerName !== currentName) {\n tokens.push('changed');\n tokens.push(formerName || 'undefined');\n tokens.push('to');\n tokens.push(currentName || 'undefined');\n }\n if (formerResult !== currentResult) {\n if (tokens.length === 0) {\n tokens.push('changed');\n tokens.push(currentName || 'undefined');\n }\n else {\n tokens.push('and');\n tokens.push('changed');\n }\n tokens.push('to return');\n tokens.push(currentResult || 'undefined');\n tokens.push('instead of');\n tokens.push(formerResult || 'undefined');\n }\n }\n else {\n tokens.push(diffModeName(action.diffMode));\n tokens.push(qualifyAction(normalizeName((0, types_1.nodeName)(action))));\n }\n if (tokens.length > 0) {\n const message = [new Array(depth).join(' '), tokens.join(' ')].join('');\n if (lineCount.has(message)) {\n lineCount.set(message, lineCount.get(message) + 1);\n }\n else {\n lineCount.set(message, 1);\n lines.push(message);\n }\n }\n depth += 1;\n }\n action.children.forEach((child) => describeChange(child, depth));\n };\n diagram.rootActions.forEach((action) => describeChange(action));\n return lines\n .map((line) => {\n const count = lineCount.get(line);\n return count === 1 ? line : [`${count} times`, line].join(': ');\n })\n .join('\\n');\n}\nexports.format = format;\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst types_1 = require(\"./types\");\nconst json = __importStar(require(\"./formatter/json\"));\nconst plantUML = __importStar(require(\"./formatter/plantUML\"));\nconst text = __importStar(require(\"./formatter/text\"));\nfunction format(formatType, diagram, source, options = {}) {\n switch (formatType) {\n case types_1.FormatType.JSON:\n return { extension: json.extension, diagram: json.format(diagram) };\n case types_1.FormatType.PlantUML:\n return { extension: plantUML.extension, diagram: plantUML.format(diagram, source, options) };\n case types_1.FormatType.Text:\n return { extension: text.extension, diagram: text.format(diagram) };\n }\n}\nexports.default = format;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass Priority {\n constructor() {\n this.patterns = [];\n this.priorityByCodeObjectGroupId = new Map();\n this.sequenceByCodeObjectGroupId = new Map();\n this.priorityByCodeObjectId = new Map();\n this.basePriority = 1;\n }\n enrollPattern(pattern) {\n this.patterns.push(pattern);\n this.priorityByCodeObjectGroupId.set(pattern, this.patterns.length * 1000);\n this.sequenceByCodeObjectGroupId.set(pattern, 0);\n }\n expandPattern(pattern, codeObjectIds) {\n const priority = this.priorityByCodeObjectGroupId.get(pattern);\n if (priority === undefined) {\n console.log(`No priority for pattern ${pattern}`);\n return;\n }\n codeObjectIds.forEach((id) => this.priorityByCodeObjectGroupId.set(id, priority));\n }\n setPriority(codeObjectId, priority) {\n this.priorityByCodeObjectGroupId.set(codeObjectId, priority);\n }\n priorityOf(codeObject) {\n let priority = this.priorityByCodeObjectId.get(codeObject.fqid);\n if (priority)\n return priority;\n const groupPriority = this.groupPriority(codeObject);\n let sequence = this.sequenceByCodeObjectGroupId.get(codeObject.fqid);\n if (sequence === undefined) {\n sequence = 0;\n this.sequenceByCodeObjectGroupId.set(codeObject.fqid, sequence);\n }\n else {\n sequence += 1;\n }\n priority = groupPriority.basePriority + sequence;\n this.priorityByCodeObjectId.set(codeObject.fqid, priority);\n return priority;\n }\n groupPriority(codeObject) {\n let co = codeObject;\n while (co) {\n const priority = this.priorityByCodeObjectGroupId.get(co.fqid);\n if (priority !== undefined)\n return { groupId: co.fqid, basePriority: priority };\n co = co.parent;\n }\n const basePriority = this.basePriority * 1000;\n this.basePriority += 1;\n this.priorityByCodeObjectGroupId.set(codeObject.fqid, basePriority);\n return { groupId: codeObject.fqid, basePriority: basePriority };\n }\n}\nexports.default = Priority;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst priority_1 = __importDefault(require(\"./priority\"));\nclass Specification {\n constructor(priority, includedCodeObjectIds, requiredCodeObjectIds) {\n this.priority = priority;\n this.includedCodeObjectIds = includedCodeObjectIds;\n this.requiredCodeObjectIds = requiredCodeObjectIds;\n this.loops = true;\n }\n get hasRequiredCodeObjects() {\n return this.requiredCodeObjectIds.size > 0;\n }\n priorityOf(codeObject) {\n return this.priority.priorityOf(codeObject);\n }\n isIncludedCodeObject(codeObject) {\n return Specification.matchCodeObject(this.includedCodeObjectIds, codeObject);\n }\n isRequiredCodeObject(codeObject) {\n return Specification.matchCodeObject(this.requiredCodeObjectIds, codeObject);\n }\n static build(appmap, options) {\n const excludeSet = new Set(options.exclude || []);\n const expandSet = new Set(options.expand || []);\n const includedCodeObjectIds = new Set();\n const hasNonPackageChildren = (co) => {\n if (co.type !== 'package')\n return true;\n return co.children.some((child) => child.type !== 'package');\n };\n const includeCodeObjects = (co) => {\n if (co.type === 'class' && co.packageObject && expandSet.has(co.packageObject.fqid)) {\n includedCodeObjectIds.add(co.fqid);\n co.children.forEach((child) => includeCodeObjects(child));\n }\n if (!this.DefaultActorTypes.includes(co.type))\n return;\n if (excludeSet.has(co.fqid))\n return;\n if (!expandSet.has(co.fqid) && hasNonPackageChildren(co))\n includedCodeObjectIds.add(co.fqid);\n co.children.forEach((child) => includeCodeObjects(child));\n };\n appmap.classMap.roots.forEach((root) => includeCodeObjects(root));\n const requiredCodeObjectIds = new Set(options.require || []);\n for (const coid of requiredCodeObjectIds) {\n includedCodeObjectIds.add(coid);\n }\n const priorityArg = options.priority || {};\n const priority = new priority_1.default();\n if (!Object.keys(priorityArg).includes('http:HTTP server requests'))\n priorityArg['http:HTTP server requests'] = 0;\n {\n const externalServices = [...includedCodeObjectIds]\n .filter((coid) => coid.split(':')[0] === 'external-service')\n .sort();\n externalServices.push('database:Database');\n for (let index = 0; index < externalServices.length; index++) {\n const service = externalServices[index];\n if (!Object.keys(priorityArg).includes(service))\n priorityArg[service] = (includedCodeObjectIds.size + index + 1) * 1000;\n }\n }\n Object.entries(priorityArg || {}).forEach((entry) => priority.setPriority(entry[0], entry[1]));\n const spec = new Specification(priority, includedCodeObjectIds, requiredCodeObjectIds);\n spec.loops = !!options.loops;\n return spec;\n }\n static matchCodeObject(codeObjectIds, codeObject) {\n let co = codeObject;\n while (co) {\n if (codeObjectIds.has(co.fqid)) {\n return co;\n }\n co = co.parent;\n }\n }\n}\nexports.default = Specification;\nSpecification.DefaultActorTypes = [\n 'package',\n 'database',\n 'http',\n 'external-service',\n];\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MoveType = exports.Move = exports.Specification = exports.format = exports.Formatters = exports.FormatType = exports.getActors = exports.validateDiagram = exports.unparseDiagram = exports.diff = exports.buildDiffDiagram = exports.buildDiagram = exports.ValidationResult = exports.hasAncestor = exports.findAncestor = exports.setParent = exports.parseRoute = exports.nodeResult = exports.nodeName = exports.actionActors = exports.isQuery = exports.isClientRPC = exports.isServerRPC = exports.isFunction = exports.isLoop = exports.DiffMode = exports.NodeType = void 0;\nvar NodeType;\n(function (NodeType) {\n NodeType[NodeType[\"Loop\"] = 1] = \"Loop\";\n NodeType[NodeType[\"Conditional\"] = 2] = \"Conditional\";\n NodeType[NodeType[\"Function\"] = 3] = \"Function\";\n NodeType[NodeType[\"ServerRPC\"] = 4] = \"ServerRPC\";\n NodeType[NodeType[\"ClientRPC\"] = 5] = \"ClientRPC\";\n NodeType[NodeType[\"Query\"] = 6] = \"Query\";\n})(NodeType = exports.NodeType || (exports.NodeType = {}));\nvar DiffMode;\n(function (DiffMode) {\n DiffMode[DiffMode[\"Insert\"] = 1] = \"Insert\";\n DiffMode[DiffMode[\"Delete\"] = 2] = \"Delete\";\n DiffMode[DiffMode[\"Change\"] = 3] = \"Change\";\n})(DiffMode = exports.DiffMode || (exports.DiffMode = {}));\nconst isLoop = (action) => action.nodeType === NodeType.Loop;\nexports.isLoop = isLoop;\nconst isFunction = (action) => action.nodeType === NodeType.Function;\nexports.isFunction = isFunction;\nconst isServerRPC = (action) => action.nodeType === NodeType.ServerRPC;\nexports.isServerRPC = isServerRPC;\nconst isClientRPC = (action) => action.nodeType === NodeType.ClientRPC;\nexports.isClientRPC = isClientRPC;\nconst isQuery = (action) => action.nodeType === NodeType.Query;\nexports.isQuery = isQuery;\nconst actionActors = (action) => {\n if (!action)\n return [];\n if ((0, exports.isFunction)(action) || (0, exports.isClientRPC)(action) || (0, exports.isQuery)(action))\n return [action.caller, action.callee];\n if ((0, exports.isServerRPC)(action))\n return [undefined, action.callee];\n return [];\n};\nexports.actionActors = actionActors;\nconst nodeName = (action) => {\n if (!action)\n return 'undefined';\n switch (action.nodeType) {\n case NodeType.Function:\n return action.name;\n case NodeType.ServerRPC:\n case NodeType.ClientRPC:\n return action.route;\n case NodeType.Query:\n return action.query;\n case NodeType.Loop:\n return 'loop';\n }\n};\nexports.nodeName = nodeName;\nconst nodeResult = (action) => {\n if (!action)\n return undefined;\n switch (action.nodeType) {\n case NodeType.Function:\n if (!action.returnValue)\n return;\n if (action.returnValue.returnValueType)\n return action.returnValue.returnValueType.name;\n if (action.returnValue.raisesException)\n return 'exception!';\n break;\n case NodeType.ServerRPC:\n return action.status ? action.status.toString() : '';\n case NodeType.ClientRPC:\n return action.status ? action.status.toString() : '';\n case NodeType.Query:\n return 'void';\n }\n};\nexports.nodeResult = nodeResult;\nfunction parseRoute(route) {\n const tokens = route.split(/\\s+/);\n return {\n method: tokens[0],\n path: tokens.slice(1).join(' '),\n };\n}\nexports.parseRoute = parseRoute;\nfunction setParent(action, parent) {\n if (parent)\n action.parent = parent;\n action.children.forEach((child) => setParent(child, action));\n}\nexports.setParent = setParent;\nfunction findAncestor(action, test) {\n let parent = action.parent;\n while (parent) {\n if (test(parent))\n return parent;\n parent = parent.parent;\n }\n}\nexports.findAncestor = findAncestor;\nfunction hasAncestor(action, test) {\n return findAncestor(action, test) !== undefined;\n}\nexports.hasAncestor = hasAncestor;\nvar ValidationResult;\n(function (ValidationResult) {\n ValidationResult[ValidationResult[\"Invalid\"] = 0] = \"Invalid\";\n ValidationResult[ValidationResult[\"Valid\"] = 1] = \"Valid\";\n ValidationResult[ValidationResult[\"AppMap\"] = 2] = \"AppMap\";\n})(ValidationResult = exports.ValidationResult || (exports.ValidationResult = {}));\nconst buildDiagram_1 = __importStar(require(\"./buildDiagram\"));\nexports.buildDiagram = buildDiagram_1.default;\nObject.defineProperty(exports, \"getActors\", { enumerable: true, get: function () { return buildDiagram_1.getActors; } });\nconst buildDiffDiagram_1 = __importDefault(require(\"./buildDiffDiagram\"));\nexports.buildDiffDiagram = buildDiffDiagram_1.default;\nconst diff_1 = __importDefault(require(\"./diff\"));\nexports.diff = diff_1.default;\nconst unparseDiagram_1 = __importDefault(require(\"./unparseDiagram\"));\nexports.unparseDiagram = unparseDiagram_1.default;\nconst validateDiagram_1 = __importDefault(require(\"./validateDiagram\"));\nexports.validateDiagram = validateDiagram_1.default;\nvar FormatType;\n(function (FormatType) {\n FormatType[\"JSON\"] = \"json\";\n FormatType[\"PlantUML\"] = \"plantuml\";\n FormatType[\"Text\"] = \"text\";\n})(FormatType = exports.FormatType || (exports.FormatType = {}));\nexports.Formatters = [FormatType.JSON, FormatType.PlantUML, FormatType.Text];\nconst formatter_1 = __importDefault(require(\"./formatter\"));\nexports.format = formatter_1.default;\nconst specification_1 = __importDefault(require(\"./specification\"));\nObject.defineProperty(exports, \"Specification\", { enumerable: true, get: function () { return specification_1.default; } });\nconst diff_2 = require(\"./diff\");\nObject.defineProperty(exports, \"Move\", { enumerable: true, get: function () { return diff_2.Move; } });\nObject.defineProperty(exports, \"MoveType\", { enumerable: true, get: function () { return diff_2.MoveType; } });\n","export var xhtml = \"http://www.w3.org/1999/xhtml\";\n\nexport default {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: xhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\n","import namespaces from \"./namespaces.js\";\n\nexport default function(name) {\n var prefix = name += \"\", i = prefix.indexOf(\":\");\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; // eslint-disable-line no-prototype-builtins\n}\n","import namespace from \"./namespace.js\";\nimport {xhtml} from \"./namespaces.js\";\n\nfunction creatorInherit(name) {\n return function() {\n var document = this.ownerDocument,\n uri = this.namespaceURI;\n return uri === xhtml && document.documentElement.namespaceURI === xhtml\n ? document.createElement(name)\n : document.createElementNS(uri, name);\n };\n}\n\nfunction creatorFixed(fullname) {\n return function() {\n return this.ownerDocument.createElementNS(fullname.space, fullname.local);\n };\n}\n\nexport default function(name) {\n var fullname = namespace(name);\n return (fullname.local\n ? creatorFixed\n : creatorInherit)(fullname);\n}\n","function none() {}\n\nexport default function(selector) {\n return selector == null ? none : function() {\n return this.querySelector(selector);\n };\n}\n","import {Selection} from \"./index.js\";\nimport selector from \"../selector.js\";\n\nexport default function(select) {\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","// Given something array like (or null), returns something that is strictly an\n// array. This is used to ensure that array-like objects passed to d3.selectAll\n// or selection.selectAll are converted into proper arrays when creating a\n// selection; we don’t ever want to create a selection backed by a live\n// HTMLCollection or NodeList. However, note that selection.selectAll will use a\n// static NodeList as a group, since it safely derived from querySelectorAll.\nexport default function array(x) {\n return x == null ? [] : Array.isArray(x) ? x : Array.from(x);\n}\n","function empty() {\n return [];\n}\n\nexport default function(selector) {\n return selector == null ? empty : function() {\n return this.querySelectorAll(selector);\n };\n}\n","import {Selection} from \"./index.js\";\nimport array from \"../array.js\";\nimport selectorAll from \"../selectorAll.js\";\n\nfunction arrayAll(select) {\n return function() {\n return array(select.apply(this, arguments));\n };\n}\n\nexport default function(select) {\n if (typeof select === \"function\") select = arrayAll(select);\n else select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n subgroups.push(select.call(node, node.__data__, i, group));\n parents.push(node);\n }\n }\n }\n\n return new Selection(subgroups, parents);\n}\n","export default function(selector) {\n return function() {\n return this.matches(selector);\n };\n}\n\nexport function childMatcher(selector) {\n return function(node) {\n return node.matches(selector);\n };\n}\n\n","import {childMatcher} from \"../matcher.js\";\n\nvar find = Array.prototype.find;\n\nfunction childFind(match) {\n return function() {\n return find.call(this.children, match);\n };\n}\n\nfunction childFirst() {\n return this.firstElementChild;\n}\n\nexport default function(match) {\n return this.select(match == null ? childFirst\n : childFind(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","import {childMatcher} from \"../matcher.js\";\n\nvar filter = Array.prototype.filter;\n\nfunction children() {\n return Array.from(this.children);\n}\n\nfunction childrenFilter(match) {\n return function() {\n return filter.call(this.children, match);\n };\n}\n\nexport default function(match) {\n return this.selectAll(match == null ? children\n : childrenFilter(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","import {Selection} from \"./index.js\";\nimport matcher from \"../matcher.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","export default function(update) {\n return new Array(update.length);\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._enter || this._groups.map(sparse), this._parents);\n}\n\nexport function EnterNode(parent, datum) {\n this.ownerDocument = parent.ownerDocument;\n this.namespaceURI = parent.namespaceURI;\n this._next = null;\n this._parent = parent;\n this.__data__ = datum;\n}\n\nEnterNode.prototype = {\n constructor: EnterNode,\n appendChild: function(child) { return this._parent.insertBefore(child, this._next); },\n insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },\n querySelector: function(selector) { return this._parent.querySelector(selector); },\n querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }\n};\n","export default function(x) {\n return function() {\n return x;\n };\n}\n","import {Selection} from \"./index.js\";\nimport {EnterNode} from \"./enter.js\";\nimport constant from \"../constant.js\";\n\nfunction bindIndex(parent, group, enter, update, exit, data) {\n var i = 0,\n node,\n groupLength = group.length,\n dataLength = data.length;\n\n // Put any non-null nodes that fit into update.\n // Put any null nodes into enter.\n // Put any remaining data into enter.\n for (; i < dataLength; ++i) {\n if (node = group[i]) {\n node.__data__ = data[i];\n update[i] = node;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Put any non-null nodes that don’t fit into exit.\n for (; i < groupLength; ++i) {\n if (node = group[i]) {\n exit[i] = node;\n }\n }\n}\n\nfunction bindKey(parent, group, enter, update, exit, data, key) {\n var i,\n node,\n nodeByKeyValue = new Map,\n groupLength = group.length,\n dataLength = data.length,\n keyValues = new Array(groupLength),\n keyValue;\n\n // Compute the key for each node.\n // If multiple nodes have the same key, the duplicates are added to exit.\n for (i = 0; i < groupLength; ++i) {\n if (node = group[i]) {\n keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + \"\";\n if (nodeByKeyValue.has(keyValue)) {\n exit[i] = node;\n } else {\n nodeByKeyValue.set(keyValue, node);\n }\n }\n }\n\n // Compute the key for each datum.\n // If there a node associated with this key, join and add it to update.\n // If there is not (or the key is a duplicate), add it to enter.\n for (i = 0; i < dataLength; ++i) {\n keyValue = key.call(parent, data[i], i, data) + \"\";\n if (node = nodeByKeyValue.get(keyValue)) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue.delete(keyValue);\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Add any remaining nodes that were not bound to data to exit.\n for (i = 0; i < groupLength; ++i) {\n if ((node = group[i]) && (nodeByKeyValue.get(keyValues[i]) === node)) {\n exit[i] = node;\n }\n }\n}\n\nfunction datum(node) {\n return node.__data__;\n}\n\nexport default function(value, key) {\n if (!arguments.length) return Array.from(this, datum);\n\n var bind = key ? bindKey : bindIndex,\n parents = this._parents,\n groups = this._groups;\n\n if (typeof value !== \"function\") value = constant(value);\n\n for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {\n var parent = parents[j],\n group = groups[j],\n groupLength = group.length,\n data = arraylike(value.call(parent, parent && parent.__data__, j, parents)),\n dataLength = data.length,\n enterGroup = enter[j] = new Array(dataLength),\n updateGroup = update[j] = new Array(dataLength),\n exitGroup = exit[j] = new Array(groupLength);\n\n bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);\n\n // Now connect the enter nodes to their following update node, such that\n // appendChild can insert the materialized enter node before this node,\n // rather than at the end of the parent node.\n for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {\n if (previous = enterGroup[i0]) {\n if (i0 >= i1) i1 = i0 + 1;\n while (!(next = updateGroup[i1]) && ++i1 < dataLength);\n previous._next = next || null;\n }\n }\n }\n\n update = new Selection(update, parents);\n update._enter = enter;\n update._exit = exit;\n return update;\n}\n\n// Given some data, this returns an array-like view of it: an object that\n// exposes a length property and allows numeric indexing. Note that unlike\n// selectAll, this isn’t worried about “live” collections because the resulting\n// array will only be used briefly while data is being bound. (It is possible to\n// cause the data to change while iterating by using a key function, but please\n// don’t; we’d rather avoid a gratuitous copy.)\nfunction arraylike(data) {\n return typeof data === \"object\" && \"length\" in data\n ? data // Array, TypedArray, NodeList, array-like\n : Array.from(data); // Map, Set, iterable, string, or anything else\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._exit || this._groups.map(sparse), this._parents);\n}\n","export default function(onenter, onupdate, onexit) {\n var enter = this.enter(), update = this, exit = this.exit();\n if (typeof onenter === \"function\") {\n enter = onenter(enter);\n if (enter) enter = enter.selection();\n } else {\n enter = enter.append(onenter + \"\");\n }\n if (onupdate != null) {\n update = onupdate(update);\n if (update) update = update.selection();\n }\n if (onexit == null) exit.remove(); else onexit(exit);\n return enter && update ? enter.merge(update).order() : update;\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(context) {\n var selection = context.selection ? context.selection() : context;\n\n for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Selection(merges, this._parents);\n}\n","export default function() {\n\n for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {\n for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {\n if (node = group[i]) {\n if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n\n return this;\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(compare) {\n if (!compare) compare = ascending;\n\n function compareNode(a, b) {\n return a && b ? compare(a.__data__, b.__data__) : !a - !b;\n }\n\n for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n sortgroup[i] = node;\n }\n }\n sortgroup.sort(compareNode);\n }\n\n return new Selection(sortgroups, this._parents).order();\n}\n\nfunction ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","export default function() {\n var callback = arguments[0];\n arguments[0] = this;\n callback.apply(null, arguments);\n return this;\n}\n","export default function() {\n return Array.from(this);\n}\n","export default function() {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {\n var node = group[i];\n if (node) return node;\n }\n }\n\n return null;\n}\n","export default function() {\n let size = 0;\n for (const node of this) ++size; // eslint-disable-line no-unused-vars\n return size;\n}\n","export default function() {\n return !this.node();\n}\n","export default function(callback) {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) callback.call(node, node.__data__, i, group);\n }\n }\n\n return this;\n}\n","import namespace from \"../namespace.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, value) {\n return function() {\n this.setAttribute(name, value);\n };\n}\n\nfunction attrConstantNS(fullname, value) {\n return function() {\n this.setAttributeNS(fullname.space, fullname.local, value);\n };\n}\n\nfunction attrFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttribute(name);\n else this.setAttribute(name, v);\n };\n}\n\nfunction attrFunctionNS(fullname, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttributeNS(fullname.space, fullname.local);\n else this.setAttributeNS(fullname.space, fullname.local, v);\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name);\n\n if (arguments.length < 2) {\n var node = this.node();\n return fullname.local\n ? node.getAttributeNS(fullname.space, fullname.local)\n : node.getAttribute(fullname);\n }\n\n return this.each((value == null\n ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)\n : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));\n}\n","export default function(node) {\n return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node\n || (node.document && node) // node is a Window\n || node.defaultView; // node is a Document\n}\n","import defaultView from \"../window.js\";\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, value, priority) {\n return function() {\n this.style.setProperty(name, value, priority);\n };\n}\n\nfunction styleFunction(name, value, priority) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.style.removeProperty(name);\n else this.style.setProperty(name, v, priority);\n };\n}\n\nexport default function(name, value, priority) {\n return arguments.length > 1\n ? this.each((value == null\n ? styleRemove : typeof value === \"function\"\n ? styleFunction\n : styleConstant)(name, value, priority == null ? \"\" : priority))\n : styleValue(this.node(), name);\n}\n\nexport function styleValue(node, name) {\n return node.style.getPropertyValue(name)\n || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);\n}\n","function propertyRemove(name) {\n return function() {\n delete this[name];\n };\n}\n\nfunction propertyConstant(name, value) {\n return function() {\n this[name] = value;\n };\n}\n\nfunction propertyFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) delete this[name];\n else this[name] = v;\n };\n}\n\nexport default function(name, value) {\n return arguments.length > 1\n ? this.each((value == null\n ? propertyRemove : typeof value === \"function\"\n ? propertyFunction\n : propertyConstant)(name, value))\n : this.node()[name];\n}\n","function classArray(string) {\n return string.trim().split(/^|\\s+/);\n}\n\nfunction classList(node) {\n return node.classList || new ClassList(node);\n}\n\nfunction ClassList(node) {\n this._node = node;\n this._names = classArray(node.getAttribute(\"class\") || \"\");\n}\n\nClassList.prototype = {\n add: function(name) {\n var i = this._names.indexOf(name);\n if (i < 0) {\n this._names.push(name);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n remove: function(name) {\n var i = this._names.indexOf(name);\n if (i >= 0) {\n this._names.splice(i, 1);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n contains: function(name) {\n return this._names.indexOf(name) >= 0;\n }\n};\n\nfunction classedAdd(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.add(names[i]);\n}\n\nfunction classedRemove(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.remove(names[i]);\n}\n\nfunction classedTrue(names) {\n return function() {\n classedAdd(this, names);\n };\n}\n\nfunction classedFalse(names) {\n return function() {\n classedRemove(this, names);\n };\n}\n\nfunction classedFunction(names, value) {\n return function() {\n (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);\n };\n}\n\nexport default function(name, value) {\n var names = classArray(name + \"\");\n\n if (arguments.length < 2) {\n var list = classList(this.node()), i = -1, n = names.length;\n while (++i < n) if (!list.contains(names[i])) return false;\n return true;\n }\n\n return this.each((typeof value === \"function\"\n ? classedFunction : value\n ? classedTrue\n : classedFalse)(names, value));\n}\n","function textRemove() {\n this.textContent = \"\";\n}\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? textRemove : (typeof value === \"function\"\n ? textFunction\n : textConstant)(value))\n : this.node().textContent;\n}\n","function htmlRemove() {\n this.innerHTML = \"\";\n}\n\nfunction htmlConstant(value) {\n return function() {\n this.innerHTML = value;\n };\n}\n\nfunction htmlFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? htmlRemove : (typeof value === \"function\"\n ? htmlFunction\n : htmlConstant)(value))\n : this.node().innerHTML;\n}\n","function raise() {\n if (this.nextSibling) this.parentNode.appendChild(this);\n}\n\nexport default function() {\n return this.each(raise);\n}\n","function lower() {\n if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);\n}\n\nexport default function() {\n return this.each(lower);\n}\n","import creator from \"../creator.js\";\n\nexport default function(name) {\n var create = typeof name === \"function\" ? name : creator(name);\n return this.select(function() {\n return this.appendChild(create.apply(this, arguments));\n });\n}\n","import creator from \"../creator.js\";\nimport selector from \"../selector.js\";\n\nfunction constantNull() {\n return null;\n}\n\nexport default function(name, before) {\n var create = typeof name === \"function\" ? name : creator(name),\n select = before == null ? constantNull : typeof before === \"function\" ? before : selector(before);\n return this.select(function() {\n return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n });\n}\n","function remove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n}\n\nexport default function() {\n return this.each(remove);\n}\n","function selection_cloneShallow() {\n var clone = this.cloneNode(false), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nfunction selection_cloneDeep() {\n var clone = this.cloneNode(true), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nexport default function(deep) {\n return this.select(deep ? selection_cloneDeep : selection_cloneShallow);\n}\n","export default function(value) {\n return arguments.length\n ? this.property(\"__data__\", value)\n : this.node().__data__;\n}\n","function contextListener(listener) {\n return function(event) {\n listener.call(this, event, this.__data__);\n };\n}\n\nfunction parseTypenames(typenames) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n return {type: t, name: name};\n });\n}\n\nfunction onRemove(typename) {\n return function() {\n var on = this.__on;\n if (!on) return;\n for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {\n if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n } else {\n on[++i] = o;\n }\n }\n if (++i) on.length = i;\n else delete this.__on;\n };\n}\n\nfunction onAdd(typename, value, options) {\n return function() {\n var on = this.__on, o, listener = contextListener(value);\n if (on) for (var j = 0, m = on.length; j < m; ++j) {\n if ((o = on[j]).type === typename.type && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n this.addEventListener(o.type, o.listener = listener, o.options = options);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, options);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, options: options};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\nexport default function(typename, value, options) {\n var typenames = parseTypenames(typename + \"\"), i, n = typenames.length, t;\n\n if (arguments.length < 2) {\n var on = this.node().__on;\n if (on) for (var j = 0, m = on.length, o; j < m; ++j) {\n for (i = 0, o = on[j]; i < n; ++i) {\n if ((t = typenames[i]).type === o.type && t.name === o.name) {\n return o.value;\n }\n }\n }\n return;\n }\n\n on = value ? onAdd : onRemove;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options));\n return this;\n}\n","import defaultView from \"../window.js\";\n\nfunction dispatchEvent(node, type, params) {\n var window = defaultView(node),\n event = window.CustomEvent;\n\n if (typeof event === \"function\") {\n event = new event(type, params);\n } else {\n event = window.document.createEvent(\"Event\");\n if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;\n else event.initEvent(type, false, false);\n }\n\n node.dispatchEvent(event);\n}\n\nfunction dispatchConstant(type, params) {\n return function() {\n return dispatchEvent(this, type, params);\n };\n}\n\nfunction dispatchFunction(type, params) {\n return function() {\n return dispatchEvent(this, type, params.apply(this, arguments));\n };\n}\n\nexport default function(type, params) {\n return this.each((typeof params === \"function\"\n ? dispatchFunction\n : dispatchConstant)(type, params));\n}\n","export default function*() {\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) yield node;\n }\n }\n}\n","import selection_select from \"./select.js\";\nimport selection_selectAll from \"./selectAll.js\";\nimport selection_selectChild from \"./selectChild.js\";\nimport selection_selectChildren from \"./selectChildren.js\";\nimport selection_filter from \"./filter.js\";\nimport selection_data from \"./data.js\";\nimport selection_enter from \"./enter.js\";\nimport selection_exit from \"./exit.js\";\nimport selection_join from \"./join.js\";\nimport selection_merge from \"./merge.js\";\nimport selection_order from \"./order.js\";\nimport selection_sort from \"./sort.js\";\nimport selection_call from \"./call.js\";\nimport selection_nodes from \"./nodes.js\";\nimport selection_node from \"./node.js\";\nimport selection_size from \"./size.js\";\nimport selection_empty from \"./empty.js\";\nimport selection_each from \"./each.js\";\nimport selection_attr from \"./attr.js\";\nimport selection_style from \"./style.js\";\nimport selection_property from \"./property.js\";\nimport selection_classed from \"./classed.js\";\nimport selection_text from \"./text.js\";\nimport selection_html from \"./html.js\";\nimport selection_raise from \"./raise.js\";\nimport selection_lower from \"./lower.js\";\nimport selection_append from \"./append.js\";\nimport selection_insert from \"./insert.js\";\nimport selection_remove from \"./remove.js\";\nimport selection_clone from \"./clone.js\";\nimport selection_datum from \"./datum.js\";\nimport selection_on from \"./on.js\";\nimport selection_dispatch from \"./dispatch.js\";\nimport selection_iterator from \"./iterator.js\";\n\nexport var root = [null];\n\nexport function Selection(groups, parents) {\n this._groups = groups;\n this._parents = parents;\n}\n\nfunction selection() {\n return new Selection([[document.documentElement]], root);\n}\n\nfunction selection_selection() {\n return this;\n}\n\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: selection_select,\n selectAll: selection_selectAll,\n selectChild: selection_selectChild,\n selectChildren: selection_selectChildren,\n filter: selection_filter,\n data: selection_data,\n enter: selection_enter,\n exit: selection_exit,\n join: selection_join,\n merge: selection_merge,\n selection: selection_selection,\n order: selection_order,\n sort: selection_sort,\n call: selection_call,\n nodes: selection_nodes,\n node: selection_node,\n size: selection_size,\n empty: selection_empty,\n each: selection_each,\n attr: selection_attr,\n style: selection_style,\n property: selection_property,\n classed: selection_classed,\n text: selection_text,\n html: selection_html,\n raise: selection_raise,\n lower: selection_lower,\n append: selection_append,\n insert: selection_insert,\n remove: selection_remove,\n clone: selection_clone,\n datum: selection_datum,\n on: selection_on,\n dispatch: selection_dispatch,\n [Symbol.iterator]: selection_iterator\n};\n\nexport default selection;\n","import {Selection, root} from \"./selection/index.js\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([[document.querySelector(selector)]], [document.documentElement])\n : new Selection([[selector]], root);\n}\n","import creator from \"./creator.js\";\nimport select from \"./select.js\";\n\nexport default function(name) {\n return select(creator(name).call(document.documentElement));\n}\n","var nextId = 0;\n\nexport default function local() {\n return new Local;\n}\n\nfunction Local() {\n this._ = \"@\" + (++nextId).toString(36);\n}\n\nLocal.prototype = local.prototype = {\n constructor: Local,\n get: function(node) {\n var id = this._;\n while (!(id in node)) if (!(node = node.parentNode)) return;\n return node[id];\n },\n set: function(node, value) {\n return node[this._] = value;\n },\n remove: function(node) {\n return this._ in node && delete node[this._];\n },\n toString: function() {\n return this._;\n }\n};\n","export default function(event) {\n let sourceEvent;\n while (sourceEvent = event.sourceEvent) event = sourceEvent;\n return event;\n}\n","import sourceEvent from \"./sourceEvent.js\";\n\nexport default function(event, node) {\n event = sourceEvent(event);\n if (node === undefined) node = event.currentTarget;\n if (node) {\n var svg = node.ownerSVGElement || node;\n if (svg.createSVGPoint) {\n var point = svg.createSVGPoint();\n point.x = event.clientX, point.y = event.clientY;\n point = point.matrixTransform(node.getScreenCTM().inverse());\n return [point.x, point.y];\n }\n if (node.getBoundingClientRect) {\n var rect = node.getBoundingClientRect();\n return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];\n }\n }\n return [event.pageX, event.pageY];\n}\n","import pointer from \"./pointer.js\";\nimport sourceEvent from \"./sourceEvent.js\";\n\nexport default function(events, node) {\n if (events.target) { // i.e., instanceof Event, not TouchList or iterable\n events = sourceEvent(events);\n if (node === undefined) node = events.currentTarget;\n events = events.touches || [events];\n }\n return Array.from(events, event => pointer(event, node));\n}\n","import array from \"./array.js\";\nimport {Selection, root} from \"./selection/index.js\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([document.querySelectorAll(selector)], [document.documentElement])\n : new Selection([array(selector)], root);\n}\n","export {default as create} from \"./create.js\";\nexport {default as creator} from \"./creator.js\";\nexport {default as local} from \"./local.js\";\nexport {default as matcher} from \"./matcher.js\";\nexport {default as namespace} from \"./namespace.js\";\nexport {default as namespaces} from \"./namespaces.js\";\nexport {default as pointer} from \"./pointer.js\";\nexport {default as pointers} from \"./pointers.js\";\nexport {default as select} from \"./select.js\";\nexport {default as selectAll} from \"./selectAll.js\";\nexport {default as selection} from \"./selection/index.js\";\nexport {default as selector} from \"./selector.js\";\nexport {default as selectorAll} from \"./selectorAll.js\";\nexport {styleValue as style} from \"./selection/style.js\";\nexport {default as window} from \"./window.js\";\n","'use strict';\n\nvar isMergeableObject = function isMergeableObject(value) {\n\treturn isNonNullObject(value)\n\t\t&& !isSpecial(value)\n};\n\nfunction isNonNullObject(value) {\n\treturn !!value && typeof value === 'object'\n}\n\nfunction isSpecial(value) {\n\tvar stringValue = Object.prototype.toString.call(value);\n\n\treturn stringValue === '[object RegExp]'\n\t\t|| stringValue === '[object Date]'\n\t\t|| isReactElement(value)\n}\n\n// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25\nvar canUseSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;\n\nfunction isReactElement(value) {\n\treturn value.$$typeof === REACT_ELEMENT_TYPE\n}\n\nfunction emptyTarget(val) {\n\treturn Array.isArray(val) ? [] : {}\n}\n\nfunction cloneUnlessOtherwiseSpecified(value, options) {\n\treturn (options.clone !== false && options.isMergeableObject(value))\n\t\t? deepmerge(emptyTarget(value), value, options)\n\t\t: value\n}\n\nfunction defaultArrayMerge(target, source, options) {\n\treturn target.concat(source).map(function(element) {\n\t\treturn cloneUnlessOtherwiseSpecified(element, options)\n\t})\n}\n\nfunction getMergeFunction(key, options) {\n\tif (!options.customMerge) {\n\t\treturn deepmerge\n\t}\n\tvar customMerge = options.customMerge(key);\n\treturn typeof customMerge === 'function' ? customMerge : deepmerge\n}\n\nfunction getEnumerableOwnPropertySymbols(target) {\n\treturn Object.getOwnPropertySymbols\n\t\t? Object.getOwnPropertySymbols(target).filter(function(symbol) {\n\t\t\treturn Object.propertyIsEnumerable.call(target, symbol)\n\t\t})\n\t\t: []\n}\n\nfunction getKeys(target) {\n\treturn Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))\n}\n\nfunction propertyIsOnObject(object, property) {\n\ttry {\n\t\treturn property in object\n\t} catch(_) {\n\t\treturn false\n\t}\n}\n\n// Protects from prototype poisoning and unexpected merging up the prototype chain.\nfunction propertyIsUnsafe(target, key) {\n\treturn propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,\n\t\t&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,\n\t\t\t&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.\n}\n\nfunction mergeObject(target, source, options) {\n\tvar destination = {};\n\tif (options.isMergeableObject(target)) {\n\t\tgetKeys(target).forEach(function(key) {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(target[key], options);\n\t\t});\n\t}\n\tgetKeys(source).forEach(function(key) {\n\t\tif (propertyIsUnsafe(target, key)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {\n\t\t\tdestination[key] = getMergeFunction(key, options)(target[key], source[key], options);\n\t\t} else {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(source[key], options);\n\t\t}\n\t});\n\treturn destination\n}\n\nfunction deepmerge(target, source, options) {\n\toptions = options || {};\n\toptions.arrayMerge = options.arrayMerge || defaultArrayMerge;\n\toptions.isMergeableObject = options.isMergeableObject || isMergeableObject;\n\t// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()\n\t// implementations can use it. The caller may not replace it.\n\toptions.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;\n\n\tvar sourceIsArray = Array.isArray(source);\n\tvar targetIsArray = Array.isArray(target);\n\tvar sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n\n\tif (!sourceAndTargetTypesMatch) {\n\t\treturn cloneUnlessOtherwiseSpecified(source, options)\n\t} else if (sourceIsArray) {\n\t\treturn options.arrayMerge(target, source, options)\n\t} else {\n\t\treturn mergeObject(target, source, options)\n\t}\n}\n\ndeepmerge.all = function deepmergeAll(array, options) {\n\tif (!Array.isArray(array)) {\n\t\tthrow new Error('first argument should be an array')\n\t}\n\n\treturn array.reduce(function(prev, next) {\n\t\treturn deepmerge(prev, next, options)\n\t}, {})\n};\n\nvar deepmerge_1 = deepmerge;\n\nmodule.exports = deepmerge_1;\n","var noop = {value: () => {}};\n\nfunction dispatch() {\n for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {\n if (!(t = arguments[i] + \"\") || (t in _) || /[\\s.]/.test(t)) throw new Error(\"illegal type: \" + t);\n _[t] = [];\n }\n return new Dispatch(_);\n}\n\nfunction Dispatch(_) {\n this._ = _;\n}\n\nfunction parseTypenames(typenames, types) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n if (t && !types.hasOwnProperty(t)) throw new Error(\"unknown type: \" + t);\n return {type: t, name: name};\n });\n}\n\nDispatch.prototype = dispatch.prototype = {\n constructor: Dispatch,\n on: function(typename, callback) {\n var _ = this._,\n T = parseTypenames(typename + \"\", _),\n t,\n i = -1,\n n = T.length;\n\n // If no callback was specified, return the callback of the given type and name.\n if (arguments.length < 2) {\n while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;\n return;\n }\n\n // If a type was specified, set the callback for the given type and name.\n // Otherwise, if a null callback was specified, remove callbacks of the given name.\n if (callback != null && typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n while (++i < n) {\n if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);\n else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);\n }\n\n return this;\n },\n copy: function() {\n var copy = {}, _ = this._;\n for (var t in _) copy[t] = _[t].slice();\n return new Dispatch(copy);\n },\n call: function(type, that) {\n if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n },\n apply: function(type, that, args) {\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n }\n};\n\nfunction get(type, name) {\n for (var i = 0, n = type.length, c; i < n; ++i) {\n if ((c = type[i]).name === name) {\n return c.value;\n }\n }\n}\n\nfunction set(type, name, callback) {\n for (var i = 0, n = type.length; i < n; ++i) {\n if (type[i].name === name) {\n type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));\n break;\n }\n }\n if (callback != null) type.push({name: name, value: callback});\n return type;\n}\n\nexport default dispatch;\n","export {default as dispatch} from \"./dispatch.js\";\n","// These are typically used in conjunction with noevent to ensure that we can\n// preventDefault on the event.\nexport const nonpassive = {passive: false};\nexport const nonpassivecapture = {capture: true, passive: false};\n\nexport function nopropagation(event) {\n event.stopImmediatePropagation();\n}\n\nexport default function(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n}\n","import {select} from \"d3-selection\";\nimport noevent, {nonpassivecapture} from \"./noevent.js\";\n\nexport default function(view) {\n var root = view.document.documentElement,\n selection = select(view).on(\"dragstart.drag\", noevent, nonpassivecapture);\n if (\"onselectstart\" in root) {\n selection.on(\"selectstart.drag\", noevent, nonpassivecapture);\n } else {\n root.__noselect = root.style.MozUserSelect;\n root.style.MozUserSelect = \"none\";\n }\n}\n\nexport function yesdrag(view, noclick) {\n var root = view.document.documentElement,\n selection = select(view).on(\"dragstart.drag\", null);\n if (noclick) {\n selection.on(\"click.drag\", noevent, nonpassivecapture);\n setTimeout(function() { selection.on(\"click.drag\", null); }, 0);\n }\n if (\"onselectstart\" in root) {\n selection.on(\"selectstart.drag\", null);\n } else {\n root.style.MozUserSelect = root.__noselect;\n delete root.__noselect;\n }\n}\n","export {default as drag} from \"./drag.js\";\nexport {default as dragDisable, yesdrag as dragEnable} from \"./nodrag.js\";\n","export default function(constructor, factory, prototype) {\n constructor.prototype = factory.prototype = prototype;\n prototype.constructor = constructor;\n}\n\nexport function extend(parent, definition) {\n var prototype = Object.create(parent.prototype);\n for (var key in definition) prototype[key] = definition[key];\n return prototype;\n}\n","import define, {extend} from \"./define.js\";\n\nexport function Color() {}\n\nexport var darker = 0.7;\nexport var brighter = 1 / darker;\n\nvar reI = \"\\\\s*([+-]?\\\\d+)\\\\s*\",\n reN = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\",\n reP = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\",\n reHex = /^#([0-9a-f]{3,8})$/,\n reRgbInteger = new RegExp(`^rgb\\\\(${reI},${reI},${reI}\\\\)$`),\n reRgbPercent = new RegExp(`^rgb\\\\(${reP},${reP},${reP}\\\\)$`),\n reRgbaInteger = new RegExp(`^rgba\\\\(${reI},${reI},${reI},${reN}\\\\)$`),\n reRgbaPercent = new RegExp(`^rgba\\\\(${reP},${reP},${reP},${reN}\\\\)$`),\n reHslPercent = new RegExp(`^hsl\\\\(${reN},${reP},${reP}\\\\)$`),\n reHslaPercent = new RegExp(`^hsla\\\\(${reN},${reP},${reP},${reN}\\\\)$`);\n\nvar named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n};\n\ndefine(Color, color, {\n copy(channels) {\n return Object.assign(new this.constructor, this, channels);\n },\n displayable() {\n return this.rgb().displayable();\n },\n hex: color_formatHex, // Deprecated! Use color.formatHex.\n formatHex: color_formatHex,\n formatHex8: color_formatHex8,\n formatHsl: color_formatHsl,\n formatRgb: color_formatRgb,\n toString: color_formatRgb\n});\n\nfunction color_formatHex() {\n return this.rgb().formatHex();\n}\n\nfunction color_formatHex8() {\n return this.rgb().formatHex8();\n}\n\nfunction color_formatHsl() {\n return hslConvert(this).formatHsl();\n}\n\nfunction color_formatRgb() {\n return this.rgb().formatRgb();\n}\n\nexport default function color(format) {\n var m, l;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000\n : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00\n : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000\n : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000\n : null) // invalid hex\n : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)\n : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)\n : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)\n : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)\n : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)\n : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)\n : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins\n : format === \"transparent\" ? new Rgb(NaN, NaN, NaN, 0)\n : null;\n}\n\nfunction rgbn(n) {\n return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);\n}\n\nfunction rgba(r, g, b, a) {\n if (a <= 0) r = g = b = NaN;\n return new Rgb(r, g, b, a);\n}\n\nexport function rgbConvert(o) {\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Rgb;\n o = o.rgb();\n return new Rgb(o.r, o.g, o.b, o.opacity);\n}\n\nexport function rgb(r, g, b, opacity) {\n return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);\n}\n\nexport function Rgb(r, g, b, opacity) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Rgb, rgb, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n rgb() {\n return this;\n },\n clamp() {\n return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));\n },\n displayable() {\n return (-0.5 <= this.r && this.r < 255.5)\n && (-0.5 <= this.g && this.g < 255.5)\n && (-0.5 <= this.b && this.b < 255.5)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n hex: rgb_formatHex, // Deprecated! Use color.formatHex.\n formatHex: rgb_formatHex,\n formatHex8: rgb_formatHex8,\n formatRgb: rgb_formatRgb,\n toString: rgb_formatRgb\n}));\n\nfunction rgb_formatHex() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;\n}\n\nfunction rgb_formatHex8() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;\n}\n\nfunction rgb_formatRgb() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"rgb(\" : \"rgba(\"}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? \")\" : `, ${a})`}`;\n}\n\nfunction clampa(opacity) {\n return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));\n}\n\nfunction clampi(value) {\n return Math.max(0, Math.min(255, Math.round(value) || 0));\n}\n\nfunction hex(value) {\n value = clampi(value);\n return (value < 16 ? \"0\" : \"\") + value.toString(16);\n}\n\nfunction hsla(h, s, l, a) {\n if (a <= 0) h = s = l = NaN;\n else if (l <= 0 || l >= 1) h = s = NaN;\n else if (s <= 0) h = NaN;\n return new Hsl(h, s, l, a);\n}\n\nexport function hslConvert(o) {\n if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Hsl;\n if (o instanceof Hsl) return o;\n o = o.rgb();\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n h = NaN,\n s = max - min,\n l = (max + min) / 2;\n if (s) {\n if (r === max) h = (g - b) / s + (g < b) * 6;\n else if (g === max) h = (b - r) / s + 2;\n else h = (r - g) / s + 4;\n s /= l < 0.5 ? max + min : 2 - max - min;\n h *= 60;\n } else {\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new Hsl(h, s, l, o.opacity);\n}\n\nexport function hsl(h, s, l, opacity) {\n return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hsl(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hsl, hsl, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < 0.5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),\n this.opacity\n );\n },\n clamp() {\n return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));\n },\n displayable() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n formatHsl() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"hsl(\" : \"hsla(\"}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? \")\" : `, ${a})`}`;\n }\n}));\n\nfunction clamph(value) {\n value = (value || 0) % 360;\n return value < 0 ? value + 360 : value;\n}\n\nfunction clampt(value) {\n return Math.max(0, Math.min(1, value || 0));\n}\n\n/* From FvD 13.37, CSS Color Module Level 3 */\nfunction hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n}\n","export const radians = Math.PI / 180;\nexport const degrees = 180 / Math.PI;\n","import define, {extend} from \"./define.js\";\nimport {Color, rgbConvert, Rgb} from \"./color.js\";\nimport {degrees, radians} from \"./math.js\";\n\n// https://observablehq.com/@mbostock/lab-and-rgb\nconst K = 18,\n Xn = 0.96422,\n Yn = 1,\n Zn = 0.82521,\n t0 = 4 / 29,\n t1 = 6 / 29,\n t2 = 3 * t1 * t1,\n t3 = t1 * t1 * t1;\n\nfunction labConvert(o) {\n if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);\n if (o instanceof Hcl) return hcl2lab(o);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = rgb2lrgb(o.r),\n g = rgb2lrgb(o.g),\n b = rgb2lrgb(o.b),\n y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;\n if (r === g && g === b) x = z = y; else {\n x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);\n z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);\n }\n return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);\n}\n\nexport function gray(l, opacity) {\n return new Lab(l, 0, 0, opacity == null ? 1 : opacity);\n}\n\nexport default function lab(l, a, b, opacity) {\n return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);\n}\n\nexport function Lab(l, a, b, opacity) {\n this.l = +l;\n this.a = +a;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Lab, lab, extend(Color, {\n brighter(k) {\n return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n darker(k) {\n return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n rgb() {\n var y = (this.l + 16) / 116,\n x = isNaN(this.a) ? y : y + this.a / 500,\n z = isNaN(this.b) ? y : y - this.b / 200;\n x = Xn * lab2xyz(x);\n y = Yn * lab2xyz(y);\n z = Zn * lab2xyz(z);\n return new Rgb(\n lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),\n lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),\n lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),\n this.opacity\n );\n }\n}));\n\nfunction xyz2lab(t) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n}\n\nfunction lab2xyz(t) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n}\n\nfunction lrgb2rgb(x) {\n return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n}\n\nfunction rgb2lrgb(x) {\n return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n}\n\nfunction hclConvert(o) {\n if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);\n if (!(o instanceof Lab)) o = labConvert(o);\n if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);\n var h = Math.atan2(o.b, o.a) * degrees;\n return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);\n}\n\nexport function lch(l, c, h, opacity) {\n return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nexport function hcl(h, c, l, opacity) {\n return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nexport function Hcl(h, c, l, opacity) {\n this.h = +h;\n this.c = +c;\n this.l = +l;\n this.opacity = +opacity;\n}\n\nfunction hcl2lab(o) {\n if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);\n var h = o.h * radians;\n return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);\n}\n\ndefine(Hcl, hcl, extend(Color, {\n brighter(k) {\n return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);\n },\n darker(k) {\n return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);\n },\n rgb() {\n return hcl2lab(this).rgb();\n }\n}));\n","import define, {extend} from \"./define.js\";\nimport {Color, rgbConvert, Rgb, darker, brighter} from \"./color.js\";\nimport {degrees, radians} from \"./math.js\";\n\nvar A = -0.14861,\n B = +1.78277,\n C = -0.29227,\n D = -0.90649,\n E = +1.97294,\n ED = E * D,\n EB = E * B,\n BC_DA = B * C - D * A;\n\nfunction cubehelixConvert(o) {\n if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),\n bl = b - l,\n k = (E * (g - l) - C * bl) / D,\n s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1\n h = s ? Math.atan2(k, bl) * degrees - 120 : NaN;\n return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);\n}\n\nexport default function cubehelix(h, s, l, opacity) {\n return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);\n}\n\nexport function Cubehelix(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Cubehelix, cubehelix, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = isNaN(this.h) ? 0 : (this.h + 120) * radians,\n l = +this.l,\n a = isNaN(this.s) ? 0 : this.s * l * (1 - l),\n cosh = Math.cos(h),\n sinh = Math.sin(h);\n return new Rgb(\n 255 * (l + a * (A * cosh + B * sinh)),\n 255 * (l + a * (C * cosh + D * sinh)),\n 255 * (l + a * (E * cosh)),\n this.opacity\n );\n }\n}));\n","export {default as color, rgb, hsl} from \"./color.js\";\nexport {default as lab, hcl, lch, gray} from \"./lab.js\";\nexport {default as cubehelix} from \"./cubehelix.js\";\n","export function basis(t1, v0, v1, v2, v3) {\n var t2 = t1 * t1, t3 = t2 * t1;\n return ((1 - 3 * t1 + 3 * t2 - t3) * v0\n + (4 - 6 * t2 + 3 * t3) * v1\n + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2\n + t3 * v3) / 6;\n}\n\nexport default function(values) {\n var n = values.length - 1;\n return function(t) {\n var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),\n v1 = values[i],\n v2 = values[i + 1],\n v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,\n v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n","import {basis} from \"./basis.js\";\n\nexport default function(values) {\n var n = values.length;\n return function(t) {\n var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),\n v0 = values[(i + n - 1) % n],\n v1 = values[i % n],\n v2 = values[(i + 1) % n],\n v3 = values[(i + 2) % n];\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n","export default x => () => x;\n","import constant from \"./constant.js\";\n\nfunction linear(a, d) {\n return function(t) {\n return a + t * d;\n };\n}\n\nfunction exponential(a, b, y) {\n return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {\n return Math.pow(a + t * b, y);\n };\n}\n\nexport function hue(a, b) {\n var d = b - a;\n return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);\n}\n\nexport function gamma(y) {\n return (y = +y) === 1 ? nogamma : function(a, b) {\n return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);\n };\n}\n\nexport default function nogamma(a, b) {\n var d = b - a;\n return d ? linear(a, d) : constant(isNaN(a) ? b : a);\n}\n","import {rgb as colorRgb} from \"d3-color\";\nimport basis from \"./basis.js\";\nimport basisClosed from \"./basisClosed.js\";\nimport nogamma, {gamma} from \"./color.js\";\n\nexport default (function rgbGamma(y) {\n var color = gamma(y);\n\n function rgb(start, end) {\n var r = color((start = colorRgb(start)).r, (end = colorRgb(end)).r),\n g = color(start.g, end.g),\n b = color(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.r = r(t);\n start.g = g(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n rgb.gamma = rgbGamma;\n\n return rgb;\n})(1);\n\nfunction rgbSpline(spline) {\n return function(colors) {\n var n = colors.length,\n r = new Array(n),\n g = new Array(n),\n b = new Array(n),\n i, color;\n for (i = 0; i < n; ++i) {\n color = colorRgb(colors[i]);\n r[i] = color.r || 0;\n g[i] = color.g || 0;\n b[i] = color.b || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n color.opacity = 1;\n return function(t) {\n color.r = r(t);\n color.g = g(t);\n color.b = b(t);\n return color + \"\";\n };\n };\n}\n\nexport var rgbBasis = rgbSpline(basis);\nexport var rgbBasisClosed = rgbSpline(basisClosed);\n","export default function(a, b) {\n if (!b) b = [];\n var n = a ? Math.min(b.length, a.length) : 0,\n c = b.slice(),\n i;\n return function(t) {\n for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;\n return c;\n };\n}\n\nexport function isNumberArray(x) {\n return ArrayBuffer.isView(x) && !(x instanceof DataView);\n}\n","import value from \"./value.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n return (isNumberArray(b) ? numberArray : genericArray)(a, b);\n}\n\nexport function genericArray(a, b) {\n var nb = b ? b.length : 0,\n na = a ? Math.min(nb, a.length) : 0,\n x = new Array(na),\n c = new Array(nb),\n i;\n\n for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]);\n for (; i < nb; ++i) c[i] = b[i];\n\n return function(t) {\n for (i = 0; i < na; ++i) c[i] = x[i](t);\n return c;\n };\n}\n","export default function(a, b) {\n var d = new Date;\n return a = +a, b = +b, function(t) {\n return d.setTime(a * (1 - t) + b * t), d;\n };\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return a * (1 - t) + b * t;\n };\n}\n","import value from \"./value.js\";\n\nexport default function(a, b) {\n var i = {},\n c = {},\n k;\n\n if (a === null || typeof a !== \"object\") a = {};\n if (b === null || typeof b !== \"object\") b = {};\n\n for (k in b) {\n if (k in a) {\n i[k] = value(a[k], b[k]);\n } else {\n c[k] = b[k];\n }\n }\n\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n}\n","import number from \"./number.js\";\n\nvar reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g,\n reB = new RegExp(reA.source, \"g\");\n\nfunction zero(b) {\n return function() {\n return b;\n };\n}\n\nfunction one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n}\n\nexport default function(a, b) {\n var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b\n am, // current match in a\n bm, // current match in b\n bs, // string preceding current number in b, if any\n i = -1, // index in s\n s = [], // string constants and placeholders\n q = []; // number interpolators\n\n // Coerce inputs to strings.\n a = a + \"\", b = b + \"\";\n\n // Interpolate pairs of numbers in a & b.\n while ((am = reA.exec(a))\n && (bm = reB.exec(b))) {\n if ((bs = bm.index) > bi) { // a string precedes the next number in b\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match\n if (s[i]) s[i] += bm; // coalesce with previous string\n else s[++i] = bm;\n } else { // interpolate non-matching numbers\n s[++i] = null;\n q.push({i: i, x: number(am, bm)});\n }\n bi = reB.lastIndex;\n }\n\n // Add remains of b.\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n\n // Special optimization for only a single match.\n // Otherwise, interpolate each of the numbers and rejoin the string.\n return s.length < 2 ? (q[0]\n ? one(q[0].x)\n : zero(b))\n : (b = q.length, function(t) {\n for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n });\n}\n","import {color} from \"d3-color\";\nimport rgb from \"./rgb.js\";\nimport {genericArray} from \"./array.js\";\nimport date from \"./date.js\";\nimport number from \"./number.js\";\nimport object from \"./object.js\";\nimport string from \"./string.js\";\nimport constant from \"./constant.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n var t = typeof b, c;\n return b == null || t === \"boolean\" ? constant(b)\n : (t === \"number\" ? number\n : t === \"string\" ? ((c = color(b)) ? (b = c, rgb) : string)\n : b instanceof color ? rgb\n : b instanceof Date ? date\n : isNumberArray(b) ? numberArray\n : Array.isArray(b) ? genericArray\n : typeof b.valueOf !== \"function\" && typeof b.toString !== \"function\" || isNaN(b) ? object\n : number)(a, b);\n}\n","export default function(range) {\n var n = range.length;\n return function(t) {\n return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];\n };\n}\n","import {hue} from \"./color.js\";\n\nexport default function(a, b) {\n var i = hue(+a, +b);\n return function(t) {\n var x = i(t);\n return x - 360 * Math.floor(x / 360);\n };\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return Math.round(a * (1 - t) + b * t);\n };\n}\n","var degrees = 180 / Math.PI;\n\nexport var identity = {\n translateX: 0,\n translateY: 0,\n rotate: 0,\n skewX: 0,\n scaleX: 1,\n scaleY: 1\n};\n\nexport default function(a, b, c, d, e, f) {\n var scaleX, scaleY, skewX;\n if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;\n if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;\n if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;\n if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;\n return {\n translateX: e,\n translateY: f,\n rotate: Math.atan2(b, a) * degrees,\n skewX: Math.atan(skewX) * degrees,\n scaleX: scaleX,\n scaleY: scaleY\n };\n}\n","import decompose, {identity} from \"./decompose.js\";\n\nvar svgNode;\n\n/* eslint-disable no-undef */\nexport function parseCss(value) {\n const m = new (typeof DOMMatrix === \"function\" ? DOMMatrix : WebKitCSSMatrix)(value + \"\");\n return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);\n}\n\nexport function parseSvg(value) {\n if (value == null) return identity;\n if (!svgNode) svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n svgNode.setAttribute(\"transform\", value);\n if (!(value = svgNode.transform.baseVal.consolidate())) return identity;\n value = value.matrix;\n return decompose(value.a, value.b, value.c, value.d, value.e, value.f);\n}\n","import number from \"../number.js\";\nimport {parseCss, parseSvg} from \"./parse.js\";\n\nfunction interpolateTransform(parse, pxComma, pxParen, degParen) {\n\n function pop(s) {\n return s.length ? s.pop() + \" \" : \"\";\n }\n\n function translate(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(\"translate(\", null, pxComma, null, pxParen);\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb || yb) {\n s.push(\"translate(\" + xb + pxComma + yb + pxParen);\n }\n }\n\n function rotate(a, b, s, q) {\n if (a !== b) {\n if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path\n q.push({i: s.push(pop(s) + \"rotate(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"rotate(\" + b + degParen);\n }\n }\n\n function skewX(a, b, s, q) {\n if (a !== b) {\n q.push({i: s.push(pop(s) + \"skewX(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"skewX(\" + b + degParen);\n }\n }\n\n function scale(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(pop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb !== 1 || yb !== 1) {\n s.push(pop(s) + \"scale(\" + xb + \",\" + yb + \")\");\n }\n }\n\n return function(a, b) {\n var s = [], // string constants and placeholders\n q = []; // number interpolators\n a = parse(a), b = parse(b);\n translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);\n rotate(a.rotate, b.rotate, s, q);\n skewX(a.skewX, b.skewX, s, q);\n scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);\n a = b = null; // gc\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n };\n}\n\nexport var interpolateTransformCss = interpolateTransform(parseCss, \"px, \", \"px)\", \"deg)\");\nexport var interpolateTransformSvg = interpolateTransform(parseSvg, \", \", \")\", \")\");\n","var epsilon2 = 1e-12;\n\nfunction cosh(x) {\n return ((x = Math.exp(x)) + 1 / x) / 2;\n}\n\nfunction sinh(x) {\n return ((x = Math.exp(x)) - 1 / x) / 2;\n}\n\nfunction tanh(x) {\n return ((x = Math.exp(2 * x)) - 1) / (x + 1);\n}\n\nexport default (function zoomRho(rho, rho2, rho4) {\n\n // p0 = [ux0, uy0, w0]\n // p1 = [ux1, uy1, w1]\n function zoom(p0, p1) {\n var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],\n ux1 = p1[0], uy1 = p1[1], w1 = p1[2],\n dx = ux1 - ux0,\n dy = uy1 - uy0,\n d2 = dx * dx + dy * dy,\n i,\n S;\n\n // Special case for u0 ≅ u1.\n if (d2 < epsilon2) {\n S = Math.log(w1 / w0) / rho;\n i = function(t) {\n return [\n ux0 + t * dx,\n uy0 + t * dy,\n w0 * Math.exp(rho * t * S)\n ];\n }\n }\n\n // General case.\n else {\n var d1 = Math.sqrt(d2),\n b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),\n b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),\n r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),\n r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);\n S = (r1 - r0) / rho;\n i = function(t) {\n var s = t * S,\n coshr0 = cosh(r0),\n u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));\n return [\n ux0 + u * dx,\n uy0 + u * dy,\n w0 * coshr0 / cosh(rho * s + r0)\n ];\n }\n }\n\n i.duration = S * 1000 * rho / Math.SQRT2;\n\n return i;\n }\n\n zoom.rho = function(_) {\n var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;\n return zoomRho(_1, _2, _4);\n };\n\n return zoom;\n})(Math.SQRT2, 2, 4);\n","import {hsl as colorHsl} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction hsl(hue) {\n return function(start, end) {\n var h = hue((start = colorHsl(start)).h, (end = colorHsl(end)).h),\n s = color(start.s, end.s),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nexport default hsl(hue);\nexport var hslLong = hsl(color);\n","import {lab as colorLab} from \"d3-color\";\nimport color from \"./color.js\";\n\nexport default function lab(start, end) {\n var l = color((start = colorLab(start)).l, (end = colorLab(end)).l),\n a = color(start.a, end.a),\n b = color(start.b, end.b),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.l = l(t);\n start.a = a(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n}\n","import {hcl as colorHcl} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction hcl(hue) {\n return function(start, end) {\n var h = hue((start = colorHcl(start)).h, (end = colorHcl(end)).h),\n c = color(start.c, end.c),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.c = c(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nexport default hcl(hue);\nexport var hclLong = hcl(color);\n","import {cubehelix as colorCubehelix} from \"d3-color\";\nimport color, {hue} from \"./color.js\";\n\nfunction cubehelix(hue) {\n return (function cubehelixGamma(y) {\n y = +y;\n\n function cubehelix(start, end) {\n var h = hue((start = colorCubehelix(start)).h, (end = colorCubehelix(end)).h),\n s = color(start.s, end.s),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(Math.pow(t, y));\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n cubehelix.gamma = cubehelixGamma;\n\n return cubehelix;\n })(1);\n}\n\nexport default cubehelix(hue);\nexport var cubehelixLong = cubehelix(color);\n","import {default as value} from \"./value.js\";\n\nexport default function piecewise(interpolate, values) {\n if (values === undefined) values = interpolate, interpolate = value;\n var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n);\n while (i < n) I[i] = interpolate(v, v = values[++i]);\n return function(t) {\n var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));\n return I[i](t - i);\n };\n}\n","export default function(interpolator, n) {\n var samples = new Array(n);\n for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));\n return samples;\n}\n","export {default as interpolate} from \"./value.js\";\nexport {default as interpolateArray} from \"./array.js\";\nexport {default as interpolateBasis} from \"./basis.js\";\nexport {default as interpolateBasisClosed} from \"./basisClosed.js\";\nexport {default as interpolateDate} from \"./date.js\";\nexport {default as interpolateDiscrete} from \"./discrete.js\";\nexport {default as interpolateHue} from \"./hue.js\";\nexport {default as interpolateNumber} from \"./number.js\";\nexport {default as interpolateNumberArray} from \"./numberArray.js\";\nexport {default as interpolateObject} from \"./object.js\";\nexport {default as interpolateRound} from \"./round.js\";\nexport {default as interpolateString} from \"./string.js\";\nexport {interpolateTransformCss, interpolateTransformSvg} from \"./transform/index.js\";\nexport {default as interpolateZoom} from \"./zoom.js\";\nexport {default as interpolateRgb, rgbBasis as interpolateRgbBasis, rgbBasisClosed as interpolateRgbBasisClosed} from \"./rgb.js\";\nexport {default as interpolateHsl, hslLong as interpolateHslLong} from \"./hsl.js\";\nexport {default as interpolateLab} from \"./lab.js\";\nexport {default as interpolateHcl, hclLong as interpolateHclLong} from \"./hcl.js\";\nexport {default as interpolateCubehelix, cubehelixLong as interpolateCubehelixLong} from \"./cubehelix.js\";\nexport {default as piecewise} from \"./piecewise.js\";\nexport {default as quantize} from \"./quantize.js\";\n","var frame = 0, // is an animation frame pending?\n timeout = 0, // is a timeout pending?\n interval = 0, // are any timers active?\n pokeDelay = 1000, // how frequently we check for clock skew\n taskHead,\n taskTail,\n clockLast = 0,\n clockNow = 0,\n clockSkew = 0,\n clock = typeof performance === \"object\" && performance.now ? performance : Date,\n setFrame = typeof window === \"object\" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };\n\nexport function now() {\n return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);\n}\n\nfunction clearNow() {\n clockNow = 0;\n}\n\nexport function Timer() {\n this._call =\n this._time =\n this._next = null;\n}\n\nTimer.prototype = timer.prototype = {\n constructor: Timer,\n restart: function(callback, delay, time) {\n if (typeof callback !== \"function\") throw new TypeError(\"callback is not a function\");\n time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);\n if (!this._next && taskTail !== this) {\n if (taskTail) taskTail._next = this;\n else taskHead = this;\n taskTail = this;\n }\n this._call = callback;\n this._time = time;\n sleep();\n },\n stop: function() {\n if (this._call) {\n this._call = null;\n this._time = Infinity;\n sleep();\n }\n }\n};\n\nexport function timer(callback, delay, time) {\n var t = new Timer;\n t.restart(callback, delay, time);\n return t;\n}\n\nexport function timerFlush() {\n now(); // Get the current time, if not already set.\n ++frame; // Pretend we’ve set an alarm, if we haven’t already.\n var t = taskHead, e;\n while (t) {\n if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);\n t = t._next;\n }\n --frame;\n}\n\nfunction wake() {\n clockNow = (clockLast = clock.now()) + clockSkew;\n frame = timeout = 0;\n try {\n timerFlush();\n } finally {\n frame = 0;\n nap();\n clockNow = 0;\n }\n}\n\nfunction poke() {\n var now = clock.now(), delay = now - clockLast;\n if (delay > pokeDelay) clockSkew -= delay, clockLast = now;\n}\n\nfunction nap() {\n var t0, t1 = taskHead, t2, time = Infinity;\n while (t1) {\n if (t1._call) {\n if (time > t1._time) time = t1._time;\n t0 = t1, t1 = t1._next;\n } else {\n t2 = t1._next, t1._next = null;\n t1 = t0 ? t0._next = t2 : taskHead = t2;\n }\n }\n taskTail = t0;\n sleep(time);\n}\n\nfunction sleep(time) {\n if (frame) return; // Soonest alarm already set, or will be.\n if (timeout) timeout = clearTimeout(timeout);\n var delay = time - clockNow; // Strictly less than if we recomputed clockNow.\n if (delay > 24) {\n if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);\n if (interval) interval = clearInterval(interval);\n } else {\n if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);\n frame = 1, setFrame(wake);\n }\n}\n","import {Timer} from \"./timer.js\";\n\nexport default function(callback, delay, time) {\n var t = new Timer;\n delay = delay == null ? 0 : +delay;\n t.restart(elapsed => {\n t.stop();\n callback(elapsed + delay);\n }, delay, time);\n return t;\n}\n","export {\n now,\n timer,\n timerFlush\n} from \"./timer.js\";\n\nexport {\n default as timeout\n} from \"./timeout.js\";\n\nexport {\n default as interval\n} from \"./interval.js\";\n","import {dispatch} from \"d3-dispatch\";\nimport {timer, timeout} from \"d3-timer\";\n\nvar emptyOn = dispatch(\"start\", \"end\", \"cancel\", \"interrupt\");\nvar emptyTween = [];\n\nexport var CREATED = 0;\nexport var SCHEDULED = 1;\nexport var STARTING = 2;\nexport var STARTED = 3;\nexport var RUNNING = 4;\nexport var ENDING = 5;\nexport var ENDED = 6;\n\nexport default function(node, name, id, index, group, timing) {\n var schedules = node.__transition;\n if (!schedules) node.__transition = {};\n else if (id in schedules) return;\n create(node, id, {\n name: name,\n index: index, // For context during callback.\n group: group, // For context during callback.\n on: emptyOn,\n tween: emptyTween,\n time: timing.time,\n delay: timing.delay,\n duration: timing.duration,\n ease: timing.ease,\n timer: null,\n state: CREATED\n });\n}\n\nexport function init(node, id) {\n var schedule = get(node, id);\n if (schedule.state > CREATED) throw new Error(\"too late; already scheduled\");\n return schedule;\n}\n\nexport function set(node, id) {\n var schedule = get(node, id);\n if (schedule.state > STARTED) throw new Error(\"too late; already running\");\n return schedule;\n}\n\nexport function get(node, id) {\n var schedule = node.__transition;\n if (!schedule || !(schedule = schedule[id])) throw new Error(\"transition not found\");\n return schedule;\n}\n\nfunction create(node, id, self) {\n var schedules = node.__transition,\n tween;\n\n // Initialize the self timer when the transition is created.\n // Note the actual delay is not known until the first callback!\n schedules[id] = self;\n self.timer = timer(schedule, 0, self.time);\n\n function schedule(elapsed) {\n self.state = SCHEDULED;\n self.timer.restart(start, self.delay, self.time);\n\n // If the elapsed delay is less than our first sleep, start immediately.\n if (self.delay <= elapsed) start(elapsed - self.delay);\n }\n\n function start(elapsed) {\n var i, j, n, o;\n\n // If the state is not SCHEDULED, then we previously errored on start.\n if (self.state !== SCHEDULED) return stop();\n\n for (i in schedules) {\n o = schedules[i];\n if (o.name !== self.name) continue;\n\n // While this element already has a starting transition during this frame,\n // defer starting an interrupting transition until that transition has a\n // chance to tick (and possibly end); see d3/d3-transition#54!\n if (o.state === STARTED) return timeout(start);\n\n // Interrupt the active transition, if any.\n if (o.state === RUNNING) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"interrupt\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n\n // Cancel any pre-empted transitions.\n else if (+i < id) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"cancel\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n }\n\n // Defer the first tick to end of the current frame; see d3/d3#1576.\n // Note the transition may be canceled after start and before the first tick!\n // Note this must be scheduled before the start event; see d3/d3-transition#16!\n // Assuming this is successful, subsequent callbacks go straight to tick.\n timeout(function() {\n if (self.state === STARTED) {\n self.state = RUNNING;\n self.timer.restart(tick, self.delay, self.time);\n tick(elapsed);\n }\n });\n\n // Dispatch the start event.\n // Note this must be done before the tween are initialized.\n self.state = STARTING;\n self.on.call(\"start\", node, node.__data__, self.index, self.group);\n if (self.state !== STARTING) return; // interrupted\n self.state = STARTED;\n\n // Initialize the tween, deleting null tween.\n tween = new Array(n = self.tween.length);\n for (i = 0, j = -1; i < n; ++i) {\n if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {\n tween[++j] = o;\n }\n }\n tween.length = j + 1;\n }\n\n function tick(elapsed) {\n var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),\n i = -1,\n n = tween.length;\n\n while (++i < n) {\n tween[i].call(node, t);\n }\n\n // Dispatch the end event.\n if (self.state === ENDING) {\n self.on.call(\"end\", node, node.__data__, self.index, self.group);\n stop();\n }\n }\n\n function stop() {\n self.state = ENDED;\n self.timer.stop();\n delete schedules[id];\n for (var i in schedules) return; // eslint-disable-line no-unused-vars\n delete node.__transition;\n }\n}\n","import {STARTING, ENDING, ENDED} from \"./transition/schedule.js\";\n\nexport default function(node, name) {\n var schedules = node.__transition,\n schedule,\n active,\n empty = true,\n i;\n\n if (!schedules) return;\n\n name = name == null ? null : name + \"\";\n\n for (i in schedules) {\n if ((schedule = schedules[i]).name !== name) { empty = false; continue; }\n active = schedule.state > STARTING && schedule.state < ENDING;\n schedule.state = ENDED;\n schedule.timer.stop();\n schedule.on.call(active ? \"interrupt\" : \"cancel\", node, node.__data__, schedule.index, schedule.group);\n delete schedules[i];\n }\n\n if (empty) delete node.__transition;\n}\n","import interrupt from \"../interrupt.js\";\n\nexport default function(name) {\n return this.each(function() {\n interrupt(this, name);\n });\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction tweenRemove(id, name) {\n var tween0, tween1;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = tween0 = tween;\n for (var i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1 = tween1.slice();\n tween1.splice(i, 1);\n break;\n }\n }\n }\n\n schedule.tween = tween1;\n };\n}\n\nfunction tweenFunction(id, name, value) {\n var tween0, tween1;\n if (typeof value !== \"function\") throw new Error;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = (tween0 = tween).slice();\n for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1[i] = t;\n break;\n }\n }\n if (i === n) tween1.push(t);\n }\n\n schedule.tween = tween1;\n };\n}\n\nexport default function(name, value) {\n var id = this._id;\n\n name += \"\";\n\n if (arguments.length < 2) {\n var tween = get(this.node(), id).tween;\n for (var i = 0, n = tween.length, t; i < n; ++i) {\n if ((t = tween[i]).name === name) {\n return t.value;\n }\n }\n return null;\n }\n\n return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));\n}\n\nexport function tweenValue(transition, name, value) {\n var id = transition._id;\n\n transition.each(function() {\n var schedule = set(this, id);\n (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);\n });\n\n return function(node) {\n return get(node, id).value[name];\n };\n}\n","import {color} from \"d3-color\";\nimport {interpolateNumber, interpolateRgb, interpolateString} from \"d3-interpolate\";\n\nexport default function(a, b) {\n var c;\n return (typeof b === \"number\" ? interpolateNumber\n : b instanceof color ? interpolateRgb\n : (c = color(b)) ? (b = c, interpolateRgb)\n : interpolateString)(a, b);\n}\n","import {interpolateTransformSvg as interpolateTransform} from \"d3-interpolate\";\nimport {namespace} from \"d3-selection\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttribute(name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrConstantNS(fullname, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttributeNS(fullname.space, fullname.local);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttribute(name);\n string0 = this.getAttribute(name);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction attrFunctionNS(fullname, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);\n string0 = this.getAttributeNS(fullname.space, fullname.local);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name), i = fullname === \"transform\" ? interpolateTransform : interpolate;\n return this.attrTween(name, typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, \"attr.\" + name, value))\n : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname)\n : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));\n}\n","import {namespace} from \"d3-selection\";\n\nfunction attrInterpolate(name, i) {\n return function(t) {\n this.setAttribute(name, i.call(this, t));\n };\n}\n\nfunction attrInterpolateNS(fullname, i) {\n return function(t) {\n this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));\n };\n}\n\nfunction attrTweenNS(fullname, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nfunction attrTween(name, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value) {\n var key = \"attr.\" + name;\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n var fullname = namespace(name);\n return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));\n}\n","import {get, init} from \"./schedule.js\";\n\nfunction delayFunction(id, value) {\n return function() {\n init(this, id).delay = +value.apply(this, arguments);\n };\n}\n\nfunction delayConstant(id, value) {\n return value = +value, function() {\n init(this, id).delay = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? delayFunction\n : delayConstant)(id, value))\n : get(this.node(), id).delay;\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction durationFunction(id, value) {\n return function() {\n set(this, id).duration = +value.apply(this, arguments);\n };\n}\n\nfunction durationConstant(id, value) {\n return value = +value, function() {\n set(this, id).duration = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? durationFunction\n : durationConstant)(id, value))\n : get(this.node(), id).duration;\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction easeConstant(id, value) {\n if (typeof value !== \"function\") throw new Error;\n return function() {\n set(this, id).ease = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each(easeConstant(id, value))\n : get(this.node(), id).ease;\n}\n","import {set} from \"./schedule.js\";\n\nfunction easeVarying(id, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (typeof v !== \"function\") throw new Error;\n set(this, id).ease = v;\n };\n}\n\nexport default function(value) {\n if (typeof value !== \"function\") throw new Error;\n return this.each(easeVarying(this._id, value));\n}\n","import {matcher} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Transition(subgroups, this._parents, this._name, this._id);\n}\n","import {Transition} from \"./index.js\";\n\nexport default function(transition) {\n if (transition._id !== this._id) throw new Error;\n\n for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Transition(merges, this._parents, this._name, this._id);\n}\n","import {get, set, init} from \"./schedule.js\";\n\nfunction start(name) {\n return (name + \"\").trim().split(/^|\\s+/).every(function(t) {\n var i = t.indexOf(\".\");\n if (i >= 0) t = t.slice(0, i);\n return !t || t === \"start\";\n });\n}\n\nfunction onFunction(id, name, listener) {\n var on0, on1, sit = start(name) ? init : set;\n return function() {\n var schedule = sit(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, listener) {\n var id = this._id;\n\n return arguments.length < 2\n ? get(this.node(), id).on.on(name)\n : this.each(onFunction(id, name, listener));\n}\n","function removeFunction(id) {\n return function() {\n var parent = this.parentNode;\n for (var i in this.__transition) if (+i !== id) return;\n if (parent) parent.removeChild(this);\n };\n}\n\nexport default function() {\n return this.on(\"end.remove\", removeFunction(this._id));\n}\n","import {selector} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n schedule(subgroup[i], name, id, i, subgroup, get(node, id));\n }\n }\n }\n\n return new Transition(subgroups, this._parents, name, id);\n}\n","import {selectorAll} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {\n if (child = children[k]) {\n schedule(child, name, id, k, children, inherit);\n }\n }\n subgroups.push(children);\n parents.push(node);\n }\n }\n }\n\n return new Transition(subgroups, parents, name, id);\n}\n","import {selection} from \"d3-selection\";\n\nvar Selection = selection.prototype.constructor;\n\nexport default function() {\n return new Selection(this._groups, this._parents);\n}\n","import {interpolateTransformCss as interpolateTransform} from \"d3-interpolate\";\nimport {style} from \"d3-selection\";\nimport {set} from \"./schedule.js\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction styleNull(name, interpolate) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n string1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, string10 = string1);\n };\n}\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = style(this, name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction styleFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n value1 = value(this),\n string1 = value1 + \"\";\n if (value1 == null) string1 = value1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction styleMaybeRemove(id, name) {\n var on0, on1, listener0, key = \"style.\" + name, event = \"end.\" + key, remove;\n return function() {\n var schedule = set(this, id),\n on = schedule.on,\n listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, value, priority) {\n var i = (name += \"\") === \"transform\" ? interpolateTransform : interpolate;\n return value == null ? this\n .styleTween(name, styleNull(name, i))\n .on(\"end.style.\" + name, styleRemove(name))\n : typeof value === \"function\" ? this\n .styleTween(name, styleFunction(name, i, tweenValue(this, \"style.\" + name, value)))\n .each(styleMaybeRemove(this._id, name))\n : this\n .styleTween(name, styleConstant(name, i, value), priority)\n .on(\"end.style.\" + name, null);\n}\n","function styleInterpolate(name, i, priority) {\n return function(t) {\n this.style.setProperty(name, i.call(this, t), priority);\n };\n}\n\nfunction styleTween(name, value, priority) {\n var t, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);\n return t;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value, priority) {\n var key = \"style.\" + (name += \"\");\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, styleTween(name, value, priority == null ? \"\" : priority));\n}\n","import {tweenValue} from \"./tween.js\";\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var value1 = value(this);\n this.textContent = value1 == null ? \"\" : value1;\n };\n}\n\nexport default function(value) {\n return this.tween(\"text\", typeof value === \"function\"\n ? textFunction(tweenValue(this, \"text\", value))\n : textConstant(value == null ? \"\" : value + \"\"));\n}\n","function textInterpolate(i) {\n return function(t) {\n this.textContent = i.call(this, t);\n };\n}\n\nfunction textTween(value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && textInterpolate(i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(value) {\n var key = \"text\";\n if (arguments.length < 1) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, textTween(value));\n}\n","import {Transition, newId} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function() {\n var name = this._name,\n id0 = this._id,\n id1 = newId();\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n var inherit = get(node, id0);\n schedule(node, name, id1, i, group, {\n time: inherit.time + inherit.delay + inherit.duration,\n delay: 0,\n duration: inherit.duration,\n ease: inherit.ease\n });\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id1);\n}\n","import {set} from \"./schedule.js\";\n\nexport default function() {\n var on0, on1, that = this, id = that._id, size = that.size();\n return new Promise(function(resolve, reject) {\n var cancel = {value: reject},\n end = {value: function() { if (--size === 0) resolve(); }};\n\n that.each(function() {\n var schedule = set(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) {\n on1 = (on0 = on).copy();\n on1._.cancel.push(cancel);\n on1._.interrupt.push(cancel);\n on1._.end.push(end);\n }\n\n schedule.on = on1;\n });\n\n // The selection was empty, resolve end immediately\n if (size === 0) resolve();\n });\n}\n","import {selection} from \"d3-selection\";\nimport transition_attr from \"./attr.js\";\nimport transition_attrTween from \"./attrTween.js\";\nimport transition_delay from \"./delay.js\";\nimport transition_duration from \"./duration.js\";\nimport transition_ease from \"./ease.js\";\nimport transition_easeVarying from \"./easeVarying.js\";\nimport transition_filter from \"./filter.js\";\nimport transition_merge from \"./merge.js\";\nimport transition_on from \"./on.js\";\nimport transition_remove from \"./remove.js\";\nimport transition_select from \"./select.js\";\nimport transition_selectAll from \"./selectAll.js\";\nimport transition_selection from \"./selection.js\";\nimport transition_style from \"./style.js\";\nimport transition_styleTween from \"./styleTween.js\";\nimport transition_text from \"./text.js\";\nimport transition_textTween from \"./textTween.js\";\nimport transition_transition from \"./transition.js\";\nimport transition_tween from \"./tween.js\";\nimport transition_end from \"./end.js\";\n\nvar id = 0;\n\nexport function Transition(groups, parents, name, id) {\n this._groups = groups;\n this._parents = parents;\n this._name = name;\n this._id = id;\n}\n\nexport default function transition(name) {\n return selection().transition(name);\n}\n\nexport function newId() {\n return ++id;\n}\n\nvar selection_prototype = selection.prototype;\n\nTransition.prototype = transition.prototype = {\n constructor: Transition,\n select: transition_select,\n selectAll: transition_selectAll,\n selectChild: selection_prototype.selectChild,\n selectChildren: selection_prototype.selectChildren,\n filter: transition_filter,\n merge: transition_merge,\n selection: transition_selection,\n transition: transition_transition,\n call: selection_prototype.call,\n nodes: selection_prototype.nodes,\n node: selection_prototype.node,\n size: selection_prototype.size,\n empty: selection_prototype.empty,\n each: selection_prototype.each,\n on: transition_on,\n attr: transition_attr,\n attrTween: transition_attrTween,\n style: transition_style,\n styleTween: transition_styleTween,\n text: transition_text,\n textTween: transition_textTween,\n remove: transition_remove,\n tween: transition_tween,\n delay: transition_delay,\n duration: transition_duration,\n ease: transition_ease,\n easeVarying: transition_easeVarying,\n end: transition_end,\n [Symbol.iterator]: selection_prototype[Symbol.iterator]\n};\n","export function cubicIn(t) {\n return t * t * t;\n}\n\nexport function cubicOut(t) {\n return --t * t * t + 1;\n}\n\nexport function cubicInOut(t) {\n return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;\n}\n","export {\n linear as easeLinear\n} from \"./linear.js\";\n\nexport {\n quadInOut as easeQuad,\n quadIn as easeQuadIn,\n quadOut as easeQuadOut,\n quadInOut as easeQuadInOut\n} from \"./quad.js\";\n\nexport {\n cubicInOut as easeCubic,\n cubicIn as easeCubicIn,\n cubicOut as easeCubicOut,\n cubicInOut as easeCubicInOut\n} from \"./cubic.js\";\n\nexport {\n polyInOut as easePoly,\n polyIn as easePolyIn,\n polyOut as easePolyOut,\n polyInOut as easePolyInOut\n} from \"./poly.js\";\n\nexport {\n sinInOut as easeSin,\n sinIn as easeSinIn,\n sinOut as easeSinOut,\n sinInOut as easeSinInOut\n} from \"./sin.js\";\n\nexport {\n expInOut as easeExp,\n expIn as easeExpIn,\n expOut as easeExpOut,\n expInOut as easeExpInOut\n} from \"./exp.js\";\n\nexport {\n circleInOut as easeCircle,\n circleIn as easeCircleIn,\n circleOut as easeCircleOut,\n circleInOut as easeCircleInOut\n} from \"./circle.js\";\n\nexport {\n bounceOut as easeBounce,\n bounceIn as easeBounceIn,\n bounceOut as easeBounceOut,\n bounceInOut as easeBounceInOut\n} from \"./bounce.js\";\n\nexport {\n backInOut as easeBack,\n backIn as easeBackIn,\n backOut as easeBackOut,\n backInOut as easeBackInOut\n} from \"./back.js\";\n\nexport {\n elasticOut as easeElastic,\n elasticIn as easeElasticIn,\n elasticOut as easeElasticOut,\n elasticInOut as easeElasticInOut\n} from \"./elastic.js\";\n","import {Transition, newId} from \"../transition/index.js\";\nimport schedule from \"../transition/schedule.js\";\nimport {easeCubicInOut} from \"d3-ease\";\nimport {now} from \"d3-timer\";\n\nvar defaultTiming = {\n time: null, // Set on use.\n delay: 0,\n duration: 250,\n ease: easeCubicInOut\n};\n\nfunction inherit(node, id) {\n var timing;\n while (!(timing = node.__transition) || !(timing = timing[id])) {\n if (!(node = node.parentNode)) {\n throw new Error(`transition ${id} not found`);\n }\n }\n return timing;\n}\n\nexport default function(name) {\n var id,\n timing;\n\n if (name instanceof Transition) {\n id = name._id, name = name._name;\n } else {\n id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + \"\";\n }\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n schedule(node, name, id, i, group, timing || inherit(node, id));\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id);\n}\n","import {selection} from \"d3-selection\";\nimport selection_interrupt from \"./interrupt.js\";\nimport selection_transition from \"./transition.js\";\n\nselection.prototype.interrupt = selection_interrupt;\nselection.prototype.transition = selection_transition;\n","import \"./selection/index.js\";\nexport {default as transition} from \"./transition/index.js\";\nexport {default as active} from \"./active.js\";\nexport {default as interrupt} from \"./interrupt.js\";\n","export default x => () => x;\n","export default function ZoomEvent(type, {\n sourceEvent,\n target,\n transform,\n dispatch\n}) {\n Object.defineProperties(this, {\n type: {value: type, enumerable: true, configurable: true},\n sourceEvent: {value: sourceEvent, enumerable: true, configurable: true},\n target: {value: target, enumerable: true, configurable: true},\n transform: {value: transform, enumerable: true, configurable: true},\n _: {value: dispatch}\n });\n}\n","export function Transform(k, x, y) {\n this.k = k;\n this.x = x;\n this.y = y;\n}\n\nTransform.prototype = {\n constructor: Transform,\n scale: function(k) {\n return k === 1 ? this : new Transform(this.k * k, this.x, this.y);\n },\n translate: function(x, y) {\n return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);\n },\n apply: function(point) {\n return [point[0] * this.k + this.x, point[1] * this.k + this.y];\n },\n applyX: function(x) {\n return x * this.k + this.x;\n },\n applyY: function(y) {\n return y * this.k + this.y;\n },\n invert: function(location) {\n return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];\n },\n invertX: function(x) {\n return (x - this.x) / this.k;\n },\n invertY: function(y) {\n return (y - this.y) / this.k;\n },\n rescaleX: function(x) {\n return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));\n },\n rescaleY: function(y) {\n return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));\n },\n toString: function() {\n return \"translate(\" + this.x + \",\" + this.y + \") scale(\" + this.k + \")\";\n }\n};\n\nexport var identity = new Transform(1, 0, 0);\n\ntransform.prototype = Transform.prototype;\n\nexport default function transform(node) {\n while (!node.__zoom) if (!(node = node.parentNode)) return identity;\n return node.__zoom;\n}\n","export function nopropagation(event) {\n event.stopImmediatePropagation();\n}\n\nexport default function(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n}\n","import {dispatch} from \"d3-dispatch\";\nimport {dragDisable, dragEnable} from \"d3-drag\";\nimport {interpolateZoom} from \"d3-interpolate\";\nimport {select, pointer} from \"d3-selection\";\nimport {interrupt} from \"d3-transition\";\nimport constant from \"./constant.js\";\nimport ZoomEvent from \"./event.js\";\nimport {Transform, identity} from \"./transform.js\";\nimport noevent, {nopropagation} from \"./noevent.js\";\n\n// Ignore right-click, since that should open the context menu.\n// except for pinch-to-zoom, which is sent as a wheel+ctrlKey event\nfunction defaultFilter(event) {\n return (!event.ctrlKey || event.type === 'wheel') && !event.button;\n}\n\nfunction defaultExtent() {\n var e = this;\n if (e instanceof SVGElement) {\n e = e.ownerSVGElement || e;\n if (e.hasAttribute(\"viewBox\")) {\n e = e.viewBox.baseVal;\n return [[e.x, e.y], [e.x + e.width, e.y + e.height]];\n }\n return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];\n }\n return [[0, 0], [e.clientWidth, e.clientHeight]];\n}\n\nfunction defaultTransform() {\n return this.__zoom || identity;\n}\n\nfunction defaultWheelDelta(event) {\n return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 0.002) * (event.ctrlKey ? 10 : 1);\n}\n\nfunction defaultTouchable() {\n return navigator.maxTouchPoints || (\"ontouchstart\" in this);\n}\n\nfunction defaultConstrain(transform, extent, translateExtent) {\n var dx0 = transform.invertX(extent[0][0]) - translateExtent[0][0],\n dx1 = transform.invertX(extent[1][0]) - translateExtent[1][0],\n dy0 = transform.invertY(extent[0][1]) - translateExtent[0][1],\n dy1 = transform.invertY(extent[1][1]) - translateExtent[1][1];\n return transform.translate(\n dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),\n dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)\n );\n}\n\nexport default function() {\n var filter = defaultFilter,\n extent = defaultExtent,\n constrain = defaultConstrain,\n wheelDelta = defaultWheelDelta,\n touchable = defaultTouchable,\n scaleExtent = [0, Infinity],\n translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]],\n duration = 250,\n interpolate = interpolateZoom,\n listeners = dispatch(\"start\", \"zoom\", \"end\"),\n touchstarting,\n touchfirst,\n touchending,\n touchDelay = 500,\n wheelDelay = 150,\n clickDistance2 = 0,\n tapDistance = 10;\n\n function zoom(selection) {\n selection\n .property(\"__zoom\", defaultTransform)\n .on(\"wheel.zoom\", wheeled, {passive: false})\n .on(\"mousedown.zoom\", mousedowned)\n .on(\"dblclick.zoom\", dblclicked)\n .filter(touchable)\n .on(\"touchstart.zoom\", touchstarted)\n .on(\"touchmove.zoom\", touchmoved)\n .on(\"touchend.zoom touchcancel.zoom\", touchended)\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n zoom.transform = function(collection, transform, point, event) {\n var selection = collection.selection ? collection.selection() : collection;\n selection.property(\"__zoom\", defaultTransform);\n if (collection !== selection) {\n schedule(collection, transform, point, event);\n } else {\n selection.interrupt().each(function() {\n gesture(this, arguments)\n .event(event)\n .start()\n .zoom(null, typeof transform === \"function\" ? transform.apply(this, arguments) : transform)\n .end();\n });\n }\n };\n\n zoom.scaleBy = function(selection, k, p, event) {\n zoom.scaleTo(selection, function() {\n var k0 = this.__zoom.k,\n k1 = typeof k === \"function\" ? k.apply(this, arguments) : k;\n return k0 * k1;\n }, p, event);\n };\n\n zoom.scaleTo = function(selection, k, p, event) {\n zoom.transform(selection, function() {\n var e = extent.apply(this, arguments),\n t0 = this.__zoom,\n p0 = p == null ? centroid(e) : typeof p === \"function\" ? p.apply(this, arguments) : p,\n p1 = t0.invert(p0),\n k1 = typeof k === \"function\" ? k.apply(this, arguments) : k;\n return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent);\n }, p, event);\n };\n\n zoom.translateBy = function(selection, x, y, event) {\n zoom.transform(selection, function() {\n return constrain(this.__zoom.translate(\n typeof x === \"function\" ? x.apply(this, arguments) : x,\n typeof y === \"function\" ? y.apply(this, arguments) : y\n ), extent.apply(this, arguments), translateExtent);\n }, null, event);\n };\n\n zoom.translateTo = function(selection, x, y, p, event) {\n zoom.transform(selection, function() {\n var e = extent.apply(this, arguments),\n t = this.__zoom,\n p0 = p == null ? centroid(e) : typeof p === \"function\" ? p.apply(this, arguments) : p;\n return constrain(identity.translate(p0[0], p0[1]).scale(t.k).translate(\n typeof x === \"function\" ? -x.apply(this, arguments) : -x,\n typeof y === \"function\" ? -y.apply(this, arguments) : -y\n ), e, translateExtent);\n }, p, event);\n };\n\n function scale(transform, k) {\n k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));\n return k === transform.k ? transform : new Transform(k, transform.x, transform.y);\n }\n\n function translate(transform, p0, p1) {\n var x = p0[0] - p1[0] * transform.k, y = p0[1] - p1[1] * transform.k;\n return x === transform.x && y === transform.y ? transform : new Transform(transform.k, x, y);\n }\n\n function centroid(extent) {\n return [(+extent[0][0] + +extent[1][0]) / 2, (+extent[0][1] + +extent[1][1]) / 2];\n }\n\n function schedule(transition, transform, point, event) {\n transition\n .on(\"start.zoom\", function() { gesture(this, arguments).event(event).start(); })\n .on(\"interrupt.zoom end.zoom\", function() { gesture(this, arguments).event(event).end(); })\n .tween(\"zoom\", function() {\n var that = this,\n args = arguments,\n g = gesture(that, args).event(event),\n e = extent.apply(that, args),\n p = point == null ? centroid(e) : typeof point === \"function\" ? point.apply(that, args) : point,\n w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]),\n a = that.__zoom,\n b = typeof transform === \"function\" ? transform.apply(that, args) : transform,\n i = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));\n return function(t) {\n if (t === 1) t = b; // Avoid rounding error on end.\n else { var l = i(t), k = w / l[2]; t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k); }\n g.zoom(null, t);\n };\n });\n }\n\n function gesture(that, args, clean) {\n return (!clean && that.__zooming) || new Gesture(that, args);\n }\n\n function Gesture(that, args) {\n this.that = that;\n this.args = args;\n this.active = 0;\n this.sourceEvent = null;\n this.extent = extent.apply(that, args);\n this.taps = 0;\n }\n\n Gesture.prototype = {\n event: function(event) {\n if (event) this.sourceEvent = event;\n return this;\n },\n start: function() {\n if (++this.active === 1) {\n this.that.__zooming = this;\n this.emit(\"start\");\n }\n return this;\n },\n zoom: function(key, transform) {\n if (this.mouse && key !== \"mouse\") this.mouse[1] = transform.invert(this.mouse[0]);\n if (this.touch0 && key !== \"touch\") this.touch0[1] = transform.invert(this.touch0[0]);\n if (this.touch1 && key !== \"touch\") this.touch1[1] = transform.invert(this.touch1[0]);\n this.that.__zoom = transform;\n this.emit(\"zoom\");\n return this;\n },\n end: function() {\n if (--this.active === 0) {\n delete this.that.__zooming;\n this.emit(\"end\");\n }\n return this;\n },\n emit: function(type) {\n var d = select(this.that).datum();\n listeners.call(\n type,\n this.that,\n new ZoomEvent(type, {\n sourceEvent: this.sourceEvent,\n target: zoom,\n type,\n transform: this.that.__zoom,\n dispatch: listeners\n }),\n d\n );\n }\n };\n\n function wheeled(event, ...args) {\n if (!filter.apply(this, arguments)) return;\n var g = gesture(this, args).event(event),\n t = this.__zoom,\n k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))),\n p = pointer(event);\n\n // If the mouse is in the same location as before, reuse it.\n // If there were recent wheel events, reset the wheel idle timeout.\n if (g.wheel) {\n if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {\n g.mouse[1] = t.invert(g.mouse[0] = p);\n }\n clearTimeout(g.wheel);\n }\n\n // If this wheel event won’t trigger a transform change, ignore it.\n else if (t.k === k) return;\n\n // Otherwise, capture the mouse point and location at the start.\n else {\n g.mouse = [p, t.invert(p)];\n interrupt(this);\n g.start();\n }\n\n noevent(event);\n g.wheel = setTimeout(wheelidled, wheelDelay);\n g.zoom(\"mouse\", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));\n\n function wheelidled() {\n g.wheel = null;\n g.end();\n }\n }\n\n function mousedowned(event, ...args) {\n if (touchending || !filter.apply(this, arguments)) return;\n var currentTarget = event.currentTarget,\n g = gesture(this, args, true).event(event),\n v = select(event.view).on(\"mousemove.zoom\", mousemoved, true).on(\"mouseup.zoom\", mouseupped, true),\n p = pointer(event, currentTarget),\n x0 = event.clientX,\n y0 = event.clientY;\n\n dragDisable(event.view);\n nopropagation(event);\n g.mouse = [p, this.__zoom.invert(p)];\n interrupt(this);\n g.start();\n\n function mousemoved(event) {\n noevent(event);\n if (!g.moved) {\n var dx = event.clientX - x0, dy = event.clientY - y0;\n g.moved = dx * dx + dy * dy > clickDistance2;\n }\n g.event(event)\n .zoom(\"mouse\", constrain(translate(g.that.__zoom, g.mouse[0] = pointer(event, currentTarget), g.mouse[1]), g.extent, translateExtent));\n }\n\n function mouseupped(event) {\n v.on(\"mousemove.zoom mouseup.zoom\", null);\n dragEnable(event.view, g.moved);\n noevent(event);\n g.event(event).end();\n }\n }\n\n function dblclicked(event, ...args) {\n if (!filter.apply(this, arguments)) return;\n var t0 = this.__zoom,\n p0 = pointer(event.changedTouches ? event.changedTouches[0] : event, this),\n p1 = t0.invert(p0),\n k1 = t0.k * (event.shiftKey ? 0.5 : 2),\n t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, args), translateExtent);\n\n noevent(event);\n if (duration > 0) select(this).transition().duration(duration).call(schedule, t1, p0, event);\n else select(this).call(zoom.transform, t1, p0, event);\n }\n\n function touchstarted(event, ...args) {\n if (!filter.apply(this, arguments)) return;\n var touches = event.touches,\n n = touches.length,\n g = gesture(this, args, event.changedTouches.length === n).event(event),\n started, i, t, p;\n\n nopropagation(event);\n for (i = 0; i < n; ++i) {\n t = touches[i], p = pointer(t, this);\n p = [p, this.__zoom.invert(p), t.identifier];\n if (!g.touch0) g.touch0 = p, started = true, g.taps = 1 + !!touchstarting;\n else if (!g.touch1 && g.touch0[2] !== p[2]) g.touch1 = p, g.taps = 0;\n }\n\n if (touchstarting) touchstarting = clearTimeout(touchstarting);\n\n if (started) {\n if (g.taps < 2) touchfirst = p[0], touchstarting = setTimeout(function() { touchstarting = null; }, touchDelay);\n interrupt(this);\n g.start();\n }\n }\n\n function touchmoved(event, ...args) {\n if (!this.__zooming) return;\n var g = gesture(this, args).event(event),\n touches = event.changedTouches,\n n = touches.length, i, t, p, l;\n\n noevent(event);\n for (i = 0; i < n; ++i) {\n t = touches[i], p = pointer(t, this);\n if (g.touch0 && g.touch0[2] === t.identifier) g.touch0[0] = p;\n else if (g.touch1 && g.touch1[2] === t.identifier) g.touch1[0] = p;\n }\n t = g.that.__zoom;\n if (g.touch1) {\n var p0 = g.touch0[0], l0 = g.touch0[1],\n p1 = g.touch1[0], l1 = g.touch1[1],\n dp = (dp = p1[0] - p0[0]) * dp + (dp = p1[1] - p0[1]) * dp,\n dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;\n t = scale(t, Math.sqrt(dp / dl));\n p = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];\n l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];\n }\n else if (g.touch0) p = g.touch0[0], l = g.touch0[1];\n else return;\n\n g.zoom(\"touch\", constrain(translate(t, p, l), g.extent, translateExtent));\n }\n\n function touchended(event, ...args) {\n if (!this.__zooming) return;\n var g = gesture(this, args).event(event),\n touches = event.changedTouches,\n n = touches.length, i, t;\n\n nopropagation(event);\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, touchDelay);\n for (i = 0; i < n; ++i) {\n t = touches[i];\n if (g.touch0 && g.touch0[2] === t.identifier) delete g.touch0;\n else if (g.touch1 && g.touch1[2] === t.identifier) delete g.touch1;\n }\n if (g.touch1 && !g.touch0) g.touch0 = g.touch1, delete g.touch1;\n if (g.touch0) g.touch0[1] = this.__zoom.invert(g.touch0[0]);\n else {\n g.end();\n // If this was a dbltap, reroute to the (optional) dblclick.zoom handler.\n if (g.taps === 2) {\n t = pointer(t, this);\n if (Math.hypot(touchfirst[0] - t[0], touchfirst[1] - t[1]) < tapDistance) {\n var p = select(this).on(\"dblclick.zoom\");\n if (p) p.apply(this, arguments);\n }\n }\n }\n }\n\n zoom.wheelDelta = function(_) {\n return arguments.length ? (wheelDelta = typeof _ === \"function\" ? _ : constant(+_), zoom) : wheelDelta;\n };\n\n zoom.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant(!!_), zoom) : filter;\n };\n\n zoom.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant(!!_), zoom) : touchable;\n };\n\n zoom.extent = function(_) {\n return arguments.length ? (extent = typeof _ === \"function\" ? _ : constant([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;\n };\n\n zoom.scaleExtent = function(_) {\n return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];\n };\n\n zoom.translateExtent = function(_) {\n return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];\n };\n\n zoom.constrain = function(_) {\n return arguments.length ? (constrain = _, zoom) : constrain;\n };\n\n zoom.duration = function(_) {\n return arguments.length ? (duration = +_, zoom) : duration;\n };\n\n zoom.interpolate = function(_) {\n return arguments.length ? (interpolate = _, zoom) : interpolate;\n };\n\n zoom.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? zoom : value;\n };\n\n zoom.clickDistance = function(_) {\n return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);\n };\n\n zoom.tapDistance = function(_) {\n return arguments.length ? (tapDistance = +_, zoom) : tapDistance;\n };\n\n return zoom;\n}\n","export {default as zoom} from \"./zoom.js\";\nexport {default as zoomTransform, identity as zoomIdentity, Transform as ZoomTransform} from \"./transform.js\";\n","/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nmodule.exports = listCacheClear;\n","/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nmodule.exports = eq;\n","var eq = require('./eq');\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nmodule.exports = assocIndexOf;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nmodule.exports = listCacheDelete;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nmodule.exports = listCacheGet;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nmodule.exports = listCacheHas;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nmodule.exports = listCacheSet;\n","var listCacheClear = require('./_listCacheClear'),\n listCacheDelete = require('./_listCacheDelete'),\n listCacheGet = require('./_listCacheGet'),\n listCacheHas = require('./_listCacheHas'),\n listCacheSet = require('./_listCacheSet');\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nmodule.exports = ListCache;\n","var ListCache = require('./_ListCache');\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\nmodule.exports = stackClear;\n","/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\nmodule.exports = stackDelete;\n","/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\nmodule.exports = stackGet;\n","/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\nmodule.exports = stackHas;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","var baseGetTag = require('./_baseGetTag'),\n isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nmodule.exports = isFunction;\n","var root = require('./_root');\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nmodule.exports = coreJsData;\n","var coreJsData = require('./_coreJsData');\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nmodule.exports = isMasked;\n","/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nmodule.exports = toSource;\n","var isFunction = require('./isFunction'),\n isMasked = require('./_isMasked'),\n isObject = require('./isObject'),\n toSource = require('./_toSource');\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nmodule.exports = baseIsNative;\n","/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nmodule.exports = getValue;\n","var baseIsNative = require('./_baseIsNative'),\n getValue = require('./_getValue');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nmodule.exports = Map;\n","var getNative = require('./_getNative');\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nmodule.exports = nativeCreate;\n","var nativeCreate = require('./_nativeCreate');\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nmodule.exports = hashClear;\n","/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = hashDelete;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nmodule.exports = hashGet;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nmodule.exports = hashHas;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nmodule.exports = hashSet;\n","var hashClear = require('./_hashClear'),\n hashDelete = require('./_hashDelete'),\n hashGet = require('./_hashGet'),\n hashHas = require('./_hashHas'),\n hashSet = require('./_hashSet');\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nmodule.exports = Hash;\n","var Hash = require('./_Hash'),\n ListCache = require('./_ListCache'),\n Map = require('./_Map');\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nmodule.exports = mapCacheClear;\n","/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nmodule.exports = isKeyable;\n","var isKeyable = require('./_isKeyable');\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nmodule.exports = getMapData;\n","var getMapData = require('./_getMapData');\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = mapCacheDelete;\n","var getMapData = require('./_getMapData');\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nmodule.exports = mapCacheGet;\n","var getMapData = require('./_getMapData');\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nmodule.exports = mapCacheHas;\n","var getMapData = require('./_getMapData');\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nmodule.exports = mapCacheSet;\n","var mapCacheClear = require('./_mapCacheClear'),\n mapCacheDelete = require('./_mapCacheDelete'),\n mapCacheGet = require('./_mapCacheGet'),\n mapCacheHas = require('./_mapCacheHas'),\n mapCacheSet = require('./_mapCacheSet');\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nmodule.exports = MapCache;\n","var ListCache = require('./_ListCache'),\n Map = require('./_Map'),\n MapCache = require('./_MapCache');\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\nmodule.exports = stackSet;\n","var ListCache = require('./_ListCache'),\n stackClear = require('./_stackClear'),\n stackDelete = require('./_stackDelete'),\n stackGet = require('./_stackGet'),\n stackHas = require('./_stackHas'),\n stackSet = require('./_stackSet');\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\nmodule.exports = Stack;\n","/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\nmodule.exports = arrayEach;\n","var getNative = require('./_getNative');\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\nmodule.exports = defineProperty;\n","var defineProperty = require('./_defineProperty');\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\nmodule.exports = baseAssignValue;\n","var baseAssignValue = require('./_baseAssignValue'),\n eq = require('./eq');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\nmodule.exports = assignValue;\n","var assignValue = require('./_assignValue'),\n baseAssignValue = require('./_baseAssignValue');\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\nmodule.exports = copyObject;\n","/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nmodule.exports = baseTimes;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nmodule.exports = baseIsArguments;\n","var baseIsArguments = require('./_baseIsArguments'),\n isObjectLike = require('./isObjectLike');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nmodule.exports = isArguments;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nmodule.exports = isArray;\n","/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = stubFalse;\n","var root = require('./_root'),\n stubFalse = require('./stubFalse');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nmodule.exports = isBuffer;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nmodule.exports = isIndex;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nmodule.exports = isLength;\n","var baseGetTag = require('./_baseGetTag'),\n isLength = require('./isLength'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nmodule.exports = baseIsTypedArray;\n","/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nmodule.exports = baseUnary;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nmodule.exports = nodeUtil;\n","var baseIsTypedArray = require('./_baseIsTypedArray'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nmodule.exports = isTypedArray;\n","var baseTimes = require('./_baseTimes'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isIndex = require('./_isIndex'),\n isTypedArray = require('./isTypedArray');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = arrayLikeKeys;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nmodule.exports = isPrototype;\n","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nmodule.exports = overArg;\n","var overArg = require('./_overArg');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nmodule.exports = nativeKeys;\n","var isPrototype = require('./_isPrototype'),\n nativeKeys = require('./_nativeKeys');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = baseKeys;\n","var isFunction = require('./isFunction'),\n isLength = require('./isLength');\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nmodule.exports = isArrayLike;\n","var arrayLikeKeys = require('./_arrayLikeKeys'),\n baseKeys = require('./_baseKeys'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nmodule.exports = keys;\n","var copyObject = require('./_copyObject'),\n keys = require('./keys');\n\n/**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n}\n\nmodule.exports = baseAssign;\n","/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = nativeKeysIn;\n","var isObject = require('./isObject'),\n isPrototype = require('./_isPrototype'),\n nativeKeysIn = require('./_nativeKeysIn');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = baseKeysIn;\n","var arrayLikeKeys = require('./_arrayLikeKeys'),\n baseKeysIn = require('./_baseKeysIn'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\nmodule.exports = keysIn;\n","var copyObject = require('./_copyObject'),\n keysIn = require('./keysIn');\n\n/**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssignIn(object, source) {\n return object && copyObject(source, keysIn(source), object);\n}\n\nmodule.exports = baseAssignIn;\n","var root = require('./_root');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n}\n\nmodule.exports = cloneBuffer;\n","/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nmodule.exports = copyArray;\n","/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nmodule.exports = arrayFilter;\n","/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nmodule.exports = stubArray;\n","var arrayFilter = require('./_arrayFilter'),\n stubArray = require('./stubArray');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nmodule.exports = getSymbols;\n","var copyObject = require('./_copyObject'),\n getSymbols = require('./_getSymbols');\n\n/**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n}\n\nmodule.exports = copySymbols;\n","/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nmodule.exports = arrayPush;\n","var overArg = require('./_overArg');\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nmodule.exports = getPrototype;\n","var arrayPush = require('./_arrayPush'),\n getPrototype = require('./_getPrototype'),\n getSymbols = require('./_getSymbols'),\n stubArray = require('./stubArray');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {\n var result = [];\n while (object) {\n arrayPush(result, getSymbols(object));\n object = getPrototype(object);\n }\n return result;\n};\n\nmodule.exports = getSymbolsIn;\n","var copyObject = require('./_copyObject'),\n getSymbolsIn = require('./_getSymbolsIn');\n\n/**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbolsIn(source, object) {\n return copyObject(source, getSymbolsIn(source), object);\n}\n\nmodule.exports = copySymbolsIn;\n","var arrayPush = require('./_arrayPush'),\n isArray = require('./isArray');\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nmodule.exports = baseGetAllKeys;\n","var baseGetAllKeys = require('./_baseGetAllKeys'),\n getSymbols = require('./_getSymbols'),\n keys = require('./keys');\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\nmodule.exports = getAllKeys;\n","var baseGetAllKeys = require('./_baseGetAllKeys'),\n getSymbolsIn = require('./_getSymbolsIn'),\n keysIn = require('./keysIn');\n\n/**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeysIn(object) {\n return baseGetAllKeys(object, keysIn, getSymbolsIn);\n}\n\nmodule.exports = getAllKeysIn;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nmodule.exports = DataView;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nmodule.exports = Promise;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nmodule.exports = Set;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nmodule.exports = WeakMap;\n","var DataView = require('./_DataView'),\n Map = require('./_Map'),\n Promise = require('./_Promise'),\n Set = require('./_Set'),\n WeakMap = require('./_WeakMap'),\n baseGetTag = require('./_baseGetTag'),\n toSource = require('./_toSource');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nmodule.exports = getTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\nmodule.exports = initCloneArray;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Uint8Array = root.Uint8Array;\n\nmodule.exports = Uint8Array;\n","var Uint8Array = require('./_Uint8Array');\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\nmodule.exports = cloneArrayBuffer;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer');\n\n/**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\nfunction cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n}\n\nmodule.exports = cloneDataView;\n","/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = /\\w*$/;\n\n/**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\nfunction cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n}\n\nmodule.exports = cloneRegExp;\n","var Symbol = require('./_Symbol');\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\nfunction cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n}\n\nmodule.exports = cloneSymbol;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer');\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\nmodule.exports = cloneTypedArray;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer'),\n cloneDataView = require('./_cloneDataView'),\n cloneRegExp = require('./_cloneRegExp'),\n cloneSymbol = require('./_cloneSymbol'),\n cloneTypedArray = require('./_cloneTypedArray');\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return new Ctor;\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return new Ctor;\n\n case symbolTag:\n return cloneSymbol(object);\n }\n}\n\nmodule.exports = initCloneByTag;\n","var isObject = require('./isObject');\n\n/** Built-in value references. */\nvar objectCreate = Object.create;\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n}());\n\nmodule.exports = baseCreate;\n","var baseCreate = require('./_baseCreate'),\n getPrototype = require('./_getPrototype'),\n isPrototype = require('./_isPrototype');\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\nmodule.exports = initCloneObject;\n","var getTag = require('./_getTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]';\n\n/**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\nfunction baseIsMap(value) {\n return isObjectLike(value) && getTag(value) == mapTag;\n}\n\nmodule.exports = baseIsMap;\n","var baseIsMap = require('./_baseIsMap'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsMap = nodeUtil && nodeUtil.isMap;\n\n/**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\nvar isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;\n\nmodule.exports = isMap;\n","var getTag = require('./_getTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar setTag = '[object Set]';\n\n/**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\nfunction baseIsSet(value) {\n return isObjectLike(value) && getTag(value) == setTag;\n}\n\nmodule.exports = baseIsSet;\n","var baseIsSet = require('./_baseIsSet'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsSet = nodeUtil && nodeUtil.isSet;\n\n/**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\nvar isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;\n\nmodule.exports = isSet;\n","var Stack = require('./_Stack'),\n arrayEach = require('./_arrayEach'),\n assignValue = require('./_assignValue'),\n baseAssign = require('./_baseAssign'),\n baseAssignIn = require('./_baseAssignIn'),\n cloneBuffer = require('./_cloneBuffer'),\n copyArray = require('./_copyArray'),\n copySymbols = require('./_copySymbols'),\n copySymbolsIn = require('./_copySymbolsIn'),\n getAllKeys = require('./_getAllKeys'),\n getAllKeysIn = require('./_getAllKeysIn'),\n getTag = require('./_getTag'),\n initCloneArray = require('./_initCloneArray'),\n initCloneByTag = require('./_initCloneByTag'),\n initCloneObject = require('./_initCloneObject'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isMap = require('./isMap'),\n isObject = require('./isObject'),\n isSet = require('./isSet'),\n keys = require('./keys'),\n keysIn = require('./keysIn');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG = 4;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\ncloneableTags[boolTag] = cloneableTags[dateTag] =\ncloneableTags[float32Tag] = cloneableTags[float64Tag] =\ncloneableTags[int8Tag] = cloneableTags[int16Tag] =\ncloneableTags[int32Tag] = cloneableTags[mapTag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[setTag] =\ncloneableTags[stringTag] = cloneableTags[symbolTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG;\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = (isFlat || isFunc) ? {} : initCloneObject(value);\n if (!isDeep) {\n return isFlat\n ? copySymbolsIn(value, baseAssignIn(result, value))\n : copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (isSet(value)) {\n value.forEach(function(subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));\n });\n } else if (isMap(value)) {\n value.forEach(function(subValue, key) {\n result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n }\n\n var keysFunc = isFull\n ? (isFlat ? getAllKeysIn : getAllKeys)\n : (isFlat ? keysIn : keys);\n\n var props = isArr ? undefined : keysFunc(value);\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n return result;\n}\n\nmodule.exports = baseClone;\n","var baseClone = require('./_baseClone');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_SYMBOLS_FLAG = 4;\n\n/**\n * Creates a shallow clone of `value`.\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)\n * and supports cloning arrays, array buffers, booleans, date objects, maps,\n * numbers, `Object` objects, regexes, sets, strings, symbols, and typed\n * arrays. The own enumerable properties of `arguments` objects are cloned\n * as plain objects. An empty object is returned for uncloneable values such\n * as error objects, functions, DOM nodes, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to clone.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeep\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var shallow = _.clone(objects);\n * console.log(shallow[0] === objects[0]);\n * // => true\n */\nfunction clone(value) {\n return baseClone(value, CLONE_SYMBOLS_FLAG);\n}\n\nmodule.exports = clone;\n","/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\nmodule.exports = constant;\n","/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\nmodule.exports = createBaseFor;\n","var createBaseFor = require('./_createBaseFor');\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\nmodule.exports = baseFor;\n","var baseFor = require('./_baseFor'),\n keys = require('./keys');\n\n/**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForOwn(object, iteratee) {\n return object && baseFor(object, iteratee, keys);\n}\n\nmodule.exports = baseForOwn;\n","var isArrayLike = require('./isArrayLike');\n\n/**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n if (collection == null) {\n return collection;\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee);\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n}\n\nmodule.exports = createBaseEach;\n","var baseForOwn = require('./_baseForOwn'),\n createBaseEach = require('./_createBaseEach');\n\n/**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\nvar baseEach = createBaseEach(baseForOwn);\n\nmodule.exports = baseEach;\n","/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nmodule.exports = identity;\n","var identity = require('./identity');\n\n/**\n * Casts `value` to `identity` if it's not a function.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {Function} Returns cast function.\n */\nfunction castFunction(value) {\n return typeof value == 'function' ? value : identity;\n}\n\nmodule.exports = castFunction;\n","var arrayEach = require('./_arrayEach'),\n baseEach = require('./_baseEach'),\n castFunction = require('./_castFunction'),\n isArray = require('./isArray');\n\n/**\n * Iterates over elements of `collection` and invokes `iteratee` for each element.\n * The iteratee is invoked with three arguments: (value, index|key, collection).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * **Note:** As with other \"Collections\" methods, objects with a \"length\"\n * property are iterated like arrays. To avoid this behavior use `_.forIn`\n * or `_.forOwn` for object iteration.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias each\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n * @see _.forEachRight\n * @example\n *\n * _.forEach([1, 2], function(value) {\n * console.log(value);\n * });\n * // => Logs `1` then `2`.\n *\n * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\nfunction forEach(collection, iteratee) {\n var func = isArray(collection) ? arrayEach : baseEach;\n return func(collection, castFunction(iteratee));\n}\n\nmodule.exports = forEach;\n","module.exports = require('./forEach');\n","var baseEach = require('./_baseEach');\n\n/**\n * The base implementation of `_.filter` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction baseFilter(collection, predicate) {\n var result = [];\n baseEach(collection, function(value, index, collection) {\n if (predicate(value, index, collection)) {\n result.push(value);\n }\n });\n return result;\n}\n\nmodule.exports = baseFilter;\n","/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\nfunction setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n}\n\nmodule.exports = setCacheAdd;\n","/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\nmodule.exports = setCacheHas;\n","var MapCache = require('./_MapCache'),\n setCacheAdd = require('./_setCacheAdd'),\n setCacheHas = require('./_setCacheHas');\n\n/**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n}\n\n// Add methods to `SetCache`.\nSetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\nSetCache.prototype.has = setCacheHas;\n\nmodule.exports = SetCache;\n","/**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\nmodule.exports = arraySome;\n","/**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction cacheHas(cache, key) {\n return cache.has(key);\n}\n\nmodule.exports = cacheHas;\n","var SetCache = require('./_SetCache'),\n arraySome = require('./_arraySome'),\n cacheHas = require('./_cacheHas');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Check that cyclic values are equal.\n var arrStacked = stack.get(array);\n var othStacked = stack.get(other);\n if (arrStacked && othStacked) {\n return arrStacked == other && othStacked == array;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n}\n\nmodule.exports = equalArrays;\n","/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\nmodule.exports = mapToArray;\n","/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\nmodule.exports = setToArray;\n","var Symbol = require('./_Symbol'),\n Uint8Array = require('./_Uint8Array'),\n eq = require('./eq'),\n equalArrays = require('./_equalArrays'),\n mapToArray = require('./_mapToArray'),\n setToArray = require('./_setToArray');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]';\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n}\n\nmodule.exports = equalByTag;\n","var getAllKeys = require('./_getAllKeys');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Check that cyclic values are equal.\n var objStacked = stack.get(object);\n var othStacked = stack.get(other);\n if (objStacked && othStacked) {\n return objStacked == other && othStacked == object;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n}\n\nmodule.exports = equalObjects;\n","var Stack = require('./_Stack'),\n equalArrays = require('./_equalArrays'),\n equalByTag = require('./_equalByTag'),\n equalObjects = require('./_equalObjects'),\n getTag = require('./_getTag'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isTypedArray = require('./isTypedArray');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n}\n\nmodule.exports = baseIsEqualDeep;\n","var baseIsEqualDeep = require('./_baseIsEqualDeep'),\n isObjectLike = require('./isObjectLike');\n\n/**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n}\n\nmodule.exports = baseIsEqual;\n","var Stack = require('./_Stack'),\n baseIsEqual = require('./_baseIsEqual');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * The base implementation of `_.isMatch` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Array} matchData The property names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\nfunction baseIsMatch(object, source, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer;\n\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (index--) {\n var data = matchData[index];\n if ((noCustomizer && data[2])\n ? data[1] !== object[data[0]]\n : !(data[0] in object)\n ) {\n return false;\n }\n }\n while (++index < length) {\n data = matchData[index];\n var key = data[0],\n objValue = object[key],\n srcValue = data[1];\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false;\n }\n } else {\n var stack = new Stack;\n if (customizer) {\n var result = customizer(objValue, srcValue, key, object, source, stack);\n }\n if (!(result === undefined\n ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)\n : result\n )) {\n return false;\n }\n }\n }\n return true;\n}\n\nmodule.exports = baseIsMatch;\n","var isObject = require('./isObject');\n\n/**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\nfunction isStrictComparable(value) {\n return value === value && !isObject(value);\n}\n\nmodule.exports = isStrictComparable;\n","var isStrictComparable = require('./_isStrictComparable'),\n keys = require('./keys');\n\n/**\n * Gets the property names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\nfunction getMatchData(object) {\n var result = keys(object),\n length = result.length;\n\n while (length--) {\n var key = result[length],\n value = object[key];\n\n result[length] = [key, value, isStrictComparable(value)];\n }\n return result;\n}\n\nmodule.exports = getMatchData;\n","/**\n * A specialized version of `matchesProperty` for source values suitable\n * for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction matchesStrictComparable(key, srcValue) {\n return function(object) {\n if (object == null) {\n return false;\n }\n return object[key] === srcValue &&\n (srcValue !== undefined || (key in Object(object)));\n };\n}\n\nmodule.exports = matchesStrictComparable;\n","var baseIsMatch = require('./_baseIsMatch'),\n getMatchData = require('./_getMatchData'),\n matchesStrictComparable = require('./_matchesStrictComparable');\n\n/**\n * The base implementation of `_.matches` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction baseMatches(source) {\n var matchData = getMatchData(source);\n if (matchData.length == 1 && matchData[0][2]) {\n return matchesStrictComparable(matchData[0][0], matchData[0][1]);\n }\n return function(object) {\n return object === source || baseIsMatch(object, source, matchData);\n };\n}\n\nmodule.exports = baseMatches;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n","var isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/;\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n}\n\nmodule.exports = isKey;\n","var MapCache = require('./_MapCache');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Expose `MapCache`.\nmemoize.Cache = MapCache;\n\nmodule.exports = memoize;\n","var memoize = require('./memoize');\n\n/** Used as the maximum memoize cache size. */\nvar MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nfunction memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n}\n\nmodule.exports = memoizeCapped;\n","var memoizeCapped = require('./_memoizeCapped');\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nvar stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n});\n\nmodule.exports = stringToPath;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nmodule.exports = arrayMap;\n","var Symbol = require('./_Symbol'),\n arrayMap = require('./_arrayMap'),\n isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = baseToString;\n","var baseToString = require('./_baseToString');\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nmodule.exports = toString;\n","var isArray = require('./isArray'),\n isKey = require('./_isKey'),\n stringToPath = require('./_stringToPath'),\n toString = require('./toString');\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nfunction castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n}\n\nmodule.exports = castPath;\n","var isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\nfunction toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = toKey;\n","var castPath = require('./_castPath'),\n toKey = require('./_toKey');\n\n/**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n}\n\nmodule.exports = baseGet;\n","var baseGet = require('./_baseGet');\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n}\n\nmodule.exports = get;\n","/**\n * The base implementation of `_.hasIn` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHasIn(object, key) {\n return object != null && key in Object(object);\n}\n\nmodule.exports = baseHasIn;\n","var castPath = require('./_castPath'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray'),\n isIndex = require('./_isIndex'),\n isLength = require('./isLength'),\n toKey = require('./_toKey');\n\n/**\n * Checks if `path` exists on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @param {Function} hasFunc The function to check properties.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n */\nfunction hasPath(object, path, hasFunc) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n result = false;\n\n while (++index < length) {\n var key = toKey(path[index]);\n if (!(result = object != null && hasFunc(object, key))) {\n break;\n }\n object = object[key];\n }\n if (result || ++index != length) {\n return result;\n }\n length = object == null ? 0 : object.length;\n return !!length && isLength(length) && isIndex(key, length) &&\n (isArray(object) || isArguments(object));\n}\n\nmodule.exports = hasPath;\n","var baseHasIn = require('./_baseHasIn'),\n hasPath = require('./_hasPath');\n\n/**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\nfunction hasIn(object, path) {\n return object != null && hasPath(object, path, baseHasIn);\n}\n\nmodule.exports = hasIn;\n","var baseIsEqual = require('./_baseIsEqual'),\n get = require('./get'),\n hasIn = require('./hasIn'),\n isKey = require('./_isKey'),\n isStrictComparable = require('./_isStrictComparable'),\n matchesStrictComparable = require('./_matchesStrictComparable'),\n toKey = require('./_toKey');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction baseMatchesProperty(path, srcValue) {\n if (isKey(path) && isStrictComparable(srcValue)) {\n return matchesStrictComparable(toKey(path), srcValue);\n }\n return function(object) {\n var objValue = get(object, path);\n return (objValue === undefined && objValue === srcValue)\n ? hasIn(object, path)\n : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);\n };\n}\n\nmodule.exports = baseMatchesProperty;\n","/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\nmodule.exports = baseProperty;\n","var baseGet = require('./_baseGet');\n\n/**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\nfunction basePropertyDeep(path) {\n return function(object) {\n return baseGet(object, path);\n };\n}\n\nmodule.exports = basePropertyDeep;\n","var baseProperty = require('./_baseProperty'),\n basePropertyDeep = require('./_basePropertyDeep'),\n isKey = require('./_isKey'),\n toKey = require('./_toKey');\n\n/**\n * Creates a function that returns the value at `path` of a given object.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n * @example\n *\n * var objects = [\n * { 'a': { 'b': 2 } },\n * { 'a': { 'b': 1 } }\n * ];\n *\n * _.map(objects, _.property('a.b'));\n * // => [2, 1]\n *\n * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');\n * // => [1, 2]\n */\nfunction property(path) {\n return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);\n}\n\nmodule.exports = property;\n","var baseMatches = require('./_baseMatches'),\n baseMatchesProperty = require('./_baseMatchesProperty'),\n identity = require('./identity'),\n isArray = require('./isArray'),\n property = require('./property');\n\n/**\n * The base implementation of `_.iteratee`.\n *\n * @private\n * @param {*} [value=_.identity] The value to convert to an iteratee.\n * @returns {Function} Returns the iteratee.\n */\nfunction baseIteratee(value) {\n // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.\n // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.\n if (typeof value == 'function') {\n return value;\n }\n if (value == null) {\n return identity;\n }\n if (typeof value == 'object') {\n return isArray(value)\n ? baseMatchesProperty(value[0], value[1])\n : baseMatches(value);\n }\n return property(value);\n}\n\nmodule.exports = baseIteratee;\n","var arrayFilter = require('./_arrayFilter'),\n baseFilter = require('./_baseFilter'),\n baseIteratee = require('./_baseIteratee'),\n isArray = require('./isArray');\n\n/**\n * Iterates over elements of `collection`, returning an array of all elements\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * **Note:** Unlike `_.remove`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.reject\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * _.filter(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.filter(users, { 'age': 36, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.filter(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.filter(users, 'active');\n * // => objects for ['barney']\n *\n * // Combining several predicates using `_.overEvery` or `_.overSome`.\n * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));\n * // => objects for ['fred', 'barney']\n */\nfunction filter(collection, predicate) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n return func(collection, baseIteratee(predicate, 3));\n}\n\nmodule.exports = filter;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.has` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHas(object, key) {\n return object != null && hasOwnProperty.call(object, key);\n}\n\nmodule.exports = baseHas;\n","var baseHas = require('./_baseHas'),\n hasPath = require('./_hasPath');\n\n/**\n * Checks if `path` is a direct property of `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = { 'a': { 'b': 2 } };\n * var other = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.has(object, 'a');\n * // => true\n *\n * _.has(object, 'a.b');\n * // => true\n *\n * _.has(object, ['a', 'b']);\n * // => true\n *\n * _.has(other, 'a');\n * // => false\n */\nfunction has(object, path) {\n return object != null && hasPath(object, path, baseHas);\n}\n\nmodule.exports = has;\n","var baseKeys = require('./_baseKeys'),\n getTag = require('./_getTag'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray'),\n isArrayLike = require('./isArrayLike'),\n isBuffer = require('./isBuffer'),\n isPrototype = require('./_isPrototype'),\n isTypedArray = require('./isTypedArray');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n setTag = '[object Set]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if `value` is an empty object, collection, map, or set.\n *\n * Objects are considered empty if they have no own enumerable string keyed\n * properties.\n *\n * Array-like values such as `arguments` objects, arrays, buffers, strings, or\n * jQuery-like collections are considered empty if they have a `length` of `0`.\n * Similarly, maps and sets are considered empty if they have a `size` of `0`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is empty, else `false`.\n * @example\n *\n * _.isEmpty(null);\n * // => true\n *\n * _.isEmpty(true);\n * // => true\n *\n * _.isEmpty(1);\n * // => true\n *\n * _.isEmpty([1, 2, 3]);\n * // => false\n *\n * _.isEmpty({ 'a': 1 });\n * // => false\n */\nfunction isEmpty(value) {\n if (value == null) {\n return true;\n }\n if (isArrayLike(value) &&\n (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||\n isBuffer(value) || isTypedArray(value) || isArguments(value))) {\n return !value.length;\n }\n var tag = getTag(value);\n if (tag == mapTag || tag == setTag) {\n return !value.size;\n }\n if (isPrototype(value)) {\n return !baseKeys(value).length;\n }\n for (var key in value) {\n if (hasOwnProperty.call(value, key)) {\n return false;\n }\n }\n return true;\n}\n\nmodule.exports = isEmpty;\n","/**\n * Checks if `value` is `undefined`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.\n * @example\n *\n * _.isUndefined(void 0);\n * // => true\n *\n * _.isUndefined(null);\n * // => false\n */\nfunction isUndefined(value) {\n return value === undefined;\n}\n\nmodule.exports = isUndefined;\n","var baseEach = require('./_baseEach'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n}\n\nmodule.exports = baseMap;\n","var arrayMap = require('./_arrayMap'),\n baseIteratee = require('./_baseIteratee'),\n baseMap = require('./_baseMap'),\n isArray = require('./isArray');\n\n/**\n * Creates an array of values by running each element in `collection` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\n * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\n * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\n * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * _.map([4, 8], square);\n * // => [16, 64]\n *\n * _.map({ 'a': 4, 'b': 8 }, square);\n * // => [16, 64] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\nfunction map(collection, iteratee) {\n var func = isArray(collection) ? arrayMap : baseMap;\n return func(collection, baseIteratee(iteratee, 3));\n}\n\nmodule.exports = map;\n","/**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\nfunction arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n}\n\nmodule.exports = arrayReduce;\n","/**\n * The base implementation of `_.reduce` and `_.reduceRight`, without support\n * for iteratee shorthands, which iterates over `collection` using `eachFunc`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} accumulator The initial value.\n * @param {boolean} initAccum Specify using the first or last element of\n * `collection` as the initial value.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the accumulated value.\n */\nfunction baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {\n eachFunc(collection, function(value, index, collection) {\n accumulator = initAccum\n ? (initAccum = false, value)\n : iteratee(accumulator, value, index, collection);\n });\n return accumulator;\n}\n\nmodule.exports = baseReduce;\n","var arrayReduce = require('./_arrayReduce'),\n baseEach = require('./_baseEach'),\n baseIteratee = require('./_baseIteratee'),\n baseReduce = require('./_baseReduce'),\n isArray = require('./isArray');\n\n/**\n * Reduces `collection` to a value which is the accumulated result of running\n * each element in `collection` thru `iteratee`, where each successive\n * invocation is supplied the return value of the previous. If `accumulator`\n * is not given, the first element of `collection` is used as the initial\n * value. The iteratee is invoked with four arguments:\n * (accumulator, value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.reduce`, `_.reduceRight`, and `_.transform`.\n *\n * The guarded methods are:\n * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,\n * and `sortBy`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @returns {*} Returns the accumulated value.\n * @see _.reduceRight\n * @example\n *\n * _.reduce([1, 2], function(sum, n) {\n * return sum + n;\n * }, 0);\n * // => 3\n *\n * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n * (result[value] || (result[value] = [])).push(key);\n * return result;\n * }, {});\n * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)\n */\nfunction reduce(collection, iteratee, accumulator) {\n var func = isArray(collection) ? arrayReduce : baseReduce,\n initAccum = arguments.length < 3;\n\n return func(collection, baseIteratee(iteratee, 4), accumulator, initAccum, baseEach);\n}\n\nmodule.exports = reduce;\n","var baseGetTag = require('./_baseGetTag'),\n isArray = require('./isArray'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar stringTag = '[object String]';\n\n/**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a string, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\nfunction isString(value) {\n return typeof value == 'string' ||\n (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);\n}\n\nmodule.exports = isString;\n","var baseProperty = require('./_baseProperty');\n\n/**\n * Gets the size of an ASCII `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\nvar asciiSize = baseProperty('length');\n\nmodule.exports = asciiSize;\n","/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsVarRange = '\\\\ufe0e\\\\ufe0f';\n\n/** Used to compose unicode capture groups. */\nvar rsZWJ = '\\\\u200d';\n\n/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */\nvar reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');\n\n/**\n * Checks if `string` contains Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a symbol is found, else `false`.\n */\nfunction hasUnicode(string) {\n return reHasUnicode.test(string);\n}\n\nmodule.exports = hasUnicode;\n","/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsVarRange = '\\\\ufe0e\\\\ufe0f';\n\n/** Used to compose unicode capture groups. */\nvar rsAstral = '[' + rsAstralRange + ']',\n rsCombo = '[' + rsComboRange + ']',\n rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n rsNonAstral = '[^' + rsAstralRange + ']',\n rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n rsZWJ = '\\\\u200d';\n\n/** Used to compose unicode regexes. */\nvar reOptMod = rsModifier + '?',\n rsOptVar = '[' + rsVarRange + ']?',\n rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n rsSeq = rsOptVar + reOptMod + rsOptJoin,\n rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';\n\n/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */\nvar reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');\n\n/**\n * Gets the size of a Unicode `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\nfunction unicodeSize(string) {\n var result = reUnicode.lastIndex = 0;\n while (reUnicode.test(string)) {\n ++result;\n }\n return result;\n}\n\nmodule.exports = unicodeSize;\n","var asciiSize = require('./_asciiSize'),\n hasUnicode = require('./_hasUnicode'),\n unicodeSize = require('./_unicodeSize');\n\n/**\n * Gets the number of symbols in `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the string size.\n */\nfunction stringSize(string) {\n return hasUnicode(string)\n ? unicodeSize(string)\n : asciiSize(string);\n}\n\nmodule.exports = stringSize;\n","var baseKeys = require('./_baseKeys'),\n getTag = require('./_getTag'),\n isArrayLike = require('./isArrayLike'),\n isString = require('./isString'),\n stringSize = require('./_stringSize');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n setTag = '[object Set]';\n\n/**\n * Gets the size of `collection` by returning its length for array-like\n * values or the number of own enumerable string keyed properties for objects.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @returns {number} Returns the collection size.\n * @example\n *\n * _.size([1, 2, 3]);\n * // => 3\n *\n * _.size({ 'a': 1, 'b': 2 });\n * // => 2\n *\n * _.size('pebbles');\n * // => 7\n */\nfunction size(collection) {\n if (collection == null) {\n return 0;\n }\n if (isArrayLike(collection)) {\n return isString(collection) ? stringSize(collection) : collection.length;\n }\n var tag = getTag(collection);\n if (tag == mapTag || tag == setTag) {\n return collection.size;\n }\n return baseKeys(collection).length;\n}\n\nmodule.exports = size;\n","var arrayEach = require('./_arrayEach'),\n baseCreate = require('./_baseCreate'),\n baseForOwn = require('./_baseForOwn'),\n baseIteratee = require('./_baseIteratee'),\n getPrototype = require('./_getPrototype'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isFunction = require('./isFunction'),\n isObject = require('./isObject'),\n isTypedArray = require('./isTypedArray');\n\n/**\n * An alternative to `_.reduce`; this method transforms `object` to a new\n * `accumulator` object which is the result of running each of its own\n * enumerable string keyed properties thru `iteratee`, with each invocation\n * potentially mutating the `accumulator` object. If `accumulator` is not\n * provided, a new object with the same `[[Prototype]]` will be used. The\n * iteratee is invoked with four arguments: (accumulator, value, key, object).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 1.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The custom accumulator value.\n * @returns {*} Returns the accumulated value.\n * @example\n *\n * _.transform([2, 3, 4], function(result, n) {\n * result.push(n *= n);\n * return n % 2 == 0;\n * }, []);\n * // => [4, 9]\n *\n * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n * (result[value] || (result[value] = [])).push(key);\n * }, {});\n * // => { '1': ['a', 'c'], '2': ['b'] }\n */\nfunction transform(object, iteratee, accumulator) {\n var isArr = isArray(object),\n isArrLike = isArr || isBuffer(object) || isTypedArray(object);\n\n iteratee = baseIteratee(iteratee, 4);\n if (accumulator == null) {\n var Ctor = object && object.constructor;\n if (isArrLike) {\n accumulator = isArr ? new Ctor : [];\n }\n else if (isObject(object)) {\n accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};\n }\n else {\n accumulator = {};\n }\n }\n (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {\n return iteratee(accumulator, value, index, object);\n });\n return accumulator;\n}\n\nmodule.exports = transform;\n","var Symbol = require('./_Symbol'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray');\n\n/** Built-in value references. */\nvar spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;\n\n/**\n * Checks if `value` is a flattenable `arguments` object or array.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n */\nfunction isFlattenable(value) {\n return isArray(value) || isArguments(value) ||\n !!(spreadableSymbol && value && value[spreadableSymbol]);\n}\n\nmodule.exports = isFlattenable;\n","var arrayPush = require('./_arrayPush'),\n isFlattenable = require('./_isFlattenable');\n\n/**\n * The base implementation of `_.flatten` with support for restricting flattening.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {number} depth The maximum recursion depth.\n * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\n * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\nfunction baseFlatten(array, depth, predicate, isStrict, result) {\n var index = -1,\n length = array.length;\n\n predicate || (predicate = isFlattenable);\n result || (result = []);\n\n while (++index < length) {\n var value = array[index];\n if (depth > 0 && predicate(value)) {\n if (depth > 1) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, depth - 1, predicate, isStrict, result);\n } else {\n arrayPush(result, value);\n }\n } else if (!isStrict) {\n result[result.length] = value;\n }\n }\n return result;\n}\n\nmodule.exports = baseFlatten;\n","/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\nmodule.exports = apply;\n","var apply = require('./_apply');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\nmodule.exports = overRest;\n","var constant = require('./constant'),\n defineProperty = require('./_defineProperty'),\n identity = require('./identity');\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\nmodule.exports = baseSetToString;\n","/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeNow = Date.now;\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\nmodule.exports = shortOut;\n","var baseSetToString = require('./_baseSetToString'),\n shortOut = require('./_shortOut');\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\nmodule.exports = setToString;\n","var identity = require('./identity'),\n overRest = require('./_overRest'),\n setToString = require('./_setToString');\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n}\n\nmodule.exports = baseRest;\n","/**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseFindIndex(array, predicate, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 1 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n}\n\nmodule.exports = baseFindIndex;\n","/**\n * The base implementation of `_.isNaN` without support for number objects.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n */\nfunction baseIsNaN(value) {\n return value !== value;\n}\n\nmodule.exports = baseIsNaN;\n","/**\n * A specialized version of `_.indexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction strictIndexOf(array, value, fromIndex) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n}\n\nmodule.exports = strictIndexOf;\n","var baseFindIndex = require('./_baseFindIndex'),\n baseIsNaN = require('./_baseIsNaN'),\n strictIndexOf = require('./_strictIndexOf');\n\n/**\n * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseIndexOf(array, value, fromIndex) {\n return value === value\n ? strictIndexOf(array, value, fromIndex)\n : baseFindIndex(array, baseIsNaN, fromIndex);\n}\n\nmodule.exports = baseIndexOf;\n","var baseIndexOf = require('./_baseIndexOf');\n\n/**\n * A specialized version of `_.includes` for arrays without support for\n * specifying an index to search from.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\nfunction arrayIncludes(array, value) {\n var length = array == null ? 0 : array.length;\n return !!length && baseIndexOf(array, value, 0) > -1;\n}\n\nmodule.exports = arrayIncludes;\n","/**\n * This function is like `arrayIncludes` except that it accepts a comparator.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\nfunction arrayIncludesWith(array, value, comparator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (comparator(value, array[index])) {\n return true;\n }\n }\n return false;\n}\n\nmodule.exports = arrayIncludesWith;\n","/**\n * This method returns `undefined`.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Util\n * @example\n *\n * _.times(2, _.noop);\n * // => [undefined, undefined]\n */\nfunction noop() {\n // No operation performed.\n}\n\nmodule.exports = noop;\n","var Set = require('./_Set'),\n noop = require('./noop'),\n setToArray = require('./_setToArray');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Creates a set object of `values`.\n *\n * @private\n * @param {Array} values The values to add to the set.\n * @returns {Object} Returns the new set.\n */\nvar createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {\n return new Set(values);\n};\n\nmodule.exports = createSet;\n","var SetCache = require('./_SetCache'),\n arrayIncludes = require('./_arrayIncludes'),\n arrayIncludesWith = require('./_arrayIncludesWith'),\n cacheHas = require('./_cacheHas'),\n createSet = require('./_createSet'),\n setToArray = require('./_setToArray');\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * The base implementation of `_.uniqBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\nfunction baseUniq(array, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n length = array.length,\n isCommon = true,\n result = [],\n seen = result;\n\n if (comparator) {\n isCommon = false;\n includes = arrayIncludesWith;\n }\n else if (length >= LARGE_ARRAY_SIZE) {\n var set = iteratee ? null : createSet(array);\n if (set) {\n return setToArray(set);\n }\n isCommon = false;\n includes = cacheHas;\n seen = new SetCache;\n }\n else {\n seen = iteratee ? [] : result;\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var seenIndex = seen.length;\n while (seenIndex--) {\n if (seen[seenIndex] === computed) {\n continue outer;\n }\n }\n if (iteratee) {\n seen.push(computed);\n }\n result.push(value);\n }\n else if (!includes(seen, computed, comparator)) {\n if (seen !== result) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n}\n\nmodule.exports = baseUniq;\n","var isArrayLike = require('./isArrayLike'),\n isObjectLike = require('./isObjectLike');\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\nmodule.exports = isArrayLikeObject;\n","var baseFlatten = require('./_baseFlatten'),\n baseRest = require('./_baseRest'),\n baseUniq = require('./_baseUniq'),\n isArrayLikeObject = require('./isArrayLikeObject');\n\n/**\n * Creates an array of unique values, in order, from all given arrays using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.union([2], [1, 2]);\n * // => [2, 1]\n */\nvar union = baseRest(function(arrays) {\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));\n});\n\nmodule.exports = union;\n","var arrayMap = require('./_arrayMap');\n\n/**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\nfunction baseValues(object, props) {\n return arrayMap(props, function(key) {\n return object[key];\n });\n}\n\nmodule.exports = baseValues;\n","var baseValues = require('./_baseValues'),\n keys = require('./keys');\n\n/**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\nfunction values(object) {\n return object == null ? [] : baseValues(object, keys(object));\n}\n\nmodule.exports = values;\n","/* global window */\n\nvar lodash;\n\nif (typeof require === \"function\") {\n try {\n lodash = {\n clone: require(\"lodash/clone\"),\n constant: require(\"lodash/constant\"),\n each: require(\"lodash/each\"),\n filter: require(\"lodash/filter\"),\n has: require(\"lodash/has\"),\n isArray: require(\"lodash/isArray\"),\n isEmpty: require(\"lodash/isEmpty\"),\n isFunction: require(\"lodash/isFunction\"),\n isUndefined: require(\"lodash/isUndefined\"),\n keys: require(\"lodash/keys\"),\n map: require(\"lodash/map\"),\n reduce: require(\"lodash/reduce\"),\n size: require(\"lodash/size\"),\n transform: require(\"lodash/transform\"),\n union: require(\"lodash/union\"),\n values: require(\"lodash/values\")\n };\n } catch (e) {\n // continue regardless of error\n }\n}\n\nif (!lodash) {\n lodash = window._;\n}\n\nmodule.exports = lodash;\n","\"use strict\";\n\nvar _ = require(\"./lodash\");\n\nmodule.exports = Graph;\n\nvar DEFAULT_EDGE_NAME = \"\\x00\";\nvar GRAPH_NODE = \"\\x00\";\nvar EDGE_KEY_DELIM = \"\\x01\";\n\n// Implementation notes:\n//\n// * Node id query functions should return string ids for the nodes\n// * Edge id query functions should return an \"edgeObj\", edge object, that is\n// composed of enough information to uniquely identify an edge: {v, w, name}.\n// * Internally we use an \"edgeId\", a stringified form of the edgeObj, to\n// reference edges. This is because we need a performant way to look these\n// edges up and, object properties, which have string keys, are the closest\n// we're going to get to a performant hashtable in JavaScript.\n\nfunction Graph(opts) {\n this._isDirected = _.has(opts, \"directed\") ? opts.directed : true;\n this._isMultigraph = _.has(opts, \"multigraph\") ? opts.multigraph : false;\n this._isCompound = _.has(opts, \"compound\") ? opts.compound : false;\n\n // Label for the graph itself\n this._label = undefined;\n\n // Defaults to be set when creating a new node\n this._defaultNodeLabelFn = _.constant(undefined);\n\n // Defaults to be set when creating a new edge\n this._defaultEdgeLabelFn = _.constant(undefined);\n\n // v -> label\n this._nodes = {};\n\n if (this._isCompound) {\n // v -> parent\n this._parent = {};\n\n // v -> children\n this._children = {};\n this._children[GRAPH_NODE] = {};\n }\n\n // v -> edgeObj\n this._in = {};\n\n // u -> v -> Number\n this._preds = {};\n\n // v -> edgeObj\n this._out = {};\n\n // v -> w -> Number\n this._sucs = {};\n\n // e -> edgeObj\n this._edgeObjs = {};\n\n // e -> label\n this._edgeLabels = {};\n}\n\n/* Number of nodes in the graph. Should only be changed by the implementation. */\nGraph.prototype._nodeCount = 0;\n\n/* Number of edges in the graph. Should only be changed by the implementation. */\nGraph.prototype._edgeCount = 0;\n\n\n/* === Graph functions ========= */\n\nGraph.prototype.isDirected = function() {\n return this._isDirected;\n};\n\nGraph.prototype.isMultigraph = function() {\n return this._isMultigraph;\n};\n\nGraph.prototype.isCompound = function() {\n return this._isCompound;\n};\n\nGraph.prototype.setGraph = function(label) {\n this._label = label;\n return this;\n};\n\nGraph.prototype.graph = function() {\n return this._label;\n};\n\n\n/* === Node functions ========== */\n\nGraph.prototype.setDefaultNodeLabel = function(newDefault) {\n if (!_.isFunction(newDefault)) {\n newDefault = _.constant(newDefault);\n }\n this._defaultNodeLabelFn = newDefault;\n return this;\n};\n\nGraph.prototype.nodeCount = function() {\n return this._nodeCount;\n};\n\nGraph.prototype.nodes = function() {\n return _.keys(this._nodes);\n};\n\nGraph.prototype.sources = function() {\n var self = this;\n return _.filter(this.nodes(), function(v) {\n return _.isEmpty(self._in[v]);\n });\n};\n\nGraph.prototype.sinks = function() {\n var self = this;\n return _.filter(this.nodes(), function(v) {\n return _.isEmpty(self._out[v]);\n });\n};\n\nGraph.prototype.setNodes = function(vs, value) {\n var args = arguments;\n var self = this;\n _.each(vs, function(v) {\n if (args.length > 1) {\n self.setNode(v, value);\n } else {\n self.setNode(v);\n }\n });\n return this;\n};\n\nGraph.prototype.setNode = function(v, value) {\n if (_.has(this._nodes, v)) {\n if (arguments.length > 1) {\n this._nodes[v] = value;\n }\n return this;\n }\n\n this._nodes[v] = arguments.length > 1 ? value : this._defaultNodeLabelFn(v);\n if (this._isCompound) {\n this._parent[v] = GRAPH_NODE;\n this._children[v] = {};\n this._children[GRAPH_NODE][v] = true;\n }\n this._in[v] = {};\n this._preds[v] = {};\n this._out[v] = {};\n this._sucs[v] = {};\n ++this._nodeCount;\n return this;\n};\n\nGraph.prototype.node = function(v) {\n return this._nodes[v];\n};\n\nGraph.prototype.hasNode = function(v) {\n return _.has(this._nodes, v);\n};\n\nGraph.prototype.removeNode = function(v) {\n var self = this;\n if (_.has(this._nodes, v)) {\n var removeEdge = function(e) { self.removeEdge(self._edgeObjs[e]); };\n delete this._nodes[v];\n if (this._isCompound) {\n this._removeFromParentsChildList(v);\n delete this._parent[v];\n _.each(this.children(v), function(child) {\n self.setParent(child);\n });\n delete this._children[v];\n }\n _.each(_.keys(this._in[v]), removeEdge);\n delete this._in[v];\n delete this._preds[v];\n _.each(_.keys(this._out[v]), removeEdge);\n delete this._out[v];\n delete this._sucs[v];\n --this._nodeCount;\n }\n return this;\n};\n\nGraph.prototype.setParent = function(v, parent) {\n if (!this._isCompound) {\n throw new Error(\"Cannot set parent in a non-compound graph\");\n }\n\n if (_.isUndefined(parent)) {\n parent = GRAPH_NODE;\n } else {\n // Coerce parent to string\n parent += \"\";\n for (var ancestor = parent;\n !_.isUndefined(ancestor);\n ancestor = this.parent(ancestor)) {\n if (ancestor === v) {\n throw new Error(\"Setting \" + parent+ \" as parent of \" + v +\n \" would create a cycle\");\n }\n }\n\n this.setNode(parent);\n }\n\n this.setNode(v);\n this._removeFromParentsChildList(v);\n this._parent[v] = parent;\n this._children[parent][v] = true;\n return this;\n};\n\nGraph.prototype._removeFromParentsChildList = function(v) {\n delete this._children[this._parent[v]][v];\n};\n\nGraph.prototype.parent = function(v) {\n if (this._isCompound) {\n var parent = this._parent[v];\n if (parent !== GRAPH_NODE) {\n return parent;\n }\n }\n};\n\nGraph.prototype.children = function(v) {\n if (_.isUndefined(v)) {\n v = GRAPH_NODE;\n }\n\n if (this._isCompound) {\n var children = this._children[v];\n if (children) {\n return _.keys(children);\n }\n } else if (v === GRAPH_NODE) {\n return this.nodes();\n } else if (this.hasNode(v)) {\n return [];\n }\n};\n\nGraph.prototype.predecessors = function(v) {\n var predsV = this._preds[v];\n if (predsV) {\n return _.keys(predsV);\n }\n};\n\nGraph.prototype.successors = function(v) {\n var sucsV = this._sucs[v];\n if (sucsV) {\n return _.keys(sucsV);\n }\n};\n\nGraph.prototype.neighbors = function(v) {\n var preds = this.predecessors(v);\n if (preds) {\n return _.union(preds, this.successors(v));\n }\n};\n\nGraph.prototype.isLeaf = function (v) {\n var neighbors;\n if (this.isDirected()) {\n neighbors = this.successors(v);\n } else {\n neighbors = this.neighbors(v);\n }\n return neighbors.length === 0;\n};\n\nGraph.prototype.filterNodes = function(filter) {\n var copy = new this.constructor({\n directed: this._isDirected,\n multigraph: this._isMultigraph,\n compound: this._isCompound\n });\n\n copy.setGraph(this.graph());\n\n var self = this;\n _.each(this._nodes, function(value, v) {\n if (filter(v)) {\n copy.setNode(v, value);\n }\n });\n\n _.each(this._edgeObjs, function(e) {\n if (copy.hasNode(e.v) && copy.hasNode(e.w)) {\n copy.setEdge(e, self.edge(e));\n }\n });\n\n var parents = {};\n function findParent(v) {\n var parent = self.parent(v);\n if (parent === undefined || copy.hasNode(parent)) {\n parents[v] = parent;\n return parent;\n } else if (parent in parents) {\n return parents[parent];\n } else {\n return findParent(parent);\n }\n }\n\n if (this._isCompound) {\n _.each(copy.nodes(), function(v) {\n copy.setParent(v, findParent(v));\n });\n }\n\n return copy;\n};\n\n/* === Edge functions ========== */\n\nGraph.prototype.setDefaultEdgeLabel = function(newDefault) {\n if (!_.isFunction(newDefault)) {\n newDefault = _.constant(newDefault);\n }\n this._defaultEdgeLabelFn = newDefault;\n return this;\n};\n\nGraph.prototype.edgeCount = function() {\n return this._edgeCount;\n};\n\nGraph.prototype.edges = function() {\n return _.values(this._edgeObjs);\n};\n\nGraph.prototype.setPath = function(vs, value) {\n var self = this;\n var args = arguments;\n _.reduce(vs, function(v, w) {\n if (args.length > 1) {\n self.setEdge(v, w, value);\n } else {\n self.setEdge(v, w);\n }\n return w;\n });\n return this;\n};\n\n/*\n * setEdge(v, w, [value, [name]])\n * setEdge({ v, w, [name] }, [value])\n */\nGraph.prototype.setEdge = function() {\n var v, w, name, value;\n var valueSpecified = false;\n var arg0 = arguments[0];\n\n if (typeof arg0 === \"object\" && arg0 !== null && \"v\" in arg0) {\n v = arg0.v;\n w = arg0.w;\n name = arg0.name;\n if (arguments.length === 2) {\n value = arguments[1];\n valueSpecified = true;\n }\n } else {\n v = arg0;\n w = arguments[1];\n name = arguments[3];\n if (arguments.length > 2) {\n value = arguments[2];\n valueSpecified = true;\n }\n }\n\n v = \"\" + v;\n w = \"\" + w;\n if (!_.isUndefined(name)) {\n name = \"\" + name;\n }\n\n var e = edgeArgsToId(this._isDirected, v, w, name);\n if (_.has(this._edgeLabels, e)) {\n if (valueSpecified) {\n this._edgeLabels[e] = value;\n }\n return this;\n }\n\n if (!_.isUndefined(name) && !this._isMultigraph) {\n throw new Error(\"Cannot set a named edge when isMultigraph = false\");\n }\n\n // It didn't exist, so we need to create it.\n // First ensure the nodes exist.\n this.setNode(v);\n this.setNode(w);\n\n this._edgeLabels[e] = valueSpecified ? value : this._defaultEdgeLabelFn(v, w, name);\n\n var edgeObj = edgeArgsToObj(this._isDirected, v, w, name);\n // Ensure we add undirected edges in a consistent way.\n v = edgeObj.v;\n w = edgeObj.w;\n\n Object.freeze(edgeObj);\n this._edgeObjs[e] = edgeObj;\n incrementOrInitEntry(this._preds[w], v);\n incrementOrInitEntry(this._sucs[v], w);\n this._in[w][e] = edgeObj;\n this._out[v][e] = edgeObj;\n this._edgeCount++;\n return this;\n};\n\nGraph.prototype.edge = function(v, w, name) {\n var e = (arguments.length === 1\n ? edgeObjToId(this._isDirected, arguments[0])\n : edgeArgsToId(this._isDirected, v, w, name));\n return this._edgeLabels[e];\n};\n\nGraph.prototype.hasEdge = function(v, w, name) {\n var e = (arguments.length === 1\n ? edgeObjToId(this._isDirected, arguments[0])\n : edgeArgsToId(this._isDirected, v, w, name));\n return _.has(this._edgeLabels, e);\n};\n\nGraph.prototype.removeEdge = function(v, w, name) {\n var e = (arguments.length === 1\n ? edgeObjToId(this._isDirected, arguments[0])\n : edgeArgsToId(this._isDirected, v, w, name));\n var edge = this._edgeObjs[e];\n if (edge) {\n v = edge.v;\n w = edge.w;\n delete this._edgeLabels[e];\n delete this._edgeObjs[e];\n decrementOrRemoveEntry(this._preds[w], v);\n decrementOrRemoveEntry(this._sucs[v], w);\n delete this._in[w][e];\n delete this._out[v][e];\n this._edgeCount--;\n }\n return this;\n};\n\nGraph.prototype.inEdges = function(v, u) {\n var inV = this._in[v];\n if (inV) {\n var edges = _.values(inV);\n if (!u) {\n return edges;\n }\n return _.filter(edges, function(edge) { return edge.v === u; });\n }\n};\n\nGraph.prototype.outEdges = function(v, w) {\n var outV = this._out[v];\n if (outV) {\n var edges = _.values(outV);\n if (!w) {\n return edges;\n }\n return _.filter(edges, function(edge) { return edge.w === w; });\n }\n};\n\nGraph.prototype.nodeEdges = function(v, w) {\n var inEdges = this.inEdges(v, w);\n if (inEdges) {\n return inEdges.concat(this.outEdges(v, w));\n }\n};\n\nfunction incrementOrInitEntry(map, k) {\n if (map[k]) {\n map[k]++;\n } else {\n map[k] = 1;\n }\n}\n\nfunction decrementOrRemoveEntry(map, k) {\n if (!--map[k]) { delete map[k]; }\n}\n\nfunction edgeArgsToId(isDirected, v_, w_, name) {\n var v = \"\" + v_;\n var w = \"\" + w_;\n if (!isDirected && v > w) {\n var tmp = v;\n v = w;\n w = tmp;\n }\n return v + EDGE_KEY_DELIM + w + EDGE_KEY_DELIM +\n (_.isUndefined(name) ? DEFAULT_EDGE_NAME : name);\n}\n\nfunction edgeArgsToObj(isDirected, v_, w_, name) {\n var v = \"\" + v_;\n var w = \"\" + w_;\n if (!isDirected && v > w) {\n var tmp = v;\n v = w;\n w = tmp;\n }\n var edgeObj = { v: v, w: w };\n if (name) {\n edgeObj.name = name;\n }\n return edgeObj;\n}\n\nfunction edgeObjToId(isDirected, edgeObj) {\n return edgeArgsToId(isDirected, edgeObj.v, edgeObj.w, edgeObj.name);\n}\n","module.exports = '2.1.8';\n","// Includes only the \"core\" of graphlib\nmodule.exports = {\n Graph: require(\"./graph\"),\n version: require(\"./version\")\n};\n","var _ = require(\"./lodash\");\nvar Graph = require(\"./graph\");\n\nmodule.exports = {\n write: write,\n read: read\n};\n\nfunction write(g) {\n var json = {\n options: {\n directed: g.isDirected(),\n multigraph: g.isMultigraph(),\n compound: g.isCompound()\n },\n nodes: writeNodes(g),\n edges: writeEdges(g)\n };\n if (!_.isUndefined(g.graph())) {\n json.value = _.clone(g.graph());\n }\n return json;\n}\n\nfunction writeNodes(g) {\n return _.map(g.nodes(), function(v) {\n var nodeValue = g.node(v);\n var parent = g.parent(v);\n var node = { v: v };\n if (!_.isUndefined(nodeValue)) {\n node.value = nodeValue;\n }\n if (!_.isUndefined(parent)) {\n node.parent = parent;\n }\n return node;\n });\n}\n\nfunction writeEdges(g) {\n return _.map(g.edges(), function(e) {\n var edgeValue = g.edge(e);\n var edge = { v: e.v, w: e.w };\n if (!_.isUndefined(e.name)) {\n edge.name = e.name;\n }\n if (!_.isUndefined(edgeValue)) {\n edge.value = edgeValue;\n }\n return edge;\n });\n}\n\nfunction read(json) {\n var g = new Graph(json.options).setGraph(json.value);\n _.each(json.nodes, function(entry) {\n g.setNode(entry.v, entry.value);\n if (entry.parent) {\n g.setParent(entry.v, entry.parent);\n }\n });\n _.each(json.edges, function(entry) {\n g.setEdge({ v: entry.v, w: entry.w, name: entry.name }, entry.value);\n });\n return g;\n}\n","var _ = require(\"../lodash\");\n\nmodule.exports = components;\n\nfunction components(g) {\n var visited = {};\n var cmpts = [];\n var cmpt;\n\n function dfs(v) {\n if (_.has(visited, v)) return;\n visited[v] = true;\n cmpt.push(v);\n _.each(g.successors(v), dfs);\n _.each(g.predecessors(v), dfs);\n }\n\n _.each(g.nodes(), function(v) {\n cmpt = [];\n dfs(v);\n if (cmpt.length) {\n cmpts.push(cmpt);\n }\n });\n\n return cmpts;\n}\n","var _ = require(\"../lodash\");\n\nmodule.exports = PriorityQueue;\n\n/**\n * A min-priority queue data structure. This algorithm is derived from Cormen,\n * et al., \"Introduction to Algorithms\". The basic idea of a min-priority\n * queue is that you can efficiently (in O(1) time) get the smallest key in\n * the queue. Adding and removing elements takes O(log n) time. A key can\n * have its priority decreased in O(log n) time.\n */\nfunction PriorityQueue() {\n this._arr = [];\n this._keyIndices = {};\n}\n\n/**\n * Returns the number of elements in the queue. Takes `O(1)` time.\n */\nPriorityQueue.prototype.size = function() {\n return this._arr.length;\n};\n\n/**\n * Returns the keys that are in the queue. Takes `O(n)` time.\n */\nPriorityQueue.prototype.keys = function() {\n return this._arr.map(function(x) { return x.key; });\n};\n\n/**\n * Returns `true` if **key** is in the queue and `false` if not.\n */\nPriorityQueue.prototype.has = function(key) {\n return _.has(this._keyIndices, key);\n};\n\n/**\n * Returns the priority for **key**. If **key** is not present in the queue\n * then this function returns `undefined`. Takes `O(1)` time.\n *\n * @param {Object} key\n */\nPriorityQueue.prototype.priority = function(key) {\n var index = this._keyIndices[key];\n if (index !== undefined) {\n return this._arr[index].priority;\n }\n};\n\n/**\n * Returns the key for the minimum element in this queue. If the queue is\n * empty this function throws an Error. Takes `O(1)` time.\n */\nPriorityQueue.prototype.min = function() {\n if (this.size() === 0) {\n throw new Error(\"Queue underflow\");\n }\n return this._arr[0].key;\n};\n\n/**\n * Inserts a new key into the priority queue. If the key already exists in\n * the queue this function returns `false`; otherwise it will return `true`.\n * Takes `O(n)` time.\n *\n * @param {Object} key the key to add\n * @param {Number} priority the initial priority for the key\n */\nPriorityQueue.prototype.add = function(key, priority) {\n var keyIndices = this._keyIndices;\n key = String(key);\n if (!_.has(keyIndices, key)) {\n var arr = this._arr;\n var index = arr.length;\n keyIndices[key] = index;\n arr.push({key: key, priority: priority});\n this._decrease(index);\n return true;\n }\n return false;\n};\n\n/**\n * Removes and returns the smallest key in the queue. Takes `O(log n)` time.\n */\nPriorityQueue.prototype.removeMin = function() {\n this._swap(0, this._arr.length - 1);\n var min = this._arr.pop();\n delete this._keyIndices[min.key];\n this._heapify(0);\n return min.key;\n};\n\n/**\n * Decreases the priority for **key** to **priority**. If the new priority is\n * greater than the previous priority, this function will throw an Error.\n *\n * @param {Object} key the key for which to raise priority\n * @param {Number} priority the new priority for the key\n */\nPriorityQueue.prototype.decrease = function(key, priority) {\n var index = this._keyIndices[key];\n if (priority > this._arr[index].priority) {\n throw new Error(\"New priority is greater than current priority. \" +\n \"Key: \" + key + \" Old: \" + this._arr[index].priority + \" New: \" + priority);\n }\n this._arr[index].priority = priority;\n this._decrease(index);\n};\n\nPriorityQueue.prototype._heapify = function(i) {\n var arr = this._arr;\n var l = 2 * i;\n var r = l + 1;\n var largest = i;\n if (l < arr.length) {\n largest = arr[l].priority < arr[largest].priority ? l : largest;\n if (r < arr.length) {\n largest = arr[r].priority < arr[largest].priority ? r : largest;\n }\n if (largest !== i) {\n this._swap(i, largest);\n this._heapify(largest);\n }\n }\n};\n\nPriorityQueue.prototype._decrease = function(index) {\n var arr = this._arr;\n var priority = arr[index].priority;\n var parent;\n while (index !== 0) {\n parent = index >> 1;\n if (arr[parent].priority < priority) {\n break;\n }\n this._swap(index, parent);\n index = parent;\n }\n};\n\nPriorityQueue.prototype._swap = function(i, j) {\n var arr = this._arr;\n var keyIndices = this._keyIndices;\n var origArrI = arr[i];\n var origArrJ = arr[j];\n arr[i] = origArrJ;\n arr[j] = origArrI;\n keyIndices[origArrJ.key] = i;\n keyIndices[origArrI.key] = j;\n};\n","var _ = require(\"../lodash\");\nvar PriorityQueue = require(\"../data/priority-queue\");\n\nmodule.exports = dijkstra;\n\nvar DEFAULT_WEIGHT_FUNC = _.constant(1);\n\nfunction dijkstra(g, source, weightFn, edgeFn) {\n return runDijkstra(g, String(source),\n weightFn || DEFAULT_WEIGHT_FUNC,\n edgeFn || function(v) { return g.outEdges(v); });\n}\n\nfunction runDijkstra(g, source, weightFn, edgeFn) {\n var results = {};\n var pq = new PriorityQueue();\n var v, vEntry;\n\n var updateNeighbors = function(edge) {\n var w = edge.v !== v ? edge.v : edge.w;\n var wEntry = results[w];\n var weight = weightFn(edge);\n var distance = vEntry.distance + weight;\n\n if (weight < 0) {\n throw new Error(\"dijkstra does not allow negative edge weights. \" +\n \"Bad edge: \" + edge + \" Weight: \" + weight);\n }\n\n if (distance < wEntry.distance) {\n wEntry.distance = distance;\n wEntry.predecessor = v;\n pq.decrease(w, distance);\n }\n };\n\n g.nodes().forEach(function(v) {\n var distance = v === source ? 0 : Number.POSITIVE_INFINITY;\n results[v] = { distance: distance };\n pq.add(v, distance);\n });\n\n while (pq.size() > 0) {\n v = pq.removeMin();\n vEntry = results[v];\n if (vEntry.distance === Number.POSITIVE_INFINITY) {\n break;\n }\n\n edgeFn(v).forEach(updateNeighbors);\n }\n\n return results;\n}\n","var dijkstra = require(\"./dijkstra\");\nvar _ = require(\"../lodash\");\n\nmodule.exports = dijkstraAll;\n\nfunction dijkstraAll(g, weightFunc, edgeFunc) {\n return _.transform(g.nodes(), function(acc, v) {\n acc[v] = dijkstra(g, v, weightFunc, edgeFunc);\n }, {});\n}\n","var _ = require(\"../lodash\");\n\nmodule.exports = tarjan;\n\nfunction tarjan(g) {\n var index = 0;\n var stack = [];\n var visited = {}; // node id -> { onStack, lowlink, index }\n var results = [];\n\n function dfs(v) {\n var entry = visited[v] = {\n onStack: true,\n lowlink: index,\n index: index++\n };\n stack.push(v);\n\n g.successors(v).forEach(function(w) {\n if (!_.has(visited, w)) {\n dfs(w);\n entry.lowlink = Math.min(entry.lowlink, visited[w].lowlink);\n } else if (visited[w].onStack) {\n entry.lowlink = Math.min(entry.lowlink, visited[w].index);\n }\n });\n\n if (entry.lowlink === entry.index) {\n var cmpt = [];\n var w;\n do {\n w = stack.pop();\n visited[w].onStack = false;\n cmpt.push(w);\n } while (v !== w);\n results.push(cmpt);\n }\n }\n\n g.nodes().forEach(function(v) {\n if (!_.has(visited, v)) {\n dfs(v);\n }\n });\n\n return results;\n}\n","var _ = require(\"../lodash\");\nvar tarjan = require(\"./tarjan\");\n\nmodule.exports = findCycles;\n\nfunction findCycles(g) {\n return _.filter(tarjan(g), function(cmpt) {\n return cmpt.length > 1 || (cmpt.length === 1 && g.hasEdge(cmpt[0], cmpt[0]));\n });\n}\n","var _ = require(\"../lodash\");\n\nmodule.exports = floydWarshall;\n\nvar DEFAULT_WEIGHT_FUNC = _.constant(1);\n\nfunction floydWarshall(g, weightFn, edgeFn) {\n return runFloydWarshall(g,\n weightFn || DEFAULT_WEIGHT_FUNC,\n edgeFn || function(v) { return g.outEdges(v); });\n}\n\nfunction runFloydWarshall(g, weightFn, edgeFn) {\n var results = {};\n var nodes = g.nodes();\n\n nodes.forEach(function(v) {\n results[v] = {};\n results[v][v] = { distance: 0 };\n nodes.forEach(function(w) {\n if (v !== w) {\n results[v][w] = { distance: Number.POSITIVE_INFINITY };\n }\n });\n edgeFn(v).forEach(function(edge) {\n var w = edge.v === v ? edge.w : edge.v;\n var d = weightFn(edge);\n results[v][w] = { distance: d, predecessor: v };\n });\n });\n\n nodes.forEach(function(k) {\n var rowK = results[k];\n nodes.forEach(function(i) {\n var rowI = results[i];\n nodes.forEach(function(j) {\n var ik = rowI[k];\n var kj = rowK[j];\n var ij = rowI[j];\n var altDistance = ik.distance + kj.distance;\n if (altDistance < ij.distance) {\n ij.distance = altDistance;\n ij.predecessor = kj.predecessor;\n }\n });\n });\n });\n\n return results;\n}\n","var _ = require(\"../lodash\");\n\nmodule.exports = topsort;\ntopsort.CycleException = CycleException;\n\nfunction topsort(g) {\n var visited = {};\n var stack = {};\n var results = [];\n\n function visit(node) {\n if (_.has(stack, node)) {\n throw new CycleException();\n }\n\n if (!_.has(visited, node)) {\n stack[node] = true;\n visited[node] = true;\n _.each(g.predecessors(node), visit);\n delete stack[node];\n results.push(node);\n }\n }\n\n _.each(g.sinks(), visit);\n\n if (_.size(visited) !== g.nodeCount()) {\n throw new CycleException();\n }\n\n return results;\n}\n\nfunction CycleException() {}\nCycleException.prototype = new Error(); // must be an instance of Error to pass testing","var topsort = require(\"./topsort\");\n\nmodule.exports = isAcyclic;\n\nfunction isAcyclic(g) {\n try {\n topsort(g);\n } catch (e) {\n if (e instanceof topsort.CycleException) {\n return false;\n }\n throw e;\n }\n return true;\n}\n","var _ = require(\"../lodash\");\n\nmodule.exports = dfs;\n\n/*\n * A helper that preforms a pre- or post-order traversal on the input graph\n * and returns the nodes in the order they were visited. If the graph is\n * undirected then this algorithm will navigate using neighbors. If the graph\n * is directed then this algorithm will navigate using successors.\n *\n * Order must be one of \"pre\" or \"post\".\n */\nfunction dfs(g, vs, order) {\n if (!_.isArray(vs)) {\n vs = [vs];\n }\n\n var navigation = (g.isDirected() ? g.successors : g.neighbors).bind(g);\n\n var acc = [];\n var visited = {};\n _.each(vs, function(v) {\n if (!g.hasNode(v)) {\n throw new Error(\"Graph does not have node: \" + v);\n }\n\n doDfs(g, v, order === \"post\", visited, navigation, acc);\n });\n return acc;\n}\n\nfunction doDfs(g, v, postorder, visited, navigation, acc) {\n if (!_.has(visited, v)) {\n visited[v] = true;\n\n if (!postorder) { acc.push(v); }\n _.each(navigation(v), function(w) {\n doDfs(g, w, postorder, visited, navigation, acc);\n });\n if (postorder) { acc.push(v); }\n }\n}\n","var dfs = require(\"./dfs\");\n\nmodule.exports = postorder;\n\nfunction postorder(g, vs) {\n return dfs(g, vs, \"post\");\n}\n","var dfs = require(\"./dfs\");\n\nmodule.exports = preorder;\n\nfunction preorder(g, vs) {\n return dfs(g, vs, \"pre\");\n}\n","var _ = require(\"../lodash\");\nvar Graph = require(\"../graph\");\nvar PriorityQueue = require(\"../data/priority-queue\");\n\nmodule.exports = prim;\n\nfunction prim(g, weightFunc) {\n var result = new Graph();\n var parents = {};\n var pq = new PriorityQueue();\n var v;\n\n function updateNeighbors(edge) {\n var w = edge.v === v ? edge.w : edge.v;\n var pri = pq.priority(w);\n if (pri !== undefined) {\n var edgeWeight = weightFunc(edge);\n if (edgeWeight < pri) {\n parents[w] = v;\n pq.decrease(w, edgeWeight);\n }\n }\n }\n\n if (g.nodeCount() === 0) {\n return result;\n }\n\n _.each(g.nodes(), function(v) {\n pq.add(v, Number.POSITIVE_INFINITY);\n result.setNode(v);\n });\n\n // Start from an arbitrary node\n pq.decrease(g.nodes()[0], 0);\n\n var init = false;\n while (pq.size() > 0) {\n v = pq.removeMin();\n if (_.has(parents, v)) {\n result.setEdge(v, parents[v]);\n } else if (init) {\n throw new Error(\"Input graph is not connected: \" + g);\n } else {\n init = true;\n }\n\n g.nodeEdges(v).forEach(updateNeighbors);\n }\n\n return result;\n}\n","module.exports = {\n components: require(\"./components\"),\n dijkstra: require(\"./dijkstra\"),\n dijkstraAll: require(\"./dijkstra-all\"),\n findCycles: require(\"./find-cycles\"),\n floydWarshall: require(\"./floyd-warshall\"),\n isAcyclic: require(\"./is-acyclic\"),\n postorder: require(\"./postorder\"),\n preorder: require(\"./preorder\"),\n prim: require(\"./prim\"),\n tarjan: require(\"./tarjan\"),\n topsort: require(\"./topsort\")\n};\n","/**\n * Copyright (c) 2014, Chris Pettitt\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * 3. Neither the name of the copyright holder nor the names of its contributors\n * may be used to endorse or promote products derived from this software without\n * specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nvar lib = require(\"./lib\");\n\nmodule.exports = {\n Graph: lib.Graph,\n json: require(\"./lib/json\"),\n alg: require(\"./lib/alg\"),\n version: lib.version\n};\n","/* global window */\n\nvar graphlib;\n\nif (typeof require === \"function\") {\n try {\n graphlib = require(\"graphlib\");\n } catch (e) {\n // continue regardless of error\n }\n}\n\nif (!graphlib) {\n graphlib = window.graphlib;\n}\n\nmodule.exports = graphlib;\n","var baseClone = require('./_baseClone');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_SYMBOLS_FLAG = 4;\n\n/**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\nfunction cloneDeep(value) {\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);\n}\n\nmodule.exports = cloneDeep;\n","var eq = require('./eq'),\n isArrayLike = require('./isArrayLike'),\n isIndex = require('./_isIndex'),\n isObject = require('./isObject');\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\nmodule.exports = isIterateeCall;\n","var baseRest = require('./_baseRest'),\n eq = require('./eq'),\n isIterateeCall = require('./_isIterateeCall'),\n keysIn = require('./keysIn');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Assigns own and inherited enumerable string keyed properties of source\n * objects to the destination object for all destination properties that\n * resolve to `undefined`. Source objects are applied from left to right.\n * Once a property is set, additional values of the same property are ignored.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaultsDeep\n * @example\n *\n * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\nvar defaults = baseRest(function(object, sources) {\n object = Object(object);\n\n var index = -1;\n var length = sources.length;\n var guard = length > 2 ? sources[2] : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n length = 1;\n }\n\n while (++index < length) {\n var source = sources[index];\n var props = keysIn(source);\n var propsIndex = -1;\n var propsLength = props.length;\n\n while (++propsIndex < propsLength) {\n var key = props[propsIndex];\n var value = object[key];\n\n if (value === undefined ||\n (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n object[key] = source[key];\n }\n }\n }\n\n return object;\n});\n\nmodule.exports = defaults;\n","var baseIteratee = require('./_baseIteratee'),\n isArrayLike = require('./isArrayLike'),\n keys = require('./keys');\n\n/**\n * Creates a `_.find` or `_.findLast` function.\n *\n * @private\n * @param {Function} findIndexFunc The function to find the collection index.\n * @returns {Function} Returns the new find function.\n */\nfunction createFind(findIndexFunc) {\n return function(collection, predicate, fromIndex) {\n var iterable = Object(collection);\n if (!isArrayLike(collection)) {\n var iteratee = baseIteratee(predicate, 3);\n collection = keys(collection);\n predicate = function(key) { return iteratee(iterable[key], key, iterable); };\n }\n var index = findIndexFunc(collection, predicate, fromIndex);\n return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;\n };\n}\n\nmodule.exports = createFind;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n","var trimmedEndIndex = require('./_trimmedEndIndex');\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n","var baseTrim = require('./_baseTrim'),\n isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n","var toNumber = require('./toNumber');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e+308;\n\n/**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\nfunction toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n}\n\nmodule.exports = toFinite;\n","var toFinite = require('./toFinite');\n\n/**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\nfunction toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n}\n\nmodule.exports = toInteger;\n","var baseFindIndex = require('./_baseFindIndex'),\n baseIteratee = require('./_baseIteratee'),\n toInteger = require('./toInteger');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * This method is like `_.find` except that it returns the index of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.findIndex(users, function(o) { return o.user == 'barney'; });\n * // => 0\n *\n * // The `_.matches` iteratee shorthand.\n * _.findIndex(users, { 'user': 'fred', 'active': false });\n * // => 1\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findIndex(users, ['active', false]);\n * // => 0\n *\n * // The `_.property` iteratee shorthand.\n * _.findIndex(users, 'active');\n * // => 2\n */\nfunction findIndex(array, predicate, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex);\n if (index < 0) {\n index = nativeMax(length + index, 0);\n }\n return baseFindIndex(array, baseIteratee(predicate, 3), index);\n}\n\nmodule.exports = findIndex;\n","var createFind = require('./_createFind'),\n findIndex = require('./findIndex');\n\n/**\n * Iterates over elements of `collection`, returning the first element\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false },\n * { 'user': 'pebbles', 'age': 1, 'active': true }\n * ];\n *\n * _.find(users, function(o) { return o.age < 40; });\n * // => object for 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.find(users, { 'age': 1, 'active': true });\n * // => object for 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.find(users, ['active', false]);\n * // => object for 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.find(users, 'active');\n * // => object for 'barney'\n */\nvar find = createFind(findIndex);\n\nmodule.exports = find;\n","var baseFlatten = require('./_baseFlatten');\n\n/**\n * Flattens `array` a single level deep.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flatten([1, [2, [3, [4]], 5]]);\n * // => [1, 2, [3, [4]], 5]\n */\nfunction flatten(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseFlatten(array, 1) : [];\n}\n\nmodule.exports = flatten;\n","var baseFor = require('./_baseFor'),\n castFunction = require('./_castFunction'),\n keysIn = require('./keysIn');\n\n/**\n * Iterates over own and inherited enumerable string keyed properties of an\n * object and invokes `iteratee` for each property. The iteratee is invoked\n * with three arguments: (value, key, object). Iteratee functions may exit\n * iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 0.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forInRight\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forIn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).\n */\nfunction forIn(object, iteratee) {\n return object == null\n ? object\n : baseFor(object, castFunction(iteratee), keysIn);\n}\n\nmodule.exports = forIn;\n","/**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\nfunction last(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n}\n\nmodule.exports = last;\n","var baseAssignValue = require('./_baseAssignValue'),\n baseForOwn = require('./_baseForOwn'),\n baseIteratee = require('./_baseIteratee');\n\n/**\n * Creates an object with the same keys as `object` and values generated\n * by running each own enumerable string keyed property of `object` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, key, object).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns the new mapped object.\n * @see _.mapKeys\n * @example\n *\n * var users = {\n * 'fred': { 'user': 'fred', 'age': 40 },\n * 'pebbles': { 'user': 'pebbles', 'age': 1 }\n * };\n *\n * _.mapValues(users, function(o) { return o.age; });\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n *\n * // The `_.property` iteratee shorthand.\n * _.mapValues(users, 'age');\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n */\nfunction mapValues(object, iteratee) {\n var result = {};\n iteratee = baseIteratee(iteratee, 3);\n\n baseForOwn(object, function(value, key, object) {\n baseAssignValue(result, key, iteratee(value, key, object));\n });\n return result;\n}\n\nmodule.exports = mapValues;\n","var isSymbol = require('./isSymbol');\n\n/**\n * The base implementation of methods like `_.max` and `_.min` which accepts a\n * `comparator` to determine the extremum value.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The iteratee invoked per iteration.\n * @param {Function} comparator The comparator used to compare values.\n * @returns {*} Returns the extremum value.\n */\nfunction baseExtremum(array, iteratee, comparator) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n var value = array[index],\n current = iteratee(value);\n\n if (current != null && (computed === undefined\n ? (current === current && !isSymbol(current))\n : comparator(current, computed)\n )) {\n var computed = current,\n result = value;\n }\n }\n return result;\n}\n\nmodule.exports = baseExtremum;\n","/**\n * The base implementation of `_.gt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than `other`,\n * else `false`.\n */\nfunction baseGt(value, other) {\n return value > other;\n}\n\nmodule.exports = baseGt;\n","var baseExtremum = require('./_baseExtremum'),\n baseGt = require('./_baseGt'),\n identity = require('./identity');\n\n/**\n * Computes the maximum value of `array`. If `array` is empty or falsey,\n * `undefined` is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {*} Returns the maximum value.\n * @example\n *\n * _.max([4, 2, 8, 6]);\n * // => 8\n *\n * _.max([]);\n * // => undefined\n */\nfunction max(array) {\n return (array && array.length)\n ? baseExtremum(array, identity, baseGt)\n : undefined;\n}\n\nmodule.exports = max;\n","var baseAssignValue = require('./_baseAssignValue'),\n eq = require('./eq');\n\n/**\n * This function is like `assignValue` except that it doesn't assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignMergeValue(object, key, value) {\n if ((value !== undefined && !eq(object[key], value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\nmodule.exports = assignMergeValue;\n","var baseGetTag = require('./_baseGetTag'),\n getPrototype = require('./_getPrototype'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nmodule.exports = isPlainObject;\n","/**\n * Gets the value at `key`, unless `key` is \"__proto__\" or \"constructor\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction safeGet(object, key) {\n if (key === 'constructor' && typeof object[key] === 'function') {\n return;\n }\n\n if (key == '__proto__') {\n return;\n }\n\n return object[key];\n}\n\nmodule.exports = safeGet;\n","var copyObject = require('./_copyObject'),\n keysIn = require('./keysIn');\n\n/**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\nfunction toPlainObject(value) {\n return copyObject(value, keysIn(value));\n}\n\nmodule.exports = toPlainObject;\n","var assignMergeValue = require('./_assignMergeValue'),\n cloneBuffer = require('./_cloneBuffer'),\n cloneTypedArray = require('./_cloneTypedArray'),\n copyArray = require('./_copyArray'),\n initCloneObject = require('./_initCloneObject'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray'),\n isArrayLikeObject = require('./isArrayLikeObject'),\n isBuffer = require('./isBuffer'),\n isFunction = require('./isFunction'),\n isObject = require('./isObject'),\n isPlainObject = require('./isPlainObject'),\n isTypedArray = require('./isTypedArray'),\n safeGet = require('./_safeGet'),\n toPlainObject = require('./toPlainObject');\n\n/**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n var objValue = safeGet(object, key),\n srcValue = safeGet(source, key),\n stacked = stack.get(srcValue);\n\n if (stacked) {\n assignMergeValue(object, key, stacked);\n return;\n }\n var newValue = customizer\n ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n : undefined;\n\n var isCommon = newValue === undefined;\n\n if (isCommon) {\n var isArr = isArray(srcValue),\n isBuff = !isArr && isBuffer(srcValue),\n isTyped = !isArr && !isBuff && isTypedArray(srcValue);\n\n newValue = srcValue;\n if (isArr || isBuff || isTyped) {\n if (isArray(objValue)) {\n newValue = objValue;\n }\n else if (isArrayLikeObject(objValue)) {\n newValue = copyArray(objValue);\n }\n else if (isBuff) {\n isCommon = false;\n newValue = cloneBuffer(srcValue, true);\n }\n else if (isTyped) {\n isCommon = false;\n newValue = cloneTypedArray(srcValue, true);\n }\n else {\n newValue = [];\n }\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n newValue = objValue;\n if (isArguments(objValue)) {\n newValue = toPlainObject(objValue);\n }\n else if (!isObject(objValue) || isFunction(objValue)) {\n newValue = initCloneObject(srcValue);\n }\n }\n else {\n isCommon = false;\n }\n }\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, newValue);\n mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n stack['delete'](srcValue);\n }\n assignMergeValue(object, key, newValue);\n}\n\nmodule.exports = baseMergeDeep;\n","var Stack = require('./_Stack'),\n assignMergeValue = require('./_assignMergeValue'),\n baseFor = require('./_baseFor'),\n baseMergeDeep = require('./_baseMergeDeep'),\n isObject = require('./isObject'),\n keysIn = require('./keysIn'),\n safeGet = require('./_safeGet');\n\n/**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMerge(object, source, srcIndex, customizer, stack) {\n if (object === source) {\n return;\n }\n baseFor(source, function(srcValue, key) {\n stack || (stack = new Stack);\n if (isObject(srcValue)) {\n baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n }\n else {\n var newValue = customizer\n ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)\n : undefined;\n\n if (newValue === undefined) {\n newValue = srcValue;\n }\n assignMergeValue(object, key, newValue);\n }\n }, keysIn);\n}\n\nmodule.exports = baseMerge;\n","var baseRest = require('./_baseRest'),\n isIterateeCall = require('./_isIterateeCall');\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\nmodule.exports = createAssigner;\n","var baseMerge = require('./_baseMerge'),\n createAssigner = require('./_createAssigner');\n\n/**\n * This method is like `_.assign` except that it recursively merges own and\n * inherited enumerable string keyed properties of source objects into the\n * destination object. Source properties that resolve to `undefined` are\n * skipped if a destination value exists. Array and plain object properties\n * are merged recursively. Other objects and value types are overridden by\n * assignment. Source objects are applied from left to right. Subsequent\n * sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {\n * 'a': [{ 'b': 2 }, { 'd': 4 }]\n * };\n *\n * var other = {\n * 'a': [{ 'c': 3 }, { 'e': 5 }]\n * };\n *\n * _.merge(object, other);\n * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }\n */\nvar merge = createAssigner(function(object, source, srcIndex) {\n baseMerge(object, source, srcIndex);\n});\n\nmodule.exports = merge;\n","/**\n * The base implementation of `_.lt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`,\n * else `false`.\n */\nfunction baseLt(value, other) {\n return value < other;\n}\n\nmodule.exports = baseLt;\n","var baseExtremum = require('./_baseExtremum'),\n baseLt = require('./_baseLt'),\n identity = require('./identity');\n\n/**\n * Computes the minimum value of `array`. If `array` is empty or falsey,\n * `undefined` is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {*} Returns the minimum value.\n * @example\n *\n * _.min([4, 2, 8, 6]);\n * // => 2\n *\n * _.min([]);\n * // => undefined\n */\nfunction min(array) {\n return (array && array.length)\n ? baseExtremum(array, identity, baseLt)\n : undefined;\n}\n\nmodule.exports = min;\n","var baseExtremum = require('./_baseExtremum'),\n baseIteratee = require('./_baseIteratee'),\n baseLt = require('./_baseLt');\n\n/**\n * This method is like `_.min` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * the value is ranked. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Math\n * @param {Array} array The array to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {*} Returns the minimum value.\n * @example\n *\n * var objects = [{ 'n': 1 }, { 'n': 2 }];\n *\n * _.minBy(objects, function(o) { return o.n; });\n * // => { 'n': 1 }\n *\n * // The `_.property` iteratee shorthand.\n * _.minBy(objects, 'n');\n * // => { 'n': 1 }\n */\nfunction minBy(array, iteratee) {\n return (array && array.length)\n ? baseExtremum(array, baseIteratee(iteratee, 2), baseLt)\n : undefined;\n}\n\nmodule.exports = minBy;\n","var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n","var assignValue = require('./_assignValue'),\n castPath = require('./_castPath'),\n isIndex = require('./_isIndex'),\n isObject = require('./isObject'),\n toKey = require('./_toKey');\n\n/**\n * The base implementation of `_.set`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\nfunction baseSet(object, path, value, customizer) {\n if (!isObject(object)) {\n return object;\n }\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object;\n\n while (nested != null && ++index < length) {\n var key = toKey(path[index]),\n newValue = value;\n\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n return object;\n }\n\n if (index != lastIndex) {\n var objValue = nested[key];\n newValue = customizer ? customizer(objValue, key, nested) : undefined;\n if (newValue === undefined) {\n newValue = isObject(objValue)\n ? objValue\n : (isIndex(path[index + 1]) ? [] : {});\n }\n }\n assignValue(nested, key, newValue);\n nested = nested[key];\n }\n return object;\n}\n\nmodule.exports = baseSet;\n","var baseGet = require('./_baseGet'),\n baseSet = require('./_baseSet'),\n castPath = require('./_castPath');\n\n/**\n * The base implementation of `_.pickBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @param {Function} predicate The function invoked per property.\n * @returns {Object} Returns the new object.\n */\nfunction basePickBy(object, paths, predicate) {\n var index = -1,\n length = paths.length,\n result = {};\n\n while (++index < length) {\n var path = paths[index],\n value = baseGet(object, path);\n\n if (predicate(value, path)) {\n baseSet(result, castPath(path, object), value);\n }\n }\n return result;\n}\n\nmodule.exports = basePickBy;\n","var basePickBy = require('./_basePickBy'),\n hasIn = require('./hasIn');\n\n/**\n * The base implementation of `_.pick` without support for individual\n * property identifiers.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @returns {Object} Returns the new object.\n */\nfunction basePick(object, paths) {\n return basePickBy(object, paths, function(value, path) {\n return hasIn(object, path);\n });\n}\n\nmodule.exports = basePick;\n","var flatten = require('./flatten'),\n overRest = require('./_overRest'),\n setToString = require('./_setToString');\n\n/**\n * A specialized version of `baseRest` which flattens the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @returns {Function} Returns the new function.\n */\nfunction flatRest(func) {\n return setToString(overRest(func, undefined, flatten), func + '');\n}\n\nmodule.exports = flatRest;\n","var basePick = require('./_basePick'),\n flatRest = require('./_flatRest');\n\n/**\n * Creates an object composed of the picked `object` properties.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pick(object, ['a', 'c']);\n * // => { 'a': 1, 'c': 3 }\n */\nvar pick = flatRest(function(object, paths) {\n return object == null ? {} : basePick(object, paths);\n});\n\nmodule.exports = pick;\n","/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeCeil = Math.ceil,\n nativeMax = Math.max;\n\n/**\n * The base implementation of `_.range` and `_.rangeRight` which doesn't\n * coerce arguments.\n *\n * @private\n * @param {number} start The start of the range.\n * @param {number} end The end of the range.\n * @param {number} step The value to increment or decrement by.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the range of numbers.\n */\nfunction baseRange(start, end, step, fromRight) {\n var index = -1,\n length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),\n result = Array(length);\n\n while (length--) {\n result[fromRight ? length : ++index] = start;\n start += step;\n }\n return result;\n}\n\nmodule.exports = baseRange;\n","var baseRange = require('./_baseRange'),\n isIterateeCall = require('./_isIterateeCall'),\n toFinite = require('./toFinite');\n\n/**\n * Creates a `_.range` or `_.rangeRight` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new range function.\n */\nfunction createRange(fromRight) {\n return function(start, end, step) {\n if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {\n end = step = undefined;\n }\n // Ensure the sign of `-0` is preserved.\n start = toFinite(start);\n if (end === undefined) {\n end = start;\n start = 0;\n } else {\n end = toFinite(end);\n }\n step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);\n return baseRange(start, end, step, fromRight);\n };\n}\n\nmodule.exports = createRange;\n","var createRange = require('./_createRange');\n\n/**\n * Creates an array of numbers (positive and/or negative) progressing from\n * `start` up to, but not including, `end`. A step of `-1` is used if a negative\n * `start` is specified without an `end` or `step`. If `end` is not specified,\n * it's set to `start` with `start` then set to `0`.\n *\n * **Note:** JavaScript follows the IEEE-754 standard for resolving\n * floating-point values which can produce unexpected results.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {number} [start=0] The start of the range.\n * @param {number} end The end of the range.\n * @param {number} [step=1] The value to increment or decrement by.\n * @returns {Array} Returns the range of numbers.\n * @see _.inRange, _.rangeRight\n * @example\n *\n * _.range(4);\n * // => [0, 1, 2, 3]\n *\n * _.range(-4);\n * // => [0, -1, -2, -3]\n *\n * _.range(1, 5);\n * // => [1, 2, 3, 4]\n *\n * _.range(0, 20, 5);\n * // => [0, 5, 10, 15]\n *\n * _.range(0, -4, -1);\n * // => [0, -1, -2, -3]\n *\n * _.range(1, 4, 0);\n * // => [1, 1, 1]\n *\n * _.range(0);\n * // => []\n */\nvar range = createRange();\n\nmodule.exports = range;\n","/**\n * The base implementation of `_.sortBy` which uses `comparer` to define the\n * sort order of `array` and replaces criteria objects with their corresponding\n * values.\n *\n * @private\n * @param {Array} array The array to sort.\n * @param {Function} comparer The function to define sort order.\n * @returns {Array} Returns `array`.\n */\nfunction baseSortBy(array, comparer) {\n var length = array.length;\n\n array.sort(comparer);\n while (length--) {\n array[length] = array[length].value;\n }\n return array;\n}\n\nmodule.exports = baseSortBy;\n","var isSymbol = require('./isSymbol');\n\n/**\n * Compares values to sort them in ascending order.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {number} Returns the sort order indicator for `value`.\n */\nfunction compareAscending(value, other) {\n if (value !== other) {\n var valIsDefined = value !== undefined,\n valIsNull = value === null,\n valIsReflexive = value === value,\n valIsSymbol = isSymbol(value);\n\n var othIsDefined = other !== undefined,\n othIsNull = other === null,\n othIsReflexive = other === other,\n othIsSymbol = isSymbol(other);\n\n if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||\n (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||\n (valIsNull && othIsDefined && othIsReflexive) ||\n (!valIsDefined && othIsReflexive) ||\n !valIsReflexive) {\n return 1;\n }\n if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||\n (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||\n (othIsNull && valIsDefined && valIsReflexive) ||\n (!othIsDefined && valIsReflexive) ||\n !othIsReflexive) {\n return -1;\n }\n }\n return 0;\n}\n\nmodule.exports = compareAscending;\n","var compareAscending = require('./_compareAscending');\n\n/**\n * Used by `_.orderBy` to compare multiple properties of a value to another\n * and stable sort them.\n *\n * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,\n * specify an order of \"desc\" for descending or \"asc\" for ascending sort order\n * of corresponding values.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {boolean[]|string[]} orders The order to sort by for each property.\n * @returns {number} Returns the sort order indicator for `object`.\n */\nfunction compareMultiple(object, other, orders) {\n var index = -1,\n objCriteria = object.criteria,\n othCriteria = other.criteria,\n length = objCriteria.length,\n ordersLength = orders.length;\n\n while (++index < length) {\n var result = compareAscending(objCriteria[index], othCriteria[index]);\n if (result) {\n if (index >= ordersLength) {\n return result;\n }\n var order = orders[index];\n return result * (order == 'desc' ? -1 : 1);\n }\n }\n // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications\n // that causes it, under certain circumstances, to provide the same value for\n // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247\n // for more details.\n //\n // This also ensures a stable sort in V8 and other engines.\n // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.\n return object.index - other.index;\n}\n\nmodule.exports = compareMultiple;\n","var arrayMap = require('./_arrayMap'),\n baseGet = require('./_baseGet'),\n baseIteratee = require('./_baseIteratee'),\n baseMap = require('./_baseMap'),\n baseSortBy = require('./_baseSortBy'),\n baseUnary = require('./_baseUnary'),\n compareMultiple = require('./_compareMultiple'),\n identity = require('./identity'),\n isArray = require('./isArray');\n\n/**\n * The base implementation of `_.orderBy` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.\n * @param {string[]} orders The sort orders of `iteratees`.\n * @returns {Array} Returns the new sorted array.\n */\nfunction baseOrderBy(collection, iteratees, orders) {\n if (iteratees.length) {\n iteratees = arrayMap(iteratees, function(iteratee) {\n if (isArray(iteratee)) {\n return function(value) {\n return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);\n }\n }\n return iteratee;\n });\n } else {\n iteratees = [identity];\n }\n\n var index = -1;\n iteratees = arrayMap(iteratees, baseUnary(baseIteratee));\n\n var result = baseMap(collection, function(value, key, collection) {\n var criteria = arrayMap(iteratees, function(iteratee) {\n return iteratee(value);\n });\n return { 'criteria': criteria, 'index': ++index, 'value': value };\n });\n\n return baseSortBy(result, function(object, other) {\n return compareMultiple(object, other, orders);\n });\n}\n\nmodule.exports = baseOrderBy;\n","var baseFlatten = require('./_baseFlatten'),\n baseOrderBy = require('./_baseOrderBy'),\n baseRest = require('./_baseRest'),\n isIterateeCall = require('./_isIterateeCall');\n\n/**\n * Creates an array of elements, sorted in ascending order by the results of\n * running each element in a collection thru each iteratee. This method\n * performs a stable sort, that is, it preserves the original sort order of\n * equal elements. The iteratees are invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {...(Function|Function[])} [iteratees=[_.identity]]\n * The iteratees to sort by.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 30 },\n * { 'user': 'barney', 'age': 34 }\n * ];\n *\n * _.sortBy(users, [function(o) { return o.user; }]);\n * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]\n *\n * _.sortBy(users, ['user', 'age']);\n * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]\n */\nvar sortBy = baseRest(function(collection, iteratees) {\n if (collection == null) {\n return [];\n }\n var length = iteratees.length;\n if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {\n iteratees = [];\n } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {\n iteratees = [iteratees[0]];\n }\n return baseOrderBy(collection, baseFlatten(iteratees, 1), []);\n});\n\nmodule.exports = sortBy;\n","var toString = require('./toString');\n\n/** Used to generate unique IDs. */\nvar idCounter = 0;\n\n/**\n * Generates a unique ID. If `prefix` is given, the ID is appended to it.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {string} [prefix=''] The value to prefix the ID with.\n * @returns {string} Returns the unique ID.\n * @example\n *\n * _.uniqueId('contact_');\n * // => 'contact_104'\n *\n * _.uniqueId();\n * // => '105'\n */\nfunction uniqueId(prefix) {\n var id = ++idCounter;\n return toString(prefix) + id;\n}\n\nmodule.exports = uniqueId;\n","/**\n * This base implementation of `_.zipObject` which assigns values using `assignFunc`.\n *\n * @private\n * @param {Array} props The property identifiers.\n * @param {Array} values The property values.\n * @param {Function} assignFunc The function to assign values.\n * @returns {Object} Returns the new object.\n */\nfunction baseZipObject(props, values, assignFunc) {\n var index = -1,\n length = props.length,\n valsLength = values.length,\n result = {};\n\n while (++index < length) {\n var value = index < valsLength ? values[index] : undefined;\n assignFunc(result, props[index], value);\n }\n return result;\n}\n\nmodule.exports = baseZipObject;\n","var assignValue = require('./_assignValue'),\n baseZipObject = require('./_baseZipObject');\n\n/**\n * This method is like `_.fromPairs` except that it accepts two arrays,\n * one of property identifiers and one of corresponding values.\n *\n * @static\n * @memberOf _\n * @since 0.4.0\n * @category Array\n * @param {Array} [props=[]] The property identifiers.\n * @param {Array} [values=[]] The property values.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.zipObject(['a', 'b'], [1, 2]);\n * // => { 'a': 1, 'b': 2 }\n */\nfunction zipObject(props, values) {\n return baseZipObject(props || [], values || [], assignValue);\n}\n\nmodule.exports = zipObject;\n","/* global window */\n\nvar lodash;\n\nif (typeof require === \"function\") {\n try {\n lodash = {\n cloneDeep: require(\"lodash/cloneDeep\"),\n constant: require(\"lodash/constant\"),\n defaults: require(\"lodash/defaults\"),\n each: require(\"lodash/each\"),\n filter: require(\"lodash/filter\"),\n find: require(\"lodash/find\"),\n flatten: require(\"lodash/flatten\"),\n forEach: require(\"lodash/forEach\"),\n forIn: require(\"lodash/forIn\"),\n has: require(\"lodash/has\"),\n isUndefined: require(\"lodash/isUndefined\"),\n last: require(\"lodash/last\"),\n map: require(\"lodash/map\"),\n mapValues: require(\"lodash/mapValues\"),\n max: require(\"lodash/max\"),\n merge: require(\"lodash/merge\"),\n min: require(\"lodash/min\"),\n minBy: require(\"lodash/minBy\"),\n now: require(\"lodash/now\"),\n pick: require(\"lodash/pick\"),\n range: require(\"lodash/range\"),\n reduce: require(\"lodash/reduce\"),\n sortBy: require(\"lodash/sortBy\"),\n uniqueId: require(\"lodash/uniqueId\"),\n values: require(\"lodash/values\"),\n zipObject: require(\"lodash/zipObject\"),\n };\n } catch (e) {\n // continue regardless of error\n }\n}\n\nif (!lodash) {\n lodash = window._;\n}\n\nmodule.exports = lodash;\n","/*\n * Simple doubly linked list implementation derived from Cormen, et al.,\n * \"Introduction to Algorithms\".\n */\n\nmodule.exports = List;\n\nfunction List() {\n var sentinel = {};\n sentinel._next = sentinel._prev = sentinel;\n this._sentinel = sentinel;\n}\n\nList.prototype.dequeue = function() {\n var sentinel = this._sentinel;\n var entry = sentinel._prev;\n if (entry !== sentinel) {\n unlink(entry);\n return entry;\n }\n};\n\nList.prototype.enqueue = function(entry) {\n var sentinel = this._sentinel;\n if (entry._prev && entry._next) {\n unlink(entry);\n }\n entry._next = sentinel._next;\n sentinel._next._prev = entry;\n sentinel._next = entry;\n entry._prev = sentinel;\n};\n\nList.prototype.toString = function() {\n var strs = [];\n var sentinel = this._sentinel;\n var curr = sentinel._prev;\n while (curr !== sentinel) {\n strs.push(JSON.stringify(curr, filterOutLinks));\n curr = curr._prev;\n }\n return \"[\" + strs.join(\", \") + \"]\";\n};\n\nfunction unlink(entry) {\n entry._prev._next = entry._next;\n entry._next._prev = entry._prev;\n delete entry._next;\n delete entry._prev;\n}\n\nfunction filterOutLinks(k, v) {\n if (k !== \"_next\" && k !== \"_prev\") {\n return v;\n }\n}\n","var _ = require(\"./lodash\");\nvar Graph = require(\"./graphlib\").Graph;\nvar List = require(\"./data/list\");\n\n/*\n * A greedy heuristic for finding a feedback arc set for a graph. A feedback\n * arc set is a set of edges that can be removed to make a graph acyclic.\n * The algorithm comes from: P. Eades, X. Lin, and W. F. Smyth, \"A fast and\n * effective heuristic for the feedback arc set problem.\" This implementation\n * adjusts that from the paper to allow for weighted edges.\n */\nmodule.exports = greedyFAS;\n\nvar DEFAULT_WEIGHT_FN = _.constant(1);\n\nfunction greedyFAS(g, weightFn) {\n if (g.nodeCount() <= 1) {\n return [];\n }\n var state = buildState(g, weightFn || DEFAULT_WEIGHT_FN);\n var results = doGreedyFAS(state.graph, state.buckets, state.zeroIdx);\n\n // Expand multi-edges\n return _.flatten(_.map(results, function(e) {\n return g.outEdges(e.v, e.w);\n }), true);\n}\n\nfunction doGreedyFAS(g, buckets, zeroIdx) {\n var results = [];\n var sources = buckets[buckets.length - 1];\n var sinks = buckets[0];\n\n var entry;\n while (g.nodeCount()) {\n while ((entry = sinks.dequeue())) { removeNode(g, buckets, zeroIdx, entry); }\n while ((entry = sources.dequeue())) { removeNode(g, buckets, zeroIdx, entry); }\n if (g.nodeCount()) {\n for (var i = buckets.length - 2; i > 0; --i) {\n entry = buckets[i].dequeue();\n if (entry) {\n results = results.concat(removeNode(g, buckets, zeroIdx, entry, true));\n break;\n }\n }\n }\n }\n\n return results;\n}\n\nfunction removeNode(g, buckets, zeroIdx, entry, collectPredecessors) {\n var results = collectPredecessors ? [] : undefined;\n\n _.forEach(g.inEdges(entry.v), function(edge) {\n var weight = g.edge(edge);\n var uEntry = g.node(edge.v);\n\n if (collectPredecessors) {\n results.push({ v: edge.v, w: edge.w });\n }\n\n uEntry.out -= weight;\n assignBucket(buckets, zeroIdx, uEntry);\n });\n\n _.forEach(g.outEdges(entry.v), function(edge) {\n var weight = g.edge(edge);\n var w = edge.w;\n var wEntry = g.node(w);\n wEntry[\"in\"] -= weight;\n assignBucket(buckets, zeroIdx, wEntry);\n });\n\n g.removeNode(entry.v);\n\n return results;\n}\n\nfunction buildState(g, weightFn) {\n var fasGraph = new Graph();\n var maxIn = 0;\n var maxOut = 0;\n\n _.forEach(g.nodes(), function(v) {\n fasGraph.setNode(v, { v: v, \"in\": 0, out: 0 });\n });\n\n // Aggregate weights on nodes, but also sum the weights across multi-edges\n // into a single edge for the fasGraph.\n _.forEach(g.edges(), function(e) {\n var prevWeight = fasGraph.edge(e.v, e.w) || 0;\n var weight = weightFn(e);\n var edgeWeight = prevWeight + weight;\n fasGraph.setEdge(e.v, e.w, edgeWeight);\n maxOut = Math.max(maxOut, fasGraph.node(e.v).out += weight);\n maxIn = Math.max(maxIn, fasGraph.node(e.w)[\"in\"] += weight);\n });\n\n var buckets = _.range(maxOut + maxIn + 3).map(function() { return new List(); });\n var zeroIdx = maxIn + 1;\n\n _.forEach(fasGraph.nodes(), function(v) {\n assignBucket(buckets, zeroIdx, fasGraph.node(v));\n });\n\n return { graph: fasGraph, buckets: buckets, zeroIdx: zeroIdx };\n}\n\nfunction assignBucket(buckets, zeroIdx, entry) {\n if (!entry.out) {\n buckets[0].enqueue(entry);\n } else if (!entry[\"in\"]) {\n buckets[buckets.length - 1].enqueue(entry);\n } else {\n buckets[entry.out - entry[\"in\"] + zeroIdx].enqueue(entry);\n }\n}\n","\"use strict\";\n\nvar _ = require(\"./lodash\");\nvar greedyFAS = require(\"./greedy-fas\");\n\nmodule.exports = {\n run: run,\n undo: undo\n};\n\nfunction run(g) {\n var fas = (g.graph().acyclicer === \"greedy\"\n ? greedyFAS(g, weightFn(g))\n : dfsFAS(g));\n _.forEach(fas, function(e) {\n var label = g.edge(e);\n g.removeEdge(e);\n label.forwardName = e.name;\n label.reversed = true;\n g.setEdge(e.w, e.v, label, _.uniqueId(\"rev\"));\n });\n\n function weightFn(g) {\n return function(e) {\n return g.edge(e).weight;\n };\n }\n}\n\nfunction dfsFAS(g) {\n var fas = [];\n var stack = {};\n var visited = {};\n\n function dfs(v) {\n if (_.has(visited, v)) {\n return;\n }\n visited[v] = true;\n stack[v] = true;\n _.forEach(g.outEdges(v), function(e) {\n if (_.has(stack, e.w)) {\n fas.push(e);\n } else {\n dfs(e.w);\n }\n });\n delete stack[v];\n }\n\n _.forEach(g.nodes(), dfs);\n return fas;\n}\n\nfunction undo(g) {\n _.forEach(g.edges(), function(e) {\n var label = g.edge(e);\n if (label.reversed) {\n g.removeEdge(e);\n\n var forwardName = label.forwardName;\n delete label.reversed;\n delete label.forwardName;\n g.setEdge(e.w, e.v, label, forwardName);\n }\n });\n}\n","/* eslint \"no-console\": off */\n\n\"use strict\";\n\nvar _ = require(\"./lodash\");\nvar Graph = require(\"./graphlib\").Graph;\n\nmodule.exports = {\n addDummyNode: addDummyNode,\n simplify: simplify,\n asNonCompoundGraph: asNonCompoundGraph,\n successorWeights: successorWeights,\n predecessorWeights: predecessorWeights,\n intersectRect: intersectRect,\n buildLayerMatrix: buildLayerMatrix,\n normalizeRanks: normalizeRanks,\n removeEmptyRanks: removeEmptyRanks,\n addBorderNode: addBorderNode,\n maxRank: maxRank,\n partition: partition,\n time: time,\n notime: notime\n};\n\n/*\n * Adds a dummy node to the graph and return v.\n */\nfunction addDummyNode(g, type, attrs, name) {\n var v;\n do {\n v = _.uniqueId(name);\n } while (g.hasNode(v));\n\n attrs.dummy = type;\n g.setNode(v, attrs);\n return v;\n}\n\n/*\n * Returns a new graph with only simple edges. Handles aggregation of data\n * associated with multi-edges.\n */\nfunction simplify(g) {\n var simplified = new Graph().setGraph(g.graph());\n _.forEach(g.nodes(), function(v) { simplified.setNode(v, g.node(v)); });\n _.forEach(g.edges(), function(e) {\n var simpleLabel = simplified.edge(e.v, e.w) || { weight: 0, minlen: 1 };\n var label = g.edge(e);\n simplified.setEdge(e.v, e.w, {\n weight: simpleLabel.weight + label.weight,\n minlen: Math.max(simpleLabel.minlen, label.minlen)\n });\n });\n return simplified;\n}\n\nfunction asNonCompoundGraph(g) {\n var simplified = new Graph({ multigraph: g.isMultigraph() }).setGraph(g.graph());\n _.forEach(g.nodes(), function(v) {\n if (!g.children(v).length) {\n simplified.setNode(v, g.node(v));\n }\n });\n _.forEach(g.edges(), function(e) {\n simplified.setEdge(e, g.edge(e));\n });\n return simplified;\n}\n\nfunction successorWeights(g) {\n var weightMap = _.map(g.nodes(), function(v) {\n var sucs = {};\n _.forEach(g.outEdges(v), function(e) {\n sucs[e.w] = (sucs[e.w] || 0) + g.edge(e).weight;\n });\n return sucs;\n });\n return _.zipObject(g.nodes(), weightMap);\n}\n\nfunction predecessorWeights(g) {\n var weightMap = _.map(g.nodes(), function(v) {\n var preds = {};\n _.forEach(g.inEdges(v), function(e) {\n preds[e.v] = (preds[e.v] || 0) + g.edge(e).weight;\n });\n return preds;\n });\n return _.zipObject(g.nodes(), weightMap);\n}\n\n/*\n * Finds where a line starting at point ({x, y}) would intersect a rectangle\n * ({x, y, width, height}) if it were pointing at the rectangle's center.\n */\nfunction intersectRect(rect, point) {\n var x = rect.x;\n var y = rect.y;\n\n // Rectangle intersection algorithm from:\n // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes\n var dx = point.x - x;\n var dy = point.y - y;\n var w = rect.width / 2;\n var h = rect.height / 2;\n\n if (!dx && !dy) {\n throw new Error(\"Not possible to find intersection inside of the rectangle\");\n }\n\n var sx, sy;\n if (Math.abs(dy) * w > Math.abs(dx) * h) {\n // Intersection is top or bottom of rect.\n if (dy < 0) {\n h = -h;\n }\n sx = h * dx / dy;\n sy = h;\n } else {\n // Intersection is left or right of rect.\n if (dx < 0) {\n w = -w;\n }\n sx = w;\n sy = w * dy / dx;\n }\n\n return { x: x + sx, y: y + sy };\n}\n\n/*\n * Given a DAG with each node assigned \"rank\" and \"order\" properties, this\n * function will produce a matrix with the ids of each node.\n */\nfunction buildLayerMatrix(g) {\n var layering = _.map(_.range(maxRank(g) + 1), function() { return []; });\n _.forEach(g.nodes(), function(v) {\n var node = g.node(v);\n var rank = node.rank;\n if (!_.isUndefined(rank)) {\n layering[rank][node.order] = v;\n }\n });\n return layering;\n}\n\n/*\n * Adjusts the ranks for all nodes in the graph such that all nodes v have\n * rank(v) >= 0 and at least one node w has rank(w) = 0.\n */\nfunction normalizeRanks(g) {\n var min = _.min(_.map(g.nodes(), function(v) { return g.node(v).rank; }));\n _.forEach(g.nodes(), function(v) {\n var node = g.node(v);\n if (_.has(node, \"rank\")) {\n node.rank -= min;\n }\n });\n}\n\nfunction removeEmptyRanks(g) {\n // Ranks may not start at 0, so we need to offset them\n var offset = _.min(_.map(g.nodes(), function(v) { return g.node(v).rank; }));\n\n var layers = [];\n _.forEach(g.nodes(), function(v) {\n var rank = g.node(v).rank - offset;\n if (!layers[rank]) {\n layers[rank] = [];\n }\n layers[rank].push(v);\n });\n\n var delta = 0;\n var nodeRankFactor = g.graph().nodeRankFactor;\n _.forEach(layers, function(vs, i) {\n if (_.isUndefined(vs) && i % nodeRankFactor !== 0) {\n --delta;\n } else if (delta) {\n _.forEach(vs, function(v) { g.node(v).rank += delta; });\n }\n });\n}\n\nfunction addBorderNode(g, prefix, rank, order) {\n var node = {\n width: 0,\n height: 0\n };\n if (arguments.length >= 4) {\n node.rank = rank;\n node.order = order;\n }\n return addDummyNode(g, \"border\", node, prefix);\n}\n\nfunction maxRank(g) {\n return _.max(_.map(g.nodes(), function(v) {\n var rank = g.node(v).rank;\n if (!_.isUndefined(rank)) {\n return rank;\n }\n }));\n}\n\n/*\n * Partition a collection into two groups: `lhs` and `rhs`. If the supplied\n * function returns true for an entry it goes into `lhs`. Otherwise it goes\n * into `rhs.\n */\nfunction partition(collection, fn) {\n var result = { lhs: [], rhs: [] };\n _.forEach(collection, function(value) {\n if (fn(value)) {\n result.lhs.push(value);\n } else {\n result.rhs.push(value);\n }\n });\n return result;\n}\n\n/*\n * Returns a new function that wraps `fn` with a timer. The wrapper logs the\n * time it takes to execute the function.\n */\nfunction time(name, fn) {\n var start = _.now();\n try {\n return fn();\n } finally {\n console.log(name + \" time: \" + (_.now() - start) + \"ms\");\n }\n}\n\nfunction notime(name, fn) {\n return fn();\n}\n","\"use strict\";\n\nvar _ = require(\"./lodash\");\nvar util = require(\"./util\");\n\nmodule.exports = {\n run: run,\n undo: undo\n};\n\n/*\n * Breaks any long edges in the graph into short segments that span 1 layer\n * each. This operation is undoable with the denormalize function.\n *\n * Pre-conditions:\n *\n * 1. The input graph is a DAG.\n * 2. Each node in the graph has a \"rank\" property.\n *\n * Post-condition:\n *\n * 1. All edges in the graph have a length of 1.\n * 2. Dummy nodes are added where edges have been split into segments.\n * 3. The graph is augmented with a \"dummyChains\" attribute which contains\n * the first dummy in each chain of dummy nodes produced.\n */\nfunction run(g) {\n g.graph().dummyChains = [];\n _.forEach(g.edges(), function(edge) { normalizeEdge(g, edge); });\n}\n\nfunction normalizeEdge(g, e) {\n var v = e.v;\n var vRank = g.node(v).rank;\n var w = e.w;\n var wRank = g.node(w).rank;\n var name = e.name;\n var edgeLabel = g.edge(e);\n var labelRank = edgeLabel.labelRank;\n\n if (wRank === vRank + 1) return;\n\n g.removeEdge(e);\n\n var dummy, attrs, i;\n for (i = 0, ++vRank; vRank < wRank; ++i, ++vRank) {\n edgeLabel.points = [];\n attrs = {\n width: 0, height: 0,\n edgeLabel: edgeLabel, edgeObj: e,\n rank: vRank\n };\n dummy = util.addDummyNode(g, \"edge\", attrs, \"_d\");\n if (vRank === labelRank) {\n attrs.width = edgeLabel.width;\n attrs.height = edgeLabel.height;\n attrs.dummy = \"edge-label\";\n attrs.labelpos = edgeLabel.labelpos;\n }\n g.setEdge(v, dummy, { weight: edgeLabel.weight }, name);\n if (i === 0) {\n g.graph().dummyChains.push(dummy);\n }\n v = dummy;\n }\n\n g.setEdge(v, w, { weight: edgeLabel.weight }, name);\n}\n\nfunction undo(g) {\n _.forEach(g.graph().dummyChains, function(v) {\n var node = g.node(v);\n var origLabel = node.edgeLabel;\n var w;\n g.setEdge(node.edgeObj, origLabel);\n while (node.dummy) {\n w = g.successors(v)[0];\n g.removeNode(v);\n origLabel.points.push({ x: node.x, y: node.y });\n if (node.dummy === \"edge-label\") {\n origLabel.x = node.x;\n origLabel.y = node.y;\n origLabel.width = node.width;\n origLabel.height = node.height;\n }\n v = w;\n node = g.node(v);\n }\n });\n}\n","\"use strict\";\n\nvar _ = require(\"../lodash\");\n\nmodule.exports = {\n longestPath: longestPath,\n slack: slack\n};\n\n/*\n * Initializes ranks for the input graph using the longest path algorithm. This\n * algorithm scales well and is fast in practice, it yields rather poor\n * solutions. Nodes are pushed to the lowest layer possible, leaving the bottom\n * ranks wide and leaving edges longer than necessary. However, due to its\n * speed, this algorithm is good for getting an initial ranking that can be fed\n * into other algorithms.\n *\n * This algorithm does not normalize layers because it will be used by other\n * algorithms in most cases. If using this algorithm directly, be sure to\n * run normalize at the end.\n *\n * Pre-conditions:\n *\n * 1. Input graph is a DAG.\n * 2. Input graph node labels can be assigned properties.\n *\n * Post-conditions:\n *\n * 1. Each node will be assign an (unnormalized) \"rank\" property.\n */\nfunction longestPath(g) {\n var visited = {};\n\n function dfs(v) {\n var label = g.node(v);\n if (_.has(visited, v)) {\n return label.rank;\n }\n visited[v] = true;\n\n var rank = _.min(_.map(g.outEdges(v), function(e) {\n return dfs(e.w) - g.edge(e).minlen;\n }));\n\n if (rank === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3\n rank === undefined || // return value of _.map([]) for Lodash 4\n rank === null) { // return value of _.map([null])\n rank = 0;\n }\n\n return (label.rank = rank);\n }\n\n _.forEach(g.sources(), dfs);\n}\n\n/*\n * Returns the amount of slack for the given edge. The slack is defined as the\n * difference between the length of the edge and its minimum length.\n */\nfunction slack(g, e) {\n return g.node(e.w).rank - g.node(e.v).rank - g.edge(e).minlen;\n}\n","\"use strict\";\n\nvar _ = require(\"../lodash\");\nvar Graph = require(\"../graphlib\").Graph;\nvar slack = require(\"./util\").slack;\n\nmodule.exports = feasibleTree;\n\n/*\n * Constructs a spanning tree with tight edges and adjusted the input node's\n * ranks to achieve this. A tight edge is one that is has a length that matches\n * its \"minlen\" attribute.\n *\n * The basic structure for this function is derived from Gansner, et al., \"A\n * Technique for Drawing Directed Graphs.\"\n *\n * Pre-conditions:\n *\n * 1. Graph must be a DAG.\n * 2. Graph must be connected.\n * 3. Graph must have at least one node.\n * 5. Graph nodes must have been previously assigned a \"rank\" property that\n * respects the \"minlen\" property of incident edges.\n * 6. Graph edges must have a \"minlen\" property.\n *\n * Post-conditions:\n *\n * - Graph nodes will have their rank adjusted to ensure that all edges are\n * tight.\n *\n * Returns a tree (undirected graph) that is constructed using only \"tight\"\n * edges.\n */\nfunction feasibleTree(g) {\n var t = new Graph({ directed: false });\n\n // Choose arbitrary node from which to start our tree\n var start = g.nodes()[0];\n var size = g.nodeCount();\n t.setNode(start, {});\n\n var edge, delta;\n while (tightTree(t, g) < size) {\n edge = findMinSlackEdge(t, g);\n delta = t.hasNode(edge.v) ? slack(g, edge) : -slack(g, edge);\n shiftRanks(t, g, delta);\n }\n\n return t;\n}\n\n/*\n * Finds a maximal tree of tight edges and returns the number of nodes in the\n * tree.\n */\nfunction tightTree(t, g) {\n function dfs(v) {\n _.forEach(g.nodeEdges(v), function(e) {\n var edgeV = e.v,\n w = (v === edgeV) ? e.w : edgeV;\n if (!t.hasNode(w) && !slack(g, e)) {\n t.setNode(w, {});\n t.setEdge(v, w, {});\n dfs(w);\n }\n });\n }\n\n _.forEach(t.nodes(), dfs);\n return t.nodeCount();\n}\n\n/*\n * Finds the edge with the smallest slack that is incident on tree and returns\n * it.\n */\nfunction findMinSlackEdge(t, g) {\n return _.minBy(g.edges(), function(e) {\n if (t.hasNode(e.v) !== t.hasNode(e.w)) {\n return slack(g, e);\n }\n });\n}\n\nfunction shiftRanks(t, g, delta) {\n _.forEach(t.nodes(), function(v) {\n g.node(v).rank += delta;\n });\n}\n","\"use strict\";\n\nvar _ = require(\"../lodash\");\nvar feasibleTree = require(\"./feasible-tree\");\nvar slack = require(\"./util\").slack;\nvar initRank = require(\"./util\").longestPath;\nvar preorder = require(\"../graphlib\").alg.preorder;\nvar postorder = require(\"../graphlib\").alg.postorder;\nvar simplify = require(\"../util\").simplify;\n\nmodule.exports = networkSimplex;\n\n// Expose some internals for testing purposes\nnetworkSimplex.initLowLimValues = initLowLimValues;\nnetworkSimplex.initCutValues = initCutValues;\nnetworkSimplex.calcCutValue = calcCutValue;\nnetworkSimplex.leaveEdge = leaveEdge;\nnetworkSimplex.enterEdge = enterEdge;\nnetworkSimplex.exchangeEdges = exchangeEdges;\n\n/*\n * The network simplex algorithm assigns ranks to each node in the input graph\n * and iteratively improves the ranking to reduce the length of edges.\n *\n * Preconditions:\n *\n * 1. The input graph must be a DAG.\n * 2. All nodes in the graph must have an object value.\n * 3. All edges in the graph must have \"minlen\" and \"weight\" attributes.\n *\n * Postconditions:\n *\n * 1. All nodes in the graph will have an assigned \"rank\" attribute that has\n * been optimized by the network simplex algorithm. Ranks start at 0.\n *\n *\n * A rough sketch of the algorithm is as follows:\n *\n * 1. Assign initial ranks to each node. We use the longest path algorithm,\n * which assigns ranks to the lowest position possible. In general this\n * leads to very wide bottom ranks and unnecessarily long edges.\n * 2. Construct a feasible tight tree. A tight tree is one such that all\n * edges in the tree have no slack (difference between length of edge\n * and minlen for the edge). This by itself greatly improves the assigned\n * rankings by shorting edges.\n * 3. Iteratively find edges that have negative cut values. Generally a\n * negative cut value indicates that the edge could be removed and a new\n * tree edge could be added to produce a more compact graph.\n *\n * Much of the algorithms here are derived from Gansner, et al., \"A Technique\n * for Drawing Directed Graphs.\" The structure of the file roughly follows the\n * structure of the overall algorithm.\n */\nfunction networkSimplex(g) {\n g = simplify(g);\n initRank(g);\n var t = feasibleTree(g);\n initLowLimValues(t);\n initCutValues(t, g);\n\n var e, f;\n while ((e = leaveEdge(t))) {\n f = enterEdge(t, g, e);\n exchangeEdges(t, g, e, f);\n }\n}\n\n/*\n * Initializes cut values for all edges in the tree.\n */\nfunction initCutValues(t, g) {\n var vs = postorder(t, t.nodes());\n vs = vs.slice(0, vs.length - 1);\n _.forEach(vs, function(v) {\n assignCutValue(t, g, v);\n });\n}\n\nfunction assignCutValue(t, g, child) {\n var childLab = t.node(child);\n var parent = childLab.parent;\n t.edge(child, parent).cutvalue = calcCutValue(t, g, child);\n}\n\n/*\n * Given the tight tree, its graph, and a child in the graph calculate and\n * return the cut value for the edge between the child and its parent.\n */\nfunction calcCutValue(t, g, child) {\n var childLab = t.node(child);\n var parent = childLab.parent;\n // True if the child is on the tail end of the edge in the directed graph\n var childIsTail = true;\n // The graph's view of the tree edge we're inspecting\n var graphEdge = g.edge(child, parent);\n // The accumulated cut value for the edge between this node and its parent\n var cutValue = 0;\n\n if (!graphEdge) {\n childIsTail = false;\n graphEdge = g.edge(parent, child);\n }\n\n cutValue = graphEdge.weight;\n\n _.forEach(g.nodeEdges(child), function(e) {\n var isOutEdge = e.v === child,\n other = isOutEdge ? e.w : e.v;\n\n if (other !== parent) {\n var pointsToHead = isOutEdge === childIsTail,\n otherWeight = g.edge(e).weight;\n\n cutValue += pointsToHead ? otherWeight : -otherWeight;\n if (isTreeEdge(t, child, other)) {\n var otherCutValue = t.edge(child, other).cutvalue;\n cutValue += pointsToHead ? -otherCutValue : otherCutValue;\n }\n }\n });\n\n return cutValue;\n}\n\nfunction initLowLimValues(tree, root) {\n if (arguments.length < 2) {\n root = tree.nodes()[0];\n }\n dfsAssignLowLim(tree, {}, 1, root);\n}\n\nfunction dfsAssignLowLim(tree, visited, nextLim, v, parent) {\n var low = nextLim;\n var label = tree.node(v);\n\n visited[v] = true;\n _.forEach(tree.neighbors(v), function(w) {\n if (!_.has(visited, w)) {\n nextLim = dfsAssignLowLim(tree, visited, nextLim, w, v);\n }\n });\n\n label.low = low;\n label.lim = nextLim++;\n if (parent) {\n label.parent = parent;\n } else {\n // TODO should be able to remove this when we incrementally update low lim\n delete label.parent;\n }\n\n return nextLim;\n}\n\nfunction leaveEdge(tree) {\n return _.find(tree.edges(), function(e) {\n return tree.edge(e).cutvalue < 0;\n });\n}\n\nfunction enterEdge(t, g, edge) {\n var v = edge.v;\n var w = edge.w;\n\n // For the rest of this function we assume that v is the tail and w is the\n // head, so if we don't have this edge in the graph we should flip it to\n // match the correct orientation.\n if (!g.hasEdge(v, w)) {\n v = edge.w;\n w = edge.v;\n }\n\n var vLabel = t.node(v);\n var wLabel = t.node(w);\n var tailLabel = vLabel;\n var flip = false;\n\n // If the root is in the tail of the edge then we need to flip the logic that\n // checks for the head and tail nodes in the candidates function below.\n if (vLabel.lim > wLabel.lim) {\n tailLabel = wLabel;\n flip = true;\n }\n\n var candidates = _.filter(g.edges(), function(edge) {\n return flip === isDescendant(t, t.node(edge.v), tailLabel) &&\n flip !== isDescendant(t, t.node(edge.w), tailLabel);\n });\n\n return _.minBy(candidates, function(edge) { return slack(g, edge); });\n}\n\nfunction exchangeEdges(t, g, e, f) {\n var v = e.v;\n var w = e.w;\n t.removeEdge(v, w);\n t.setEdge(f.v, f.w, {});\n initLowLimValues(t);\n initCutValues(t, g);\n updateRanks(t, g);\n}\n\nfunction updateRanks(t, g) {\n var root = _.find(t.nodes(), function(v) { return !g.node(v).parent; });\n var vs = preorder(t, root);\n vs = vs.slice(1);\n _.forEach(vs, function(v) {\n var parent = t.node(v).parent,\n edge = g.edge(v, parent),\n flipped = false;\n\n if (!edge) {\n edge = g.edge(parent, v);\n flipped = true;\n }\n\n g.node(v).rank = g.node(parent).rank + (flipped ? edge.minlen : -edge.minlen);\n });\n}\n\n/*\n * Returns true if the edge is in the tree.\n */\nfunction isTreeEdge(tree, u, v) {\n return tree.hasEdge(u, v);\n}\n\n/*\n * Returns true if the specified node is descendant of the root node per the\n * assigned low and lim attributes in the tree.\n */\nfunction isDescendant(tree, vLabel, rootLabel) {\n return rootLabel.low <= vLabel.lim && vLabel.lim <= rootLabel.lim;\n}\n","\"use strict\";\n\nvar rankUtil = require(\"./util\");\nvar longestPath = rankUtil.longestPath;\nvar feasibleTree = require(\"./feasible-tree\");\nvar networkSimplex = require(\"./network-simplex\");\n\nmodule.exports = rank;\n\n/*\n * Assigns a rank to each node in the input graph that respects the \"minlen\"\n * constraint specified on edges between nodes.\n *\n * This basic structure is derived from Gansner, et al., \"A Technique for\n * Drawing Directed Graphs.\"\n *\n * Pre-conditions:\n *\n * 1. Graph must be a connected DAG\n * 2. Graph nodes must be objects\n * 3. Graph edges must have \"weight\" and \"minlen\" attributes\n *\n * Post-conditions:\n *\n * 1. Graph nodes will have a \"rank\" attribute based on the results of the\n * algorithm. Ranks can start at any index (including negative), we'll\n * fix them up later.\n */\nfunction rank(g) {\n switch(g.graph().ranker) {\n case \"network-simplex\": networkSimplexRanker(g); break;\n case \"tight-tree\": tightTreeRanker(g); break;\n case \"longest-path\": longestPathRanker(g); break;\n default: networkSimplexRanker(g);\n }\n}\n\n// A fast and simple ranker, but results are far from optimal.\nvar longestPathRanker = longestPath;\n\nfunction tightTreeRanker(g) {\n longestPath(g);\n feasibleTree(g);\n}\n\nfunction networkSimplexRanker(g) {\n networkSimplex(g);\n}\n","var _ = require(\"./lodash\");\n\nmodule.exports = parentDummyChains;\n\nfunction parentDummyChains(g) {\n var postorderNums = postorder(g);\n\n _.forEach(g.graph().dummyChains, function(v) {\n var node = g.node(v);\n var edgeObj = node.edgeObj;\n var pathData = findPath(g, postorderNums, edgeObj.v, edgeObj.w);\n var path = pathData.path;\n var lca = pathData.lca;\n var pathIdx = 0;\n var pathV = path[pathIdx];\n var ascending = true;\n\n while (v !== edgeObj.w) {\n node = g.node(v);\n\n if (ascending) {\n while ((pathV = path[pathIdx]) !== lca &&\n g.node(pathV).maxRank < node.rank) {\n pathIdx++;\n }\n\n if (pathV === lca) {\n ascending = false;\n }\n }\n\n if (!ascending) {\n while (pathIdx < path.length - 1 &&\n g.node(pathV = path[pathIdx + 1]).minRank <= node.rank) {\n pathIdx++;\n }\n pathV = path[pathIdx];\n }\n\n g.setParent(v, pathV);\n v = g.successors(v)[0];\n }\n });\n}\n\n// Find a path from v to w through the lowest common ancestor (LCA). Return the\n// full path and the LCA.\nfunction findPath(g, postorderNums, v, w) {\n var vPath = [];\n var wPath = [];\n var low = Math.min(postorderNums[v].low, postorderNums[w].low);\n var lim = Math.max(postorderNums[v].lim, postorderNums[w].lim);\n var parent;\n var lca;\n\n // Traverse up from v to find the LCA\n parent = v;\n do {\n parent = g.parent(parent);\n vPath.push(parent);\n } while (parent &&\n (postorderNums[parent].low > low || lim > postorderNums[parent].lim));\n lca = parent;\n\n // Traverse from w to LCA\n parent = w;\n while ((parent = g.parent(parent)) !== lca) {\n wPath.push(parent);\n }\n\n return { path: vPath.concat(wPath.reverse()), lca: lca };\n}\n\nfunction postorder(g) {\n var result = {};\n var lim = 0;\n\n function dfs(v) {\n var low = lim;\n _.forEach(g.children(v), dfs);\n result[v] = { low: low, lim: lim++ };\n }\n _.forEach(g.children(), dfs);\n\n return result;\n}\n","var _ = require(\"./lodash\");\nvar util = require(\"./util\");\n\nmodule.exports = {\n run: run,\n cleanup: cleanup\n};\n\n/*\n * A nesting graph creates dummy nodes for the tops and bottoms of subgraphs,\n * adds appropriate edges to ensure that all cluster nodes are placed between\n * these boundries, and ensures that the graph is connected.\n *\n * In addition we ensure, through the use of the minlen property, that nodes\n * and subgraph border nodes to not end up on the same rank.\n *\n * Preconditions:\n *\n * 1. Input graph is a DAG\n * 2. Nodes in the input graph has a minlen attribute\n *\n * Postconditions:\n *\n * 1. Input graph is connected.\n * 2. Dummy nodes are added for the tops and bottoms of subgraphs.\n * 3. The minlen attribute for nodes is adjusted to ensure nodes do not\n * get placed on the same rank as subgraph border nodes.\n *\n * The nesting graph idea comes from Sander, \"Layout of Compound Directed\n * Graphs.\"\n */\nfunction run(g) {\n var root = util.addDummyNode(g, \"root\", {}, \"_root\");\n var depths = treeDepths(g);\n var height = _.max(_.values(depths)) - 1; // Note: depths is an Object not an array\n var nodeSep = 2 * height + 1;\n\n g.graph().nestingRoot = root;\n\n // Multiply minlen by nodeSep to align nodes on non-border ranks.\n _.forEach(g.edges(), function(e) { g.edge(e).minlen *= nodeSep; });\n\n // Calculate a weight that is sufficient to keep subgraphs vertically compact\n var weight = sumWeights(g) + 1;\n\n // Create border nodes and link them up\n _.forEach(g.children(), function(child) {\n dfs(g, root, nodeSep, weight, height, depths, child);\n });\n\n // Save the multiplier for node layers for later removal of empty border\n // layers.\n g.graph().nodeRankFactor = nodeSep;\n}\n\nfunction dfs(g, root, nodeSep, weight, height, depths, v) {\n var children = g.children(v);\n if (!children.length) {\n if (v !== root) {\n g.setEdge(root, v, { weight: 0, minlen: nodeSep });\n }\n return;\n }\n\n var top = util.addBorderNode(g, \"_bt\");\n var bottom = util.addBorderNode(g, \"_bb\");\n var label = g.node(v);\n\n g.setParent(top, v);\n label.borderTop = top;\n g.setParent(bottom, v);\n label.borderBottom = bottom;\n\n _.forEach(children, function(child) {\n dfs(g, root, nodeSep, weight, height, depths, child);\n\n var childNode = g.node(child);\n var childTop = childNode.borderTop ? childNode.borderTop : child;\n var childBottom = childNode.borderBottom ? childNode.borderBottom : child;\n var thisWeight = childNode.borderTop ? weight : 2 * weight;\n var minlen = childTop !== childBottom ? 1 : height - depths[v] + 1;\n\n g.setEdge(top, childTop, {\n weight: thisWeight,\n minlen: minlen,\n nestingEdge: true\n });\n\n g.setEdge(childBottom, bottom, {\n weight: thisWeight,\n minlen: minlen,\n nestingEdge: true\n });\n });\n\n if (!g.parent(v)) {\n g.setEdge(root, top, { weight: 0, minlen: height + depths[v] });\n }\n}\n\nfunction treeDepths(g) {\n var depths = {};\n function dfs(v, depth) {\n var children = g.children(v);\n if (children && children.length) {\n _.forEach(children, function(child) {\n dfs(child, depth + 1);\n });\n }\n depths[v] = depth;\n }\n _.forEach(g.children(), function(v) { dfs(v, 1); });\n return depths;\n}\n\nfunction sumWeights(g) {\n return _.reduce(g.edges(), function(acc, e) {\n return acc + g.edge(e).weight;\n }, 0);\n}\n\nfunction cleanup(g) {\n var graphLabel = g.graph();\n g.removeNode(graphLabel.nestingRoot);\n delete graphLabel.nestingRoot;\n _.forEach(g.edges(), function(e) {\n var edge = g.edge(e);\n if (edge.nestingEdge) {\n g.removeEdge(e);\n }\n });\n}\n","var _ = require(\"./lodash\");\nvar util = require(\"./util\");\n\nmodule.exports = addBorderSegments;\n\nfunction addBorderSegments(g) {\n function dfs(v) {\n var children = g.children(v);\n var node = g.node(v);\n if (children.length) {\n _.forEach(children, dfs);\n }\n\n if (_.has(node, \"minRank\")) {\n node.borderLeft = [];\n node.borderRight = [];\n for (var rank = node.minRank, maxRank = node.maxRank + 1;\n rank < maxRank;\n ++rank) {\n addBorderNode(g, \"borderLeft\", \"_bl\", v, node, rank);\n addBorderNode(g, \"borderRight\", \"_br\", v, node, rank);\n }\n }\n }\n\n _.forEach(g.children(), dfs);\n}\n\nfunction addBorderNode(g, prop, prefix, sg, sgNode, rank) {\n var label = { width: 0, height: 0, rank: rank, borderType: prop };\n var prev = sgNode[prop][rank - 1];\n var curr = util.addDummyNode(g, \"border\", label, prefix);\n sgNode[prop][rank] = curr;\n g.setParent(curr, sg);\n if (prev) {\n g.setEdge(prev, curr, { weight: 1 });\n }\n}\n","\"use strict\";\n\nvar _ = require(\"./lodash\");\n\nmodule.exports = {\n adjust: adjust,\n undo: undo\n};\n\nfunction adjust(g) {\n var rankDir = g.graph().rankdir.toLowerCase();\n if (rankDir === \"lr\" || rankDir === \"rl\") {\n swapWidthHeight(g);\n }\n}\n\nfunction undo(g) {\n var rankDir = g.graph().rankdir.toLowerCase();\n if (rankDir === \"bt\" || rankDir === \"rl\") {\n reverseY(g);\n }\n\n if (rankDir === \"lr\" || rankDir === \"rl\") {\n swapXY(g);\n swapWidthHeight(g);\n }\n}\n\nfunction swapWidthHeight(g) {\n _.forEach(g.nodes(), function(v) { swapWidthHeightOne(g.node(v)); });\n _.forEach(g.edges(), function(e) { swapWidthHeightOne(g.edge(e)); });\n}\n\nfunction swapWidthHeightOne(attrs) {\n var w = attrs.width;\n attrs.width = attrs.height;\n attrs.height = w;\n}\n\nfunction reverseY(g) {\n _.forEach(g.nodes(), function(v) { reverseYOne(g.node(v)); });\n\n _.forEach(g.edges(), function(e) {\n var edge = g.edge(e);\n _.forEach(edge.points, reverseYOne);\n if (_.has(edge, \"y\")) {\n reverseYOne(edge);\n }\n });\n}\n\nfunction reverseYOne(attrs) {\n attrs.y = -attrs.y;\n}\n\nfunction swapXY(g) {\n _.forEach(g.nodes(), function(v) { swapXYOne(g.node(v)); });\n\n _.forEach(g.edges(), function(e) {\n var edge = g.edge(e);\n _.forEach(edge.points, swapXYOne);\n if (_.has(edge, \"x\")) {\n swapXYOne(edge);\n }\n });\n}\n\nfunction swapXYOne(attrs) {\n var x = attrs.x;\n attrs.x = attrs.y;\n attrs.y = x;\n}\n","\"use strict\";\n\nvar _ = require(\"../lodash\");\n\nmodule.exports = initOrder;\n\n/*\n * Assigns an initial order value for each node by performing a DFS search\n * starting from nodes in the first rank. Nodes are assigned an order in their\n * rank as they are first visited.\n *\n * This approach comes from Gansner, et al., \"A Technique for Drawing Directed\n * Graphs.\"\n *\n * Returns a layering matrix with an array per layer and each layer sorted by\n * the order of its nodes.\n */\nfunction initOrder(g) {\n var visited = {};\n var simpleNodes = _.filter(g.nodes(), function(v) {\n return !g.children(v).length;\n });\n var maxRank = _.max(_.map(simpleNodes, function(v) { return g.node(v).rank; }));\n var layers = _.map(_.range(maxRank + 1), function() { return []; });\n\n function dfs(v) {\n if (_.has(visited, v)) return;\n visited[v] = true;\n var node = g.node(v);\n layers[node.rank].push(v);\n _.forEach(g.successors(v), dfs);\n }\n\n var orderedVs = _.sortBy(simpleNodes, function(v) { return g.node(v).rank; });\n _.forEach(orderedVs, dfs);\n\n return layers;\n}\n","\"use strict\";\n\nvar _ = require(\"../lodash\");\n\nmodule.exports = crossCount;\n\n/*\n * A function that takes a layering (an array of layers, each with an array of\n * ordererd nodes) and a graph and returns a weighted crossing count.\n *\n * Pre-conditions:\n *\n * 1. Input graph must be simple (not a multigraph), directed, and include\n * only simple edges.\n * 2. Edges in the input graph must have assigned weights.\n *\n * Post-conditions:\n *\n * 1. The graph and layering matrix are left unchanged.\n *\n * This algorithm is derived from Barth, et al., \"Bilayer Cross Counting.\"\n */\nfunction crossCount(g, layering) {\n var cc = 0;\n for (var i = 1; i < layering.length; ++i) {\n cc += twoLayerCrossCount(g, layering[i-1], layering[i]);\n }\n return cc;\n}\n\nfunction twoLayerCrossCount(g, northLayer, southLayer) {\n // Sort all of the edges between the north and south layers by their position\n // in the north layer and then the south. Map these edges to the position of\n // their head in the south layer.\n var southPos = _.zipObject(southLayer,\n _.map(southLayer, function (v, i) { return i; }));\n var southEntries = _.flatten(_.map(northLayer, function(v) {\n return _.sortBy(_.map(g.outEdges(v), function(e) {\n return { pos: southPos[e.w], weight: g.edge(e).weight };\n }), \"pos\");\n }), true);\n\n // Build the accumulator tree\n var firstIndex = 1;\n while (firstIndex < southLayer.length) firstIndex <<= 1;\n var treeSize = 2 * firstIndex - 1;\n firstIndex -= 1;\n var tree = _.map(new Array(treeSize), function() { return 0; });\n\n // Calculate the weighted crossings\n var cc = 0;\n _.forEach(southEntries.forEach(function(entry) {\n var index = entry.pos + firstIndex;\n tree[index] += entry.weight;\n var weightSum = 0;\n while (index > 0) {\n if (index % 2) {\n weightSum += tree[index + 1];\n }\n index = (index - 1) >> 1;\n tree[index] += entry.weight;\n }\n cc += entry.weight * weightSum;\n }));\n\n return cc;\n}\n","var _ = require(\"../lodash\");\n\nmodule.exports = barycenter;\n\nfunction barycenter(g, movable) {\n return _.map(movable, function(v) {\n var inV = g.inEdges(v);\n if (!inV.length) {\n return { v: v };\n } else {\n var result = _.reduce(inV, function(acc, e) {\n var edge = g.edge(e),\n nodeU = g.node(e.v);\n return {\n sum: acc.sum + (edge.weight * nodeU.order),\n weight: acc.weight + edge.weight\n };\n }, { sum: 0, weight: 0 });\n\n return {\n v: v,\n barycenter: result.sum / result.weight,\n weight: result.weight\n };\n }\n });\n}\n\n","\"use strict\";\n\nvar _ = require(\"../lodash\");\n\nmodule.exports = resolveConflicts;\n\n/*\n * Given a list of entries of the form {v, barycenter, weight} and a\n * constraint graph this function will resolve any conflicts between the\n * constraint graph and the barycenters for the entries. If the barycenters for\n * an entry would violate a constraint in the constraint graph then we coalesce\n * the nodes in the conflict into a new node that respects the contraint and\n * aggregates barycenter and weight information.\n *\n * This implementation is based on the description in Forster, \"A Fast and\n * Simple Hueristic for Constrained Two-Level Crossing Reduction,\" thought it\n * differs in some specific details.\n *\n * Pre-conditions:\n *\n * 1. Each entry has the form {v, barycenter, weight}, or if the node has\n * no barycenter, then {v}.\n *\n * Returns:\n *\n * A new list of entries of the form {vs, i, barycenter, weight}. The list\n * `vs` may either be a singleton or it may be an aggregation of nodes\n * ordered such that they do not violate constraints from the constraint\n * graph. The property `i` is the lowest original index of any of the\n * elements in `vs`.\n */\nfunction resolveConflicts(entries, cg) {\n var mappedEntries = {};\n _.forEach(entries, function(entry, i) {\n var tmp = mappedEntries[entry.v] = {\n indegree: 0,\n \"in\": [],\n out: [],\n vs: [entry.v],\n i: i\n };\n if (!_.isUndefined(entry.barycenter)) {\n tmp.barycenter = entry.barycenter;\n tmp.weight = entry.weight;\n }\n });\n\n _.forEach(cg.edges(), function(e) {\n var entryV = mappedEntries[e.v];\n var entryW = mappedEntries[e.w];\n if (!_.isUndefined(entryV) && !_.isUndefined(entryW)) {\n entryW.indegree++;\n entryV.out.push(mappedEntries[e.w]);\n }\n });\n\n var sourceSet = _.filter(mappedEntries, function(entry) {\n return !entry.indegree;\n });\n\n return doResolveConflicts(sourceSet);\n}\n\nfunction doResolveConflicts(sourceSet) {\n var entries = [];\n\n function handleIn(vEntry) {\n return function(uEntry) {\n if (uEntry.merged) {\n return;\n }\n if (_.isUndefined(uEntry.barycenter) ||\n _.isUndefined(vEntry.barycenter) ||\n uEntry.barycenter >= vEntry.barycenter) {\n mergeEntries(vEntry, uEntry);\n }\n };\n }\n\n function handleOut(vEntry) {\n return function(wEntry) {\n wEntry[\"in\"].push(vEntry);\n if (--wEntry.indegree === 0) {\n sourceSet.push(wEntry);\n }\n };\n }\n\n while (sourceSet.length) {\n var entry = sourceSet.pop();\n entries.push(entry);\n _.forEach(entry[\"in\"].reverse(), handleIn(entry));\n _.forEach(entry.out, handleOut(entry));\n }\n\n return _.map(_.filter(entries, function(entry) { return !entry.merged; }),\n function(entry) {\n return _.pick(entry, [\"vs\", \"i\", \"barycenter\", \"weight\"]);\n });\n\n}\n\nfunction mergeEntries(target, source) {\n var sum = 0;\n var weight = 0;\n\n if (target.weight) {\n sum += target.barycenter * target.weight;\n weight += target.weight;\n }\n\n if (source.weight) {\n sum += source.barycenter * source.weight;\n weight += source.weight;\n }\n\n target.vs = source.vs.concat(target.vs);\n target.barycenter = sum / weight;\n target.weight = weight;\n target.i = Math.min(source.i, target.i);\n source.merged = true;\n}\n","var _ = require(\"../lodash\");\nvar util = require(\"../util\");\n\nmodule.exports = sort;\n\nfunction sort(entries, biasRight) {\n var parts = util.partition(entries, function(entry) {\n return _.has(entry, \"barycenter\");\n });\n var sortable = parts.lhs,\n unsortable = _.sortBy(parts.rhs, function(entry) { return -entry.i; }),\n vs = [],\n sum = 0,\n weight = 0,\n vsIndex = 0;\n\n sortable.sort(compareWithBias(!!biasRight));\n\n vsIndex = consumeUnsortable(vs, unsortable, vsIndex);\n\n _.forEach(sortable, function (entry) {\n vsIndex += entry.vs.length;\n vs.push(entry.vs);\n sum += entry.barycenter * entry.weight;\n weight += entry.weight;\n vsIndex = consumeUnsortable(vs, unsortable, vsIndex);\n });\n\n var result = { vs: _.flatten(vs, true) };\n if (weight) {\n result.barycenter = sum / weight;\n result.weight = weight;\n }\n return result;\n}\n\nfunction consumeUnsortable(vs, unsortable, index) {\n var last;\n while (unsortable.length && (last = _.last(unsortable)).i <= index) {\n unsortable.pop();\n vs.push(last.vs);\n index++;\n }\n return index;\n}\n\nfunction compareWithBias(bias) {\n return function(entryV, entryW) {\n if (entryV.barycenter < entryW.barycenter) {\n return -1;\n } else if (entryV.barycenter > entryW.barycenter) {\n return 1;\n }\n\n return !bias ? entryV.i - entryW.i : entryW.i - entryV.i;\n };\n}\n","var _ = require(\"../lodash\");\nvar barycenter = require(\"./barycenter\");\nvar resolveConflicts = require(\"./resolve-conflicts\");\nvar sort = require(\"./sort\");\n\nmodule.exports = sortSubgraph;\n\nfunction sortSubgraph(g, v, cg, biasRight) {\n var movable = g.children(v);\n var node = g.node(v);\n var bl = node ? node.borderLeft : undefined;\n var br = node ? node.borderRight: undefined;\n var subgraphs = {};\n\n if (bl) {\n movable = _.filter(movable, function(w) {\n return w !== bl && w !== br;\n });\n }\n\n var barycenters = barycenter(g, movable);\n _.forEach(barycenters, function(entry) {\n if (g.children(entry.v).length) {\n var subgraphResult = sortSubgraph(g, entry.v, cg, biasRight);\n subgraphs[entry.v] = subgraphResult;\n if (_.has(subgraphResult, \"barycenter\")) {\n mergeBarycenters(entry, subgraphResult);\n }\n }\n });\n\n var entries = resolveConflicts(barycenters, cg);\n expandSubgraphs(entries, subgraphs);\n\n var result = sort(entries, biasRight);\n\n if (bl) {\n result.vs = _.flatten([bl, result.vs, br], true);\n if (g.predecessors(bl).length) {\n var blPred = g.node(g.predecessors(bl)[0]),\n brPred = g.node(g.predecessors(br)[0]);\n if (!_.has(result, \"barycenter\")) {\n result.barycenter = 0;\n result.weight = 0;\n }\n result.barycenter = (result.barycenter * result.weight +\n blPred.order + brPred.order) / (result.weight + 2);\n result.weight += 2;\n }\n }\n\n return result;\n}\n\nfunction expandSubgraphs(entries, subgraphs) {\n _.forEach(entries, function(entry) {\n entry.vs = _.flatten(entry.vs.map(function(v) {\n if (subgraphs[v]) {\n return subgraphs[v].vs;\n }\n return v;\n }), true);\n });\n}\n\nfunction mergeBarycenters(target, other) {\n if (!_.isUndefined(target.barycenter)) {\n target.barycenter = (target.barycenter * target.weight +\n other.barycenter * other.weight) /\n (target.weight + other.weight);\n target.weight += other.weight;\n } else {\n target.barycenter = other.barycenter;\n target.weight = other.weight;\n }\n}\n","var _ = require(\"../lodash\");\nvar Graph = require(\"../graphlib\").Graph;\n\nmodule.exports = buildLayerGraph;\n\n/*\n * Constructs a graph that can be used to sort a layer of nodes. The graph will\n * contain all base and subgraph nodes from the request layer in their original\n * hierarchy and any edges that are incident on these nodes and are of the type\n * requested by the \"relationship\" parameter.\n *\n * Nodes from the requested rank that do not have parents are assigned a root\n * node in the output graph, which is set in the root graph attribute. This\n * makes it easy to walk the hierarchy of movable nodes during ordering.\n *\n * Pre-conditions:\n *\n * 1. Input graph is a DAG\n * 2. Base nodes in the input graph have a rank attribute\n * 3. Subgraph nodes in the input graph has minRank and maxRank attributes\n * 4. Edges have an assigned weight\n *\n * Post-conditions:\n *\n * 1. Output graph has all nodes in the movable rank with preserved\n * hierarchy.\n * 2. Root nodes in the movable layer are made children of the node\n * indicated by the root attribute of the graph.\n * 3. Non-movable nodes incident on movable nodes, selected by the\n * relationship parameter, are included in the graph (without hierarchy).\n * 4. Edges incident on movable nodes, selected by the relationship\n * parameter, are added to the output graph.\n * 5. The weights for copied edges are aggregated as need, since the output\n * graph is not a multi-graph.\n */\nfunction buildLayerGraph(g, rank, relationship) {\n var root = createRootNode(g),\n result = new Graph({ compound: true }).setGraph({ root: root })\n .setDefaultNodeLabel(function(v) { return g.node(v); });\n\n _.forEach(g.nodes(), function(v) {\n var node = g.node(v),\n parent = g.parent(v);\n\n if (node.rank === rank || node.minRank <= rank && rank <= node.maxRank) {\n result.setNode(v);\n result.setParent(v, parent || root);\n\n // This assumes we have only short edges!\n _.forEach(g[relationship](v), function(e) {\n var u = e.v === v ? e.w : e.v,\n edge = result.edge(u, v),\n weight = !_.isUndefined(edge) ? edge.weight : 0;\n result.setEdge(u, v, { weight: g.edge(e).weight + weight });\n });\n\n if (_.has(node, \"minRank\")) {\n result.setNode(v, {\n borderLeft: node.borderLeft[rank],\n borderRight: node.borderRight[rank]\n });\n }\n }\n });\n\n return result;\n}\n\nfunction createRootNode(g) {\n var v;\n while (g.hasNode((v = _.uniqueId(\"_root\"))));\n return v;\n}\n","var _ = require(\"../lodash\");\n\nmodule.exports = addSubgraphConstraints;\n\nfunction addSubgraphConstraints(g, cg, vs) {\n var prev = {},\n rootPrev;\n\n _.forEach(vs, function(v) {\n var child = g.parent(v),\n parent,\n prevChild;\n while (child) {\n parent = g.parent(child);\n if (parent) {\n prevChild = prev[parent];\n prev[parent] = child;\n } else {\n prevChild = rootPrev;\n rootPrev = child;\n }\n if (prevChild && prevChild !== child) {\n cg.setEdge(prevChild, child);\n return;\n }\n child = parent;\n }\n });\n\n /*\n function dfs(v) {\n var children = v ? g.children(v) : g.children();\n if (children.length) {\n var min = Number.POSITIVE_INFINITY,\n subgraphs = [];\n _.each(children, function(child) {\n var childMin = dfs(child);\n if (g.children(child).length) {\n subgraphs.push({ v: child, order: childMin });\n }\n min = Math.min(min, childMin);\n });\n _.reduce(_.sortBy(subgraphs, \"order\"), function(prev, curr) {\n cg.setEdge(prev.v, curr.v);\n return curr;\n });\n return min;\n }\n return g.node(v).order;\n }\n dfs(undefined);\n */\n}\n","\"use strict\";\n\nvar _ = require(\"../lodash\");\nvar initOrder = require(\"./init-order\");\nvar crossCount = require(\"./cross-count\");\nvar sortSubgraph = require(\"./sort-subgraph\");\nvar buildLayerGraph = require(\"./build-layer-graph\");\nvar addSubgraphConstraints = require(\"./add-subgraph-constraints\");\nvar Graph = require(\"../graphlib\").Graph;\nvar util = require(\"../util\");\n\nmodule.exports = order;\n\n/*\n * Applies heuristics to minimize edge crossings in the graph and sets the best\n * order solution as an order attribute on each node.\n *\n * Pre-conditions:\n *\n * 1. Graph must be DAG\n * 2. Graph nodes must be objects with a \"rank\" attribute\n * 3. Graph edges must have the \"weight\" attribute\n *\n * Post-conditions:\n *\n * 1. Graph nodes will have an \"order\" attribute based on the results of the\n * algorithm.\n */\nfunction order(g) {\n var maxRank = util.maxRank(g),\n downLayerGraphs = buildLayerGraphs(g, _.range(1, maxRank + 1), \"inEdges\"),\n upLayerGraphs = buildLayerGraphs(g, _.range(maxRank - 1, -1, -1), \"outEdges\");\n\n var layering = initOrder(g);\n assignOrder(g, layering);\n\n var bestCC = Number.POSITIVE_INFINITY,\n best;\n\n for (var i = 0, lastBest = 0; lastBest < 4; ++i, ++lastBest) {\n sweepLayerGraphs(i % 2 ? downLayerGraphs : upLayerGraphs, i % 4 >= 2);\n\n layering = util.buildLayerMatrix(g);\n var cc = crossCount(g, layering);\n if (cc < bestCC) {\n lastBest = 0;\n best = _.cloneDeep(layering);\n bestCC = cc;\n }\n }\n\n assignOrder(g, best);\n}\n\nfunction buildLayerGraphs(g, ranks, relationship) {\n return _.map(ranks, function(rank) {\n return buildLayerGraph(g, rank, relationship);\n });\n}\n\nfunction sweepLayerGraphs(layerGraphs, biasRight) {\n var cg = new Graph();\n _.forEach(layerGraphs, function(lg) {\n var root = lg.graph().root;\n var sorted = sortSubgraph(lg, root, cg, biasRight);\n _.forEach(sorted.vs, function(v, i) {\n lg.node(v).order = i;\n });\n addSubgraphConstraints(lg, cg, sorted.vs);\n });\n}\n\nfunction assignOrder(g, layering) {\n _.forEach(layering, function(layer) {\n _.forEach(layer, function(v, i) {\n g.node(v).order = i;\n });\n });\n}\n","\"use strict\";\n\nvar _ = require(\"../lodash\");\nvar Graph = require(\"../graphlib\").Graph;\nvar util = require(\"../util\");\n\n/*\n * This module provides coordinate assignment based on Brandes and Köpf, \"Fast\n * and Simple Horizontal Coordinate Assignment.\"\n */\n\nmodule.exports = {\n positionX: positionX,\n findType1Conflicts: findType1Conflicts,\n findType2Conflicts: findType2Conflicts,\n addConflict: addConflict,\n hasConflict: hasConflict,\n verticalAlignment: verticalAlignment,\n horizontalCompaction: horizontalCompaction,\n alignCoordinates: alignCoordinates,\n findSmallestWidthAlignment: findSmallestWidthAlignment,\n balance: balance\n};\n\n/*\n * Marks all edges in the graph with a type-1 conflict with the \"type1Conflict\"\n * property. A type-1 conflict is one where a non-inner segment crosses an\n * inner segment. An inner segment is an edge with both incident nodes marked\n * with the \"dummy\" property.\n *\n * This algorithm scans layer by layer, starting with the second, for type-1\n * conflicts between the current layer and the previous layer. For each layer\n * it scans the nodes from left to right until it reaches one that is incident\n * on an inner segment. It then scans predecessors to determine if they have\n * edges that cross that inner segment. At the end a final scan is done for all\n * nodes on the current rank to see if they cross the last visited inner\n * segment.\n *\n * This algorithm (safely) assumes that a dummy node will only be incident on a\n * single node in the layers being scanned.\n */\nfunction findType1Conflicts(g, layering) {\n var conflicts = {};\n\n function visitLayer(prevLayer, layer) {\n var\n // last visited node in the previous layer that is incident on an inner\n // segment.\n k0 = 0,\n // Tracks the last node in this layer scanned for crossings with a type-1\n // segment.\n scanPos = 0,\n prevLayerLength = prevLayer.length,\n lastNode = _.last(layer);\n\n _.forEach(layer, function(v, i) {\n var w = findOtherInnerSegmentNode(g, v),\n k1 = w ? g.node(w).order : prevLayerLength;\n\n if (w || v === lastNode) {\n _.forEach(layer.slice(scanPos, i +1), function(scanNode) {\n _.forEach(g.predecessors(scanNode), function(u) {\n var uLabel = g.node(u),\n uPos = uLabel.order;\n if ((uPos < k0 || k1 < uPos) &&\n !(uLabel.dummy && g.node(scanNode).dummy)) {\n addConflict(conflicts, u, scanNode);\n }\n });\n });\n scanPos = i + 1;\n k0 = k1;\n }\n });\n\n return layer;\n }\n\n _.reduce(layering, visitLayer);\n return conflicts;\n}\n\nfunction findType2Conflicts(g, layering) {\n var conflicts = {};\n\n function scan(south, southPos, southEnd, prevNorthBorder, nextNorthBorder) {\n var v;\n _.forEach(_.range(southPos, southEnd), function(i) {\n v = south[i];\n if (g.node(v).dummy) {\n _.forEach(g.predecessors(v), function(u) {\n var uNode = g.node(u);\n if (uNode.dummy &&\n (uNode.order < prevNorthBorder || uNode.order > nextNorthBorder)) {\n addConflict(conflicts, u, v);\n }\n });\n }\n });\n }\n\n\n function visitLayer(north, south) {\n var prevNorthPos = -1,\n nextNorthPos,\n southPos = 0;\n\n _.forEach(south, function(v, southLookahead) {\n if (g.node(v).dummy === \"border\") {\n var predecessors = g.predecessors(v);\n if (predecessors.length) {\n nextNorthPos = g.node(predecessors[0]).order;\n scan(south, southPos, southLookahead, prevNorthPos, nextNorthPos);\n southPos = southLookahead;\n prevNorthPos = nextNorthPos;\n }\n }\n scan(south, southPos, south.length, nextNorthPos, north.length);\n });\n\n return south;\n }\n\n _.reduce(layering, visitLayer);\n return conflicts;\n}\n\nfunction findOtherInnerSegmentNode(g, v) {\n if (g.node(v).dummy) {\n return _.find(g.predecessors(v), function(u) {\n return g.node(u).dummy;\n });\n }\n}\n\nfunction addConflict(conflicts, v, w) {\n if (v > w) {\n var tmp = v;\n v = w;\n w = tmp;\n }\n\n var conflictsV = conflicts[v];\n if (!conflictsV) {\n conflicts[v] = conflictsV = {};\n }\n conflictsV[w] = true;\n}\n\nfunction hasConflict(conflicts, v, w) {\n if (v > w) {\n var tmp = v;\n v = w;\n w = tmp;\n }\n return _.has(conflicts[v], w);\n}\n\n/*\n * Try to align nodes into vertical \"blocks\" where possible. This algorithm\n * attempts to align a node with one of its median neighbors. If the edge\n * connecting a neighbor is a type-1 conflict then we ignore that possibility.\n * If a previous node has already formed a block with a node after the node\n * we're trying to form a block with, we also ignore that possibility - our\n * blocks would be split in that scenario.\n */\nfunction verticalAlignment(g, layering, conflicts, neighborFn) {\n var root = {},\n align = {},\n pos = {};\n\n // We cache the position here based on the layering because the graph and\n // layering may be out of sync. The layering matrix is manipulated to\n // generate different extreme alignments.\n _.forEach(layering, function(layer) {\n _.forEach(layer, function(v, order) {\n root[v] = v;\n align[v] = v;\n pos[v] = order;\n });\n });\n\n _.forEach(layering, function(layer) {\n var prevIdx = -1;\n _.forEach(layer, function(v) {\n var ws = neighborFn(v);\n if (ws.length) {\n ws = _.sortBy(ws, function(w) { return pos[w]; });\n var mp = (ws.length - 1) / 2;\n for (var i = Math.floor(mp), il = Math.ceil(mp); i <= il; ++i) {\n var w = ws[i];\n if (align[v] === v &&\n prevIdx < pos[w] &&\n !hasConflict(conflicts, v, w)) {\n align[w] = v;\n align[v] = root[v] = root[w];\n prevIdx = pos[w];\n }\n }\n }\n });\n });\n\n return { root: root, align: align };\n}\n\nfunction horizontalCompaction(g, layering, root, align, reverseSep) {\n // This portion of the algorithm differs from BK due to a number of problems.\n // Instead of their algorithm we construct a new block graph and do two\n // sweeps. The first sweep places blocks with the smallest possible\n // coordinates. The second sweep removes unused space by moving blocks to the\n // greatest coordinates without violating separation.\n var xs = {},\n blockG = buildBlockGraph(g, layering, root, reverseSep),\n borderType = reverseSep ? \"borderLeft\" : \"borderRight\";\n\n function iterate(setXsFunc, nextNodesFunc) {\n var stack = blockG.nodes();\n var elem = stack.pop();\n var visited = {};\n while (elem) {\n if (visited[elem]) {\n setXsFunc(elem);\n } else {\n visited[elem] = true;\n stack.push(elem);\n stack = stack.concat(nextNodesFunc(elem));\n }\n\n elem = stack.pop();\n }\n }\n\n // First pass, assign smallest coordinates\n function pass1(elem) {\n xs[elem] = blockG.inEdges(elem).reduce(function(acc, e) {\n return Math.max(acc, xs[e.v] + blockG.edge(e));\n }, 0);\n }\n\n // Second pass, assign greatest coordinates\n function pass2(elem) {\n var min = blockG.outEdges(elem).reduce(function(acc, e) {\n return Math.min(acc, xs[e.w] - blockG.edge(e));\n }, Number.POSITIVE_INFINITY);\n\n var node = g.node(elem);\n if (min !== Number.POSITIVE_INFINITY && node.borderType !== borderType) {\n xs[elem] = Math.max(xs[elem], min);\n }\n }\n\n iterate(pass1, blockG.predecessors.bind(blockG));\n iterate(pass2, blockG.successors.bind(blockG));\n\n // Assign x coordinates to all nodes\n _.forEach(align, function(v) {\n xs[v] = xs[root[v]];\n });\n\n return xs;\n}\n\n\nfunction buildBlockGraph(g, layering, root, reverseSep) {\n var blockGraph = new Graph(),\n graphLabel = g.graph(),\n sepFn = sep(graphLabel.nodesep, graphLabel.edgesep, reverseSep);\n\n _.forEach(layering, function(layer) {\n var u;\n _.forEach(layer, function(v) {\n var vRoot = root[v];\n blockGraph.setNode(vRoot);\n if (u) {\n var uRoot = root[u],\n prevMax = blockGraph.edge(uRoot, vRoot);\n blockGraph.setEdge(uRoot, vRoot, Math.max(sepFn(g, v, u), prevMax || 0));\n }\n u = v;\n });\n });\n\n return blockGraph;\n}\n\n/*\n * Returns the alignment that has the smallest width of the given alignments.\n */\nfunction findSmallestWidthAlignment(g, xss) {\n return _.minBy(_.values(xss), function (xs) {\n var max = Number.NEGATIVE_INFINITY;\n var min = Number.POSITIVE_INFINITY;\n\n _.forIn(xs, function (x, v) {\n var halfWidth = width(g, v) / 2;\n\n max = Math.max(x + halfWidth, max);\n min = Math.min(x - halfWidth, min);\n });\n\n return max - min;\n });\n}\n\n/*\n * Align the coordinates of each of the layout alignments such that\n * left-biased alignments have their minimum coordinate at the same point as\n * the minimum coordinate of the smallest width alignment and right-biased\n * alignments have their maximum coordinate at the same point as the maximum\n * coordinate of the smallest width alignment.\n */\nfunction alignCoordinates(xss, alignTo) {\n var alignToVals = _.values(alignTo),\n alignToMin = _.min(alignToVals),\n alignToMax = _.max(alignToVals);\n\n _.forEach([\"u\", \"d\"], function(vert) {\n _.forEach([\"l\", \"r\"], function(horiz) {\n var alignment = vert + horiz,\n xs = xss[alignment],\n delta;\n if (xs === alignTo) return;\n\n var xsVals = _.values(xs);\n delta = horiz === \"l\" ? alignToMin - _.min(xsVals) : alignToMax - _.max(xsVals);\n\n if (delta) {\n xss[alignment] = _.mapValues(xs, function(x) { return x + delta; });\n }\n });\n });\n}\n\nfunction balance(xss, align) {\n return _.mapValues(xss.ul, function(ignore, v) {\n if (align) {\n return xss[align.toLowerCase()][v];\n } else {\n var xs = _.sortBy(_.map(xss, v));\n return (xs[1] + xs[2]) / 2;\n }\n });\n}\n\nfunction positionX(g) {\n var layering = util.buildLayerMatrix(g);\n var conflicts = _.merge(\n findType1Conflicts(g, layering),\n findType2Conflicts(g, layering));\n\n var xss = {};\n var adjustedLayering;\n _.forEach([\"u\", \"d\"], function(vert) {\n adjustedLayering = vert === \"u\" ? layering : _.values(layering).reverse();\n _.forEach([\"l\", \"r\"], function(horiz) {\n if (horiz === \"r\") {\n adjustedLayering = _.map(adjustedLayering, function(inner) {\n return _.values(inner).reverse();\n });\n }\n\n var neighborFn = (vert === \"u\" ? g.predecessors : g.successors).bind(g);\n var align = verticalAlignment(g, adjustedLayering, conflicts, neighborFn);\n var xs = horizontalCompaction(g, adjustedLayering,\n align.root, align.align, horiz === \"r\");\n if (horiz === \"r\") {\n xs = _.mapValues(xs, function(x) { return -x; });\n }\n xss[vert + horiz] = xs;\n });\n });\n\n var smallestWidth = findSmallestWidthAlignment(g, xss);\n alignCoordinates(xss, smallestWidth);\n return balance(xss, g.graph().align);\n}\n\nfunction sep(nodeSep, edgeSep, reverseSep) {\n return function(g, v, w) {\n var vLabel = g.node(v);\n var wLabel = g.node(w);\n var sum = 0;\n var delta;\n\n sum += vLabel.width / 2;\n if (_.has(vLabel, \"labelpos\")) {\n switch (vLabel.labelpos.toLowerCase()) {\n case \"l\": delta = -vLabel.width / 2; break;\n case \"r\": delta = vLabel.width / 2; break;\n }\n }\n if (delta) {\n sum += reverseSep ? delta : -delta;\n }\n delta = 0;\n\n sum += (vLabel.dummy ? edgeSep : nodeSep) / 2;\n sum += (wLabel.dummy ? edgeSep : nodeSep) / 2;\n\n sum += wLabel.width / 2;\n if (_.has(wLabel, \"labelpos\")) {\n switch (wLabel.labelpos.toLowerCase()) {\n case \"l\": delta = wLabel.width / 2; break;\n case \"r\": delta = -wLabel.width / 2; break;\n }\n }\n if (delta) {\n sum += reverseSep ? delta : -delta;\n }\n delta = 0;\n\n return sum;\n };\n}\n\nfunction width(g, v) {\n return g.node(v).width;\n}\n","\"use strict\";\n\nvar _ = require(\"../lodash\");\nvar util = require(\"../util\");\nvar positionX = require(\"./bk\").positionX;\n\nmodule.exports = position;\n\nfunction position(g) {\n g = util.asNonCompoundGraph(g);\n\n positionY(g);\n _.forEach(positionX(g), function(x, v) {\n g.node(v).x = x;\n });\n}\n\nfunction positionY(g) {\n var layering = util.buildLayerMatrix(g);\n var rankSep = g.graph().ranksep;\n var prevY = 0;\n _.forEach(layering, function(layer) {\n var maxHeight = _.max(_.map(layer, function(v) { return g.node(v).height; }));\n _.forEach(layer, function(v) {\n g.node(v).y = prevY + maxHeight / 2;\n });\n prevY += maxHeight + rankSep;\n });\n}\n\n","\"use strict\";\n\nvar _ = require(\"./lodash\");\nvar acyclic = require(\"./acyclic\");\nvar normalize = require(\"./normalize\");\nvar rank = require(\"./rank\");\nvar normalizeRanks = require(\"./util\").normalizeRanks;\nvar parentDummyChains = require(\"./parent-dummy-chains\");\nvar removeEmptyRanks = require(\"./util\").removeEmptyRanks;\nvar nestingGraph = require(\"./nesting-graph\");\nvar addBorderSegments = require(\"./add-border-segments\");\nvar coordinateSystem = require(\"./coordinate-system\");\nvar order = require(\"./order\");\nvar position = require(\"./position\");\nvar util = require(\"./util\");\nvar Graph = require(\"./graphlib\").Graph;\n\nmodule.exports = layout;\n\nfunction layout(g, opts) {\n var time = opts && opts.debugTiming ? util.time : util.notime;\n time(\"layout\", function() {\n var layoutGraph = \n time(\" buildLayoutGraph\", function() { return buildLayoutGraph(g); });\n time(\" runLayout\", function() { runLayout(layoutGraph, time); });\n time(\" updateInputGraph\", function() { updateInputGraph(g, layoutGraph); });\n });\n}\n\nfunction runLayout(g, time) {\n time(\" makeSpaceForEdgeLabels\", function() { makeSpaceForEdgeLabels(g); });\n time(\" removeSelfEdges\", function() { removeSelfEdges(g); });\n time(\" acyclic\", function() { acyclic.run(g); });\n time(\" nestingGraph.run\", function() { nestingGraph.run(g); });\n time(\" rank\", function() { rank(util.asNonCompoundGraph(g)); });\n time(\" injectEdgeLabelProxies\", function() { injectEdgeLabelProxies(g); });\n time(\" removeEmptyRanks\", function() { removeEmptyRanks(g); });\n time(\" nestingGraph.cleanup\", function() { nestingGraph.cleanup(g); });\n time(\" normalizeRanks\", function() { normalizeRanks(g); });\n time(\" assignRankMinMax\", function() { assignRankMinMax(g); });\n time(\" removeEdgeLabelProxies\", function() { removeEdgeLabelProxies(g); });\n time(\" normalize.run\", function() { normalize.run(g); });\n time(\" parentDummyChains\", function() { parentDummyChains(g); });\n time(\" addBorderSegments\", function() { addBorderSegments(g); });\n time(\" order\", function() { order(g); });\n time(\" insertSelfEdges\", function() { insertSelfEdges(g); });\n time(\" adjustCoordinateSystem\", function() { coordinateSystem.adjust(g); });\n time(\" position\", function() { position(g); });\n time(\" positionSelfEdges\", function() { positionSelfEdges(g); });\n time(\" removeBorderNodes\", function() { removeBorderNodes(g); });\n time(\" normalize.undo\", function() { normalize.undo(g); });\n time(\" fixupEdgeLabelCoords\", function() { fixupEdgeLabelCoords(g); });\n time(\" undoCoordinateSystem\", function() { coordinateSystem.undo(g); });\n time(\" translateGraph\", function() { translateGraph(g); });\n time(\" assignNodeIntersects\", function() { assignNodeIntersects(g); });\n time(\" reversePoints\", function() { reversePointsForReversedEdges(g); });\n time(\" acyclic.undo\", function() { acyclic.undo(g); });\n}\n\n/*\n * Copies final layout information from the layout graph back to the input\n * graph. This process only copies whitelisted attributes from the layout graph\n * to the input graph, so it serves as a good place to determine what\n * attributes can influence layout.\n */\nfunction updateInputGraph(inputGraph, layoutGraph) {\n _.forEach(inputGraph.nodes(), function(v) {\n var inputLabel = inputGraph.node(v);\n var layoutLabel = layoutGraph.node(v);\n\n if (inputLabel) {\n inputLabel.x = layoutLabel.x;\n inputLabel.y = layoutLabel.y;\n\n if (layoutGraph.children(v).length) {\n inputLabel.width = layoutLabel.width;\n inputLabel.height = layoutLabel.height;\n }\n }\n });\n\n _.forEach(inputGraph.edges(), function(e) {\n var inputLabel = inputGraph.edge(e);\n var layoutLabel = layoutGraph.edge(e);\n\n inputLabel.points = layoutLabel.points;\n if (_.has(layoutLabel, \"x\")) {\n inputLabel.x = layoutLabel.x;\n inputLabel.y = layoutLabel.y;\n }\n });\n\n inputGraph.graph().width = layoutGraph.graph().width;\n inputGraph.graph().height = layoutGraph.graph().height;\n}\n\nvar graphNumAttrs = [\"nodesep\", \"edgesep\", \"ranksep\", \"marginx\", \"marginy\"];\nvar graphDefaults = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: \"tb\" };\nvar graphAttrs = [\"acyclicer\", \"ranker\", \"rankdir\", \"align\"];\nvar nodeNumAttrs = [\"width\", \"height\"];\nvar nodeDefaults = { width: 0, height: 0 };\nvar edgeNumAttrs = [\"minlen\", \"weight\", \"width\", \"height\", \"labeloffset\"];\nvar edgeDefaults = {\n minlen: 1, weight: 1, width: 0, height: 0,\n labeloffset: 10, labelpos: \"r\"\n};\nvar edgeAttrs = [\"labelpos\"];\n\n/*\n * Constructs a new graph from the input graph, which can be used for layout.\n * This process copies only whitelisted attributes from the input graph to the\n * layout graph. Thus this function serves as a good place to determine what\n * attributes can influence layout.\n */\nfunction buildLayoutGraph(inputGraph) {\n var g = new Graph({ multigraph: true, compound: true });\n var graph = canonicalize(inputGraph.graph());\n\n g.setGraph(_.merge({},\n graphDefaults,\n selectNumberAttrs(graph, graphNumAttrs),\n _.pick(graph, graphAttrs)));\n\n _.forEach(inputGraph.nodes(), function(v) {\n var node = canonicalize(inputGraph.node(v));\n g.setNode(v, _.defaults(selectNumberAttrs(node, nodeNumAttrs), nodeDefaults));\n g.setParent(v, inputGraph.parent(v));\n });\n\n _.forEach(inputGraph.edges(), function(e) {\n var edge = canonicalize(inputGraph.edge(e));\n g.setEdge(e, _.merge({},\n edgeDefaults,\n selectNumberAttrs(edge, edgeNumAttrs),\n _.pick(edge, edgeAttrs)));\n });\n\n return g;\n}\n\n/*\n * This idea comes from the Gansner paper: to account for edge labels in our\n * layout we split each rank in half by doubling minlen and halving ranksep.\n * Then we can place labels at these mid-points between nodes.\n *\n * We also add some minimal padding to the width to push the label for the edge\n * away from the edge itself a bit.\n */\nfunction makeSpaceForEdgeLabels(g) {\n var graph = g.graph();\n graph.ranksep /= 2;\n _.forEach(g.edges(), function(e) {\n var edge = g.edge(e);\n edge.minlen *= 2;\n if (edge.labelpos.toLowerCase() !== \"c\") {\n if (graph.rankdir === \"TB\" || graph.rankdir === \"BT\") {\n edge.width += edge.labeloffset;\n } else {\n edge.height += edge.labeloffset;\n }\n }\n });\n}\n\n/*\n * Creates temporary dummy nodes that capture the rank in which each edge's\n * label is going to, if it has one of non-zero width and height. We do this\n * so that we can safely remove empty ranks while preserving balance for the\n * label's position.\n */\nfunction injectEdgeLabelProxies(g) {\n _.forEach(g.edges(), function(e) {\n var edge = g.edge(e);\n if (edge.width && edge.height) {\n var v = g.node(e.v);\n var w = g.node(e.w);\n var label = { rank: (w.rank - v.rank) / 2 + v.rank, e: e };\n util.addDummyNode(g, \"edge-proxy\", label, \"_ep\");\n }\n });\n}\n\nfunction assignRankMinMax(g) {\n var maxRank = 0;\n _.forEach(g.nodes(), function(v) {\n var node = g.node(v);\n if (node.borderTop) {\n node.minRank = g.node(node.borderTop).rank;\n node.maxRank = g.node(node.borderBottom).rank;\n maxRank = _.max(maxRank, node.maxRank);\n }\n });\n g.graph().maxRank = maxRank;\n}\n\nfunction removeEdgeLabelProxies(g) {\n _.forEach(g.nodes(), function(v) {\n var node = g.node(v);\n if (node.dummy === \"edge-proxy\") {\n g.edge(node.e).labelRank = node.rank;\n g.removeNode(v);\n }\n });\n}\n\nfunction translateGraph(g) {\n var minX = Number.POSITIVE_INFINITY;\n var maxX = 0;\n var minY = Number.POSITIVE_INFINITY;\n var maxY = 0;\n var graphLabel = g.graph();\n var marginX = graphLabel.marginx || 0;\n var marginY = graphLabel.marginy || 0;\n\n function getExtremes(attrs) {\n var x = attrs.x;\n var y = attrs.y;\n var w = attrs.width;\n var h = attrs.height;\n minX = Math.min(minX, x - w / 2);\n maxX = Math.max(maxX, x + w / 2);\n minY = Math.min(minY, y - h / 2);\n maxY = Math.max(maxY, y + h / 2);\n }\n\n _.forEach(g.nodes(), function(v) { getExtremes(g.node(v)); });\n _.forEach(g.edges(), function(e) {\n var edge = g.edge(e);\n if (_.has(edge, \"x\")) {\n getExtremes(edge);\n }\n });\n\n minX -= marginX;\n minY -= marginY;\n\n _.forEach(g.nodes(), function(v) {\n var node = g.node(v);\n node.x -= minX;\n node.y -= minY;\n });\n\n _.forEach(g.edges(), function(e) {\n var edge = g.edge(e);\n _.forEach(edge.points, function(p) {\n p.x -= minX;\n p.y -= minY;\n });\n if (_.has(edge, \"x\")) { edge.x -= minX; }\n if (_.has(edge, \"y\")) { edge.y -= minY; }\n });\n\n graphLabel.width = maxX - minX + marginX;\n graphLabel.height = maxY - minY + marginY;\n}\n\nfunction assignNodeIntersects(g) {\n _.forEach(g.edges(), function(e) {\n var edge = g.edge(e);\n var nodeV = g.node(e.v);\n var nodeW = g.node(e.w);\n var p1, p2;\n if (!edge.points) {\n edge.points = [];\n p1 = nodeW;\n p2 = nodeV;\n } else {\n p1 = edge.points[0];\n p2 = edge.points[edge.points.length - 1];\n }\n edge.points.unshift(util.intersectRect(nodeV, p1));\n edge.points.push(util.intersectRect(nodeW, p2));\n });\n}\n\nfunction fixupEdgeLabelCoords(g) {\n _.forEach(g.edges(), function(e) {\n var edge = g.edge(e);\n if (_.has(edge, \"x\")) {\n if (edge.labelpos === \"l\" || edge.labelpos === \"r\") {\n edge.width -= edge.labeloffset;\n }\n switch (edge.labelpos) {\n case \"l\": edge.x -= edge.width / 2 + edge.labeloffset; break;\n case \"r\": edge.x += edge.width / 2 + edge.labeloffset; break;\n }\n }\n });\n}\n\nfunction reversePointsForReversedEdges(g) {\n _.forEach(g.edges(), function(e) {\n var edge = g.edge(e);\n if (edge.reversed) {\n edge.points.reverse();\n }\n });\n}\n\nfunction removeBorderNodes(g) {\n _.forEach(g.nodes(), function(v) {\n if (g.children(v).length) {\n var node = g.node(v);\n var t = g.node(node.borderTop);\n var b = g.node(node.borderBottom);\n var l = g.node(_.last(node.borderLeft));\n var r = g.node(_.last(node.borderRight));\n\n node.width = Math.abs(r.x - l.x);\n node.height = Math.abs(b.y - t.y);\n node.x = l.x + node.width / 2;\n node.y = t.y + node.height / 2;\n }\n });\n\n _.forEach(g.nodes(), function(v) {\n if (g.node(v).dummy === \"border\") {\n g.removeNode(v);\n }\n });\n}\n\nfunction removeSelfEdges(g) {\n _.forEach(g.edges(), function(e) {\n if (e.v === e.w) {\n var node = g.node(e.v);\n if (!node.selfEdges) {\n node.selfEdges = [];\n }\n node.selfEdges.push({ e: e, label: g.edge(e) });\n g.removeEdge(e);\n }\n });\n}\n\nfunction insertSelfEdges(g) {\n var layers = util.buildLayerMatrix(g);\n _.forEach(layers, function(layer) {\n var orderShift = 0;\n _.forEach(layer, function(v, i) {\n var node = g.node(v);\n node.order = i + orderShift;\n _.forEach(node.selfEdges, function(selfEdge) {\n util.addDummyNode(g, \"selfedge\", {\n width: selfEdge.label.width,\n height: selfEdge.label.height,\n rank: node.rank,\n order: i + (++orderShift),\n e: selfEdge.e,\n label: selfEdge.label\n }, \"_se\");\n });\n delete node.selfEdges;\n });\n });\n}\n\nfunction positionSelfEdges(g) {\n _.forEach(g.nodes(), function(v) {\n var node = g.node(v);\n if (node.dummy === \"selfedge\") {\n var selfNode = g.node(node.e.v);\n var x = selfNode.x + selfNode.width / 2;\n var y = selfNode.y;\n var dx = node.x - x;\n var dy = selfNode.height / 2;\n g.setEdge(node.e, node.label);\n g.removeNode(v);\n node.label.points = [\n { x: x + 2 * dx / 3, y: y - dy },\n { x: x + 5 * dx / 6, y: y - dy },\n { x: x + dx , y: y },\n { x: x + 5 * dx / 6, y: y + dy },\n { x: x + 2 * dx / 3, y: y + dy }\n ];\n node.label.x = node.x;\n node.label.y = node.y;\n }\n });\n}\n\nfunction selectNumberAttrs(obj, attrs) {\n return _.mapValues(_.pick(obj, attrs), Number);\n}\n\nfunction canonicalize(attrs) {\n var newAttrs = {};\n _.forEach(attrs, function(v, k) {\n newAttrs[k.toLowerCase()] = v;\n });\n return newAttrs;\n}\n","var _ = require(\"./lodash\");\nvar util = require(\"./util\");\nvar Graph = require(\"./graphlib\").Graph;\n\nmodule.exports = {\n debugOrdering: debugOrdering\n};\n\n/* istanbul ignore next */\nfunction debugOrdering(g) {\n var layerMatrix = util.buildLayerMatrix(g);\n\n var h = new Graph({ compound: true, multigraph: true }).setGraph({});\n\n _.forEach(g.nodes(), function(v) {\n h.setNode(v, { label: v });\n h.setParent(v, \"layer\" + g.node(v).rank);\n });\n\n _.forEach(g.edges(), function(e) {\n h.setEdge(e.v, e.w, {}, e.name);\n });\n\n _.forEach(layerMatrix, function(layer, i) {\n var layerV = \"layer\" + i;\n h.setNode(layerV, { rank: \"same\" });\n _.reduce(layer, function(u, v) {\n h.setEdge(u, v, { style: \"invis\" });\n return v;\n });\n });\n\n return h;\n}\n","module.exports = \"0.8.5\";\n","/*\nCopyright (c) 2012-2014 Chris Pettitt\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n*/\n\nmodule.exports = {\n graphlib: require(\"./lib/graphlib\"),\n\n layout: require(\"./lib/layout\"),\n debug: require(\"./lib/debug\"),\n util: {\n time: require(\"./lib/util\").time,\n notime: require(\"./lib/util\").notime\n },\n version: require(\"./lib/version\")\n};\n","export default function(x) {\n return function constant() {\n return x;\n };\n}\n","export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","const pi = Math.PI,\n tau = 2 * pi,\n epsilon = 1e-6,\n tauEpsilon = tau - epsilon;\n\nfunction append(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += arguments[i] + strings[i];\n }\n}\n\nfunction appendRound(digits) {\n let d = Math.floor(digits);\n if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`);\n if (d > 15) return append;\n const k = 10 ** d;\n return function(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += Math.round(arguments[i] * k) / k + strings[i];\n }\n };\n}\n\nexport class Path {\n constructor(digits) {\n this._x0 = this._y0 = // start of current subpath\n this._x1 = this._y1 = null; // end of current subpath\n this._ = \"\";\n this._append = digits == null ? append : appendRound(digits);\n }\n moveTo(x, y) {\n this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;\n }\n closePath() {\n if (this._x1 !== null) {\n this._x1 = this._x0, this._y1 = this._y0;\n this._append`Z`;\n }\n }\n lineTo(x, y) {\n this._append`L${this._x1 = +x},${this._y1 = +y}`;\n }\n quadraticCurveTo(x1, y1, x, y) {\n this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;\n }\n bezierCurveTo(x1, y1, x2, y2, x, y) {\n this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;\n }\n arcTo(x1, y1, x2, y2, r) {\n x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let x0 = this._x1,\n y0 = this._y1,\n x21 = x2 - x1,\n y21 = y2 - y1,\n x01 = x0 - x1,\n y01 = y0 - y1,\n l01_2 = x01 * x01 + y01 * y01;\n\n // Is this path empty? Move to (x1,y1).\n if (this._x1 === null) {\n this._append`M${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.\n else if (!(l01_2 > epsilon));\n\n // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?\n // Equivalently, is (x1,y1) coincident with (x2,y2)?\n // Or, is the radius zero? Line to (x1,y1).\n else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {\n this._append`L${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Otherwise, draw an arc!\n else {\n let x20 = x2 - x0,\n y20 = y2 - y0,\n l21_2 = x21 * x21 + y21 * y21,\n l20_2 = x20 * x20 + y20 * y20,\n l21 = Math.sqrt(l21_2),\n l01 = Math.sqrt(l01_2),\n l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),\n t01 = l / l01,\n t21 = l / l21;\n\n // If the start tangent is not coincident with (x0,y0), line to.\n if (Math.abs(t01 - 1) > epsilon) {\n this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;\n }\n\n this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;\n }\n }\n arc(x, y, r, a0, a1, ccw) {\n x = +x, y = +y, r = +r, ccw = !!ccw;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let dx = r * Math.cos(a0),\n dy = r * Math.sin(a0),\n x0 = x + dx,\n y0 = y + dy,\n cw = 1 ^ ccw,\n da = ccw ? a0 - a1 : a1 - a0;\n\n // Is this path empty? Move to (x0,y0).\n if (this._x1 === null) {\n this._append`M${x0},${y0}`;\n }\n\n // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).\n else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {\n this._append`L${x0},${y0}`;\n }\n\n // Is this arc empty? We’re done.\n if (!r) return;\n\n // Does the angle go the wrong way? Flip the direction.\n if (da < 0) da = da % tau + tau;\n\n // Is this a complete circle? Draw two arcs to complete the circle.\n if (da > tauEpsilon) {\n this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;\n }\n\n // Is this arc non-empty? Draw an arc!\n else if (da > epsilon) {\n this._append`A${r},${r},0,${+(da >= pi)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;\n }\n }\n rect(x, y, w, h) {\n this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;\n }\n toString() {\n return this._;\n }\n}\n\nexport function path() {\n return new Path;\n}\n\n// Allow instanceof d3.path\npath.prototype = Path.prototype;\n\nexport function pathRound(digits = 3) {\n return new Path(+digits);\n}\n","export {Path, path, pathRound} from \"./path.js\";\n","import {Path} from \"d3-path\";\n\nexport function withPath(shape) {\n let digits = 3;\n\n shape.digits = function(_) {\n if (!arguments.length) return digits;\n if (_ == null) {\n digits = null;\n } else {\n const d = Math.floor(_);\n if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);\n digits = d;\n }\n return shape;\n };\n\n return () => new Path(digits);\n}\n","import constant from \"./constant.js\";\nimport {abs, acos, asin, atan2, cos, epsilon, halfPi, max, min, pi, sin, sqrt, tau} from \"./math.js\";\nimport {withPath} from \"./path.js\";\n\nfunction arcInnerRadius(d) {\n return d.innerRadius;\n}\n\nfunction arcOuterRadius(d) {\n return d.outerRadius;\n}\n\nfunction arcStartAngle(d) {\n return d.startAngle;\n}\n\nfunction arcEndAngle(d) {\n return d.endAngle;\n}\n\nfunction arcPadAngle(d) {\n return d && d.padAngle; // Note: optional!\n}\n\nfunction intersect(x0, y0, x1, y1, x2, y2, x3, y3) {\n var x10 = x1 - x0, y10 = y1 - y0,\n x32 = x3 - x2, y32 = y3 - y2,\n t = y32 * x10 - x32 * y10;\n if (t * t < epsilon) return;\n t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;\n return [x0 + t * x10, y0 + t * y10];\n}\n\n// Compute perpendicular offset line of length rc.\n// http://mathworld.wolfram.com/Circle-LineIntersection.html\nfunction cornerTangents(x0, y0, x1, y1, r1, rc, cw) {\n var x01 = x0 - x1,\n y01 = y0 - y1,\n lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),\n ox = lo * y01,\n oy = -lo * x01,\n x11 = x0 + ox,\n y11 = y0 + oy,\n x10 = x1 + ox,\n y10 = y1 + oy,\n x00 = (x11 + x10) / 2,\n y00 = (y11 + y10) / 2,\n dx = x10 - x11,\n dy = y10 - y11,\n d2 = dx * dx + dy * dy,\n r = r1 - rc,\n D = x11 * y10 - x10 * y11,\n d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)),\n cx0 = (D * dy - dx * d) / d2,\n cy0 = (-D * dx - dy * d) / d2,\n cx1 = (D * dy + dx * d) / d2,\n cy1 = (-D * dx + dy * d) / d2,\n dx0 = cx0 - x00,\n dy0 = cy0 - y00,\n dx1 = cx1 - x00,\n dy1 = cy1 - y00;\n\n // Pick the closer of the two intersection points.\n // TODO Is there a faster way to determine which intersection to use?\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;\n\n return {\n cx: cx0,\n cy: cy0,\n x01: -ox,\n y01: -oy,\n x11: cx0 * (r1 / r - 1),\n y11: cy0 * (r1 / r - 1)\n };\n}\n\nexport default function() {\n var innerRadius = arcInnerRadius,\n outerRadius = arcOuterRadius,\n cornerRadius = constant(0),\n padRadius = null,\n startAngle = arcStartAngle,\n endAngle = arcEndAngle,\n padAngle = arcPadAngle,\n context = null,\n path = withPath(arc);\n\n function arc() {\n var buffer,\n r,\n r0 = +innerRadius.apply(this, arguments),\n r1 = +outerRadius.apply(this, arguments),\n a0 = startAngle.apply(this, arguments) - halfPi,\n a1 = endAngle.apply(this, arguments) - halfPi,\n da = abs(a1 - a0),\n cw = a1 > a0;\n\n if (!context) context = buffer = path();\n\n // Ensure that the outer radius is always larger than the inner radius.\n if (r1 < r0) r = r1, r1 = r0, r0 = r;\n\n // Is it a point?\n if (!(r1 > epsilon)) context.moveTo(0, 0);\n\n // Or is it a circle or annulus?\n else if (da > tau - epsilon) {\n context.moveTo(r1 * cos(a0), r1 * sin(a0));\n context.arc(0, 0, r1, a0, a1, !cw);\n if (r0 > epsilon) {\n context.moveTo(r0 * cos(a1), r0 * sin(a1));\n context.arc(0, 0, r0, a1, a0, cw);\n }\n }\n\n // Or is it a circular or annular sector?\n else {\n var a01 = a0,\n a11 = a1,\n a00 = a0,\n a10 = a1,\n da0 = da,\n da1 = da,\n ap = padAngle.apply(this, arguments) / 2,\n rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),\n rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),\n rc0 = rc,\n rc1 = rc,\n t0,\n t1;\n\n // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.\n if (rp > epsilon) {\n var p0 = asin(rp / r0 * sin(ap)),\n p1 = asin(rp / r1 * sin(ap));\n if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;\n else da0 = 0, a00 = a10 = (a0 + a1) / 2;\n if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;\n else da1 = 0, a01 = a11 = (a0 + a1) / 2;\n }\n\n var x01 = r1 * cos(a01),\n y01 = r1 * sin(a01),\n x10 = r0 * cos(a10),\n y10 = r0 * sin(a10);\n\n // Apply rounded corners?\n if (rc > epsilon) {\n var x11 = r1 * cos(a11),\n y11 = r1 * sin(a11),\n x00 = r0 * cos(a00),\n y00 = r0 * sin(a00),\n oc;\n\n // Restrict the corner radius according to the sector angle. If this\n // intersection fails, it’s probably because the arc is too small, so\n // disable the corner radius entirely.\n if (da < pi) {\n if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {\n var ax = x01 - oc[0],\n ay = y01 - oc[1],\n bx = x11 - oc[0],\n by = y11 - oc[1],\n kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),\n lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);\n rc0 = min(rc, (r0 - lc) / (kc - 1));\n rc1 = min(rc, (r1 - lc) / (kc + 1));\n } else {\n rc0 = rc1 = 0;\n }\n }\n }\n\n // Is the sector collapsed to a line?\n if (!(da1 > epsilon)) context.moveTo(x01, y01);\n\n // Does the sector’s outer ring have rounded corners?\n else if (rc1 > epsilon) {\n t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);\n t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);\n\n context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);\n context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the outer ring just a circular arc?\n else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);\n\n // Is there no inner ring, and it’s a circular sector?\n // Or perhaps it’s an annular sector collapsed due to padding?\n if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10);\n\n // Does the sector’s inner ring (or point) have rounded corners?\n else if (rc0 > epsilon) {\n t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);\n t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);\n\n context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);\n context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the inner ring just a circular arc?\n else context.arc(0, 0, r0, a10, a00, cw);\n }\n\n context.closePath();\n\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n arc.centroid = function() {\n var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,\n a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;\n return [cos(a) * r, sin(a) * r];\n };\n\n arc.innerRadius = function(_) {\n return arguments.length ? (innerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : innerRadius;\n };\n\n arc.outerRadius = function(_) {\n return arguments.length ? (outerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : outerRadius;\n };\n\n arc.cornerRadius = function(_) {\n return arguments.length ? (cornerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : cornerRadius;\n };\n\n arc.padRadius = function(_) {\n return arguments.length ? (padRadius = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), arc) : padRadius;\n };\n\n arc.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : startAngle;\n };\n\n arc.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : endAngle;\n };\n\n arc.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : padAngle;\n };\n\n arc.context = function(_) {\n return arguments.length ? ((context = _ == null ? null : _), arc) : context;\n };\n\n return arc;\n}\n","export var slice = Array.prototype.slice;\n\nexport default function(x) {\n return typeof x === \"object\" && \"length\" in x\n ? x // Array, TypedArray, NodeList, array-like\n : Array.from(x); // Map, Set, iterable, string, or anything else\n}\n","function Linear(context) {\n this._context = context;\n}\n\nLinear.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // falls through\n default: this._context.lineTo(x, y); break;\n }\n }\n};\n\nexport default function(context) {\n return new Linear(context);\n}\n","export function x(p) {\n return p[0];\n}\n\nexport function y(p) {\n return p[1];\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport curveLinear from \"./curve/linear.js\";\nimport {withPath} from \"./path.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nexport default function(x, y) {\n var defined = constant(true),\n context = null,\n curve = curveLinear,\n output = null,\n path = withPath(line);\n\n x = typeof x === \"function\" ? x : (x === undefined) ? pointX : constant(x);\n y = typeof y === \"function\" ? y : (y === undefined) ? pointY : constant(y);\n\n function line(data) {\n var i,\n n = (data = array(data)).length,\n d,\n defined0 = false,\n buffer;\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) output.lineStart();\n else output.lineEnd();\n }\n if (defined0) output.point(+x(d, i, data), +y(d, i, data));\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n line.x = function(_) {\n return arguments.length ? (x = typeof _ === \"function\" ? _ : constant(+_), line) : x;\n };\n\n line.y = function(_) {\n return arguments.length ? (y = typeof _ === \"function\" ? _ : constant(+_), line) : y;\n };\n\n line.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), line) : defined;\n };\n\n line.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;\n };\n\n line.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;\n };\n\n return line;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport curveLinear from \"./curve/linear.js\";\nimport line from \"./line.js\";\nimport {withPath} from \"./path.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nexport default function(x0, y0, y1) {\n var x1 = null,\n defined = constant(true),\n context = null,\n curve = curveLinear,\n output = null,\n path = withPath(area);\n\n x0 = typeof x0 === \"function\" ? x0 : (x0 === undefined) ? pointX : constant(+x0);\n y0 = typeof y0 === \"function\" ? y0 : (y0 === undefined) ? constant(0) : constant(+y0);\n y1 = typeof y1 === \"function\" ? y1 : (y1 === undefined) ? pointY : constant(+y1);\n\n function area(data) {\n var i,\n j,\n k,\n n = (data = array(data)).length,\n d,\n defined0 = false,\n buffer,\n x0z = new Array(n),\n y0z = new Array(n);\n\n if (context == null) output = curve(buffer = path());\n\n for (i = 0; i <= n; ++i) {\n if (!(i < n && defined(d = data[i], i, data)) === defined0) {\n if (defined0 = !defined0) {\n j = i;\n output.areaStart();\n output.lineStart();\n } else {\n output.lineEnd();\n output.lineStart();\n for (k = i - 1; k >= j; --k) {\n output.point(x0z[k], y0z[k]);\n }\n output.lineEnd();\n output.areaEnd();\n }\n }\n if (defined0) {\n x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);\n output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);\n }\n }\n\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n function arealine() {\n return line().defined(defined).curve(curve).context(context);\n }\n\n area.x = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), x1 = null, area) : x0;\n };\n\n area.x0 = function(_) {\n return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), area) : x0;\n };\n\n area.x1 = function(_) {\n return arguments.length ? (x1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area) : x1;\n };\n\n area.y = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), y1 = null, area) : y0;\n };\n\n area.y0 = function(_) {\n return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), area) : y0;\n };\n\n area.y1 = function(_) {\n return arguments.length ? (y1 = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), area) : y1;\n };\n\n area.lineX0 =\n area.lineY0 = function() {\n return arealine().x(x0).y(y0);\n };\n\n area.lineY1 = function() {\n return arealine().x(x0).y(y1);\n };\n\n area.lineX1 = function() {\n return arealine().x(x1).y(y0);\n };\n\n area.defined = function(_) {\n return arguments.length ? (defined = typeof _ === \"function\" ? _ : constant(!!_), area) : defined;\n };\n\n area.curve = function(_) {\n return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;\n };\n\n area.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;\n };\n\n return area;\n}\n","export default function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n}\n","export default function(d) {\n return d;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport descending from \"./descending.js\";\nimport identity from \"./identity.js\";\nimport {tau} from \"./math.js\";\n\nexport default function() {\n var value = identity,\n sortValues = descending,\n sort = null,\n startAngle = constant(0),\n endAngle = constant(tau),\n padAngle = constant(0);\n\n function pie(data) {\n var i,\n n = (data = array(data)).length,\n j,\n k,\n sum = 0,\n index = new Array(n),\n arcs = new Array(n),\n a0 = +startAngle.apply(this, arguments),\n da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),\n a1,\n p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),\n pa = p * (da < 0 ? -1 : 1),\n v;\n\n for (i = 0; i < n; ++i) {\n if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {\n sum += v;\n }\n }\n\n // Optionally sort the arcs by previously-computed values or by data.\n if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });\n else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });\n\n // Compute the arcs! They are stored in the original data's order.\n for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {\n j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {\n data: data[j],\n index: i,\n value: v,\n startAngle: a0,\n endAngle: a1,\n padAngle: p\n };\n }\n\n return arcs;\n }\n\n pie.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), pie) : value;\n };\n\n pie.sortValues = function(_) {\n return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;\n };\n\n pie.sort = function(_) {\n return arguments.length ? (sort = _, sortValues = null, pie) : sort;\n };\n\n pie.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : startAngle;\n };\n\n pie.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : endAngle;\n };\n\n pie.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : padAngle;\n };\n\n return pie;\n}\n","import curveLinear from \"./linear.js\";\n\nexport var curveRadialLinear = curveRadial(curveLinear);\n\nfunction Radial(curve) {\n this._curve = curve;\n}\n\nRadial.prototype = {\n areaStart: function() {\n this._curve.areaStart();\n },\n areaEnd: function() {\n this._curve.areaEnd();\n },\n lineStart: function() {\n this._curve.lineStart();\n },\n lineEnd: function() {\n this._curve.lineEnd();\n },\n point: function(a, r) {\n this._curve.point(r * Math.sin(a), r * -Math.cos(a));\n }\n};\n\nexport default function curveRadial(curve) {\n\n function radial(context) {\n return new Radial(curve(context));\n }\n\n radial._curve = curve;\n\n return radial;\n}\n","import curveRadial, {curveRadialLinear} from \"./curve/radial.js\";\nimport line from \"./line.js\";\n\nexport function lineRadial(l) {\n var c = l.curve;\n\n l.angle = l.x, delete l.x;\n l.radius = l.y, delete l.y;\n\n l.curve = function(_) {\n return arguments.length ? c(curveRadial(_)) : c()._curve;\n };\n\n return l;\n}\n\nexport default function() {\n return lineRadial(line().curve(curveRadialLinear));\n}\n","import curveRadial, {curveRadialLinear} from \"./curve/radial.js\";\nimport area from \"./area.js\";\nimport {lineRadial} from \"./lineRadial.js\";\n\nexport default function() {\n var a = area().curve(curveRadialLinear),\n c = a.curve,\n x0 = a.lineX0,\n x1 = a.lineX1,\n y0 = a.lineY0,\n y1 = a.lineY1;\n\n a.angle = a.x, delete a.x;\n a.startAngle = a.x0, delete a.x0;\n a.endAngle = a.x1, delete a.x1;\n a.radius = a.y, delete a.y;\n a.innerRadius = a.y0, delete a.y0;\n a.outerRadius = a.y1, delete a.y1;\n a.lineStartAngle = function() { return lineRadial(x0()); }, delete a.lineX0;\n a.lineEndAngle = function() { return lineRadial(x1()); }, delete a.lineX1;\n a.lineInnerRadius = function() { return lineRadial(y0()); }, delete a.lineY0;\n a.lineOuterRadius = function() { return lineRadial(y1()); }, delete a.lineY1;\n\n a.curve = function(_) {\n return arguments.length ? c(curveRadial(_)) : c()._curve;\n };\n\n return a;\n}\n","export default function(x, y) {\n return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)];\n}\n","import pointRadial from \"../pointRadial.js\";\n\nclass Bump {\n constructor(context, x) {\n this._context = context;\n this._x = x;\n }\n areaStart() {\n this._line = 0;\n }\n areaEnd() {\n this._line = NaN;\n }\n lineStart() {\n this._point = 0;\n }\n lineEnd() {\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n }\n point(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: {\n this._point = 1;\n if (this._line) this._context.lineTo(x, y);\n else this._context.moveTo(x, y);\n break;\n }\n case 1: this._point = 2; // falls through\n default: {\n if (this._x) this._context.bezierCurveTo(this._x0 = (this._x0 + x) / 2, this._y0, this._x0, y, x, y);\n else this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + y) / 2, x, this._y0, x, y);\n break;\n }\n }\n this._x0 = x, this._y0 = y;\n }\n}\n\nclass BumpRadial {\n constructor(context) {\n this._context = context;\n }\n lineStart() {\n this._point = 0;\n }\n lineEnd() {}\n point(x, y) {\n x = +x, y = +y;\n if (this._point === 0) {\n this._point = 1;\n } else {\n const p0 = pointRadial(this._x0, this._y0);\n const p1 = pointRadial(this._x0, this._y0 = (this._y0 + y) / 2);\n const p2 = pointRadial(x, this._y0);\n const p3 = pointRadial(x, y);\n this._context.moveTo(...p0);\n this._context.bezierCurveTo(...p1, ...p2, ...p3);\n }\n this._x0 = x, this._y0 = y;\n }\n}\n\nexport function bumpX(context) {\n return new Bump(context, true);\n}\n\nexport function bumpY(context) {\n return new Bump(context, false);\n}\n\nexport function bumpRadial(context) {\n return new BumpRadial(context);\n}\n","import {slice} from \"./array.js\";\nimport constant from \"./constant.js\";\nimport {bumpX, bumpY, bumpRadial} from \"./curve/bump.js\";\nimport {withPath} from \"./path.js\";\nimport {x as pointX, y as pointY} from \"./point.js\";\n\nfunction linkSource(d) {\n return d.source;\n}\n\nfunction linkTarget(d) {\n return d.target;\n}\n\nexport function link(curve) {\n let source = linkSource,\n target = linkTarget,\n x = pointX,\n y = pointY,\n context = null,\n output = null,\n path = withPath(link);\n\n function link() {\n let buffer;\n const argv = slice.call(arguments);\n const s = source.apply(this, argv);\n const t = target.apply(this, argv);\n if (context == null) output = curve(buffer = path());\n output.lineStart();\n argv[0] = s, output.point(+x.apply(this, argv), +y.apply(this, argv));\n argv[0] = t, output.point(+x.apply(this, argv), +y.apply(this, argv));\n output.lineEnd();\n if (buffer) return output = null, buffer + \"\" || null;\n }\n\n link.source = function(_) {\n return arguments.length ? (source = _, link) : source;\n };\n\n link.target = function(_) {\n return arguments.length ? (target = _, link) : target;\n };\n\n link.x = function(_) {\n return arguments.length ? (x = typeof _ === \"function\" ? _ : constant(+_), link) : x;\n };\n\n link.y = function(_) {\n return arguments.length ? (y = typeof _ === \"function\" ? _ : constant(+_), link) : y;\n };\n\n link.context = function(_) {\n return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), link) : context;\n };\n\n return link;\n}\n\nexport function linkHorizontal() {\n return link(bumpX);\n}\n\nexport function linkVertical() {\n return link(bumpY);\n}\n\nexport function linkRadial() {\n const l = link(bumpRadial);\n l.angle = l.x, delete l.x;\n l.radius = l.y, delete l.y;\n return l;\n}\n","import {min, sqrt} from \"../math.js\";\n\nconst sqrt3 = sqrt(3);\n\nexport default {\n draw(context, size) {\n const r = sqrt(size + min(size / 28, 0.75)) * 0.59436;\n const t = r / 2;\n const u = t * sqrt3;\n context.moveTo(0, r);\n context.lineTo(0, -r);\n context.moveTo(-u, -t);\n context.lineTo(u, t);\n context.moveTo(-u, t);\n context.lineTo(u, -t);\n }\n};\n","import {pi, sqrt, tau} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size / pi);\n context.moveTo(r, 0);\n context.arc(0, 0, r, 0, tau);\n }\n};\n","import {sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size / 5) / 2;\n context.moveTo(-3 * r, -r);\n context.lineTo(-r, -r);\n context.lineTo(-r, -3 * r);\n context.lineTo(r, -3 * r);\n context.lineTo(r, -r);\n context.lineTo(3 * r, -r);\n context.lineTo(3 * r, r);\n context.lineTo(r, r);\n context.lineTo(r, 3 * r);\n context.lineTo(-r, 3 * r);\n context.lineTo(-r, r);\n context.lineTo(-3 * r, r);\n context.closePath();\n }\n};\n","import {sqrt} from \"../math.js\";\n\nconst tan30 = sqrt(1 / 3);\nconst tan30_2 = tan30 * 2;\n\nexport default {\n draw(context, size) {\n const y = sqrt(size / tan30_2);\n const x = y * tan30;\n context.moveTo(0, -y);\n context.lineTo(x, 0);\n context.lineTo(0, y);\n context.lineTo(-x, 0);\n context.closePath();\n }\n};\n","import {sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size) * 0.62625;\n context.moveTo(0, -r);\n context.lineTo(r, 0);\n context.lineTo(0, r);\n context.lineTo(-r, 0);\n context.closePath();\n }\n};\n","import {min, sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size - min(size / 7, 2)) * 0.87559;\n context.moveTo(-r, 0);\n context.lineTo(r, 0);\n context.moveTo(0, r);\n context.lineTo(0, -r);\n }\n};\n","import {sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const w = sqrt(size);\n const x = -w / 2;\n context.rect(x, x, w, w);\n }\n};\n","import {sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size) * 0.4431;\n context.moveTo(r, r);\n context.lineTo(r, -r);\n context.lineTo(-r, -r);\n context.lineTo(-r, r);\n context.closePath();\n }\n};\n","import {sin, cos, sqrt, pi, tau} from \"../math.js\";\n\nconst ka = 0.89081309152928522810;\nconst kr = sin(pi / 10) / sin(7 * pi / 10);\nconst kx = sin(tau / 10) * kr;\nconst ky = -cos(tau / 10) * kr;\n\nexport default {\n draw(context, size) {\n const r = sqrt(size * ka);\n const x = kx * r;\n const y = ky * r;\n context.moveTo(0, -r);\n context.lineTo(x, y);\n for (let i = 1; i < 5; ++i) {\n const a = tau * i / 5;\n const c = cos(a);\n const s = sin(a);\n context.lineTo(s * r, -c * r);\n context.lineTo(c * x - s * y, s * x + c * y);\n }\n context.closePath();\n }\n};\n","import {sqrt} from \"../math.js\";\n\nconst sqrt3 = sqrt(3);\n\nexport default {\n draw(context, size) {\n const y = -sqrt(size / (sqrt3 * 3));\n context.moveTo(0, y * 2);\n context.lineTo(-sqrt3 * y, -y);\n context.lineTo(sqrt3 * y, -y);\n context.closePath();\n }\n};\n","import {sqrt} from \"../math.js\";\n\nconst sqrt3 = sqrt(3);\n\nexport default {\n draw(context, size) {\n const s = sqrt(size) * 0.6824;\n const t = s / 2;\n const u = (s * sqrt3) / 2; // cos(Math.PI / 6)\n context.moveTo(0, -s);\n context.lineTo(u, t);\n context.lineTo(-u, t);\n context.closePath();\n }\n};\n","import {sqrt} from \"../math.js\";\n\nconst c = -0.5;\nconst s = sqrt(3) / 2;\nconst k = 1 / sqrt(12);\nconst a = (k / 2 + 1) * 3;\n\nexport default {\n draw(context, size) {\n const r = sqrt(size / a);\n const x0 = r / 2, y0 = r * k;\n const x1 = x0, y1 = r * k + r;\n const x2 = -x1, y2 = y1;\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n context.lineTo(c * x0 - s * y0, s * x0 + c * y0);\n context.lineTo(c * x1 - s * y1, s * x1 + c * y1);\n context.lineTo(c * x2 - s * y2, s * x2 + c * y2);\n context.lineTo(c * x0 + s * y0, c * y0 - s * x0);\n context.lineTo(c * x1 + s * y1, c * y1 - s * x1);\n context.lineTo(c * x2 + s * y2, c * y2 - s * x2);\n context.closePath();\n }\n};\n","import {min, sqrt} from \"../math.js\";\n\nexport default {\n draw(context, size) {\n const r = sqrt(size - min(size / 6, 1.7)) * 0.6189;\n context.moveTo(-r, -r);\n context.lineTo(r, r);\n context.moveTo(-r, r);\n context.lineTo(r, -r);\n }\n};\n","import constant from \"./constant.js\";\nimport {withPath} from \"./path.js\";\nimport asterisk from \"./symbol/asterisk.js\";\nimport circle from \"./symbol/circle.js\";\nimport cross from \"./symbol/cross.js\";\nimport diamond from \"./symbol/diamond.js\";\nimport diamond2 from \"./symbol/diamond2.js\";\nimport plus from \"./symbol/plus.js\";\nimport square from \"./symbol/square.js\";\nimport square2 from \"./symbol/square2.js\";\nimport star from \"./symbol/star.js\";\nimport triangle from \"./symbol/triangle.js\";\nimport triangle2 from \"./symbol/triangle2.js\";\nimport wye from \"./symbol/wye.js\";\nimport times from \"./symbol/times.js\";\n\n// These symbols are designed to be filled.\nexport const symbolsFill = [\n circle,\n cross,\n diamond,\n square,\n star,\n triangle,\n wye\n];\n\n// These symbols are designed to be stroked (with a width of 1.5px and round caps).\nexport const symbolsStroke = [\n circle,\n plus,\n times,\n triangle2,\n asterisk,\n square2,\n diamond2\n];\n\nexport default function Symbol(type, size) {\n let context = null,\n path = withPath(symbol);\n\n type = typeof type === \"function\" ? type : constant(type || circle);\n size = typeof size === \"function\" ? size : constant(size === undefined ? 64 : +size);\n\n function symbol() {\n let buffer;\n if (!context) context = buffer = path();\n type.apply(this, arguments).draw(context, +size.apply(this, arguments));\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n symbol.type = function(_) {\n return arguments.length ? (type = typeof _ === \"function\" ? _ : constant(_), symbol) : type;\n };\n\n symbol.size = function(_) {\n return arguments.length ? (size = typeof _ === \"function\" ? _ : constant(+_), symbol) : size;\n };\n\n symbol.context = function(_) {\n return arguments.length ? (context = _ == null ? null : _, symbol) : context;\n };\n\n return symbol;\n}\n","export default function() {}\n","export function point(that, x, y) {\n that._context.bezierCurveTo(\n (2 * that._x0 + that._x1) / 3,\n (2 * that._y0 + that._y1) / 3,\n (that._x0 + 2 * that._x1) / 3,\n (that._y0 + 2 * that._y1) / 3,\n (that._x0 + 4 * that._x1 + x) / 6,\n (that._y0 + 4 * that._y1 + y) / 6\n );\n}\n\nexport function Basis(context) {\n this._context = context;\n}\n\nBasis.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 3: point(this, this._x1, this._y1); // falls through\n case 2: this._context.lineTo(this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new Basis(context);\n}\n","import noop from \"../noop.js\";\nimport {point} from \"./basis.js\";\n\nfunction BasisClosed(context) {\n this._context = context;\n}\n\nBasisClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x2, this._y2);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);\n this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x2, this._y2);\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x2 = x, this._y2 = y; break;\n case 1: this._point = 2; this._x3 = x, this._y3 = y; break;\n case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new BasisClosed(context);\n}\n","import {point} from \"./basis.js\";\n\nfunction BasisOpen(context) {\n this._context = context;\n}\n\nBasisOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n }\n};\n\nexport default function(context) {\n return new BasisOpen(context);\n}\n","import {Basis} from \"./basis.js\";\n\nfunction Bundle(context, beta) {\n this._basis = new Basis(context);\n this._beta = beta;\n}\n\nBundle.prototype = {\n lineStart: function() {\n this._x = [];\n this._y = [];\n this._basis.lineStart();\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n j = x.length - 1;\n\n if (j > 0) {\n var x0 = x[0],\n y0 = y[0],\n dx = x[j] - x0,\n dy = y[j] - y0,\n i = -1,\n t;\n\n while (++i <= j) {\n t = i / j;\n this._basis.point(\n this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),\n this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)\n );\n }\n }\n\n this._x = this._y = null;\n this._basis.lineEnd();\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\nexport default (function custom(beta) {\n\n function bundle(context) {\n return beta === 1 ? new Basis(context) : new Bundle(context, beta);\n }\n\n bundle.beta = function(beta) {\n return custom(+beta);\n };\n\n return bundle;\n})(0.85);\n","export function point(that, x, y) {\n that._context.bezierCurveTo(\n that._x1 + that._k * (that._x2 - that._x0),\n that._y1 + that._k * (that._y2 - that._y0),\n that._x2 + that._k * (that._x1 - x),\n that._y2 + that._k * (that._y1 - y),\n that._x2,\n that._y2\n );\n}\n\nexport function Cardinal(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinal.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: point(this, this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; this._x1 = x, this._y1 = y; break;\n case 2: this._point = 3; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new Cardinal(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import noop from \"../noop.js\";\nimport {point} from \"./cardinal.js\";\n\nexport function CardinalClosed(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalClosed(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import {point} from \"./cardinal.js\";\n\nexport function CardinalOpen(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalOpen(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import {epsilon} from \"../math.js\";\nimport {Cardinal} from \"./cardinal.js\";\n\nexport function point(that, x, y) {\n var x1 = that._x1,\n y1 = that._y1,\n x2 = that._x2,\n y2 = that._y2;\n\n if (that._l01_a > epsilon) {\n var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,\n n = 3 * that._l01_a * (that._l01_a + that._l12_a);\n x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;\n y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;\n }\n\n if (that._l23_a > epsilon) {\n var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,\n m = 3 * that._l23_a * (that._l23_a + that._l12_a);\n x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;\n y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;\n }\n\n that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);\n}\n\nfunction CatmullRom(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRom.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: this.point(this._x2, this._y2); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; // falls through\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n","import {CardinalClosed} from \"./cardinalClosed.js\";\nimport noop from \"../noop.js\";\nimport {point} from \"./catmullRom.js\";\n\nfunction CatmullRomClosed(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n","import {CardinalOpen} from \"./cardinalOpen.js\";\nimport {point} from \"./catmullRom.js\";\n\nfunction CatmullRomOpen(context, alpha) {\n this._context = context;\n this._alpha = alpha;\n}\n\nCatmullRomOpen.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._l01_a = this._l12_a = this._l23_a =\n this._l01_2a = this._l12_2a = this._l23_2a =\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n\n if (this._point) {\n var x23 = this._x2 - x,\n y23 = this._y2 - y;\n this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n }\n\n switch (this._point) {\n case 0: this._point = 1; break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n case 3: this._point = 4; // falls through\n default: point(this, x, y); break;\n }\n\n this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(alpha) {\n\n function catmullRom(context) {\n return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);\n }\n\n catmullRom.alpha = function(alpha) {\n return custom(+alpha);\n };\n\n return catmullRom;\n})(0.5);\n","import noop from \"../noop.js\";\n\nfunction LinearClosed(context) {\n this._context = context;\n}\n\nLinearClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._point) this._context.closePath();\n },\n point: function(x, y) {\n x = +x, y = +y;\n if (this._point) this._context.lineTo(x, y);\n else this._point = 1, this._context.moveTo(x, y);\n }\n};\n\nexport default function(context) {\n return new LinearClosed(context);\n}\n","function sign(x) {\n return x < 0 ? -1 : 1;\n}\n\n// Calculate the slopes of the tangents (Hermite-type interpolation) based on\n// the following paper: Steffen, M. 1990. A Simple Method for Monotonic\n// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.\n// NOV(II), P. 443, 1990.\nfunction slope3(that, x2, y2) {\n var h0 = that._x1 - that._x0,\n h1 = x2 - that._x1,\n s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),\n s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),\n p = (s0 * h1 + s1 * h0) / (h0 + h1);\n return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n}\n\n// Calculate a one-sided slope.\nfunction slope2(that, t) {\n var h = that._x1 - that._x0;\n return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;\n}\n\n// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations\n// \"you can express cubic Hermite interpolation in terms of cubic Bézier curves\n// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1\".\nfunction point(that, t0, t1) {\n var x0 = that._x0,\n y0 = that._y0,\n x1 = that._x1,\n y1 = that._y1,\n dx = (x1 - x0) / 3;\n that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);\n}\n\nfunction MonotoneX(context) {\n this._context = context;\n}\n\nMonotoneX.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 =\n this._t0 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x1, this._y1); break;\n case 3: point(this, this._t0, slope2(this, this._t0)); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n var t1 = NaN;\n\n x = +x, y = +y;\n if (x === this._x1 && y === this._y1) return; // Ignore coincident points.\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; point(this, slope2(this, t1 = slope3(this, x, y)), t1); break;\n default: point(this, this._t0, t1 = slope3(this, x, y)); break;\n }\n\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n this._t0 = t1;\n }\n}\n\nfunction MonotoneY(context) {\n this._context = new ReflectContext(context);\n}\n\n(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {\n MonotoneX.prototype.point.call(this, y, x);\n};\n\nfunction ReflectContext(context) {\n this._context = context;\n}\n\nReflectContext.prototype = {\n moveTo: function(x, y) { this._context.moveTo(y, x); },\n closePath: function() { this._context.closePath(); },\n lineTo: function(x, y) { this._context.lineTo(y, x); },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }\n};\n\nexport function monotoneX(context) {\n return new MonotoneX(context);\n}\n\nexport function monotoneY(context) {\n return new MonotoneY(context);\n}\n","function Natural(context) {\n this._context = context;\n}\n\nNatural.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = [];\n this._y = [];\n },\n lineEnd: function() {\n var x = this._x,\n y = this._y,\n n = x.length;\n\n if (n) {\n this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);\n if (n === 2) {\n this._context.lineTo(x[1], y[1]);\n } else {\n var px = controlPoints(x),\n py = controlPoints(y);\n for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {\n this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);\n }\n }\n }\n\n if (this._line || (this._line !== 0 && n === 1)) this._context.closePath();\n this._line = 1 - this._line;\n this._x = this._y = null;\n },\n point: function(x, y) {\n this._x.push(+x);\n this._y.push(+y);\n }\n};\n\n// See https://www.particleincell.com/2012/bezier-splines/ for derivation.\nfunction controlPoints(x) {\n var i,\n n = x.length - 1,\n m,\n a = new Array(n),\n b = new Array(n),\n r = new Array(n);\n a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];\n for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];\n a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];\n for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];\n a[n - 1] = r[n - 1] / b[n - 1];\n for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];\n b[n - 1] = (x[n] + a[n - 1]) / 2;\n for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];\n return [a, b];\n}\n\nexport default function(context) {\n return new Natural(context);\n}\n","function Step(context, t) {\n this._context = context;\n this._t = t;\n}\n\nStep.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x = this._y = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // falls through\n default: {\n if (this._t <= 0) {\n this._context.lineTo(this._x, y);\n this._context.lineTo(x, y);\n } else {\n var x1 = this._x * (1 - this._t) + x * this._t;\n this._context.lineTo(x1, this._y);\n this._context.lineTo(x1, y);\n }\n break;\n }\n }\n this._x = x, this._y = y;\n }\n};\n\nexport default function(context) {\n return new Step(context, 0.5);\n}\n\nexport function stepBefore(context) {\n return new Step(context, 0);\n}\n\nexport function stepAfter(context) {\n return new Step(context, 1);\n}\n","export default function(series, order) {\n if (!((n = series.length) > 1)) return;\n for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) {\n s0 = s1, s1 = series[order[i]];\n for (j = 0; j < m; ++j) {\n s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1];\n }\n }\n}\n","export default function(series) {\n var n = series.length, o = new Array(n);\n while (--n >= 0) o[n] = n;\n return o;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport offsetNone from \"./offset/none.js\";\nimport orderNone from \"./order/none.js\";\n\nfunction stackValue(d, key) {\n return d[key];\n}\n\nfunction stackSeries(key) {\n const series = [];\n series.key = key;\n return series;\n}\n\nexport default function() {\n var keys = constant([]),\n order = orderNone,\n offset = offsetNone,\n value = stackValue;\n\n function stack(data) {\n var sz = Array.from(keys.apply(this, arguments), stackSeries),\n i, n = sz.length, j = -1,\n oz;\n\n for (const d of data) {\n for (i = 0, ++j; i < n; ++i) {\n (sz[i][j] = [0, +value(d, sz[i].key, j, data)]).data = d;\n }\n }\n\n for (i = 0, oz = array(order(sz)); i < n; ++i) {\n sz[oz[i]].index = i;\n }\n\n offset(sz, oz);\n return sz;\n }\n\n stack.keys = function(_) {\n return arguments.length ? (keys = typeof _ === \"function\" ? _ : constant(Array.from(_)), stack) : keys;\n };\n\n stack.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), stack) : value;\n };\n\n stack.order = function(_) {\n return arguments.length ? (order = _ == null ? orderNone : typeof _ === \"function\" ? _ : constant(Array.from(_)), stack) : order;\n };\n\n stack.offset = function(_) {\n return arguments.length ? (offset = _ == null ? offsetNone : _, stack) : offset;\n };\n\n return stack;\n}\n","import none from \"./none.js\";\n\nexport default function(series, order) {\n if (!((n = series.length) > 0)) return;\n for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) {\n for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0;\n if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y;\n }\n none(series, order);\n}\n","export default function(series, order) {\n if (!((n = series.length) > 0)) return;\n for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) {\n for (yp = yn = 0, i = 0; i < n; ++i) {\n if ((dy = (d = series[order[i]][j])[1] - d[0]) > 0) {\n d[0] = yp, d[1] = yp += dy;\n } else if (dy < 0) {\n d[1] = yn, d[0] = yn += dy;\n } else {\n d[0] = 0, d[1] = dy;\n }\n }\n }\n}\n","import none from \"./none.js\";\n\nexport default function(series, order) {\n if (!((n = series.length) > 0)) return;\n for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) {\n for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0;\n s0[j][1] += s0[j][0] = -y / 2;\n }\n none(series, order);\n}\n","import none from \"./none.js\";\n\nexport default function(series, order) {\n if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return;\n for (var y = 0, j = 1, s0, m, n; j < m; ++j) {\n for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) {\n var si = series[order[i]],\n sij0 = si[j][1] || 0,\n sij1 = si[j - 1][1] || 0,\n s3 = (sij0 - sij1) / 2;\n for (var k = 0; k < i; ++k) {\n var sk = series[order[k]],\n skj0 = sk[j][1] || 0,\n skj1 = sk[j - 1][1] || 0;\n s3 += skj0 - skj1;\n }\n s1 += sij0, s2 += s3 * sij0;\n }\n s0[j - 1][1] += s0[j - 1][0] = y;\n if (s1) y -= s2 / s1;\n }\n s0[j - 1][1] += s0[j - 1][0] = y;\n none(series, order);\n}\n","import none from \"./none.js\";\n\nexport default function(series) {\n var peaks = series.map(peak);\n return none(series).sort(function(a, b) { return peaks[a] - peaks[b]; });\n}\n\nfunction peak(series) {\n var i = -1, j = 0, n = series.length, vi, vj = -Infinity;\n while (++i < n) if ((vi = +series[i][1]) > vj) vj = vi, j = i;\n return j;\n}\n","import none from \"./none.js\";\n\nexport default function(series) {\n var sums = series.map(sum);\n return none(series).sort(function(a, b) { return sums[a] - sums[b]; });\n}\n\nexport function sum(series) {\n var s = 0, i = -1, n = series.length, v;\n while (++i < n) if (v = +series[i][1]) s += v;\n return s;\n}\n","import ascending from \"./ascending.js\";\n\nexport default function(series) {\n return ascending(series).reverse();\n}\n","import appearance from \"./appearance.js\";\nimport {sum} from \"./ascending.js\";\n\nexport default function(series) {\n var n = series.length,\n i,\n j,\n sums = series.map(sum),\n order = appearance(series),\n top = 0,\n bottom = 0,\n tops = [],\n bottoms = [];\n\n for (i = 0; i < n; ++i) {\n j = order[i];\n if (top < bottom) {\n top += sums[j];\n tops.push(j);\n } else {\n bottom += sums[j];\n bottoms.push(j);\n }\n }\n\n return bottoms.reverse().concat(tops);\n}\n","import none from \"./none.js\";\n\nexport default function(series) {\n return none(series).reverse();\n}\n","export {default as arc} from \"./arc.js\";\nexport {default as area} from \"./area.js\";\nexport {default as line} from \"./line.js\";\nexport {default as pie} from \"./pie.js\";\nexport {default as areaRadial, default as radialArea} from \"./areaRadial.js\"; // Note: radialArea is deprecated!\nexport {default as lineRadial, default as radialLine} from \"./lineRadial.js\"; // Note: radialLine is deprecated!\nexport {default as pointRadial} from \"./pointRadial.js\";\nexport {link, linkHorizontal, linkVertical, linkRadial} from \"./link.js\";\n\nexport {default as symbol, symbolsStroke, symbolsFill, symbolsFill as symbols} from \"./symbol.js\";\nexport {default as symbolAsterisk} from \"./symbol/asterisk.js\";\nexport {default as symbolCircle} from \"./symbol/circle.js\";\nexport {default as symbolCross} from \"./symbol/cross.js\";\nexport {default as symbolDiamond} from \"./symbol/diamond.js\";\nexport {default as symbolDiamond2} from \"./symbol/diamond2.js\";\nexport {default as symbolPlus} from \"./symbol/plus.js\";\nexport {default as symbolSquare} from \"./symbol/square.js\";\nexport {default as symbolSquare2} from \"./symbol/square2.js\";\nexport {default as symbolStar} from \"./symbol/star.js\";\nexport {default as symbolTriangle} from \"./symbol/triangle.js\";\nexport {default as symbolTriangle2} from \"./symbol/triangle2.js\";\nexport {default as symbolWye} from \"./symbol/wye.js\";\nexport {default as symbolTimes, default as symbolX} from \"./symbol/times.js\";\n\nexport {default as curveBasisClosed} from \"./curve/basisClosed.js\";\nexport {default as curveBasisOpen} from \"./curve/basisOpen.js\";\nexport {default as curveBasis} from \"./curve/basis.js\";\nexport {bumpX as curveBumpX, bumpY as curveBumpY} from \"./curve/bump.js\";\nexport {default as curveBundle} from \"./curve/bundle.js\";\nexport {default as curveCardinalClosed} from \"./curve/cardinalClosed.js\";\nexport {default as curveCardinalOpen} from \"./curve/cardinalOpen.js\";\nexport {default as curveCardinal} from \"./curve/cardinal.js\";\nexport {default as curveCatmullRomClosed} from \"./curve/catmullRomClosed.js\";\nexport {default as curveCatmullRomOpen} from \"./curve/catmullRomOpen.js\";\nexport {default as curveCatmullRom} from \"./curve/catmullRom.js\";\nexport {default as curveLinearClosed} from \"./curve/linearClosed.js\";\nexport {default as curveLinear} from \"./curve/linear.js\";\nexport {monotoneX as curveMonotoneX, monotoneY as curveMonotoneY} from \"./curve/monotone.js\";\nexport {default as curveNatural} from \"./curve/natural.js\";\nexport {default as curveStep, stepAfter as curveStepAfter, stepBefore as curveStepBefore} from \"./curve/step.js\";\n\nexport {default as stack} from \"./stack.js\";\nexport {default as stackOffsetExpand} from \"./offset/expand.js\";\nexport {default as stackOffsetDiverging} from \"./offset/diverging.js\";\nexport {default as stackOffsetNone} from \"./offset/none.js\";\nexport {default as stackOffsetSilhouette} from \"./offset/silhouette.js\";\nexport {default as stackOffsetWiggle} from \"./offset/wiggle.js\";\nexport {default as stackOrderAppearance} from \"./order/appearance.js\";\nexport {default as stackOrderAscending} from \"./order/ascending.js\";\nexport {default as stackOrderDescending} from \"./order/descending.js\";\nexport {default as stackOrderInsideOut} from \"./order/insideOut.js\";\nexport {default as stackOrderNone} from \"./order/none.js\";\nexport {default as stackOrderReverse} from \"./order/reverse.js\";\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar d3Selection = require('d3-selection');\nvar deepmerge = require('deepmerge');\nvar models = require('@appland/models');\nvar d3Zoom = require('d3-zoom');\nvar d3Interpolate = require('d3-interpolate');\nvar dagre = require('dagre');\nvar d3Shape = require('d3-shape');\n\nfunction _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }\n\nvar deepmerge__default = /*#__PURE__*/_interopDefaultLegacy(deepmerge);\nvar dagre__default = /*#__PURE__*/_interopDefaultLegacy(dagre);\n\nclass Transform {\n constructor(x = 0, y = 0, k = 1) {\n this.x = x;\n this.y = y;\n this.k = k;\n }\n\n toString() {\n return [\n this.x !== 0 ? `translateX(${this.x}px)` : null,\n this.y !== 0 ? `translateY(${this.y}px)` : null,\n this.k !== 1 ? `scale(${this.k}` : null,\n ].join(' ');\n }\n}\n\nvar Geometry = {\n // Checks if a rect (such as a DOMRect) fully contains another.\n contains(outer, inner) {\n return (\n outer.top <= inner.top &&\n outer.bottom >= inner.bottom &&\n outer.left <= inner.left &&\n outer.right >= inner.right\n );\n },\n\n inContainer(outer, inner) {\n const x = inner.x - outer.x;\n const y = inner.y - outer.y;\n\n return x > 0 && y > 0 && x + inner.width < outer.width && y + inner.height < outer.height;\n },\n\n // delta returns the shortest relative translation to place inner within\n // outer\n delta(outer, inner) {\n let x = 0;\n let y = 0;\n\n if (outer.left >= inner.left) {\n x = outer.left - inner.left;\n } else if (outer.right <= inner.right) {\n x = outer.right - inner.right;\n }\n\n if (outer.top >= inner.top) {\n y = outer.top - inner.top;\n } else if (outer.bottom <= inner.bottom) {\n y = outer.bottom - inner.bottom;\n }\n\n return { x, y };\n },\n\n // calculates a transform that shifts from one position to another\n shift(from, to) {\n return new Transform(from.x - to.x, from.y - to.y);\n },\n\n Transform,\n};\n\nfunction getEventTarget(target, container = document, selector = false) {\n let el = target;\n let selectedElements;\n\n if (selector) {\n selectedElements = Array.from(container.querySelectorAll(selector));\n } else {\n selectedElements = [container];\n }\n\n while (el) {\n if (selectedElements.includes(el)) {\n break;\n }\n\n el = el.parentNode;\n }\n\n return el;\n}\n\n// Move the minimum amount to put the element into view\nfunction lazyPanToElement(viewport, element, padding = 0) {\n if (!element) {\n return;\n }\n\n let { x, y } = Geometry.delta(\n viewport.element.getBoundingClientRect(),\n element.getBoundingClientRect()\n );\n\n // Apply padding\n x += Math.sign(x) * padding;\n y += Math.sign(y) * padding;\n\n // Scale the offset using the current transform. This is necessary to put the\n // element in view at different scales.\n const { k } = viewport.transform;\n x /= k;\n y /= k;\n\n viewport.translateBy(x, y);\n}\n\nfunction nodeFullyVisible(container, node) {\n if (!node) return false;\n return Geometry.inContainer(container.getBoundingClientRect(), node.getBoundingClientRect());\n}\n\nfunction getParentRelativeOffset(element, parent) {\n const offset = {\n left: 0,\n top: 0,\n };\n\n let child = element;\n while (child && child !== parent) {\n offset.left += child.offsetLeft;\n offset.top += child.offsetTop;\n child = child.offsetParent;\n }\n\n return offset;\n}\n\nfunction getElementCenter(node) {\n return {\n x: node.offsetLeft + node.clientWidth * 0.5,\n y: node.offsetTop + node.clientHeight * 0.5,\n };\n}\n\nconst STALE_TIME = 0.63; // seconds\n\nfunction removeStaleSamples(accumulator) {\n let lastTime = Date.now();\n for (let i = accumulator.values.length - 1; i >= 0; i -= 1) {\n const sample = accumulator.values[i];\n const dt = (lastTime - sample.time) / 60.0;\n\n // If enough time has passed between the new sample and the last sample,\n // all the existing data is considered stale and removed.\n if (dt > accumulator.staleTime) {\n accumulator.values.splice(0, accumulator.values.length);\n break;\n }\n\n lastTime = sample.time;\n }\n}\n\n// Accumulator keeps a running average of values up to a max number of samples\n// samples decay and are removed after the staleTime\nclass Accumulator {\n constructor(maxSamples, staleTime = STALE_TIME) {\n this.maxSamples = maxSamples;\n this.staleTime = staleTime;\n this.reset();\n }\n\n add(value) {\n removeStaleSamples(this);\n\n if (this.values.length >= this.maxSamples) {\n this.values.splice(0, this.values.length - this.maxSamples + 1);\n }\n\n this.values.push({ value, time: Date.now() });\n }\n\n reset() {\n this.values = [];\n }\n\n get length() {\n return this.values.length;\n }\n\n get value() {\n removeStaleSamples(this);\n const length = this.values.length - 1;\n /* eslint-disable no-param-reassign, no-return-assign */\n return length !== 0\n ? this.values.reduce((acc, sample) => (acc += sample.value), 0) / length\n : 0;\n /* eslint-enable no-param-reassign, no-return-assign */\n }\n}\n\nconst FRICTION_COEFFICIENT = 2.5;\nconst IMPULSE_THRESHOLD = 1;\nconst EPSILON = 0.2;\nconst SAMPLES = 8;\n\nclass Momentum {\n constructor(zoom, selection) {\n this.vX = new Accumulator(SAMPLES);\n this.vY = new Accumulator(SAMPLES);\n this.transform = { x: 0.0, y: 0.0, k: 0.0 };\n this.velocity = { x: 0, y: 0 };\n this.selection = selection;\n this.node = selection.node();\n this.zoom = zoom;\n this.active = false;\n this.ticking = false;\n }\n\n cancel() {\n if (this.lastTick) {\n delete this.lastTick;\n }\n\n this.active = false;\n this.ticking = false;\n }\n\n hold() {\n this.active = false;\n this.holding = true;\n this.vX.reset();\n this.vY.reset();\n }\n\n release() {\n if (!this.holding) {\n return;\n }\n\n this.holding = false;\n this.impulse(this.vX.value, this.vY.value);\n }\n\n impulse(x, y, threshold = IMPULSE_THRESHOLD) {\n if (Math.abs(x) + Math.abs(y) < threshold) {\n return;\n }\n\n this.velocity.x = x / this.transform.k;\n this.velocity.y = y / this.transform.k;\n\n if (this.ticking) {\n return;\n }\n\n this.active = true;\n this.tick();\n }\n\n tick() {\n if (!this.moving || !this.active) {\n this.cancel();\n return;\n }\n\n this.ticking = true;\n\n requestAnimationFrame((t) => {\n if (!this.active) {\n this.cancel();\n return;\n }\n\n if (!this.lastTick) {\n this.lastTick = t - 1;\n }\n\n const dt = (t - this.lastTick) / 1000.0;\n\n this.zoom.translateBy(this.selection, this.velocity.x, this.velocity.y);\n\n this.velocity.x -= this.velocity.x * FRICTION_COEFFICIENT * dt;\n this.velocity.y -= this.velocity.y * FRICTION_COEFFICIENT * dt;\n\n this.lastTick = t;\n this.tick();\n });\n }\n\n updateTransform(transform) {\n // check if translation has changed by checking if scale hasn't\n if (!this.active && transform.k === this.transform.k) {\n this.vX.add(transform.x - this.transform.x);\n this.vY.add(transform.y - this.transform.y);\n }\n\n this.transform.x = transform.x;\n this.transform.y = transform.y;\n this.transform.k = transform.k;\n }\n\n get moving() {\n return Math.abs(this.velocity.x) + Math.abs(this.velocity.y) > EPSILON;\n }\n}\n\nfunction momentum(zoom, selection) {\n /* eslint-disable no-param-reassign */\n const m = new Momentum(zoom, selection);\n const onZoom = zoom.on('zoom');\n const onBlur = window.onblur;\n\n selection\n .on('mousedown', () => m.hold())\n .on('mouseup', () => m.release())\n .on('pointerdown', () => m.hold())\n .on('pointerup', () => m.release())\n .on('touchstart', () => m.hold())\n .on('touchend', () => m.release())\n .on('touchcancel', () => m.release());\n\n window.addEventListener('mouseup', () => m.release());\n window.addEventListener('pointerup', () => m.release());\n window.onblur = () => {\n if (onBlur) {\n onBlur();\n }\n\n m.cancel();\n };\n\n zoom.on('zoom', (d3Event) => {\n if (!d3Event) {\n return;\n }\n\n m.updateTransform(d3Event.transform);\n if (onZoom) {\n onZoom(d3Event);\n }\n });\n\n const { translateTo } = zoom;\n zoom.translateTo = (...args) => {\n m.cancel();\n return translateTo(...args);\n };\n\n const { translate } = zoom;\n zoom.translate = (...args) => {\n m.cancel();\n return translate(...args);\n };\n\n return zoom;\n /* eslint-enable no-param-reassign */\n}\n\n// updateZoom updates the bar that indicates the current level of zoom.\n// `zoomScale` is a float, ranging from 0.0 (fully zoomed in) to 1.0 (fully\n// zoomed out)\nfunction updateZoom(viewportZoom, zoomScale) {\n /* eslint-disable no-param-reassign */\n const { controls } = viewportZoom;\n if (!viewportZoom.maxZoomBarValue) {\n const zoomBarHeight = controls.zoomBar.getBoundingClientRect().height;\n const zoomGrabHeight = controls.zoomGrab.getBoundingClientRect().height;\n viewportZoom.maxZoomBarValue = zoomBarHeight - zoomGrabHeight;\n }\n\n const { maxZoomBarValue } = viewportZoom;\n const topOffset = maxZoomBarValue - maxZoomBarValue * zoomScale;\n viewportZoom.zoomScale = zoomScale;\n\n controls.zoomGrab.style.top = `${topOffset}px`;\n /* eslint-enable no-param-reassign */\n}\n\n/* eslint-disable no-param-reassign */\nfunction createDOM(viewportZoom) {\n const controlsContainer = document.createElement('div');\n controlsContainer.className = 'appmap__zoom';\n\n const { controls } = viewportZoom;\n controls.buttonZoomIn = document.createElement('button');\n controls.buttonZoomIn.setAttribute('type', 'button');\n controls.buttonZoomIn.className = 'appmap__zoom-button';\n controls.buttonZoomIn.innerHTML = '+';\n controlsContainer.appendChild(controls.buttonZoomIn);\n\n controls.zoomBar = document.createElement('div');\n controls.zoomBar.className = 'appmap__zoom-bar';\n controls.zoomGrab = document.createElement('div');\n controls.zoomGrab.className = 'appmap__zoom-grab';\n controls.zoomBar.appendChild(controls.zoomGrab);\n controlsContainer.appendChild(controls.zoomBar);\n\n controls.buttonZoomOut = document.createElement('button');\n controls.buttonZoomOut.setAttribute('type', 'button');\n controls.buttonZoomOut.className = 'appmap__zoom-button';\n controls.buttonZoomOut.innerHTML = '−';\n controlsContainer.appendChild(controls.buttonZoomOut);\n\n viewportZoom.container.appendChild(controlsContainer);\n viewportZoom.element = controlsContainer;\n\n controls.buttonZoomIn.addEventListener('click', (event) => {\n event.stopPropagation();\n\n viewportZoom.zoomScale = Math.min(1.0, viewportZoom.zoomScale + viewportZoom.step);\n viewportZoom.emit('zoom', viewportZoom.zoomScale);\n });\n\n controls.buttonZoomOut.addEventListener('click', (event) => {\n event.stopPropagation();\n\n viewportZoom.zoomScale = Math.max(0.0, viewportZoom.zoomScale - viewportZoom.step);\n viewportZoom.emit('zoom', viewportZoom.zoomScale);\n });\n\n controls.zoomBar.addEventListener('click', (event) => {\n event.stopPropagation();\n\n if (event.target !== controls.zoomBar) {\n return false;\n }\n\n const maxOffset = controls.zoomBar.getBoundingClientRect().height;\n const offset = event.clientY - Math.round(controls.zoomBar.getBoundingClientRect().top);\n\n viewportZoom.emit('zoom', 1.0 - offset / maxOffset);\n\n return true;\n });\n\n controls.zoomBar.addEventListener('mousedown', (event) => {\n document.body.style.cursor = 'grabbing';\n viewportZoom.zoomGrabPosition = controls.zoomGrab.offsetTop;\n viewportZoom.dragStart = event.clientY;\n viewportZoom.isDragging = true;\n event.stopPropagation();\n });\n\n document.body.addEventListener('mousemove', (event) => {\n if (viewportZoom.isDragging) {\n const maxOffset = controls.zoomBar.getBoundingClientRect().height;\n const offset = viewportZoom.zoomGrabPosition + (event.clientY - viewportZoom.dragStart);\n viewportZoom.emit('zoom', 1.0 - offset / maxOffset);\n event.preventDefault();\n }\n });\n\n document.body.addEventListener('mouseup', () => {\n document.body.style.cursor = null;\n viewportZoom.isDragging = false;\n });\n}\n/* eslint-enable no-param-reassign */\n\nclass ContainerZoom extends models.EventSource {\n constructor(container, options) {\n super();\n\n this.container = container.element;\n this.step = options.step;\n this.controls = {};\n this.maxZoomBarValue = null;\n this.dragStart = null;\n this.zoomGrabPosition = null;\n this.isDragging = false;\n this.zoomGrabTimeout = null;\n\n createDOM(this);\n updateZoom(this, container.transform.k);\n container.on('move', (transform) =>\n updateZoom(this, (transform.k - options.minRatio) / (options.maxRatio - options.minRatio))\n );\n }\n}\n\nfunction transformElement$1(item, element) {\n if (typeof item.data.transform === 'function') {\n return item.data.transform(element);\n }\n return element;\n}\n\nclass ContextMenuItem extends models.EventSource {\n constructor() {\n super();\n this.data = {\n text: 'Untitled item',\n selector: null,\n condition: null,\n transform: null,\n };\n }\n\n text(value) {\n this.data.text = value;\n return this;\n }\n\n selector(value) {\n this.data.selector = value;\n return this;\n }\n\n condition(fn) {\n this.data.condition = fn;\n return this;\n }\n\n transform(fn) {\n this.data.transform = fn;\n return this;\n }\n\n match(e) {\n const matchSelector = !this.data.selector || e.matches(this.data.selector);\n if (!matchSelector) {\n return false;\n }\n\n const subject = transformElement$1(this, e);\n if (!subject) {\n // we have a transform and it failed to resolve\n return false;\n }\n\n const matchCondition = !this.data.condition || this.data.condition(subject);\n return matchCondition;\n }\n}\n\nfunction initializeDomElements(parent) {\n const dropdown = document.createElement('div');\n dropdown.classList.add('appmap__context-menu');\n dropdown.style.display = 'none';\n\n const dropdownMenu = document.createElement('div');\n dropdownMenu.classList.add('dropdown-menu');\n dropdown.appendChild(dropdownMenu);\n\n // Don't propagate mousedown events to elements we're above. For example, we\n // don't want the user being able to pan a viewport through this element.\n // OTOH, maybe this shouldn't be a class behavior and should be handled by the\n // context menu owner. If this causes issues in the future we can move this\n // out.\n dropdown.addEventListener('mousedown', (e) => e.stopPropagation());\n dropdown.addEventListener('pointerdown', (e) => e.stopPropagation());\n dropdown.addEventListener('touchstart', (e) => e.stopPropagation());\n\n const emptyMessage = document.createElement('p');\n emptyMessage.innerText = 'No actions available';\n emptyMessage.style.display = 'none';\n dropdownMenu.appendChild(emptyMessage);\n\n parent.appendChild(dropdown);\n\n return {\n dropdown,\n menu: dropdownMenu,\n emptyMessage,\n };\n}\n\nfunction addItem(contextMenu, item) {\n /* eslint-disable no-param-reassign */\n const itemElement = document.createElement('a');\n itemElement.classList.add('dropdown-item');\n itemElement.innerText = item.data.text;\n contextMenu.elements.menu.appendChild(itemElement);\n item.element = itemElement;\n\n return itemElement;\n /* eslint-enable no-param-reassign */\n}\n\nfunction addDivider(contextMenu) {\n const divider = document.createElement('div');\n divider.classList.add('dropdown-divider');\n contextMenu.elements.menu.appendChild(divider);\n}\n\nfunction transformElement(item, element) {\n if (typeof item.data.transform === 'function') {\n return item.data.transform(element);\n }\n return element;\n}\n\nfunction show(contextMenu, clickEvent) {\n /* eslint-disable no-param-reassign */\n let itemsDisplayed = 0;\n\n // Remove ancestors of the container element, we don't need to iterate any\n // further than that.\n const activeAreaIndex = clickEvent.composedPath().findIndex((e) => e === contextMenu.activeArea);\n\n if (activeAreaIndex === -1) {\n return;\n }\n\n const path = clickEvent.composedPath().slice(0, activeAreaIndex + 1);\n\n contextMenu.items.forEach((item) => {\n const match = path.find((e) => item.match(e));\n if (!match) {\n item.element.style.display = 'none';\n return;\n }\n\n if (item.element.listener) {\n // make sure there's no old state\n item.element.removeEventListener('click', item.element.listener);\n }\n\n item.element.listener = () => item.emit('execute', transformElement(item, match));\n item.element.addEventListener('click', item.element.listener);\n item.element.style.display = '';\n item.emit('show');\n itemsDisplayed += 1;\n });\n\n contextMenu.elements.emptyMessage.style.display = itemsDisplayed > 0 ? 'none' : '';\n\n const { x, y } = contextMenu.parent.getBoundingClientRect();\n contextMenu.elements.menu.style.transform = `translate(${clickEvent.x - x}px, ${\n clickEvent.y - y\n }px)`;\n contextMenu.elements.dropdown.style.display = 'block';\n /* eslint-enable no-param-reassign */\n}\n\nclass ContextMenu extends models.EventSource {\n constructor(container, activeArea = null) {\n super();\n\n this.parent = container;\n this.activeArea = activeArea || container;\n this.elements = initializeDomElements(container);\n this.activeArea.addEventListener('contextmenu', (e) => {\n show(this, e);\n e.preventDefault();\n this.emit('show');\n });\n this.selectors = {};\n this.items = [];\n }\n\n divider() {\n addDivider(this);\n return this;\n }\n\n add(itemBuilder) {\n const item = itemBuilder(new ContextMenuItem());\n\n if (!item) {\n return this;\n }\n\n addItem(this, item);\n this.items.push(item);\n\n return this;\n }\n\n get visible() {\n if (!this.elements || !this.elements.menu) {\n return false;\n }\n\n return this.elements.menu.offsetWidth > 0;\n }\n\n close() {\n const isVisible = this.visible;\n if (isVisible) {\n this.elements.dropdown.style.display = 'none';\n }\n return isVisible;\n }\n\n // Determines whether or not an event could have originated from the context\n // menu.\n isEventSource(e) {\n if (!e) return false;\n\n const path = e.composedPath();\n\n if (!path || !this.elements) {\n return false;\n }\n\n return path.includes(this.elements.menu);\n }\n}\n\nconst AVAILABLE_THEMES = ['light', 'dark'];\nconst DEFAULT_THEME = 'light';\n\nconst defaultOptions = {\n contextMenu: false,\n pan: {\n momentum: true, // if true, enables momentum on panning\n boundary: {\n contain: null, // selector for contained element\n overlap: 300, // px\n },\n tweenTime: 250, // ms\n },\n theme: DEFAULT_THEME,\n zoom: {\n controls: false, // display zoom controls (+ / - buttons)\n step: 0.1, // zoom step when clicking a button in the interface\n minRatio: 0.1, // minimum zoom scale\n maxRatio: 1.0, // maximum zoom scale\n requireActive: false, // whether or not the user must interact with the element before zooming\n },\n};\n\nconst clamp$1 = (x, min, max) => Math.min(Math.max(x, min), max);\n\n// TODO\n// Retire this class in favor of a Vue component\nclass Container extends models.EventSource {\n constructor(parent, options = {}, element = null, contentElement = null) {\n super();\n\n this.options = deepmerge__default[\"default\"](defaultOptions, options);\n this.scaleTarget = false;\n\n let { theme } = this.options;\n\n if (AVAILABLE_THEMES.indexOf(theme) === -1) {\n theme = DEFAULT_THEME;\n }\n\n this.element = element;\n if (!element) {\n this.element = document.createElement('div');\n this.element.className = `appmap appmap--theme-${theme}`;\n }\n\n this.contentElement = contentElement || document.createElement('div');\n this.contentElement.className = 'appmap__content';\n this.contentElement.containerController = this;\n\n if (!this.contentElement.parentElement) {\n this.element.appendChild(this.contentElement);\n }\n\n let parentElement = element;\n if (parent) {\n parentElement = d3Selection.select(parent).node();\n parentElement.appendChild(this.element);\n }\n\n if (this.options.zoom) {\n if (this.options.zoom.controls) {\n this.zoomController = new ContainerZoom(this, this.options.zoom).on('zoom', (k) => {\n const { minRatio, maxRatio } = this.options.zoom;\n const scaleLevel = (maxRatio - minRatio) * k + minRatio;\n\n if (this.scaleTarget && this.scaleTarget.x && this.scaleTarget.y) {\n this.scaleToAndTranslate(scaleLevel, this.scaleTarget.x, this.scaleTarget.y);\n } else {\n this.scaleTo(scaleLevel);\n }\n this.active = true;\n });\n }\n\n this.zoom = d3Zoom.zoom()\n .scaleExtent([this.options.zoom.minRatio, this.options.zoom.maxRatio])\n .interpolate(d3Interpolate.interpolate)\n .filter((d3Event) => {\n if (d3Event.type === 'wheel') {\n return this.active || !this.options.zoom.requireActive;\n }\n\n // Mutating state in a filter is not so great here. So far I've been\n // unsuccessful at binding a 'start' handler to do this. I'm all for\n // moving this mutation somewhere more appropriate if someone would\n // like to take the time to do so. -DB\n this.active = true;\n\n return true;\n })\n .on('zoom', (d3Event) => {\n const { transform } = d3Event;\n\n const { offsetHeight, offsetWidth } = parentElement;\n\n transform.x = clamp$1(\n transform.x,\n (this.options.pan.boundary.overlap - this.contentElement.offsetWidth) * transform.k,\n offsetWidth - this.options.pan.boundary.overlap * transform.k\n );\n\n transform.y = clamp$1(\n transform.y,\n (this.options.pan.boundary.overlap - this.contentElement.offsetHeight) * transform.k,\n offsetHeight - this.options.pan.boundary.overlap * transform.k\n );\n\n this.contentElement.style.transform = `translate(${transform.x}px, ${transform.y}px) scale(${transform.k})`;\n this.contentElement.style.transformOrigin = '0 0';\n\n this.emit('move', transform);\n });\n\n if (this.options.pan.momentum) {\n momentum(this.zoom, d3Selection.select(this.element));\n }\n\n d3Selection.select(this.element).call(this.zoom).on('dblclick.zoom', null);\n }\n }\n\n setContextMenu(componentController) {\n if (this.options.contextMenu === false || typeof this.options.contextMenu !== 'function') {\n return;\n }\n\n this.contextMenu = new ContextMenu(this.element);\n\n const contextMenuItems = this.options.contextMenu(componentController);\n\n contextMenuItems.forEach((item) => this.contextMenu.add(item));\n }\n\n fitViewport(targetElement) {\n const targetHeight = targetElement.offsetHeight;\n const targetWidth = targetElement.offsetWidth;\n const { clientWidth, clientHeight } = this.element.parentNode;\n const { minRatio, maxRatio } = this.options.zoom;\n const desiredRatio = Math.min(clientHeight / targetHeight, clientWidth / targetWidth);\n const initialScale = Math.max(Math.min(Math.max(desiredRatio, minRatio), maxRatio), 0.8);\n const transformMatrix = d3Zoom.zoomIdentity\n .translate(\n (clientWidth - targetWidth * initialScale) * 0.5,\n (clientHeight - targetHeight * initialScale) * 0.5\n )\n .scale(initialScale);\n\n this.transform = transformMatrix;\n }\n\n centerX(verticalPadding = 0) {\n if (!this.element || !this.element.parentNode || !this.contentElement) {\n return;\n }\n\n const { offsetWidth: targetWidth } = this.contentElement;\n const { clientWidth } = this.element.parentNode;\n\n const transformMatrix = d3Zoom.zoomIdentity.translate(\n clientWidth * 0.5 - targetWidth * 0.5,\n verticalPadding\n );\n\n this.transform = transformMatrix;\n }\n\n translateTo(x, y, target = null) {\n d3Selection.select(this.element)\n .transition()\n .duration(this.options.pan.tweenTime)\n .call(this.zoom.translateTo, x, y, target);\n }\n\n translateBy(x, y) {\n d3Selection.select(this.element)\n .transition()\n .duration(this.options.pan.tweenTime)\n .call(this.zoom.translateBy, x, y);\n }\n\n scaleTo(k) {\n d3Selection.select(this.element).transition().duration(100).call(this.zoom.scaleTo, k);\n }\n\n scaleToAndTranslate(k, x, y) {\n d3Selection.select(this.element)\n .transition()\n .duration(100)\n .call(this.zoom.scaleTo, k)\n .transition()\n .duration(this.options.pan.tweenTime)\n .call(this.zoom.translateTo, x, y, null);\n }\n\n get transform() {\n return d3Zoom.zoomTransform(this.element);\n }\n\n set transform(transform) {\n d3Selection.select(this.element).call(this.zoom.transform, transform);\n }\n}\n\nfunction generateHash() {\n return Math.random().toString(16).slice(2, 10);\n}\n\nfunction getAnimationStep(from, to, percent) {\n return percent < 1 ? from + (to - from) * percent : to;\n}\n\nfunction createSVGElement(tagName, className = null) {\n const el = document.createElementNS('http://www.w3.org/2000/svg', tagName);\n\n if (className) {\n el.setAttribute('class', className);\n }\n\n return el;\n}\n\n// transform 'dagre' points into simple array which will be passed to 'd3-line' helper\nfunction transformPoints(points) {\n const result = [];\n\n points.forEach((p) => {\n result.push([p.x, p.y]);\n });\n\n return result;\n}\n\n// when we need to transition between 2 edges with different points length - fill smaller array with copies of it's first point\nfunction normalizePoints(points1, points2) {\n if (points1.length === points2.length) {\n return;\n }\n\n const smaller = points1.length < points2.length ? points1 : points2;\n const bigger = points2 === smaller ? points1 : points2;\n\n for (let i = 0, len = bigger.length - smaller.length; i < len; i += 1) {\n smaller.splice(0, 0, smaller[0]);\n }\n}\n\nfunction findTraversableNodesAndEdges(graph, id) {\n const visitedNodes = new Set();\n const visitedEdges = new Set();\n const queue = [id];\n\n // traverse left from id\n while (queue.length > 0) {\n const currentId = queue.pop();\n if (!visitedNodes.has(currentId)) {\n graph.inEdges(currentId).forEach((e) => {\n visitedEdges.add(e);\n queue.push(e.v);\n });\n\n visitedNodes.add(currentId);\n }\n }\n\n // traverse right from id\n queue.push(id);\n visitedNodes.delete(id);\n\n while (queue.length > 0) {\n const currentId = queue.pop();\n if (!visitedNodes.has(currentId)) {\n graph.outEdges(currentId).forEach((e) => {\n visitedEdges.add(e);\n queue.push(e.w);\n });\n\n visitedNodes.add(currentId);\n }\n }\n return [visitedNodes, visitedEdges];\n}\n\nfunction Rect(width, height) {\n const rect = createSVGElement('rect');\n rect.setAttribute('rx', 0);\n rect.setAttribute('ry', 0);\n rect.setAttribute('x', -(width / 2));\n rect.setAttribute('y', -(height / 2));\n rect.setAttribute('width', width);\n rect.setAttribute('height', height);\n return rect;\n}\n\nconst iconSize = 14;\n\nfunction createSVGIcon(icon) {\n const svg = createSVGElement('svg', `label__icon label__icon--${icon}`);\n svg.setAttribute('viewBox', '0 0 512 512');\n svg.setAttribute('width', `${iconSize}px`);\n svg.setAttribute('height', `${iconSize}px`);\n\n const rect = createSVGElement('rect');\n rect.setAttribute('x', 0);\n rect.setAttribute('y', 0);\n rect.setAttribute('width', '100%');\n rect.setAttribute('height', '100%');\n rect.setAttribute('fill', 'transparent');\n svg.appendChild(rect);\n\n switch (icon) {\n case 'expand': {\n const path1 = createSVGElement('path');\n path1.setAttribute(\n 'd',\n 'm453.332031 512h-394.664062c-32.363281 0-58.667969-26.304688-58.667969-58.667969v-394.664062c0-32.363281 26.304688-58.667969 58.667969-58.667969h394.664062c32.363281 0 58.667969 26.304688 58.667969 58.667969v394.664062c0 32.363281-26.304688 58.667969-58.667969 58.667969zm-394.664062-480c-14.699219 0-26.667969 11.96875-26.667969 26.667969v394.664062c0 14.699219 11.96875 26.667969 26.667969 26.667969h394.664062c14.699219 0 26.667969-11.96875 26.667969-26.667969v-394.664062c0-14.699219-11.96875-26.667969-26.667969-26.667969zm0 0'\n );\n svg.appendChild(path1);\n\n const path2 = createSVGElement('path');\n path2.setAttribute(\n 'd',\n 'm368 272h-224c-8.832031 0-16-7.167969-16-16s7.167969-16 16-16h224c8.832031 0 16 7.167969 16 16s-7.167969 16-16 16zm0 0'\n );\n svg.appendChild(path2);\n\n const path3 = createSVGElement('path');\n path3.setAttribute(\n 'd',\n 'm256 384c-8.832031 0-16-7.167969-16-16v-224c0-8.832031 7.167969-16 16-16s16 7.167969 16 16v224c0 8.832031-7.167969 16-16 16zm0 0'\n );\n svg.appendChild(path3);\n break;\n }\n case 'collapse': {\n const path1 = createSVGElement('path');\n path1.setAttribute(\n 'd',\n 'm453.332031 512h-394.664062c-32.363281 0-58.667969-26.304688-58.667969-58.667969v-394.664062c0-32.363281 26.304688-58.667969 58.667969-58.667969h394.664062c32.363281 0 58.667969 26.304688 58.667969 58.667969v394.664062c0 32.363281-26.304688 58.667969-58.667969 58.667969zm-394.664062-480c-14.699219 0-26.667969 11.96875-26.667969 26.667969v394.664062c0 14.699219 11.96875 26.667969 26.667969 26.667969h394.664062c14.699219 0 26.667969-11.96875 26.667969-26.667969v-394.664062c0-14.699219-11.96875-26.667969-26.667969-26.667969zm0 0'\n );\n svg.appendChild(path1);\n\n const path2 = createSVGElement('path');\n path2.setAttribute(\n 'd',\n 'm368 272h-224c-8.832031 0-16-7.167969-16-16s7.167969-16 16-16h224c8.832031 0 16 7.167969 16 16s-7.167969 16-16 16zm0 0'\n );\n svg.appendChild(path2);\n\n svg.setAttribute('y', '5px');\n break;\n }\n }\n\n return svg;\n}\n\nclass LabelGroup {\n constructor(label, icon = false, isHidden = false) {\n this.element = createSVGElement('g', 'label');\n\n if (icon) {\n const iconEl = createSVGIcon(icon);\n this.element.appendChild(iconEl);\n }\n\n if (isHidden) {\n this.element.setAttribute('opacity', 0);\n }\n\n this.textElement = createSVGElement('text');\n this.tspanElement = createSVGElement('tspan');\n this.tspanElement.setAttribute('space', 'preserve');\n this.tspanElement.setAttribute('dy', '1em');\n this.tspanElement.setAttribute('x', 1 + (icon ? iconSize + 6 : 0));\n this.tspanElement.textContent = label;\n this.textElement.appendChild(this.tspanElement);\n this.element.appendChild(this.textElement);\n }\n\n getBBox() {\n return this.element.getBBox();\n }\n\n show() {\n this.element.setAttribute('opacity', 1);\n return this;\n }\n\n hide() {\n this.element.setAttribute('opacity', 0);\n return this;\n }\n\n cutToWidth(width) {\n const textEl = this.textElement;\n const textSpanEl = this.tspanElement;\n let string = textEl.textContent;\n\n const title = createSVGElement('title');\n title.textContent = string;\n this.textElement.appendChild(title);\n\n while (textEl.getComputedTextLength() >= width && string.length > 0) {\n if (string.includes('/')) {\n const packagePath = string.split('/');\n packagePath.shift();\n string = packagePath.join('/');\n textSpanEl.textContent = `.../${string}`;\n } else {\n string = string.slice(0, -1);\n textSpanEl.textContent = `${string}...`;\n }\n }\n\n return this;\n }\n}\n\nconst PADDING = 4;\nconst LABEL_RESERVE_SPACE = PADDING * 2 + 30;\n\nfunction setElementPosition$1(nodeGroup, x, y) {\n /* eslint-disable no-param-reassign */\n nodeGroup.element.setAttribute('transform', `translate(${x},${y})`);\n nodeGroup.position = { x, y };\n /* eslint-enable no-param-reassign */\n}\n\nclass ClusterGroup {\n constructor(node) {\n const classes = ['cluster'];\n if (node.children > 1) {\n classes.push(`cluster--${node.class}`, 'cluster--bordered');\n }\n\n this.element = createSVGElement('g', classes.join(' '));\n this.element.dataset.id = node.id;\n this.element.dataset.type = node.class;\n\n setElementPosition$1(this, node.x, node.y);\n\n const rect = Rect(node.width, node.height);\n this.element.appendChild(rect);\n\n this.label = new LabelGroup(node.label, 'collapse');\n this.label.hide();\n this.moveLabel(node.width, node.height);\n this.element.appendChild(this.label.element);\n\n requestAnimationFrame(() => {\n this.label.cutToWidth(node.width - LABEL_RESERVE_SPACE);\n this.label.show();\n });\n }\n\n move(x, y) {\n if (this.animationOptions && this.animationOptions.enable) {\n const initialX = this.position.x;\n const initialY = this.position.y;\n const start = +new Date();\n const { duration } = this.animationOptions;\n\n const tick = () => {\n const now = +new Date();\n const percent = (now - start) / duration;\n\n const newX = getAnimationStep(initialX, x, percent);\n const newY = getAnimationStep(initialY, y, percent);\n\n setElementPosition$1(this, newX, newY);\n\n if (percent < 1) {\n window.requestAnimationFrame(tick);\n } else {\n setElementPosition$1(this, x, y);\n }\n };\n tick();\n } else {\n setElementPosition$1(this, x, y);\n }\n }\n\n resize(width, height) {\n const rect = this.element.querySelector('rect');\n rect.setAttribute('x', -(width / 2));\n rect.setAttribute('y', -(height / 2));\n rect.setAttribute('width', width);\n rect.setAttribute('height', height);\n\n this.moveLabel(width, height);\n this.label\n .hide()\n .cutToWidth(width - LABEL_RESERVE_SPACE)\n .show();\n }\n\n moveLabel(width, height) {\n const dX = -width * 0.5 + PADDING;\n const dY = -height * 0.5;\n this.label.element.style.transform = `translate(${dX}px, ${dY}px)`;\n }\n\n remove() {\n const { element } = this;\n element.parentNode.removeChild(element);\n }\n}\n\nfunction Cylinder(width, height) {\n const path = createSVGElement('path');\n\n const rx = width / 2;\n const ry = rx / (2.5 + width / 50);\n\n const shape = `M 0,${ry} a ${rx},${ry} 0,0,0 ${width} 0 a ${rx},${ry} 0,0,0 ${-width} 0 l 0,${height} a ${rx},${ry} 0,0,0 ${width} 0 l 0, ${-height}`;\n\n path.setAttribute('d', shape);\n path.setAttribute('transform', `translate(${-width / 2}, ${-(height / 2 + ry)})`);\n\n return path;\n}\n\nfunction Parallelogram(width, height) {\n const polygon = createSVGElement('polygon');\n const w = width;\n const h = height;\n const points = [\n { x: (-2 * h) / 6, y: 0 },\n { x: w - h / 6, y: 0 },\n { x: w + (2 * h) / 6, y: -h },\n { x: h / 6, y: -h },\n ];\n\n polygon.setAttribute('points', points.map((d) => `${d.x},${d.y}`).join());\n polygon.setAttribute('transform', `translate(${-w * 0.5}, ${h * 0.5})`);\n\n return polygon;\n}\n\nfunction setElementPosition(nodeGroup, x, y) {\n /* eslint-disable no-param-reassign */\n nodeGroup.element.setAttribute('transform', `translate(${x},${y})`);\n nodeGroup.position = { x, y };\n /* eslint-enable no-param-reassign */\n}\n\nclass NodeGroup {\n constructor(node, animationOptions = {}) {\n this.element = createSVGElement('g', `node ${node.class}`);\n this.element.dataset.id = node.id;\n this.element.dataset.type = node.codeObject.type;\n this.element.setAttribute('opacity', 0);\n\n setElementPosition(this, node.x, node.y);\n\n this.animationOptions = animationOptions;\n\n let shape;\n\n switch (node.shape) {\n case 'http':\n shape = Parallelogram(node.width, node.height);\n break;\n case 'database':\n shape = Cylinder(node.width, node.height);\n break;\n default:\n shape = Rect(node.width, node.height);\n break;\n }\n\n this.element.appendChild(shape);\n\n const labelGroup = new LabelGroup(\n node.label,\n ['http', 'package'].includes(node.class) ? 'expand' : false\n );\n labelGroup.element.setAttribute(\n 'transform',\n `translate(-${node.labelWidth / 2},-${node.labelHeight / 2})`\n );\n this.element.appendChild(labelGroup.element);\n }\n\n show() {\n if (this.animationOptions && this.animationOptions.enable) {\n const start = +new Date();\n const { duration } = this.animationOptions;\n\n const tick = () => {\n const now = +new Date();\n const percent = (now - start) / duration;\n\n this.element.setAttribute('opacity', percent);\n\n if (percent < 1) {\n window.requestAnimationFrame(tick);\n } else {\n this.element.setAttribute('opacity', 1);\n }\n };\n tick();\n } else {\n this.element.setAttribute('opacity', 1);\n }\n }\n\n move(x, y) {\n if (this.animationOptions && this.animationOptions.enable) {\n const initialX = this.position.x;\n const initialY = this.position.y;\n const start = +new Date();\n const { duration } = this.animationOptions;\n\n const tick = () => {\n const now = +new Date();\n const percent = (now - start) / duration;\n\n const newX = getAnimationStep(initialX, x, percent);\n const newY = getAnimationStep(initialY, y, percent);\n\n setElementPosition(this, newX, newY);\n\n if (percent < 1) {\n window.requestAnimationFrame(tick);\n } else {\n setElementPosition(this, x, y);\n }\n };\n tick();\n } else {\n setElementPosition(this, x, y);\n }\n }\n\n remove() {\n const { element } = this;\n element.parentNode.removeChild(element);\n }\n}\n\nconst lineGenerator = d3Shape.line().curve(d3Shape.curveBasis);\n\nclass Path {\n constructor(points) {\n this.element = createSVGElement('path');\n this.element.setAttribute('d', lineGenerator(points));\n }\n\n setPoints(points) {\n this.element.setAttribute('d', lineGenerator(points));\n }\n}\n\nfunction Marker() {\n const marker = createSVGElement('marker');\n marker.setAttribute('viewBox', '0 0 10 10');\n marker.setAttribute('refX', '10');\n marker.setAttribute('refY', '5');\n marker.setAttribute('markerUnits', 'strokeWidth');\n marker.setAttribute('markerWidth', '4');\n marker.setAttribute('markerHeight', '4');\n marker.setAttribute('orient', 'auto');\n\n const path = createSVGElement('path');\n path.setAttribute('d', 'M 0 0 L 10 5 L 0 10 z');\n marker.appendChild(path);\n\n return marker;\n}\n\nfunction setPathPoints(edgeGroup, points) {\n /* eslint-disable no-param-reassign */\n edgeGroup.points = points;\n edgeGroup.path.setPoints(points);\n /* eslint-enable no-param-reassign */\n}\n\nclass EdgeGroup {\n constructor(points, animationOptions = {}) {\n this.animationOptions = animationOptions;\n this.points = transformPoints(points);\n\n this.element = createSVGElement('g', 'edgePath');\n this.element.setAttribute('opacity', 0);\n this.path = new Path(this.points);\n\n const defs = createSVGElement('defs');\n const marker = Marker();\n\n const arrowId = `arrowhead${generateHash()}`;\n marker.setAttribute('id', arrowId);\n this.path.element.setAttribute('marker-end', `url(#${arrowId})`);\n\n defs.appendChild(marker);\n\n this.element.appendChild(this.path.element);\n this.element.appendChild(defs);\n }\n\n show() {\n if (this.animationOptions && this.animationOptions.enable) {\n const start = +new Date();\n const { duration } = this.animationOptions;\n\n const tick = () => {\n const now = +new Date();\n const percent = (now - start) / duration;\n\n this.element.setAttribute('opacity', percent);\n\n if (percent < 1) {\n window.requestAnimationFrame(tick);\n } else {\n this.element.setAttribute('opacity', 1);\n }\n };\n tick();\n } else {\n this.element.setAttribute('opacity', 1);\n }\n }\n\n move(points) {\n if (this.animationOptions && this.animationOptions.enable) {\n const startPoints = Array.from(this.points);\n const endPoints = transformPoints(points);\n normalizePoints(startPoints, endPoints);\n\n const start = +new Date();\n const { duration } = this.animationOptions;\n\n const tick = () => {\n const now = +new Date();\n const percent = (now - start) / duration;\n\n const currentPoints = [];\n\n startPoints.forEach((item, index) => {\n currentPoints.push([\n getAnimationStep(item[0], endPoints[index][0], percent),\n getAnimationStep(item[1], endPoints[index][1], percent),\n ]);\n });\n\n setPathPoints(this, currentPoints);\n\n if (percent < 1) {\n window.requestAnimationFrame(tick);\n } else {\n setPathPoints(this, endPoints);\n }\n };\n tick();\n } else {\n setPathPoints(this, points);\n }\n }\n\n remove() {\n const { element } = this;\n element.parentNode.removeChild(element);\n }\n}\n\nconst NODE_PADDING_HORIZONTAL = 15;\nconst NODE_PADDING_VERTICAL = 10;\n\nconst DEFAULT_OPTIONS = {\n animation: {\n enable: true,\n duration: 300,\n },\n};\n\nclass Graph {\n constructor(element, options = {}) {\n this.element = element;\n this.options = deepmerge__default[\"default\"](DEFAULT_OPTIONS, options);\n\n this.outputGroup = createSVGElement('g', 'output');\n this.edgesGroup = createSVGElement('g', 'edgePaths');\n this.clustersGroup = createSVGElement('g', 'clusters');\n this.nodesGroup = createSVGElement('g', 'nodes');\n\n this.outputGroup.appendChild(this.clustersGroup);\n this.outputGroup.appendChild(this.edgesGroup);\n this.outputGroup.appendChild(this.nodesGroup);\n\n this.element.innerHTML = '';\n this.element.appendChild(this.outputGroup);\n\n this.graph = new dagre__default[\"default\"].graphlib.Graph({ compound: true })\n .setGraph({ rankdir: 'LR' })\n .setDefaultEdgeLabel(() => ({}));\n }\n\n setNodeFromCodeObject(codeObject, parentId = null) {\n let label = codeObject.prettyName;\n\n if (codeObject.type === models.CodeObjectType.PACKAGE || codeObject.type === models.CodeObjectType.HTTP) {\n const numChildren = codeObject.childLeafs().length;\n\n label += ` (${numChildren})`;\n }\n\n const node = {\n codeObject,\n label,\n id: codeObject.id,\n class: codeObject.type,\n shape: codeObject.type,\n };\n this.setNode(node, parentId);\n }\n\n setNode(data, parentId = null) {\n const node = { ...data };\n if (this.graph.node(node.id)) {\n return;\n }\n\n if (node.type !== 'cluster') {\n // create dummy with label to determine label width\n const dummyNodeGroup = createSVGElement('g', 'node');\n const labelGroup = new LabelGroup(\n node.label,\n ['http', 'package'].includes(node.class) ? 'expand' : false,\n true\n );\n dummyNodeGroup.appendChild(labelGroup.element);\n this.nodesGroup.appendChild(dummyNodeGroup);\n const labelBBox = labelGroup.getBBox();\n this.nodesGroup.removeChild(dummyNodeGroup);\n\n node.labelWidth = labelBBox.width;\n node.labelHeight = labelBBox.height;\n node.width = labelBBox.width + NODE_PADDING_HORIZONTAL * 2;\n node.height = labelBBox.height + NODE_PADDING_VERTICAL * 2;\n }\n\n this.graph.setNode(node.id, node);\n\n if (parentId) {\n this.graph.setParent(node.id, parentId);\n }\n }\n\n removeNode(id) {\n const edges = this.graph.nodeEdges(id);\n const node = this.graph.node(id);\n\n if (edges) {\n edges.forEach(({ v, w }) => {\n const edge = this.graph.edge(v, w);\n if (edge.group) {\n edge.group.remove();\n }\n this.graph.removeEdge(v, w);\n });\n }\n\n node.group.remove();\n this.graph.removeNode(id);\n }\n\n setEdge(codeObjectFrom, codeObjectTo) {\n const idFrom = codeObjectFrom.id;\n const idTo = codeObjectTo.id;\n\n if (codeObjectFrom === codeObjectTo || this.graph.edge(idFrom, idTo)) {\n return;\n }\n\n if (!this.graph.node(idTo) || this.graph.children(idTo).length) {\n return;\n }\n\n if (!this.graph.node(idFrom) || this.graph.children(idFrom).length) {\n return;\n }\n\n this.graph.setEdge(idFrom, idTo, {\n codeObjectTo,\n codeObjectFrom,\n });\n }\n\n render() {\n dagre__default[\"default\"].layout(this.graph);\n\n this.graph.nodes().forEach((id) => {\n const node = this.graph.node(id);\n\n if (node.group) {\n node.group.move(node.x, node.y);\n\n if (node.type === 'cluster') {\n node.group.resize(node.width, node.height);\n }\n\n return;\n }\n\n if (node.type === 'cluster') {\n const clusterGroup = new ClusterGroup(node);\n node.group = clusterGroup;\n node.element = clusterGroup.element;\n this.clustersGroup.appendChild(clusterGroup.element);\n } else {\n const nodeGroup = new NodeGroup(node, this.options.animation);\n\n node.group = nodeGroup;\n node.element = nodeGroup.element;\n\n this.nodesGroup.appendChild(nodeGroup.element);\n\n nodeGroup.show();\n }\n });\n\n this.graph.edges().forEach(({ v, w }) => {\n const edge = this.graph.edge(v, w);\n\n if (edge.group) {\n edge.group.move(edge.points);\n } else {\n const edgeGroup = new EdgeGroup(edge.points, this.options.animation);\n const fromNode = this.graph.node(v);\n const toNode = this.graph.node(w);\n\n edgeGroup.element.dataset.from = v;\n edgeGroup.element.dataset.fromType = fromNode.codeObject.type;\n\n edgeGroup.element.dataset.to = w;\n edgeGroup.element.dataset.toType = toNode.codeObject.type;\n\n edge.group = edgeGroup;\n edge.element = edgeGroup.element;\n\n this.edgesGroup.appendChild(edgeGroup.element);\n\n edgeGroup.show();\n }\n });\n\n this.element.setAttribute('width', this.graph.graph().width);\n this.element.setAttribute('height', this.graph.graph().height);\n }\n\n clearHighlights() {\n this.outputGroup.querySelectorAll('.highlight,.highlight--inbound').forEach((el) => {\n el.classList.remove('highlight');\n el.classList.remove('highlight--inbound');\n });\n }\n\n highlightNode(id) {\n const highlightedNode = this.graph.node(id);\n if (!highlightedNode) {\n return null;\n }\n\n const children = this.graph.children(id);\n if (highlightedNode.type === 'cluster') {\n children.forEach((childId) => this.highlightNode(childId));\n }\n\n if (highlightedNode.element.classList.contains('dim')) {\n return null;\n }\n\n highlightedNode.element.classList.add('highlight');\n\n this.graph.nodeEdges(id).forEach((e) => {\n const edge = this.graph.edge(e).element;\n edge.classList.add('highlight');\n\n if (id === e.w) {\n edge.classList.add('highlight--inbound');\n }\n\n // Render highlighted connections above non-highlighted connections\n if (!edge.classList.contains('dim')) {\n const parent = edge.parentNode;\n parent.removeChild(edge);\n parent.appendChild(edge);\n }\n });\n\n return highlightedNode.codeObject;\n }\n\n clearFocus() {\n this.outputGroup.querySelectorAll('.dim').forEach((el) => {\n el.classList.remove('dim');\n });\n }\n\n focus(id) {\n const [visitedNodes, visitedEdges] = findTraversableNodesAndEdges(this.graph, id);\n\n this.graph.nodes().forEach((nodeId) => {\n if (visitedNodes.has(nodeId)) {\n return;\n }\n\n const node = this.graph.node(nodeId);\n if (node.type !== 'cluster') {\n node.element.classList.add('dim');\n }\n });\n\n this.graph.edges().forEach((edgeId) => {\n if (visitedEdges.has(edgeId)) {\n return;\n }\n\n const edge = this.graph.edge(edgeId).element;\n edge.classList.add('dim');\n\n const parent = edge.parentNode;\n parent.removeChild(edge);\n parent.insertAdjacentElement('afterbegin', edge);\n });\n }\n\n expand(codeObject, children) {\n const { id } = codeObject;\n\n this.graph.edges().forEach(({ v, w }) => {\n if (v === id || w === id) {\n const edge = this.graph.edge(v, w);\n if (edge.group) {\n edge.group.remove();\n this.graph.removeEdge(v, w);\n }\n }\n });\n\n this.removeNode(id);\n\n const clusterNode = {\n id,\n type: 'cluster',\n label: codeObject.id,\n children: children.length,\n class: codeObject.type,\n codeObject,\n };\n\n this.setNode(clusterNode);\n children.forEach((obj) => this.setNodeFromCodeObject(obj, id));\n }\n\n collapse() {\n this.render();\n }\n\n getNodesBox(nodes) {\n const nodesBox = {\n top: [],\n left: [],\n right: [],\n bottom: [],\n x: [],\n y: [],\n };\n\n nodes.forEach((id) => {\n const node = this.graph.node(id);\n if (!node) {\n return;\n }\n\n const nodeBox = node.element.getBoundingClientRect() || node.element.getBBox();\n nodesBox.top.push(nodeBox.top);\n nodesBox.left.push(nodeBox.left);\n nodesBox.right.push(nodeBox.right);\n nodesBox.bottom.push(nodeBox.bottom);\n nodesBox.x.push(node.x - nodeBox.width / 2);\n nodesBox.y.push(node.y - nodeBox.height / 2);\n });\n\n nodesBox.top = Math.min(...nodesBox.top);\n nodesBox.left = Math.min(...nodesBox.left);\n nodesBox.right = Math.max(...nodesBox.right);\n nodesBox.bottom = Math.max(...nodesBox.bottom);\n nodesBox.offsetTop = Math.min(...nodesBox.y);\n nodesBox.offsetLeft = Math.min(...nodesBox.x);\n\n nodesBox.width = nodesBox.right - nodesBox.left;\n nodesBox.height = nodesBox.bottom - nodesBox.top;\n\n return nodesBox;\n }\n\n scrollToNodes(container, nodes) {\n const nodesBox = this.getNodesBox(nodes);\n const containerBox = container.getBoundingClientRect();\n\n if (Geometry.contains(containerBox, nodesBox)) {\n return false;\n }\n\n const xRatio = containerBox.width / nodesBox.width;\n const yRatio = containerBox.height / nodesBox.height;\n const scale = xRatio > 1 && yRatio > 1 ? 1 : Math.min(xRatio, yRatio) - 0.01;\n\n return {\n scale,\n x: nodesBox.width / 2 + nodesBox.offsetLeft,\n y: nodesBox.height / 2 + nodesBox.offsetTop,\n };\n }\n\n edge(to, from) {\n return this.graph.edge(to, from);\n }\n\n node(id) {\n return this.graph.node(id);\n }\n}\n\nconst DEFAULT_TARGET_COUNT = 1;\n\n// Types which have render support within the diagram\nconst renderableTypes = [\n models.CodeObjectType.DATABASE,\n models.CodeObjectType.HTTP,\n models.CodeObjectType.EXTERNAL_SERVICE,\n models.CodeObjectType.ROUTE,\n models.CodeObjectType.PACKAGE,\n models.CodeObjectType.CLASS,\n];\n\nfunction codeObjectFromElement(element, classMap) {\n const { id, type } = element.dataset;\n return classMap.codeObjects.find((obj) => obj.id === id && obj.type === type);\n}\n\nfunction bindEvents(componentDiagram, classMap) {\n const svg = componentDiagram.element.node();\n\n svg.addEventListener('click', (event) => {\n const expandIcon = getEventTarget(event.target, svg, 'g.label .label__icon--expand');\n if (!expandIcon) {\n return;\n }\n\n event.stopImmediatePropagation();\n\n const codeObject = codeObjectFromElement(expandIcon.closest('.node'), classMap);\n componentDiagram.expand(codeObject);\n });\n\n svg.addEventListener('click', (event) => {\n const collapseIcon = getEventTarget(event.target, svg, 'g.label .label__icon--collapse');\n if (!collapseIcon) {\n return;\n }\n\n event.stopImmediatePropagation();\n\n const codeObject = codeObjectFromElement(collapseIcon.closest('.cluster'), classMap);\n componentDiagram.collapse(codeObject);\n });\n\n svg.addEventListener('click', (event) => {\n const node = getEventTarget(event.target, svg, 'g.nodes g.node');\n if (!node) {\n return;\n }\n\n event.stopPropagation();\n const codeObject = codeObjectFromElement(node, classMap);\n componentDiagram.highlight(codeObject);\n componentDiagram.emit('click', codeObject);\n });\n\n svg.addEventListener('dblclick', (event) => {\n const node = getEventTarget(event.target, svg, 'g.nodes g.node');\n if (!node) {\n return;\n }\n\n event.stopPropagation();\n componentDiagram.focus(codeObjectFromElement(node, classMap));\n });\n\n svg.addEventListener('click', (event) => {\n const edge = getEventTarget(event.target, svg, '.edgePath > path');\n if (!edge) {\n return;\n }\n\n event.stopPropagation();\n componentDiagram.clearHighlights(true);\n\n edge.parentNode.classList.add('highlight');\n d3Selection.select(svg).selectAll('.edgePath.highlight').raise();\n\n const { to, from } = edge.parentElement.dataset;\n const { codeObjectTo, codeObjectFrom } = componentDiagram.graph.edge(from, to);\n\n componentDiagram.emit('edge', { to: codeObjectTo, from: codeObjectFrom });\n });\n\n svg.addEventListener('click', (event) => {\n const cluster = getEventTarget(event.target, svg, 'g.cluster');\n if (!cluster) {\n return;\n }\n\n event.stopPropagation();\n const codeObject = codeObjectFromElement(cluster, classMap);\n componentDiagram.highlight(codeObject);\n componentDiagram.emit('click', codeObject);\n });\n}\n\nconst expandableTypes = [models.CodeObjectType.PACKAGE, models.CodeObjectType.HTTP];\nconst COMPONENT_OPTIONS = {\n contextMenu(componentDiagram) {\n return [\n (item) =>\n item\n .text('Set as root')\n .selector('.nodes .node')\n .transform((e) => componentDiagram.graph.node(e.dataset.id).codeObject)\n .on('execute', (id) => componentDiagram.emit('makeRoot', id)),\n (item) =>\n item\n .text('Expand')\n .selector('g.node')\n .transform((e) => componentDiagram.graph.node(e.dataset.id).codeObject)\n .condition((obj) => expandableTypes.includes(obj.type))\n .on('execute', (id) => componentDiagram.expand(id)),\n (item) =>\n item\n .text('Collapse')\n .selector('g.node')\n .transform((e) => componentDiagram.graph.node(e.dataset.id).codeObject)\n .condition(\n (obj) => !expandableTypes.includes(obj.type) && obj.type !== models.CodeObjectType.DATABASE\n )\n .on('execute', (id) => componentDiagram.collapse(id)),\n (item) =>\n item\n .text('Collapse')\n .selector('g.cluster')\n .transform((e) => componentDiagram.graph.node(e.dataset.id).codeObject)\n .on('execute', (obj) => componentDiagram.collapse(obj)),\n (item) =>\n item.text('Reset view').on('execute', () => {\n componentDiagram.render(componentDiagram.classMap);\n }),\n ];\n },\n};\n\n// These functions clearly need an API abstraction, I'm just not sure what that is yet. -DB\nfunction inboundEdges(...codeObjects) {\n return codeObjects\n .map((obj) =>\n obj.inboundConnections\n .map((connection) => [connection, ...connection.ancestors()])\n .flat()\n .map((connection) => ({\n from: connection,\n to: obj,\n }))\n )\n .flat()\n .filter((edge) => edge.to !== edge.from);\n}\n\nfunction outboundEdges(...codeObjects) {\n return codeObjects\n .map((obj) =>\n obj.outboundConnections\n .map((connection) => [connection, ...connection.ancestors()])\n .flat()\n .map((connection) => ({\n from: obj,\n to: connection,\n }))\n )\n .flat()\n .filter((edge) => edge.to !== edge.from);\n}\n\nfunction allEdges(...codeObjects) {\n // Grab all the connections and build edges for every ancestor of that connection.\n return [...outboundEdges(...codeObjects), ...inboundEdges(...codeObjects)];\n}\n\nclass ComponentDiagram extends models.EventSource {\n constructor(container, options = {}) {\n super();\n\n const componentDiagramOptions = deepmerge__default[\"default\"](COMPONENT_OPTIONS, options);\n\n this.container = new Container(container, componentDiagramOptions);\n this.container.setContextMenu(this);\n\n this.targetCount = DEFAULT_TARGET_COUNT;\n this.element = d3Selection.select(this.container.contentElement)\n .append('svg')\n .attr('class', 'appmap__component-diagram');\n\n this.on('postrender', () => {\n this.container.fitViewport(this.container.contentElement);\n });\n\n this.container.element.addEventListener('click', (event) => {\n if (!event.target.classList.contains('dropdown-item')) {\n this.emit('click', null);\n this.clearHighlights();\n }\n\n if (this.container.contextMenu) {\n this.container.contextMenu.close();\n }\n });\n\n this.container.element.addEventListener('move', () => {\n if (this.container.contextMenu) {\n this.container.contextMenu.close();\n }\n });\n\n this.container.element.addEventListener('dblclick', () => {\n this.clearFocus();\n });\n }\n\n render(classMap) {\n if (!classMap) {\n return;\n }\n\n this.classMap = classMap;\n this.graph = new Graph(this.element.node(), {\n animation: {\n duration: 600,\n },\n });\n\n const codeObjects = classMap.roots\n .map((root) => root.leafs())\n .flat()\n .reduce((objects, obj) => {\n const children = obj.childLeafs();\n\n if (children.length === 1 && renderableTypes.includes(children[0].type)) {\n // Make sure this object isn't empty\n const eventCount = obj.allEvents.length;\n if (eventCount > 0) {\n objects.push(children[0]);\n }\n } else {\n objects.push(obj);\n }\n\n return objects;\n }, []);\n const edges = outboundEdges(...codeObjects);\n\n codeObjects.forEach((codeObject) => this.graph.setNodeFromCodeObject(codeObject));\n edges.forEach((edge) => this.graph.setEdge(edge.from, edge.to));\n\n this.graph.render();\n bindEvents(this, classMap);\n this.emit('postrender');\n }\n\n clearHighlights(noEvent = false) {\n this.graph.clearHighlights();\n\n this.container.scaleTarget = false;\n\n if (!noEvent) {\n this.emit('highlight', null);\n }\n }\n\n highlight(...codeObjects) {\n this.clearHighlights(true);\n\n const highlightedCodeObjects = codeObjects\n .filter(Boolean)\n .map((obj) => this.graph.highlightNode(obj.id ?? obj.name))\n .filter(Boolean);\n\n if (highlightedCodeObjects.length) {\n this.scrollTo(highlightedCodeObjects);\n }\n\n const hlBox = this.graph.getNodesBox(highlightedCodeObjects.map((obj) => obj.id ?? obj.name));\n this.container.scaleTarget = {\n x: hlBox.width / 2 + hlBox.offsetLeft,\n y: hlBox.height / 2 + hlBox.offsetTop,\n };\n\n this.emit('highlight', highlightedCodeObjects);\n\n return highlightedCodeObjects.length > 0;\n }\n\n clearFocus() {\n this.graph.clearFocus();\n\n this.emit('focus', null);\n }\n\n focus(codeObject) {\n this.graph.clearFocus();\n this.graph.focus(codeObject.id);\n\n this.scrollTo(codeObject);\n\n this.emit('focus', codeObject);\n }\n\n scrollTo(...codeObjects) {\n const scrollOptions = this.graph.scrollToNodes(\n this.container.element,\n codeObjects.map((obj) => obj.id)\n );\n\n if (scrollOptions) {\n this.container.scaleTo(scrollOptions.scale);\n\n setTimeout(() => {\n this.container.translateTo(scrollOptions.x, scrollOptions.y);\n }, 200);\n\n this.emit('scrollTo', codeObjects);\n }\n }\n\n expand(codeObject, scrollToSubclasses = true) {\n const nodeWasHighlighted = this.isHighlighted(codeObject);\n const children = codeObject.children.map((child) => child.leafs()).flat();\n\n this.graph.expand(codeObject, children);\n allEdges(...children).forEach(({ from, to }) => this.graph.setEdge(from, to));\n\n // HACK.\n // The child graph should really be doing this, but there's no way to add the edges before\n // rendering without bloating the API any further.\n this.graph.render();\n\n if (scrollToSubclasses) {\n this.scrollTo(children);\n }\n\n if (nodeWasHighlighted) {\n this.graph.highlightNode(codeObject.id);\n }\n\n this.emit('expand', codeObject);\n }\n\n collapse(codeObject, scrollToPackage = true) {\n const codeObjectPackage = codeObject.packageObject || codeObject.parent || codeObject;\n const nodeWasHighlighted = this.isHighlighted(codeObjectPackage);\n const { id } = codeObjectPackage;\n\n this.graph.removeNode(id);\n\n codeObjectPackage.childLeafs().forEach((child) => this.graph.removeNode(child.id));\n\n this.graph.setNodeFromCodeObject(codeObjectPackage);\n\n allEdges(codeObjectPackage).forEach(({ to, from }) => this.graph.setEdge(from, to));\n\n this.graph.collapse();\n\n if (scrollToPackage) {\n this.scrollTo(codeObjectPackage);\n }\n\n if (nodeWasHighlighted) {\n this.graph.highlightNode(id);\n }\n\n this.emit('collapse', codeObjectPackage);\n }\n\n hasPackage(packageId) {\n return this.currentDiagramModel.packages.has(packageId);\n }\n\n hasObject(codeObject) {\n return Boolean(this.graph.node(codeObject.id));\n }\n\n isHighlighted(codeObject) {\n const { id } = codeObject;\n const element = this.element.node().querySelector(`[data-id=\"${id}\"]`);\n return element && element.classList.contains('highlight');\n }\n}\n\n// Returns [ r, g, b ]\nfunction parseHexColor(hexColor) {\n const result = [];\n const match = hexColor.match(/^#([a-fA-F0-9]{3,6})/);\n\n if (match) {\n const hex = match[1];\n const charsPerNumber = Math.ceil(hex.length / 3);\n const numberCount = hex.length / charsPerNumber;\n\n for (let i = 0; i < numberCount; i += charsPerNumber) {\n const slice = hex.slice(i, i + charsPerNumber);\n let bytes = parseInt(slice, 16);\n\n if (charsPerNumber === 1) {\n bytes *= bytes;\n }\n\n result.push(bytes);\n }\n }\n\n const len = result.length;\n for (let i = 0; i < 3 - len; i += 1) {\n result.push(0.0);\n }\n\n return result;\n}\n\n// Shifts the next item off the array and coerces it to a number\nfunction getNextNumber(arr) {\n const val = arr.shift();\n if (typeof val !== 'number') {\n return 0.0;\n }\n return val;\n}\n\nfunction clamp(val, min, max) {\n return Math.min(Math.max(min, val), max);\n}\n\n// Convenience class for converting and mutating colors\nclass Color {\n // Supports the following constructors:\n // new Color(127) -> rgba(127, 127, 127, 1.0)\n // new Color(127, 0.5) -> rgba(127, 127, 127, 0.5)\n // new Color(10, 60, 224) -> rgba(10, 60, 224, 1.0)\n // new Color(10, 60, 224, 0.5) -> rgba(10, 60, 224, 0.5)\n // new Color('#f0f') -> rgba(255, 0, 255, 1.0)\n // new Color('#08ff00') -> rgba(127, 255, 0, 1.0)\n // new Color('#08ff00', 0.5) -> rgba(127, 255, 0, 1.0, 0.5)\n // new Color(color) -> rgba(color.r, color.g, color.b, color.a)\n // new Color(color, 1.0) -> rgba(color.r, color.g, color.b, 1.0)\n constructor(...vals) {\n Object.defineProperty(this, '$data', {\n writable: false,\n enumerable: false,\n value: {\n r: 0.0,\n g: 0.0,\n b: 0.0,\n a: 0.0,\n },\n });\n\n switch (vals.length) {\n case 1:\n {\n const color = vals[0];\n const colorType = typeof color;\n\n if (colorType === 'string') {\n const [r, g, b] = parseHexColor(color);\n this.r = r;\n this.g = g;\n this.b = b;\n } else if (colorType === 'number') {\n this.r = color;\n this.g = color;\n this.b = color;\n } else if (color instanceof Color) {\n this.r = color.r;\n this.g = color.g;\n this.b = color.b;\n this.a = color.a;\n }\n }\n break;\n\n case 2:\n {\n const color = vals[0];\n const colorType = typeof color;\n\n if (colorType === 'string') {\n const [r, g, b] = parseHexColor(color);\n this.r = r;\n this.g = g;\n this.b = b;\n } else if (colorType === 'number') {\n this.r = color;\n this.g = color;\n this.b = color;\n } else if (color instanceof Color) {\n this.r = color.r;\n this.g = color.g;\n this.b = color.b;\n }\n\n const alpha = vals[1];\n if (typeof alpha === 'number') {\n this.a = alpha;\n }\n }\n break;\n\n case 3:\n this.r = getNextNumber(vals);\n this.g = getNextNumber(vals);\n this.b = getNextNumber(vals);\n break;\n\n case 4:\n this.r = getNextNumber(vals);\n this.g = getNextNumber(vals);\n this.b = getNextNumber(vals);\n this.a = getNextNumber(vals);\n break;\n }\n\n if (this.a > 1) {\n this.a /= 0xff;\n }\n }\n\n set r(val) {\n this.$data.r = Math.floor(clamp(val, 0, 255));\n }\n\n set g(val) {\n this.$data.g = Math.floor(clamp(val, 0, 255));\n }\n\n set b(val) {\n this.$data.b = Math.floor(clamp(val, 0, 255));\n }\n\n set a(val) {\n this.$data.a = clamp(val, 0, 1);\n }\n\n get r() {\n return this.$data.r;\n }\n\n get g() {\n return this.$data.g;\n }\n\n get b() {\n return this.$data.b;\n }\n\n get a() {\n return this.$data.a;\n }\n\n get rgb() {\n return `rgb(${this.r}, ${this.g}, ${this.b})`;\n }\n\n get hex() {\n const r = this.r.toString(16).padStart(2, '0');\n const g = this.g.toString(16).padStart(2, '0');\n const b = this.b.toString(16).padStart(2, '0');\n return `#${r}${g}${b}`;\n }\n\n get rgba() {\n return `rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`;\n }\n\n static hex(...vals) {\n const color = new Color(...vals);\n return color.hex;\n }\n\n static rgb(...vals) {\n const color = new Color(...vals);\n return color.rgb;\n }\n\n static rgba(...vals) {\n const color = new Color(...vals);\n return color.rgba;\n }\n\n darken(val) {\n this.r *= val;\n this.g *= val;\n this.b *= val;\n }\n\n toString() {\n return this.hex;\n }\n}\n\nexports.Color = Color;\nexports.ComponentDiagram = ComponentDiagram;\nexports.Container = Container;\nexports.getElementCenter = getElementCenter;\nexports.getEventTarget = getEventTarget;\nexports.getParentRelativeOffset = getParentRelativeOffset;\nexports.lazyPanToElement = lazyPanToElement;\nexports.nodeFullyVisible = nodeFullyVisible;\n","exports.isatty = function () { return false; };\n\nfunction ReadStream() {\n throw new Error('tty.ReadStream is not implemented');\n}\nexports.ReadStream = ReadStream;\n\nfunction WriteStream() {\n throw new Error('tty.ReadStream is not implemented');\n}\nexports.WriteStream = WriteStream;\n","let argv = process.argv || [],\n\tenv = process.env\nlet isColorSupported =\n\t!(\"NO_COLOR\" in env || argv.includes(\"--no-color\")) &&\n\t(\"FORCE_COLOR\" in env ||\n\t\targv.includes(\"--color\") ||\n\t\tprocess.platform === \"win32\" ||\n\t\t(require != null && require(\"tty\").isatty(1) && env.TERM !== \"dumb\") ||\n\t\t\"CI\" in env)\n\nlet formatter =\n\t(open, close, replace = open) =>\n\tinput => {\n\t\tlet string = \"\" + input\n\t\tlet index = string.indexOf(close, open.length)\n\t\treturn ~index\n\t\t\t? open + replaceClose(string, close, replace, index) + close\n\t\t\t: open + string + close\n\t}\n\nlet replaceClose = (string, close, replace, index) => {\n\tlet result = \"\"\n\tlet cursor = 0\n\tdo {\n\t\tresult += string.substring(cursor, index) + replace\n\t\tcursor = index + close.length\n\t\tindex = string.indexOf(close, cursor)\n\t} while (~index)\n\treturn result + string.substring(cursor)\n}\n\nlet createColors = (enabled = isColorSupported) => {\n\tlet init = enabled ? formatter : () => String\n\treturn {\n\t\tisColorSupported: enabled,\n\t\treset: init(\"\\x1b[0m\", \"\\x1b[0m\"),\n\t\tbold: init(\"\\x1b[1m\", \"\\x1b[22m\", \"\\x1b[22m\\x1b[1m\"),\n\t\tdim: init(\"\\x1b[2m\", \"\\x1b[22m\", \"\\x1b[22m\\x1b[2m\"),\n\t\titalic: init(\"\\x1b[3m\", \"\\x1b[23m\"),\n\t\tunderline: init(\"\\x1b[4m\", \"\\x1b[24m\"),\n\t\tinverse: init(\"\\x1b[7m\", \"\\x1b[27m\"),\n\t\thidden: init(\"\\x1b[8m\", \"\\x1b[28m\"),\n\t\tstrikethrough: init(\"\\x1b[9m\", \"\\x1b[29m\"),\n\t\tblack: init(\"\\x1b[30m\", \"\\x1b[39m\"),\n\t\tred: init(\"\\x1b[31m\", \"\\x1b[39m\"),\n\t\tgreen: init(\"\\x1b[32m\", \"\\x1b[39m\"),\n\t\tyellow: init(\"\\x1b[33m\", \"\\x1b[39m\"),\n\t\tblue: init(\"\\x1b[34m\", \"\\x1b[39m\"),\n\t\tmagenta: init(\"\\x1b[35m\", \"\\x1b[39m\"),\n\t\tcyan: init(\"\\x1b[36m\", \"\\x1b[39m\"),\n\t\twhite: init(\"\\x1b[37m\", \"\\x1b[39m\"),\n\t\tgray: init(\"\\x1b[90m\", \"\\x1b[39m\"),\n\t\tbgBlack: init(\"\\x1b[40m\", \"\\x1b[49m\"),\n\t\tbgRed: init(\"\\x1b[41m\", \"\\x1b[49m\"),\n\t\tbgGreen: init(\"\\x1b[42m\", \"\\x1b[49m\"),\n\t\tbgYellow: init(\"\\x1b[43m\", \"\\x1b[49m\"),\n\t\tbgBlue: init(\"\\x1b[44m\", \"\\x1b[49m\"),\n\t\tbgMagenta: init(\"\\x1b[45m\", \"\\x1b[49m\"),\n\t\tbgCyan: init(\"\\x1b[46m\", \"\\x1b[49m\"),\n\t\tbgWhite: init(\"\\x1b[47m\", \"\\x1b[49m\"),\n\t}\n}\n\nmodule.exports = createColors()\nmodule.exports.createColors = createColors\n","'use strict'\n\nconst SINGLE_QUOTE = \"'\".charCodeAt(0)\nconst DOUBLE_QUOTE = '\"'.charCodeAt(0)\nconst BACKSLASH = '\\\\'.charCodeAt(0)\nconst SLASH = '/'.charCodeAt(0)\nconst NEWLINE = '\\n'.charCodeAt(0)\nconst SPACE = ' '.charCodeAt(0)\nconst FEED = '\\f'.charCodeAt(0)\nconst TAB = '\\t'.charCodeAt(0)\nconst CR = '\\r'.charCodeAt(0)\nconst OPEN_SQUARE = '['.charCodeAt(0)\nconst CLOSE_SQUARE = ']'.charCodeAt(0)\nconst OPEN_PARENTHESES = '('.charCodeAt(0)\nconst CLOSE_PARENTHESES = ')'.charCodeAt(0)\nconst OPEN_CURLY = '{'.charCodeAt(0)\nconst CLOSE_CURLY = '}'.charCodeAt(0)\nconst SEMICOLON = ';'.charCodeAt(0)\nconst ASTERISK = '*'.charCodeAt(0)\nconst COLON = ':'.charCodeAt(0)\nconst AT = '@'.charCodeAt(0)\n\nconst RE_AT_END = /[\\t\\n\\f\\r \"#'()/;[\\\\\\]{}]/g\nconst RE_WORD_END = /[\\t\\n\\f\\r !\"#'():;@[\\\\\\]{}]|\\/(?=\\*)/g\nconst RE_BAD_BRACKET = /.[\\r\\n\"'(/\\\\]/\nconst RE_HEX_ESCAPE = /[\\da-f]/i\n\nmodule.exports = function tokenizer(input, options = {}) {\n let css = input.css.valueOf()\n let ignore = options.ignoreErrors\n\n let code, next, quote, content, escape\n let escaped, escapePos, prev, n, currentToken\n\n let length = css.length\n let pos = 0\n let buffer = []\n let returned = []\n\n function position() {\n return pos\n }\n\n function unclosed(what) {\n throw input.error('Unclosed ' + what, pos)\n }\n\n function endOfFile() {\n return returned.length === 0 && pos >= length\n }\n\n function nextToken(opts) {\n if (returned.length) return returned.pop()\n if (pos >= length) return\n\n let ignoreUnclosed = opts ? opts.ignoreUnclosed : false\n\n code = css.charCodeAt(pos)\n\n switch (code) {\n case NEWLINE:\n case SPACE:\n case TAB:\n case CR:\n case FEED: {\n next = pos\n do {\n next += 1\n code = css.charCodeAt(next)\n } while (\n code === SPACE ||\n code === NEWLINE ||\n code === TAB ||\n code === CR ||\n code === FEED\n )\n\n currentToken = ['space', css.slice(pos, next)]\n pos = next - 1\n break\n }\n\n case OPEN_SQUARE:\n case CLOSE_SQUARE:\n case OPEN_CURLY:\n case CLOSE_CURLY:\n case COLON:\n case SEMICOLON:\n case CLOSE_PARENTHESES: {\n let controlChar = String.fromCharCode(code)\n currentToken = [controlChar, controlChar, pos]\n break\n }\n\n case OPEN_PARENTHESES: {\n prev = buffer.length ? buffer.pop()[1] : ''\n n = css.charCodeAt(pos + 1)\n if (\n prev === 'url' &&\n n !== SINGLE_QUOTE &&\n n !== DOUBLE_QUOTE &&\n n !== SPACE &&\n n !== NEWLINE &&\n n !== TAB &&\n n !== FEED &&\n n !== CR\n ) {\n next = pos\n do {\n escaped = false\n next = css.indexOf(')', next + 1)\n if (next === -1) {\n if (ignore || ignoreUnclosed) {\n next = pos\n break\n } else {\n unclosed('bracket')\n }\n }\n escapePos = next\n while (css.charCodeAt(escapePos - 1) === BACKSLASH) {\n escapePos -= 1\n escaped = !escaped\n }\n } while (escaped)\n\n currentToken = ['brackets', css.slice(pos, next + 1), pos, next]\n\n pos = next\n } else {\n next = css.indexOf(')', pos + 1)\n content = css.slice(pos, next + 1)\n\n if (next === -1 || RE_BAD_BRACKET.test(content)) {\n currentToken = ['(', '(', pos]\n } else {\n currentToken = ['brackets', content, pos, next]\n pos = next\n }\n }\n\n break\n }\n\n case SINGLE_QUOTE:\n case DOUBLE_QUOTE: {\n quote = code === SINGLE_QUOTE ? \"'\" : '\"'\n next = pos\n do {\n escaped = false\n next = css.indexOf(quote, next + 1)\n if (next === -1) {\n if (ignore || ignoreUnclosed) {\n next = pos + 1\n break\n } else {\n unclosed('string')\n }\n }\n escapePos = next\n while (css.charCodeAt(escapePos - 1) === BACKSLASH) {\n escapePos -= 1\n escaped = !escaped\n }\n } while (escaped)\n\n currentToken = ['string', css.slice(pos, next + 1), pos, next]\n pos = next\n break\n }\n\n case AT: {\n RE_AT_END.lastIndex = pos + 1\n RE_AT_END.test(css)\n if (RE_AT_END.lastIndex === 0) {\n next = css.length - 1\n } else {\n next = RE_AT_END.lastIndex - 2\n }\n\n currentToken = ['at-word', css.slice(pos, next + 1), pos, next]\n\n pos = next\n break\n }\n\n case BACKSLASH: {\n next = pos\n escape = true\n while (css.charCodeAt(next + 1) === BACKSLASH) {\n next += 1\n escape = !escape\n }\n code = css.charCodeAt(next + 1)\n if (\n escape &&\n code !== SLASH &&\n code !== SPACE &&\n code !== NEWLINE &&\n code !== TAB &&\n code !== CR &&\n code !== FEED\n ) {\n next += 1\n if (RE_HEX_ESCAPE.test(css.charAt(next))) {\n while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) {\n next += 1\n }\n if (css.charCodeAt(next + 1) === SPACE) {\n next += 1\n }\n }\n }\n\n currentToken = ['word', css.slice(pos, next + 1), pos, next]\n\n pos = next\n break\n }\n\n default: {\n if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {\n next = css.indexOf('*/', pos + 2) + 1\n if (next === 0) {\n if (ignore || ignoreUnclosed) {\n next = css.length\n } else {\n unclosed('comment')\n }\n }\n\n currentToken = ['comment', css.slice(pos, next + 1), pos, next]\n pos = next\n } else {\n RE_WORD_END.lastIndex = pos + 1\n RE_WORD_END.test(css)\n if (RE_WORD_END.lastIndex === 0) {\n next = css.length - 1\n } else {\n next = RE_WORD_END.lastIndex - 2\n }\n\n currentToken = ['word', css.slice(pos, next + 1), pos, next]\n buffer.push(currentToken)\n pos = next\n }\n\n break\n }\n }\n\n pos++\n return currentToken\n }\n\n function back(token) {\n returned.push(token)\n }\n\n return {\n back,\n endOfFile,\n nextToken,\n position\n }\n}\n","'use strict'\n\nlet pico = require('picocolors')\n\nlet tokenizer = require('./tokenize')\n\nlet Input\n\nfunction registerInput(dependant) {\n Input = dependant\n}\n\nconst HIGHLIGHT_THEME = {\n ';': pico.yellow,\n ':': pico.yellow,\n '(': pico.cyan,\n ')': pico.cyan,\n '[': pico.yellow,\n ']': pico.yellow,\n '{': pico.yellow,\n '}': pico.yellow,\n 'at-word': pico.cyan,\n 'brackets': pico.cyan,\n 'call': pico.cyan,\n 'class': pico.yellow,\n 'comment': pico.gray,\n 'hash': pico.magenta,\n 'string': pico.green\n}\n\nfunction getTokenType([type, value], processor) {\n if (type === 'word') {\n if (value[0] === '.') {\n return 'class'\n }\n if (value[0] === '#') {\n return 'hash'\n }\n }\n\n if (!processor.endOfFile()) {\n let next = processor.nextToken()\n processor.back(next)\n if (next[0] === 'brackets' || next[0] === '(') return 'call'\n }\n\n return type\n}\n\nfunction terminalHighlight(css) {\n let processor = tokenizer(new Input(css), { ignoreErrors: true })\n let result = ''\n while (!processor.endOfFile()) {\n let token = processor.nextToken()\n let color = HIGHLIGHT_THEME[getTokenType(token, processor)]\n if (color) {\n result += token[1]\n .split(/\\r?\\n/)\n .map(i => color(i))\n .join('\\n')\n } else {\n result += token[1]\n }\n }\n return result\n}\n\nterminalHighlight.registerInput = registerInput\n\nmodule.exports = terminalHighlight\n","'use strict'\n\nlet pico = require('picocolors')\n\nlet terminalHighlight = require('./terminal-highlight')\n\nclass CssSyntaxError extends Error {\n constructor(message, line, column, source, file, plugin) {\n super(message)\n this.name = 'CssSyntaxError'\n this.reason = message\n\n if (file) {\n this.file = file\n }\n if (source) {\n this.source = source\n }\n if (plugin) {\n this.plugin = plugin\n }\n if (typeof line !== 'undefined' && typeof column !== 'undefined') {\n if (typeof line === 'number') {\n this.line = line\n this.column = column\n } else {\n this.line = line.line\n this.column = line.column\n this.endLine = column.line\n this.endColumn = column.column\n }\n }\n\n this.setMessage()\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, CssSyntaxError)\n }\n }\n\n setMessage() {\n this.message = this.plugin ? this.plugin + ': ' : ''\n this.message += this.file ? this.file : ''\n if (typeof this.line !== 'undefined') {\n this.message += ':' + this.line + ':' + this.column\n }\n this.message += ': ' + this.reason\n }\n\n showSourceCode(color) {\n if (!this.source) return ''\n\n let css = this.source\n if (color == null) color = pico.isColorSupported\n if (terminalHighlight) {\n if (color) css = terminalHighlight(css)\n }\n\n let lines = css.split(/\\r?\\n/)\n let start = Math.max(this.line - 3, 0)\n let end = Math.min(this.line + 2, lines.length)\n\n let maxWidth = String(end).length\n\n let mark, aside\n if (color) {\n let { bold, gray, red } = pico.createColors(true)\n mark = text => bold(red(text))\n aside = text => gray(text)\n } else {\n mark = aside = str => str\n }\n\n return lines\n .slice(start, end)\n .map((line, index) => {\n let number = start + 1 + index\n let gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | '\n if (number === this.line) {\n let spacing =\n aside(gutter.replace(/\\d/g, ' ')) +\n line.slice(0, this.column - 1).replace(/[^\\t]/g, ' ')\n return mark('>') + aside(gutter) + line + '\\n ' + spacing + mark('^')\n }\n return ' ' + aside(gutter) + line\n })\n .join('\\n')\n }\n\n toString() {\n let code = this.showSourceCode()\n if (code) {\n code = '\\n\\n' + code + '\\n'\n }\n return this.name + ': ' + this.message + code\n }\n}\n\nmodule.exports = CssSyntaxError\nCssSyntaxError.default = CssSyntaxError\n","'use strict'\n\nmodule.exports.isClean = Symbol('isClean')\n\nmodule.exports.my = Symbol('my')\n","'use strict'\n\nconst DEFAULT_RAW = {\n after: '\\n',\n beforeClose: '\\n',\n beforeComment: '\\n',\n beforeDecl: '\\n',\n beforeOpen: ' ',\n beforeRule: '\\n',\n colon: ': ',\n commentLeft: ' ',\n commentRight: ' ',\n emptyBody: '',\n indent: ' ',\n semicolon: false\n}\n\nfunction capitalize(str) {\n return str[0].toUpperCase() + str.slice(1)\n}\n\nclass Stringifier {\n constructor(builder) {\n this.builder = builder\n }\n\n atrule(node, semicolon) {\n let name = '@' + node.name\n let params = node.params ? this.rawValue(node, 'params') : ''\n\n if (typeof node.raws.afterName !== 'undefined') {\n name += node.raws.afterName\n } else if (params) {\n name += ' '\n }\n\n if (node.nodes) {\n this.block(node, name + params)\n } else {\n let end = (node.raws.between || '') + (semicolon ? ';' : '')\n this.builder(name + params + end, node)\n }\n }\n\n beforeAfter(node, detect) {\n let value\n if (node.type === 'decl') {\n value = this.raw(node, null, 'beforeDecl')\n } else if (node.type === 'comment') {\n value = this.raw(node, null, 'beforeComment')\n } else if (detect === 'before') {\n value = this.raw(node, null, 'beforeRule')\n } else {\n value = this.raw(node, null, 'beforeClose')\n }\n\n let buf = node.parent\n let depth = 0\n while (buf && buf.type !== 'root') {\n depth += 1\n buf = buf.parent\n }\n\n if (value.includes('\\n')) {\n let indent = this.raw(node, null, 'indent')\n if (indent.length) {\n for (let step = 0; step < depth; step++) value += indent\n }\n }\n\n return value\n }\n\n block(node, start) {\n let between = this.raw(node, 'between', 'beforeOpen')\n this.builder(start + between + '{', node, 'start')\n\n let after\n if (node.nodes && node.nodes.length) {\n this.body(node)\n after = this.raw(node, 'after')\n } else {\n after = this.raw(node, 'after', 'emptyBody')\n }\n\n if (after) this.builder(after)\n this.builder('}', node, 'end')\n }\n\n body(node) {\n let last = node.nodes.length - 1\n while (last > 0) {\n if (node.nodes[last].type !== 'comment') break\n last -= 1\n }\n\n let semicolon = this.raw(node, 'semicolon')\n for (let i = 0; i < node.nodes.length; i++) {\n let child = node.nodes[i]\n let before = this.raw(child, 'before')\n if (before) this.builder(before)\n this.stringify(child, last !== i || semicolon)\n }\n }\n\n comment(node) {\n let left = this.raw(node, 'left', 'commentLeft')\n let right = this.raw(node, 'right', 'commentRight')\n this.builder('/*' + left + node.text + right + '*/', node)\n }\n\n decl(node, semicolon) {\n let between = this.raw(node, 'between', 'colon')\n let string = node.prop + between + this.rawValue(node, 'value')\n\n if (node.important) {\n string += node.raws.important || ' !important'\n }\n\n if (semicolon) string += ';'\n this.builder(string, node)\n }\n\n document(node) {\n this.body(node)\n }\n\n raw(node, own, detect) {\n let value\n if (!detect) detect = own\n\n // Already had\n if (own) {\n value = node.raws[own]\n if (typeof value !== 'undefined') return value\n }\n\n let parent = node.parent\n\n if (detect === 'before') {\n // Hack for first rule in CSS\n if (!parent || (parent.type === 'root' && parent.first === node)) {\n return ''\n }\n\n // `root` nodes in `document` should use only their own raws\n if (parent && parent.type === 'document') {\n return ''\n }\n }\n\n // Floating child without parent\n if (!parent) return DEFAULT_RAW[detect]\n\n // Detect style by other nodes\n let root = node.root()\n if (!root.rawCache) root.rawCache = {}\n if (typeof root.rawCache[detect] !== 'undefined') {\n return root.rawCache[detect]\n }\n\n if (detect === 'before' || detect === 'after') {\n return this.beforeAfter(node, detect)\n } else {\n let method = 'raw' + capitalize(detect)\n if (this[method]) {\n value = this[method](root, node)\n } else {\n root.walk(i => {\n value = i.raws[own]\n if (typeof value !== 'undefined') return false\n })\n }\n }\n\n if (typeof value === 'undefined') value = DEFAULT_RAW[detect]\n\n root.rawCache[detect] = value\n return value\n }\n\n rawBeforeClose(root) {\n let value\n root.walk(i => {\n if (i.nodes && i.nodes.length > 0) {\n if (typeof i.raws.after !== 'undefined') {\n value = i.raws.after\n if (value.includes('\\n')) {\n value = value.replace(/[^\\n]+$/, '')\n }\n return false\n }\n }\n })\n if (value) value = value.replace(/\\S/g, '')\n return value\n }\n\n rawBeforeComment(root, node) {\n let value\n root.walkComments(i => {\n if (typeof i.raws.before !== 'undefined') {\n value = i.raws.before\n if (value.includes('\\n')) {\n value = value.replace(/[^\\n]+$/, '')\n }\n return false\n }\n })\n if (typeof value === 'undefined') {\n value = this.raw(node, null, 'beforeDecl')\n } else if (value) {\n value = value.replace(/\\S/g, '')\n }\n return value\n }\n\n rawBeforeDecl(root, node) {\n let value\n root.walkDecls(i => {\n if (typeof i.raws.before !== 'undefined') {\n value = i.raws.before\n if (value.includes('\\n')) {\n value = value.replace(/[^\\n]+$/, '')\n }\n return false\n }\n })\n if (typeof value === 'undefined') {\n value = this.raw(node, null, 'beforeRule')\n } else if (value) {\n value = value.replace(/\\S/g, '')\n }\n return value\n }\n\n rawBeforeOpen(root) {\n let value\n root.walk(i => {\n if (i.type !== 'decl') {\n value = i.raws.between\n if (typeof value !== 'undefined') return false\n }\n })\n return value\n }\n\n rawBeforeRule(root) {\n let value\n root.walk(i => {\n if (i.nodes && (i.parent !== root || root.first !== i)) {\n if (typeof i.raws.before !== 'undefined') {\n value = i.raws.before\n if (value.includes('\\n')) {\n value = value.replace(/[^\\n]+$/, '')\n }\n return false\n }\n }\n })\n if (value) value = value.replace(/\\S/g, '')\n return value\n }\n\n rawColon(root) {\n let value\n root.walkDecls(i => {\n if (typeof i.raws.between !== 'undefined') {\n value = i.raws.between.replace(/[^\\s:]/g, '')\n return false\n }\n })\n return value\n }\n\n rawEmptyBody(root) {\n let value\n root.walk(i => {\n if (i.nodes && i.nodes.length === 0) {\n value = i.raws.after\n if (typeof value !== 'undefined') return false\n }\n })\n return value\n }\n\n rawIndent(root) {\n if (root.raws.indent) return root.raws.indent\n let value\n root.walk(i => {\n let p = i.parent\n if (p && p !== root && p.parent && p.parent === root) {\n if (typeof i.raws.before !== 'undefined') {\n let parts = i.raws.before.split('\\n')\n value = parts[parts.length - 1]\n value = value.replace(/\\S/g, '')\n return false\n }\n }\n })\n return value\n }\n\n rawSemicolon(root) {\n let value\n root.walk(i => {\n if (i.nodes && i.nodes.length && i.last.type === 'decl') {\n value = i.raws.semicolon\n if (typeof value !== 'undefined') return false\n }\n })\n return value\n }\n\n rawValue(node, prop) {\n let value = node[prop]\n let raw = node.raws[prop]\n if (raw && raw.value === value) {\n return raw.raw\n }\n\n return value\n }\n\n root(node) {\n this.body(node)\n if (node.raws.after) this.builder(node.raws.after)\n }\n\n rule(node) {\n this.block(node, this.rawValue(node, 'selector'))\n if (node.raws.ownSemicolon) {\n this.builder(node.raws.ownSemicolon, node, 'end')\n }\n }\n\n stringify(node, semicolon) {\n /* c8 ignore start */\n if (!this[node.type]) {\n throw new Error(\n 'Unknown AST node type ' +\n node.type +\n '. ' +\n 'Maybe you need to change PostCSS stringifier.'\n )\n }\n /* c8 ignore stop */\n this[node.type](node, semicolon)\n }\n}\n\nmodule.exports = Stringifier\nStringifier.default = Stringifier\n","'use strict'\n\nlet Stringifier = require('./stringifier')\n\nfunction stringify(node, builder) {\n let str = new Stringifier(builder)\n str.stringify(node)\n}\n\nmodule.exports = stringify\nstringify.default = stringify\n","'use strict'\n\nlet { isClean, my } = require('./symbols')\nlet CssSyntaxError = require('./css-syntax-error')\nlet Stringifier = require('./stringifier')\nlet stringify = require('./stringify')\n\nfunction cloneNode(obj, parent) {\n let cloned = new obj.constructor()\n\n for (let i in obj) {\n if (!Object.prototype.hasOwnProperty.call(obj, i)) {\n /* c8 ignore next 2 */\n continue\n }\n if (i === 'proxyCache') continue\n let value = obj[i]\n let type = typeof value\n\n if (i === 'parent' && type === 'object') {\n if (parent) cloned[i] = parent\n } else if (i === 'source') {\n cloned[i] = value\n } else if (Array.isArray(value)) {\n cloned[i] = value.map(j => cloneNode(j, cloned))\n } else {\n if (type === 'object' && value !== null) value = cloneNode(value)\n cloned[i] = value\n }\n }\n\n return cloned\n}\n\nclass Node {\n constructor(defaults = {}) {\n this.raws = {}\n this[isClean] = false\n this[my] = true\n\n for (let name in defaults) {\n if (name === 'nodes') {\n this.nodes = []\n for (let node of defaults[name]) {\n if (typeof node.clone === 'function') {\n this.append(node.clone())\n } else {\n this.append(node)\n }\n }\n } else {\n this[name] = defaults[name]\n }\n }\n }\n\n addToError(error) {\n error.postcssNode = this\n if (error.stack && this.source && /\\n\\s{4}at /.test(error.stack)) {\n let s = this.source\n error.stack = error.stack.replace(\n /\\n\\s{4}at /,\n `$&${s.input.from}:${s.start.line}:${s.start.column}$&`\n )\n }\n return error\n }\n\n after(add) {\n this.parent.insertAfter(this, add)\n return this\n }\n\n assign(overrides = {}) {\n for (let name in overrides) {\n this[name] = overrides[name]\n }\n return this\n }\n\n before(add) {\n this.parent.insertBefore(this, add)\n return this\n }\n\n cleanRaws(keepBetween) {\n delete this.raws.before\n delete this.raws.after\n if (!keepBetween) delete this.raws.between\n }\n\n clone(overrides = {}) {\n let cloned = cloneNode(this)\n for (let name in overrides) {\n cloned[name] = overrides[name]\n }\n return cloned\n }\n\n cloneAfter(overrides = {}) {\n let cloned = this.clone(overrides)\n this.parent.insertAfter(this, cloned)\n return cloned\n }\n\n cloneBefore(overrides = {}) {\n let cloned = this.clone(overrides)\n this.parent.insertBefore(this, cloned)\n return cloned\n }\n\n error(message, opts = {}) {\n if (this.source) {\n let { end, start } = this.rangeBy(opts)\n return this.source.input.error(\n message,\n { column: start.column, line: start.line },\n { column: end.column, line: end.line },\n opts\n )\n }\n return new CssSyntaxError(message)\n }\n\n getProxyProcessor() {\n return {\n get(node, prop) {\n if (prop === 'proxyOf') {\n return node\n } else if (prop === 'root') {\n return () => node.root().toProxy()\n } else {\n return node[prop]\n }\n },\n\n set(node, prop, value) {\n if (node[prop] === value) return true\n node[prop] = value\n if (\n prop === 'prop' ||\n prop === 'value' ||\n prop === 'name' ||\n prop === 'params' ||\n prop === 'important' ||\n /* c8 ignore next */\n prop === 'text'\n ) {\n node.markDirty()\n }\n return true\n }\n }\n }\n\n markDirty() {\n if (this[isClean]) {\n this[isClean] = false\n let next = this\n while ((next = next.parent)) {\n next[isClean] = false\n }\n }\n }\n\n next() {\n if (!this.parent) return undefined\n let index = this.parent.index(this)\n return this.parent.nodes[index + 1]\n }\n\n positionBy(opts, stringRepresentation) {\n let pos = this.source.start\n if (opts.index) {\n pos = this.positionInside(opts.index, stringRepresentation)\n } else if (opts.word) {\n stringRepresentation = this.toString()\n let index = stringRepresentation.indexOf(opts.word)\n if (index !== -1) pos = this.positionInside(index, stringRepresentation)\n }\n return pos\n }\n\n positionInside(index, stringRepresentation) {\n let string = stringRepresentation || this.toString()\n let column = this.source.start.column\n let line = this.source.start.line\n\n for (let i = 0; i < index; i++) {\n if (string[i] === '\\n') {\n column = 1\n line += 1\n } else {\n column += 1\n }\n }\n\n return { column, line }\n }\n\n prev() {\n if (!this.parent) return undefined\n let index = this.parent.index(this)\n return this.parent.nodes[index - 1]\n }\n\n rangeBy(opts) {\n let start = {\n column: this.source.start.column,\n line: this.source.start.line\n }\n let end = this.source.end\n ? {\n column: this.source.end.column + 1,\n line: this.source.end.line\n }\n : {\n column: start.column + 1,\n line: start.line\n }\n\n if (opts.word) {\n let stringRepresentation = this.toString()\n let index = stringRepresentation.indexOf(opts.word)\n if (index !== -1) {\n start = this.positionInside(index, stringRepresentation)\n end = this.positionInside(index + opts.word.length, stringRepresentation)\n }\n } else {\n if (opts.start) {\n start = {\n column: opts.start.column,\n line: opts.start.line\n }\n } else if (opts.index) {\n start = this.positionInside(opts.index)\n }\n\n if (opts.end) {\n end = {\n column: opts.end.column,\n line: opts.end.line\n }\n } else if (typeof opts.endIndex === 'number') {\n end = this.positionInside(opts.endIndex)\n } else if (opts.index) {\n end = this.positionInside(opts.index + 1)\n }\n }\n\n if (\n end.line < start.line ||\n (end.line === start.line && end.column <= start.column)\n ) {\n end = { column: start.column + 1, line: start.line }\n }\n\n return { end, start }\n }\n\n raw(prop, defaultType) {\n let str = new Stringifier()\n return str.raw(this, prop, defaultType)\n }\n\n remove() {\n if (this.parent) {\n this.parent.removeChild(this)\n }\n this.parent = undefined\n return this\n }\n\n replaceWith(...nodes) {\n if (this.parent) {\n let bookmark = this\n let foundSelf = false\n for (let node of nodes) {\n if (node === this) {\n foundSelf = true\n } else if (foundSelf) {\n this.parent.insertAfter(bookmark, node)\n bookmark = node\n } else {\n this.parent.insertBefore(bookmark, node)\n }\n }\n\n if (!foundSelf) {\n this.remove()\n }\n }\n\n return this\n }\n\n root() {\n let result = this\n while (result.parent && result.parent.type !== 'document') {\n result = result.parent\n }\n return result\n }\n\n toJSON(_, inputs) {\n let fixed = {}\n let emitInputs = inputs == null\n inputs = inputs || new Map()\n let inputsNextIndex = 0\n\n for (let name in this) {\n if (!Object.prototype.hasOwnProperty.call(this, name)) {\n /* c8 ignore next 2 */\n continue\n }\n if (name === 'parent' || name === 'proxyCache') continue\n let value = this[name]\n\n if (Array.isArray(value)) {\n fixed[name] = value.map(i => {\n if (typeof i === 'object' && i.toJSON) {\n return i.toJSON(null, inputs)\n } else {\n return i\n }\n })\n } else if (typeof value === 'object' && value.toJSON) {\n fixed[name] = value.toJSON(null, inputs)\n } else if (name === 'source') {\n let inputId = inputs.get(value.input)\n if (inputId == null) {\n inputId = inputsNextIndex\n inputs.set(value.input, inputsNextIndex)\n inputsNextIndex++\n }\n fixed[name] = {\n end: value.end,\n inputId,\n start: value.start\n }\n } else {\n fixed[name] = value\n }\n }\n\n if (emitInputs) {\n fixed.inputs = [...inputs.keys()].map(input => input.toJSON())\n }\n\n return fixed\n }\n\n toProxy() {\n if (!this.proxyCache) {\n this.proxyCache = new Proxy(this, this.getProxyProcessor())\n }\n return this.proxyCache\n }\n\n toString(stringifier = stringify) {\n if (stringifier.stringify) stringifier = stringifier.stringify\n let result = ''\n stringifier(this, i => {\n result += i\n })\n return result\n }\n\n warn(result, text, opts) {\n let data = { node: this }\n for (let i in opts) data[i] = opts[i]\n return result.warn(text, data)\n }\n\n get proxyOf() {\n return this\n }\n}\n\nmodule.exports = Node\nNode.default = Node\n","'use strict'\n\nlet Node = require('./node')\n\nclass Declaration extends Node {\n constructor(defaults) {\n if (\n defaults &&\n typeof defaults.value !== 'undefined' &&\n typeof defaults.value !== 'string'\n ) {\n defaults = { ...defaults, value: String(defaults.value) }\n }\n super(defaults)\n this.type = 'decl'\n }\n\n get variable() {\n return this.prop.startsWith('--') || this.prop[0] === '$'\n }\n}\n\nmodule.exports = Declaration\nDeclaration.default = Declaration\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n\n/**\n * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n */\nexports.encode = function (number) {\n if (0 <= number && number < intToCharMap.length) {\n return intToCharMap[number];\n }\n throw new TypeError(\"Must be between 0 and 63: \" + number);\n};\n\n/**\n * Decode a single base 64 character code digit to an integer. Returns -1 on\n * failure.\n */\nexports.decode = function (charCode) {\n var bigA = 65; // 'A'\n var bigZ = 90; // 'Z'\n\n var littleA = 97; // 'a'\n var littleZ = 122; // 'z'\n\n var zero = 48; // '0'\n var nine = 57; // '9'\n\n var plus = 43; // '+'\n var slash = 47; // '/'\n\n var littleOffset = 26;\n var numberOffset = 52;\n\n // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ\n if (bigA <= charCode && charCode <= bigZ) {\n return (charCode - bigA);\n }\n\n // 26 - 51: abcdefghijklmnopqrstuvwxyz\n if (littleA <= charCode && charCode <= littleZ) {\n return (charCode - littleA + littleOffset);\n }\n\n // 52 - 61: 0123456789\n if (zero <= charCode && charCode <= nine) {\n return (charCode - zero + numberOffset);\n }\n\n // 62: +\n if (charCode == plus) {\n return 62;\n }\n\n // 63: /\n if (charCode == slash) {\n return 63;\n }\n\n // Invalid base64 digit.\n return -1;\n};\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n *\n * Based on the Base 64 VLQ implementation in Closure Compiler:\n * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java\n *\n * Copyright 2011 The Closure Compiler Authors. All rights reserved.\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above\n * copyright notice, this list of conditions and the following\n * disclaimer in the documentation and/or other materials provided\n * with the distribution.\n * * Neither the name of Google Inc. nor the names of its\n * contributors may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nvar base64 = require('./base64');\n\n// A single base 64 digit can contain 6 bits of data. For the base 64 variable\n// length quantities we use in the source map spec, the first bit is the sign,\n// the next four bits are the actual value, and the 6th bit is the\n// continuation bit. The continuation bit tells us whether there are more\n// digits in this value following this digit.\n//\n// Continuation\n// | Sign\n// | |\n// V V\n// 101011\n\nvar VLQ_BASE_SHIFT = 5;\n\n// binary: 100000\nvar VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\n// binary: 011111\nvar VLQ_BASE_MASK = VLQ_BASE - 1;\n\n// binary: 100000\nvar VLQ_CONTINUATION_BIT = VLQ_BASE;\n\n/**\n * Converts from a two-complement value to a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)\n * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)\n */\nfunction toVLQSigned(aValue) {\n return aValue < 0\n ? ((-aValue) << 1) + 1\n : (aValue << 1) + 0;\n}\n\n/**\n * Converts to a two-complement value from a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1\n * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2\n */\nfunction fromVLQSigned(aValue) {\n var isNegative = (aValue & 1) === 1;\n var shifted = aValue >> 1;\n return isNegative\n ? -shifted\n : shifted;\n}\n\n/**\n * Returns the base 64 VLQ encoded value.\n */\nexports.encode = function base64VLQ_encode(aValue) {\n var encoded = \"\";\n var digit;\n\n var vlq = toVLQSigned(aValue);\n\n do {\n digit = vlq & VLQ_BASE_MASK;\n vlq >>>= VLQ_BASE_SHIFT;\n if (vlq > 0) {\n // There are still more digits in this value, so we must make sure the\n // continuation bit is marked.\n digit |= VLQ_CONTINUATION_BIT;\n }\n encoded += base64.encode(digit);\n } while (vlq > 0);\n\n return encoded;\n};\n\n/**\n * Decodes the next base 64 VLQ value from the given string and returns the\n * value and the rest of the string via the out parameter.\n */\nexports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {\n var strLen = aStr.length;\n var result = 0;\n var shift = 0;\n var continuation, digit;\n\n do {\n if (aIndex >= strLen) {\n throw new Error(\"Expected more digits in base 64 VLQ value.\");\n }\n\n digit = base64.decode(aStr.charCodeAt(aIndex++));\n if (digit === -1) {\n throw new Error(\"Invalid base64 digit: \" + aStr.charAt(aIndex - 1));\n }\n\n continuation = !!(digit & VLQ_CONTINUATION_BIT);\n digit &= VLQ_BASE_MASK;\n result = result + (digit << shift);\n shift += VLQ_BASE_SHIFT;\n } while (continuation);\n\n aOutParam.value = fromVLQSigned(result);\n aOutParam.rest = aIndex;\n};\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n/**\n * This is a helper function for getting values from parameter/options\n * objects.\n *\n * @param args The object we are extracting values from\n * @param name The name of the property we are getting.\n * @param defaultValue An optional value to return if the property is missing\n * from the object. If this is not specified and the property is missing, an\n * error will be thrown.\n */\nfunction getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n}\nexports.getArg = getArg;\n\nvar urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.-]*)(?::(\\d+))?(.*)$/;\nvar dataUrlRegexp = /^data:.+\\,.+$/;\n\nfunction urlParse(aUrl) {\n var match = aUrl.match(urlRegexp);\n if (!match) {\n return null;\n }\n return {\n scheme: match[1],\n auth: match[2],\n host: match[3],\n port: match[4],\n path: match[5]\n };\n}\nexports.urlParse = urlParse;\n\nfunction urlGenerate(aParsedUrl) {\n var url = '';\n if (aParsedUrl.scheme) {\n url += aParsedUrl.scheme + ':';\n }\n url += '//';\n if (aParsedUrl.auth) {\n url += aParsedUrl.auth + '@';\n }\n if (aParsedUrl.host) {\n url += aParsedUrl.host;\n }\n if (aParsedUrl.port) {\n url += \":\" + aParsedUrl.port\n }\n if (aParsedUrl.path) {\n url += aParsedUrl.path;\n }\n return url;\n}\nexports.urlGenerate = urlGenerate;\n\nvar MAX_CACHED_INPUTS = 32;\n\n/**\n * Takes some function `f(input) -> result` and returns a memoized version of\n * `f`.\n *\n * We keep at most `MAX_CACHED_INPUTS` memoized results of `f` alive. The\n * memoization is a dumb-simple, linear least-recently-used cache.\n */\nfunction lruMemoize(f) {\n var cache = [];\n\n return function(input) {\n for (var i = 0; i < cache.length; i++) {\n if (cache[i].input === input) {\n var temp = cache[0];\n cache[0] = cache[i];\n cache[i] = temp;\n return cache[0].result;\n }\n }\n\n var result = f(input);\n\n cache.unshift({\n input,\n result,\n });\n\n if (cache.length > MAX_CACHED_INPUTS) {\n cache.pop();\n }\n\n return result;\n };\n}\n\n/**\n * Normalizes a path, or the path portion of a URL:\n *\n * - Replaces consecutive slashes with one slash.\n * - Removes unnecessary '.' parts.\n * - Removes unnecessary '/..' parts.\n *\n * Based on code in the Node.js 'path' core module.\n *\n * @param aPath The path or url to normalize.\n */\nvar normalize = lruMemoize(function normalize(aPath) {\n var path = aPath;\n var url = urlParse(aPath);\n if (url) {\n if (!url.path) {\n return aPath;\n }\n path = url.path;\n }\n var isAbsolute = exports.isAbsolute(path);\n // Split the path into parts between `/` characters. This is much faster than\n // using `.split(/\\/+/g)`.\n var parts = [];\n var start = 0;\n var i = 0;\n while (true) {\n start = i;\n i = path.indexOf(\"/\", start);\n if (i === -1) {\n parts.push(path.slice(start));\n break;\n } else {\n parts.push(path.slice(start, i));\n while (i < path.length && path[i] === \"/\") {\n i++;\n }\n }\n }\n\n for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {\n part = parts[i];\n if (part === '.') {\n parts.splice(i, 1);\n } else if (part === '..') {\n up++;\n } else if (up > 0) {\n if (part === '') {\n // The first part is blank if the path is absolute. Trying to go\n // above the root is a no-op. Therefore we can remove all '..' parts\n // directly after the root.\n parts.splice(i + 1, up);\n up = 0;\n } else {\n parts.splice(i, 2);\n up--;\n }\n }\n }\n path = parts.join('/');\n\n if (path === '') {\n path = isAbsolute ? '/' : '.';\n }\n\n if (url) {\n url.path = path;\n return urlGenerate(url);\n }\n return path;\n});\nexports.normalize = normalize;\n\n/**\n * Joins two paths/URLs.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be joined with the root.\n *\n * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a\n * scheme-relative URL: Then the scheme of aRoot, if any, is prepended\n * first.\n * - Otherwise aPath is a path. If aRoot is a URL, then its path portion\n * is updated with the result and aRoot is returned. Otherwise the result\n * is returned.\n * - If aPath is absolute, the result is aPath.\n * - Otherwise the two paths are joined with a slash.\n * - Joining for example 'http://' and 'www.example.com' is also supported.\n */\nfunction join(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n if (aPath === \"\") {\n aPath = \".\";\n }\n var aPathUrl = urlParse(aPath);\n var aRootUrl = urlParse(aRoot);\n if (aRootUrl) {\n aRoot = aRootUrl.path || '/';\n }\n\n // `join(foo, '//www.example.org')`\n if (aPathUrl && !aPathUrl.scheme) {\n if (aRootUrl) {\n aPathUrl.scheme = aRootUrl.scheme;\n }\n return urlGenerate(aPathUrl);\n }\n\n if (aPathUrl || aPath.match(dataUrlRegexp)) {\n return aPath;\n }\n\n // `join('http://', 'www.example.com')`\n if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {\n aRootUrl.host = aPath;\n return urlGenerate(aRootUrl);\n }\n\n var joined = aPath.charAt(0) === '/'\n ? aPath\n : normalize(aRoot.replace(/\\/+$/, '') + '/' + aPath);\n\n if (aRootUrl) {\n aRootUrl.path = joined;\n return urlGenerate(aRootUrl);\n }\n return joined;\n}\nexports.join = join;\n\nexports.isAbsolute = function (aPath) {\n return aPath.charAt(0) === '/' || urlRegexp.test(aPath);\n};\n\n/**\n * Make a path relative to a URL or another path.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be made relative to aRoot.\n */\nfunction relative(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n\n aRoot = aRoot.replace(/\\/$/, '');\n\n // It is possible for the path to be above the root. In this case, simply\n // checking whether the root is a prefix of the path won't work. Instead, we\n // need to remove components from the root one by one, until either we find\n // a prefix that fits, or we run out of components to remove.\n var level = 0;\n while (aPath.indexOf(aRoot + '/') !== 0) {\n var index = aRoot.lastIndexOf(\"/\");\n if (index < 0) {\n return aPath;\n }\n\n // If the only part of the root that is left is the scheme (i.e. http://,\n // file:///, etc.), one or more slashes (/), or simply nothing at all, we\n // have exhausted all components, so the path is not relative to the root.\n aRoot = aRoot.slice(0, index);\n if (aRoot.match(/^([^\\/]+:\\/)?\\/*$/)) {\n return aPath;\n }\n\n ++level;\n }\n\n // Make sure we add a \"../\" for each component we removed from the root.\n return Array(level + 1).join(\"../\") + aPath.substr(aRoot.length + 1);\n}\nexports.relative = relative;\n\nvar supportsNullProto = (function () {\n var obj = Object.create(null);\n return !('__proto__' in obj);\n}());\n\nfunction identity (s) {\n return s;\n}\n\n/**\n * Because behavior goes wacky when you set `__proto__` on objects, we\n * have to prefix all the strings in our set with an arbitrary character.\n *\n * See https://github.com/mozilla/source-map/pull/31 and\n * https://github.com/mozilla/source-map/issues/30\n *\n * @param String aStr\n */\nfunction toSetString(aStr) {\n if (isProtoString(aStr)) {\n return '$' + aStr;\n }\n\n return aStr;\n}\nexports.toSetString = supportsNullProto ? identity : toSetString;\n\nfunction fromSetString(aStr) {\n if (isProtoString(aStr)) {\n return aStr.slice(1);\n }\n\n return aStr;\n}\nexports.fromSetString = supportsNullProto ? identity : fromSetString;\n\nfunction isProtoString(s) {\n if (!s) {\n return false;\n }\n\n var length = s.length;\n\n if (length < 9 /* \"__proto__\".length */) {\n return false;\n }\n\n if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||\n s.charCodeAt(length - 2) !== 95 /* '_' */ ||\n s.charCodeAt(length - 3) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 4) !== 116 /* 't' */ ||\n s.charCodeAt(length - 5) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 6) !== 114 /* 'r' */ ||\n s.charCodeAt(length - 7) !== 112 /* 'p' */ ||\n s.charCodeAt(length - 8) !== 95 /* '_' */ ||\n s.charCodeAt(length - 9) !== 95 /* '_' */) {\n return false;\n }\n\n for (var i = length - 10; i >= 0; i--) {\n if (s.charCodeAt(i) !== 36 /* '$' */) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Comparator between two mappings where the original positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same original source/line/column, but different generated\n * line and column the same. Useful when searching for a mapping with a\n * stubbed out mapping.\n */\nfunction compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {\n var cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0 || onlyCompareOriginal) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByOriginalPositions = compareByOriginalPositions;\n\nfunction compareByOriginalPositionsNoSource(mappingA, mappingB, onlyCompareOriginal) {\n var cmp\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0 || onlyCompareOriginal) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByOriginalPositionsNoSource = compareByOriginalPositionsNoSource;\n\n/**\n * Comparator between two mappings with deflated source and name indices where\n * the generated positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same generated line and column, but different\n * source/name/original line and column the same. Useful when searching for a\n * mapping with a stubbed out mapping.\n */\nfunction compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0 || onlyCompareGenerated) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\nfunction compareByGeneratedPositionsDeflatedNoLine(mappingA, mappingB, onlyCompareGenerated) {\n var cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0 || onlyCompareGenerated) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByGeneratedPositionsDeflatedNoLine = compareByGeneratedPositionsDeflatedNoLine;\n\nfunction strcmp(aStr1, aStr2) {\n if (aStr1 === aStr2) {\n return 0;\n }\n\n if (aStr1 === null) {\n return 1; // aStr2 !== null\n }\n\n if (aStr2 === null) {\n return -1; // aStr1 !== null\n }\n\n if (aStr1 > aStr2) {\n return 1;\n }\n\n return -1;\n}\n\n/**\n * Comparator between two mappings with inflated source and name strings where\n * the generated positions are compared.\n */\nfunction compareByGeneratedPositionsInflated(mappingA, mappingB) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\n\n/**\n * Strip any JSON XSSI avoidance prefix from the string (as documented\n * in the source maps specification), and then parse the string as\n * JSON.\n */\nfunction parseSourceMapInput(str) {\n return JSON.parse(str.replace(/^\\)]}'[^\\n]*\\n/, ''));\n}\nexports.parseSourceMapInput = parseSourceMapInput;\n\n/**\n * Compute the URL of a source given the the source root, the source's\n * URL, and the source map's URL.\n */\nfunction computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {\n sourceURL = sourceURL || '';\n\n if (sourceRoot) {\n // This follows what Chrome does.\n if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {\n sourceRoot += '/';\n }\n // The spec says:\n // Line 4: An optional source root, useful for relocating source\n // files on a server or removing repeated values in the\n // “sources” entry. This value is prepended to the individual\n // entries in the “source” field.\n sourceURL = sourceRoot + sourceURL;\n }\n\n // Historically, SourceMapConsumer did not take the sourceMapURL as\n // a parameter. This mode is still somewhat supported, which is why\n // this code block is conditional. However, it's preferable to pass\n // the source map URL to SourceMapConsumer, so that this function\n // can implement the source URL resolution algorithm as outlined in\n // the spec. This block is basically the equivalent of:\n // new URL(sourceURL, sourceMapURL).toString()\n // ... except it avoids using URL, which wasn't available in the\n // older releases of node still supported by this library.\n //\n // The spec says:\n // If the sources are not absolute URLs after prepending of the\n // “sourceRoot”, the sources are resolved relative to the\n // SourceMap (like resolving script src in a html document).\n if (sourceMapURL) {\n var parsed = urlParse(sourceMapURL);\n if (!parsed) {\n throw new Error(\"sourceMapURL could not be parsed\");\n }\n if (parsed.path) {\n // Strip the last path component, but keep the \"/\".\n var index = parsed.path.lastIndexOf('/');\n if (index >= 0) {\n parsed.path = parsed.path.substring(0, index + 1);\n }\n }\n sourceURL = join(urlGenerate(parsed), sourceURL);\n }\n\n return normalize(sourceURL);\n}\nexports.computeSourceURL = computeSourceURL;\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar has = Object.prototype.hasOwnProperty;\nvar hasNativeMap = typeof Map !== \"undefined\";\n\n/**\n * A data structure which is a combination of an array and a set. Adding a new\n * member is O(1), testing for membership is O(1), and finding the index of an\n * element is O(1). Removing elements from the set is not supported. Only\n * strings are supported for membership.\n */\nfunction ArraySet() {\n this._array = [];\n this._set = hasNativeMap ? new Map() : Object.create(null);\n}\n\n/**\n * Static method for creating ArraySet instances from an existing array.\n */\nArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {\n var set = new ArraySet();\n for (var i = 0, len = aArray.length; i < len; i++) {\n set.add(aArray[i], aAllowDuplicates);\n }\n return set;\n};\n\n/**\n * Return how many unique items are in this ArraySet. If duplicates have been\n * added, than those do not count towards the size.\n *\n * @returns Number\n */\nArraySet.prototype.size = function ArraySet_size() {\n return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;\n};\n\n/**\n * Add the given string to this set.\n *\n * @param String aStr\n */\nArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n var sStr = hasNativeMap ? aStr : util.toSetString(aStr);\n var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);\n var idx = this._array.length;\n if (!isDuplicate || aAllowDuplicates) {\n this._array.push(aStr);\n }\n if (!isDuplicate) {\n if (hasNativeMap) {\n this._set.set(aStr, idx);\n } else {\n this._set[sStr] = idx;\n }\n }\n};\n\n/**\n * Is the given string a member of this set?\n *\n * @param String aStr\n */\nArraySet.prototype.has = function ArraySet_has(aStr) {\n if (hasNativeMap) {\n return this._set.has(aStr);\n } else {\n var sStr = util.toSetString(aStr);\n return has.call(this._set, sStr);\n }\n};\n\n/**\n * What is the index of the given string in the array?\n *\n * @param String aStr\n */\nArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n if (hasNativeMap) {\n var idx = this._set.get(aStr);\n if (idx >= 0) {\n return idx;\n }\n } else {\n var sStr = util.toSetString(aStr);\n if (has.call(this._set, sStr)) {\n return this._set[sStr];\n }\n }\n\n throw new Error('\"' + aStr + '\" is not in the set.');\n};\n\n/**\n * What is the element at the given index?\n *\n * @param Number aIdx\n */\nArraySet.prototype.at = function ArraySet_at(aIdx) {\n if (aIdx >= 0 && aIdx < this._array.length) {\n return this._array[aIdx];\n }\n throw new Error('No element indexed by ' + aIdx);\n};\n\n/**\n * Returns the array representation of this set (which has the proper indices\n * indicated by indexOf). Note that this is a copy of the internal array used\n * for storing the members so that no one can mess with internal state.\n */\nArraySet.prototype.toArray = function ArraySet_toArray() {\n return this._array.slice();\n};\n\nexports.ArraySet = ArraySet;\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2014 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\n\n/**\n * Determine whether mappingB is after mappingA with respect to generated\n * position.\n */\nfunction generatedPositionAfter(mappingA, mappingB) {\n // Optimized for most common case\n var lineA = mappingA.generatedLine;\n var lineB = mappingB.generatedLine;\n var columnA = mappingA.generatedColumn;\n var columnB = mappingB.generatedColumn;\n return lineB > lineA || lineB == lineA && columnB >= columnA ||\n util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;\n}\n\n/**\n * A data structure to provide a sorted view of accumulated mappings in a\n * performance conscious manner. It trades a neglibable overhead in general\n * case for a large speedup in case of mappings being added in order.\n */\nfunction MappingList() {\n this._array = [];\n this._sorted = true;\n // Serves as infimum\n this._last = {generatedLine: -1, generatedColumn: 0};\n}\n\n/**\n * Iterate through internal items. This method takes the same arguments that\n * `Array.prototype.forEach` takes.\n *\n * NOTE: The order of the mappings is NOT guaranteed.\n */\nMappingList.prototype.unsortedForEach =\n function MappingList_forEach(aCallback, aThisArg) {\n this._array.forEach(aCallback, aThisArg);\n };\n\n/**\n * Add the given source mapping.\n *\n * @param Object aMapping\n */\nMappingList.prototype.add = function MappingList_add(aMapping) {\n if (generatedPositionAfter(this._last, aMapping)) {\n this._last = aMapping;\n this._array.push(aMapping);\n } else {\n this._sorted = false;\n this._array.push(aMapping);\n }\n};\n\n/**\n * Returns the flat, sorted array of mappings. The mappings are sorted by\n * generated position.\n *\n * WARNING: This method returns internal data without copying, for\n * performance. The return value must NOT be mutated, and should be treated as\n * an immutable borrow. If you want to take ownership, you must make your own\n * copy.\n */\nMappingList.prototype.toArray = function MappingList_toArray() {\n if (!this._sorted) {\n this._array.sort(util.compareByGeneratedPositionsInflated);\n this._sorted = true;\n }\n return this._array;\n};\n\nexports.MappingList = MappingList;\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar base64VLQ = require('./base64-vlq');\nvar util = require('./util');\nvar ArraySet = require('./array-set').ArraySet;\nvar MappingList = require('./mapping-list').MappingList;\n\n/**\n * An instance of the SourceMapGenerator represents a source map which is\n * being built incrementally. You may pass an object with the following\n * properties:\n *\n * - file: The filename of the generated source.\n * - sourceRoot: A root for all relative URLs in this source map.\n */\nfunction SourceMapGenerator(aArgs) {\n if (!aArgs) {\n aArgs = {};\n }\n this._file = util.getArg(aArgs, 'file', null);\n this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);\n this._skipValidation = util.getArg(aArgs, 'skipValidation', false);\n this._ignoreInvalidMapping = util.getArg(aArgs, 'ignoreInvalidMapping', false);\n this._sources = new ArraySet();\n this._names = new ArraySet();\n this._mappings = new MappingList();\n this._sourcesContents = null;\n}\n\nSourceMapGenerator.prototype._version = 3;\n\n/**\n * Creates a new SourceMapGenerator based on a SourceMapConsumer\n *\n * @param aSourceMapConsumer The SourceMap.\n */\nSourceMapGenerator.fromSourceMap =\n function SourceMapGenerator_fromSourceMap(aSourceMapConsumer, generatorOps) {\n var sourceRoot = aSourceMapConsumer.sourceRoot;\n var generator = new SourceMapGenerator(Object.assign(generatorOps || {}, {\n file: aSourceMapConsumer.file,\n sourceRoot: sourceRoot\n }));\n aSourceMapConsumer.eachMapping(function (mapping) {\n var newMapping = {\n generated: {\n line: mapping.generatedLine,\n column: mapping.generatedColumn\n }\n };\n\n if (mapping.source != null) {\n newMapping.source = mapping.source;\n if (sourceRoot != null) {\n newMapping.source = util.relative(sourceRoot, newMapping.source);\n }\n\n newMapping.original = {\n line: mapping.originalLine,\n column: mapping.originalColumn\n };\n\n if (mapping.name != null) {\n newMapping.name = mapping.name;\n }\n }\n\n generator.addMapping(newMapping);\n });\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var sourceRelative = sourceFile;\n if (sourceRoot !== null) {\n sourceRelative = util.relative(sourceRoot, sourceFile);\n }\n\n if (!generator._sources.has(sourceRelative)) {\n generator._sources.add(sourceRelative);\n }\n\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n generator.setSourceContent(sourceFile, content);\n }\n });\n return generator;\n };\n\n/**\n * Add a single mapping from original source line and column to the generated\n * source's line and column for this source map being created. The mapping\n * object should have the following properties:\n *\n * - generated: An object with the generated line and column positions.\n * - original: An object with the original line and column positions.\n * - source: The original source file (relative to the sourceRoot).\n * - name: An optional original token name for this mapping.\n */\nSourceMapGenerator.prototype.addMapping =\n function SourceMapGenerator_addMapping(aArgs) {\n var generated = util.getArg(aArgs, 'generated');\n var original = util.getArg(aArgs, 'original', null);\n var source = util.getArg(aArgs, 'source', null);\n var name = util.getArg(aArgs, 'name', null);\n\n if (!this._skipValidation) {\n if (this._validateMapping(generated, original, source, name) === false) {\n return;\n }\n }\n\n if (source != null) {\n source = String(source);\n if (!this._sources.has(source)) {\n this._sources.add(source);\n }\n }\n\n if (name != null) {\n name = String(name);\n if (!this._names.has(name)) {\n this._names.add(name);\n }\n }\n\n this._mappings.add({\n generatedLine: generated.line,\n generatedColumn: generated.column,\n originalLine: original != null && original.line,\n originalColumn: original != null && original.column,\n source: source,\n name: name\n });\n };\n\n/**\n * Set the source content for a source file.\n */\nSourceMapGenerator.prototype.setSourceContent =\n function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {\n var source = aSourceFile;\n if (this._sourceRoot != null) {\n source = util.relative(this._sourceRoot, source);\n }\n\n if (aSourceContent != null) {\n // Add the source content to the _sourcesContents map.\n // Create a new _sourcesContents map if the property is null.\n if (!this._sourcesContents) {\n this._sourcesContents = Object.create(null);\n }\n this._sourcesContents[util.toSetString(source)] = aSourceContent;\n } else if (this._sourcesContents) {\n // Remove the source file from the _sourcesContents map.\n // If the _sourcesContents map is empty, set the property to null.\n delete this._sourcesContents[util.toSetString(source)];\n if (Object.keys(this._sourcesContents).length === 0) {\n this._sourcesContents = null;\n }\n }\n };\n\n/**\n * Applies the mappings of a sub-source-map for a specific source file to the\n * source map being generated. Each mapping to the supplied source file is\n * rewritten using the supplied source map. Note: The resolution for the\n * resulting mappings is the minimium of this map and the supplied map.\n *\n * @param aSourceMapConsumer The source map to be applied.\n * @param aSourceFile Optional. The filename of the source file.\n * If omitted, SourceMapConsumer's file property will be used.\n * @param aSourceMapPath Optional. The dirname of the path to the source map\n * to be applied. If relative, it is relative to the SourceMapConsumer.\n * This parameter is needed when the two source maps aren't in the same\n * directory, and the source map to be applied contains relative source\n * paths. If so, those relative source paths need to be rewritten\n * relative to the SourceMapGenerator.\n */\nSourceMapGenerator.prototype.applySourceMap =\n function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {\n var sourceFile = aSourceFile;\n // If aSourceFile is omitted, we will use the file property of the SourceMap\n if (aSourceFile == null) {\n if (aSourceMapConsumer.file == null) {\n throw new Error(\n 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +\n 'or the source map\\'s \"file\" property. Both were omitted.'\n );\n }\n sourceFile = aSourceMapConsumer.file;\n }\n var sourceRoot = this._sourceRoot;\n // Make \"sourceFile\" relative if an absolute Url is passed.\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n // Applying the SourceMap can add and remove items from the sources and\n // the names array.\n var newSources = new ArraySet();\n var newNames = new ArraySet();\n\n // Find mappings for the \"sourceFile\"\n this._mappings.unsortedForEach(function (mapping) {\n if (mapping.source === sourceFile && mapping.originalLine != null) {\n // Check if it can be mapped by the source map, then update the mapping.\n var original = aSourceMapConsumer.originalPositionFor({\n line: mapping.originalLine,\n column: mapping.originalColumn\n });\n if (original.source != null) {\n // Copy mapping\n mapping.source = original.source;\n if (aSourceMapPath != null) {\n mapping.source = util.join(aSourceMapPath, mapping.source)\n }\n if (sourceRoot != null) {\n mapping.source = util.relative(sourceRoot, mapping.source);\n }\n mapping.originalLine = original.line;\n mapping.originalColumn = original.column;\n if (original.name != null) {\n mapping.name = original.name;\n }\n }\n }\n\n var source = mapping.source;\n if (source != null && !newSources.has(source)) {\n newSources.add(source);\n }\n\n var name = mapping.name;\n if (name != null && !newNames.has(name)) {\n newNames.add(name);\n }\n\n }, this);\n this._sources = newSources;\n this._names = newNames;\n\n // Copy sourcesContents of applied map.\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aSourceMapPath != null) {\n sourceFile = util.join(aSourceMapPath, sourceFile);\n }\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n this.setSourceContent(sourceFile, content);\n }\n }, this);\n };\n\n/**\n * A mapping can have one of the three levels of data:\n *\n * 1. Just the generated position.\n * 2. The Generated position, original position, and original source.\n * 3. Generated and original position, original source, as well as a name\n * token.\n *\n * To maintain consistency, we validate that any new mapping being added falls\n * in to one of these categories.\n */\nSourceMapGenerator.prototype._validateMapping =\n function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,\n aName) {\n // When aOriginal is truthy but has empty values for .line and .column,\n // it is most likely a programmer error. In this case we throw a very\n // specific error message to try to guide them the right way.\n // For example: https://github.com/Polymer/polymer-bundler/pull/519\n if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {\n var message = 'original.line and original.column are not numbers -- you probably meant to omit ' +\n 'the original mapping entirely and only map the generated position. If so, pass ' +\n 'null for the original mapping instead of an object with empty or null values.'\n\n if (this._ignoreInvalidMapping) {\n if (typeof console !== 'undefined' && console.warn) {\n console.warn(message);\n }\n return false;\n } else {\n throw new Error(message);\n }\n }\n\n if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aGenerated.line > 0 && aGenerated.column >= 0\n && !aOriginal && !aSource && !aName) {\n // Case 1.\n return;\n }\n else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aOriginal && 'line' in aOriginal && 'column' in aOriginal\n && aGenerated.line > 0 && aGenerated.column >= 0\n && aOriginal.line > 0 && aOriginal.column >= 0\n && aSource) {\n // Cases 2 and 3.\n return;\n }\n else {\n var message = 'Invalid mapping: ' + JSON.stringify({\n generated: aGenerated,\n source: aSource,\n original: aOriginal,\n name: aName\n });\n\n if (this._ignoreInvalidMapping) {\n if (typeof console !== 'undefined' && console.warn) {\n console.warn(message);\n }\n return false;\n } else {\n throw new Error(message)\n }\n }\n };\n\n/**\n * Serialize the accumulated mappings in to the stream of base 64 VLQs\n * specified by the source map format.\n */\nSourceMapGenerator.prototype._serializeMappings =\n function SourceMapGenerator_serializeMappings() {\n var previousGeneratedColumn = 0;\n var previousGeneratedLine = 1;\n var previousOriginalColumn = 0;\n var previousOriginalLine = 0;\n var previousName = 0;\n var previousSource = 0;\n var result = '';\n var next;\n var mapping;\n var nameIdx;\n var sourceIdx;\n\n var mappings = this._mappings.toArray();\n for (var i = 0, len = mappings.length; i < len; i++) {\n mapping = mappings[i];\n next = ''\n\n if (mapping.generatedLine !== previousGeneratedLine) {\n previousGeneratedColumn = 0;\n while (mapping.generatedLine !== previousGeneratedLine) {\n next += ';';\n previousGeneratedLine++;\n }\n }\n else {\n if (i > 0) {\n if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {\n continue;\n }\n next += ',';\n }\n }\n\n next += base64VLQ.encode(mapping.generatedColumn\n - previousGeneratedColumn);\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (mapping.source != null) {\n sourceIdx = this._sources.indexOf(mapping.source);\n next += base64VLQ.encode(sourceIdx - previousSource);\n previousSource = sourceIdx;\n\n // lines are stored 0-based in SourceMap spec version 3\n next += base64VLQ.encode(mapping.originalLine - 1\n - previousOriginalLine);\n previousOriginalLine = mapping.originalLine - 1;\n\n next += base64VLQ.encode(mapping.originalColumn\n - previousOriginalColumn);\n previousOriginalColumn = mapping.originalColumn;\n\n if (mapping.name != null) {\n nameIdx = this._names.indexOf(mapping.name);\n next += base64VLQ.encode(nameIdx - previousName);\n previousName = nameIdx;\n }\n }\n\n result += next;\n }\n\n return result;\n };\n\nSourceMapGenerator.prototype._generateSourcesContent =\n function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {\n return aSources.map(function (source) {\n if (!this._sourcesContents) {\n return null;\n }\n if (aSourceRoot != null) {\n source = util.relative(aSourceRoot, source);\n }\n var key = util.toSetString(source);\n return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)\n ? this._sourcesContents[key]\n : null;\n }, this);\n };\n\n/**\n * Externalize the source map.\n */\nSourceMapGenerator.prototype.toJSON =\n function SourceMapGenerator_toJSON() {\n var map = {\n version: this._version,\n sources: this._sources.toArray(),\n names: this._names.toArray(),\n mappings: this._serializeMappings()\n };\n if (this._file != null) {\n map.file = this._file;\n }\n if (this._sourceRoot != null) {\n map.sourceRoot = this._sourceRoot;\n }\n if (this._sourcesContents) {\n map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);\n }\n\n return map;\n };\n\n/**\n * Render the source map being generated to a string.\n */\nSourceMapGenerator.prototype.toString =\n function SourceMapGenerator_toString() {\n return JSON.stringify(this.toJSON());\n };\n\nexports.SourceMapGenerator = SourceMapGenerator;\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nexports.GREATEST_LOWER_BOUND = 1;\nexports.LEAST_UPPER_BOUND = 2;\n\n/**\n * Recursive implementation of binary search.\n *\n * @param aLow Indices here and lower do not contain the needle.\n * @param aHigh Indices here and higher do not contain the needle.\n * @param aNeedle The element being searched for.\n * @param aHaystack The non-empty array being searched.\n * @param aCompare Function which takes two elements and returns -1, 0, or 1.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n */\nfunction recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {\n // This function terminates when one of the following is true:\n //\n // 1. We find the exact element we are looking for.\n //\n // 2. We did not find the exact element, but we can return the index of\n // the next-closest element.\n //\n // 3. We did not find the exact element, and there is no next-closest\n // element than the one we are searching for, so we return -1.\n var mid = Math.floor((aHigh - aLow) / 2) + aLow;\n var cmp = aCompare(aNeedle, aHaystack[mid], true);\n if (cmp === 0) {\n // Found the element we are looking for.\n return mid;\n }\n else if (cmp > 0) {\n // Our needle is greater than aHaystack[mid].\n if (aHigh - mid > 1) {\n // The element is in the upper half.\n return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // The exact needle element was not found in this haystack. Determine if\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return aHigh < aHaystack.length ? aHigh : -1;\n } else {\n return mid;\n }\n }\n else {\n // Our needle is less than aHaystack[mid].\n if (mid - aLow > 1) {\n // The element is in the lower half.\n return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return mid;\n } else {\n return aLow < 0 ? -1 : aLow;\n }\n }\n}\n\n/**\n * This is an implementation of binary search which will always try and return\n * the index of the closest element if there is no exact hit. This is because\n * mappings between original and generated line/col pairs are single points,\n * and there is an implicit region between each of them, so a miss just means\n * that you aren't on the very start of a region.\n *\n * @param aNeedle The element you are looking for.\n * @param aHaystack The array that is being searched.\n * @param aCompare A function which takes the needle and an element in the\n * array and returns -1, 0, or 1 depending on whether the needle is less\n * than, equal to, or greater than the element, respectively.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.\n */\nexports.search = function search(aNeedle, aHaystack, aCompare, aBias) {\n if (aHaystack.length === 0) {\n return -1;\n }\n\n var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,\n aCompare, aBias || exports.GREATEST_LOWER_BOUND);\n if (index < 0) {\n return -1;\n }\n\n // We have found either the exact element, or the next-closest element than\n // the one we are searching for. However, there may be more than one such\n // element. Make sure we always return the smallest of these.\n while (index - 1 >= 0) {\n if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {\n break;\n }\n --index;\n }\n\n return index;\n};\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n// It turns out that some (most?) JavaScript engines don't self-host\n// `Array.prototype.sort`. This makes sense because C++ will likely remain\n// faster than JS when doing raw CPU-intensive sorting. However, when using a\n// custom comparator function, calling back and forth between the VM's C++ and\n// JIT'd JS is rather slow *and* loses JIT type information, resulting in\n// worse generated code for the comparator function than would be optimal. In\n// fact, when sorting with a comparator, these costs outweigh the benefits of\n// sorting in C++. By using our own JS-implemented Quick Sort (below), we get\n// a ~3500ms mean speed-up in `bench/bench.html`.\n\nfunction SortTemplate(comparator) {\n\n/**\n * Swap the elements indexed by `x` and `y` in the array `ary`.\n *\n * @param {Array} ary\n * The array.\n * @param {Number} x\n * The index of the first item.\n * @param {Number} y\n * The index of the second item.\n */\nfunction swap(ary, x, y) {\n var temp = ary[x];\n ary[x] = ary[y];\n ary[y] = temp;\n}\n\n/**\n * Returns a random integer within the range `low .. high` inclusive.\n *\n * @param {Number} low\n * The lower bound on the range.\n * @param {Number} high\n * The upper bound on the range.\n */\nfunction randomIntInRange(low, high) {\n return Math.round(low + (Math.random() * (high - low)));\n}\n\n/**\n * The Quick Sort algorithm.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n * @param {Number} p\n * Start index of the array\n * @param {Number} r\n * End index of the array\n */\nfunction doQuickSort(ary, comparator, p, r) {\n // If our lower bound is less than our upper bound, we (1) partition the\n // array into two pieces and (2) recurse on each half. If it is not, this is\n // the empty array and our base case.\n\n if (p < r) {\n // (1) Partitioning.\n //\n // The partitioning chooses a pivot between `p` and `r` and moves all\n // elements that are less than or equal to the pivot to the before it, and\n // all the elements that are greater than it after it. The effect is that\n // once partition is done, the pivot is in the exact place it will be when\n // the array is put in sorted order, and it will not need to be moved\n // again. This runs in O(n) time.\n\n // Always choose a random pivot so that an input array which is reverse\n // sorted does not cause O(n^2) running time.\n var pivotIndex = randomIntInRange(p, r);\n var i = p - 1;\n\n swap(ary, pivotIndex, r);\n var pivot = ary[r];\n\n // Immediately after `j` is incremented in this loop, the following hold\n // true:\n //\n // * Every element in `ary[p .. i]` is less than or equal to the pivot.\n //\n // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.\n for (var j = p; j < r; j++) {\n if (comparator(ary[j], pivot, false) <= 0) {\n i += 1;\n swap(ary, i, j);\n }\n }\n\n swap(ary, i + 1, j);\n var q = i + 1;\n\n // (2) Recurse on each half.\n\n doQuickSort(ary, comparator, p, q - 1);\n doQuickSort(ary, comparator, q + 1, r);\n }\n}\n\n return doQuickSort;\n}\n\nfunction cloneSort(comparator) {\n let template = SortTemplate.toString();\n let templateFn = new Function(`return ${template}`)();\n return templateFn(comparator);\n}\n\n/**\n * Sort the given array in-place with the given comparator function.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n */\n\nlet sortCache = new WeakMap();\nexports.quickSort = function (ary, comparator, start = 0) {\n let doQuickSort = sortCache.get(comparator);\n if (doQuickSort === void 0) {\n doQuickSort = cloneSort(comparator);\n sortCache.set(comparator, doQuickSort);\n }\n doQuickSort(ary, comparator, start, ary.length - 1);\n};\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar binarySearch = require('./binary-search');\nvar ArraySet = require('./array-set').ArraySet;\nvar base64VLQ = require('./base64-vlq');\nvar quickSort = require('./quick-sort').quickSort;\n\nfunction SourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n return sourceMap.sections != null\n ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)\n : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);\n}\n\nSourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {\n return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);\n}\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nSourceMapConsumer.prototype._version = 3;\n\n// `__generatedMappings` and `__originalMappings` are arrays that hold the\n// parsed mapping coordinates from the source map's \"mappings\" attribute. They\n// are lazily instantiated, accessed via the `_generatedMappings` and\n// `_originalMappings` getters respectively, and we only parse the mappings\n// and create these arrays once queried for a source location. We jump through\n// these hoops because there can be many thousands of mappings, and parsing\n// them is expensive, so we only want to do it if we must.\n//\n// Each object in the arrays is of the form:\n//\n// {\n// generatedLine: The line number in the generated code,\n// generatedColumn: The column number in the generated code,\n// source: The path to the original source file that generated this\n// chunk of code,\n// originalLine: The line number in the original source that\n// corresponds to this chunk of generated code,\n// originalColumn: The column number in the original source that\n// corresponds to this chunk of generated code,\n// name: The name of the original symbol which generated this chunk of\n// code.\n// }\n//\n// All properties except for `generatedLine` and `generatedColumn` can be\n// `null`.\n//\n// `_generatedMappings` is ordered by the generated positions.\n//\n// `_originalMappings` is ordered by the original positions.\n\nSourceMapConsumer.prototype.__generatedMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {\n configurable: true,\n enumerable: true,\n get: function () {\n if (!this.__generatedMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__generatedMappings;\n }\n});\n\nSourceMapConsumer.prototype.__originalMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {\n configurable: true,\n enumerable: true,\n get: function () {\n if (!this.__originalMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__originalMappings;\n }\n});\n\nSourceMapConsumer.prototype._charIsMappingSeparator =\n function SourceMapConsumer_charIsMappingSeparator(aStr, index) {\n var c = aStr.charAt(index);\n return c === \";\" || c === \",\";\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n throw new Error(\"Subclasses must implement _parseMappings\");\n };\n\nSourceMapConsumer.GENERATED_ORDER = 1;\nSourceMapConsumer.ORIGINAL_ORDER = 2;\n\nSourceMapConsumer.GREATEST_LOWER_BOUND = 1;\nSourceMapConsumer.LEAST_UPPER_BOUND = 2;\n\n/**\n * Iterate over each mapping between an original source/line/column and a\n * generated line/column in this source map.\n *\n * @param Function aCallback\n * The function that is called with each mapping.\n * @param Object aContext\n * Optional. If specified, this object will be the value of `this` every\n * time that `aCallback` is called.\n * @param aOrder\n * Either `SourceMapConsumer.GENERATED_ORDER` or\n * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to\n * iterate over the mappings sorted by the generated file's line/column\n * order or the original's source/line/column order, respectively. Defaults to\n * `SourceMapConsumer.GENERATED_ORDER`.\n */\nSourceMapConsumer.prototype.eachMapping =\n function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {\n var context = aContext || null;\n var order = aOrder || SourceMapConsumer.GENERATED_ORDER;\n\n var mappings;\n switch (order) {\n case SourceMapConsumer.GENERATED_ORDER:\n mappings = this._generatedMappings;\n break;\n case SourceMapConsumer.ORIGINAL_ORDER:\n mappings = this._originalMappings;\n break;\n default:\n throw new Error(\"Unknown order of iteration.\");\n }\n\n var sourceRoot = this.sourceRoot;\n var boundCallback = aCallback.bind(context);\n var names = this._names;\n var sources = this._sources;\n var sourceMapURL = this._sourceMapURL;\n\n for (var i = 0, n = mappings.length; i < n; i++) {\n var mapping = mappings[i];\n var source = mapping.source === null ? null : sources.at(mapping.source);\n source = util.computeSourceURL(sourceRoot, source, sourceMapURL);\n boundCallback({\n source: source,\n generatedLine: mapping.generatedLine,\n generatedColumn: mapping.generatedColumn,\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: mapping.name === null ? null : names.at(mapping.name)\n });\n }\n };\n\n/**\n * Returns all generated line and column information for the original source,\n * line, and column provided. If no column is provided, returns all mappings\n * corresponding to a either the line we are searching for or the next\n * closest line that has any mappings. Otherwise, returns all mappings\n * corresponding to the given line and either the column we are searching for\n * or the next closest column that has any offsets.\n *\n * The only argument is an object with the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number is 1-based.\n * - column: Optional. the column number in the original source.\n * The column number is 0-based.\n *\n * and an array of objects is returned, each with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based.\n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nSourceMapConsumer.prototype.allGeneratedPositionsFor =\n function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {\n var line = util.getArg(aArgs, 'line');\n\n // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping\n // returns the index of the closest mapping less than the needle. By\n // setting needle.originalColumn to 0, we thus find the last mapping for\n // the given line, provided such a mapping exists.\n var needle = {\n source: util.getArg(aArgs, 'source'),\n originalLine: line,\n originalColumn: util.getArg(aArgs, 'column', 0)\n };\n\n needle.source = this._findSourceIndex(needle.source);\n if (needle.source < 0) {\n return [];\n }\n\n var mappings = [];\n\n var index = this._findMapping(needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n binarySearch.LEAST_UPPER_BOUND);\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (aArgs.column === undefined) {\n var originalLine = mapping.originalLine;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we found. Since\n // mappings are sorted, this is guaranteed to find all mappings for\n // the line we found.\n while (mapping && mapping.originalLine === originalLine) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n } else {\n var originalColumn = mapping.originalColumn;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we were searching for.\n // Since mappings are sorted, this is guaranteed to find all mappings for\n // the line we are searching for.\n while (mapping &&\n mapping.originalLine === line &&\n mapping.originalColumn == originalColumn) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n }\n }\n\n return mappings;\n };\n\nexports.SourceMapConsumer = SourceMapConsumer;\n\n/**\n * A BasicSourceMapConsumer instance represents a parsed source map which we can\n * query for information about the original file positions by giving it a file\n * position in the generated source.\n *\n * The first parameter is the raw source map (either as a JSON string, or\n * already parsed to an object). According to the spec, source maps have the\n * following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - sources: An array of URLs to the original source files.\n * - names: An array of identifiers which can be referrenced by individual mappings.\n * - sourceRoot: Optional. The URL root from which all sources are relative.\n * - sourcesContent: Optional. An array of contents of the original source files.\n * - mappings: A string of base64 VLQs which contain the actual mappings.\n * - file: Optional. The generated file this source map is associated with.\n *\n * Here is an example source map, taken from the source map spec[0]:\n *\n * {\n * version : 3,\n * file: \"out.js\",\n * sourceRoot : \"\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AA,AB;;ABCDE;\"\n * }\n *\n * The second parameter, if given, is a string whose value is the URL\n * at which the source map was found. This URL is used to compute the\n * sources array.\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#\n */\nfunction BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sources = util.getArg(sourceMap, 'sources');\n // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which\n // requires the array) to play nice here.\n var names = util.getArg(sourceMap, 'names', []);\n var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);\n var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);\n var mappings = util.getArg(sourceMap, 'mappings');\n var file = util.getArg(sourceMap, 'file', null);\n\n // Once again, Sass deviates from the spec and supplies the version as a\n // string rather than a number, so we use loose equality checking here.\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n if (sourceRoot) {\n sourceRoot = util.normalize(sourceRoot);\n }\n\n sources = sources\n .map(String)\n // Some source maps produce relative source paths like \"./foo.js\" instead of\n // \"foo.js\". Normalize these first so that future comparisons will succeed.\n // See bugzil.la/1090768.\n .map(util.normalize)\n // Always ensure that absolute sources are internally stored relative to\n // the source root, if the source root is absolute. Not doing this would\n // be particularly problematic when the source root is a prefix of the\n // source (valid, but why??). See github issue #199 and bugzil.la/1188982.\n .map(function (source) {\n return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)\n ? util.relative(sourceRoot, source)\n : source;\n });\n\n // Pass `true` below to allow duplicate names and sources. While source maps\n // are intended to be compressed and deduplicated, the TypeScript compiler\n // sometimes generates source maps with duplicates in them. See Github issue\n // #72 and bugzil.la/889492.\n this._names = ArraySet.fromArray(names.map(String), true);\n this._sources = ArraySet.fromArray(sources, true);\n\n this._absoluteSources = this._sources.toArray().map(function (s) {\n return util.computeSourceURL(sourceRoot, s, aSourceMapURL);\n });\n\n this.sourceRoot = sourceRoot;\n this.sourcesContent = sourcesContent;\n this._mappings = mappings;\n this._sourceMapURL = aSourceMapURL;\n this.file = file;\n}\n\nBasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nBasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;\n\n/**\n * Utility function to find the index of a source. Returns -1 if not\n * found.\n */\nBasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {\n var relativeSource = aSource;\n if (this.sourceRoot != null) {\n relativeSource = util.relative(this.sourceRoot, relativeSource);\n }\n\n if (this._sources.has(relativeSource)) {\n return this._sources.indexOf(relativeSource);\n }\n\n // Maybe aSource is an absolute URL as returned by |sources|. In\n // this case we can't simply undo the transform.\n var i;\n for (i = 0; i < this._absoluteSources.length; ++i) {\n if (this._absoluteSources[i] == aSource) {\n return i;\n }\n }\n\n return -1;\n};\n\n/**\n * Create a BasicSourceMapConsumer from a SourceMapGenerator.\n *\n * @param SourceMapGenerator aSourceMap\n * The source map that will be consumed.\n * @param String aSourceMapURL\n * The URL at which the source map can be found (optional)\n * @returns BasicSourceMapConsumer\n */\nBasicSourceMapConsumer.fromSourceMap =\n function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {\n var smc = Object.create(BasicSourceMapConsumer.prototype);\n\n var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);\n var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);\n smc.sourceRoot = aSourceMap._sourceRoot;\n smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),\n smc.sourceRoot);\n smc.file = aSourceMap._file;\n smc._sourceMapURL = aSourceMapURL;\n smc._absoluteSources = smc._sources.toArray().map(function (s) {\n return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);\n });\n\n // Because we are modifying the entries (by converting string sources and\n // names to indices into the sources and names ArraySets), we have to make\n // a copy of the entry or else bad things happen. Shared mutable state\n // strikes again! See github issue #191.\n\n var generatedMappings = aSourceMap._mappings.toArray().slice();\n var destGeneratedMappings = smc.__generatedMappings = [];\n var destOriginalMappings = smc.__originalMappings = [];\n\n for (var i = 0, length = generatedMappings.length; i < length; i++) {\n var srcMapping = generatedMappings[i];\n var destMapping = new Mapping;\n destMapping.generatedLine = srcMapping.generatedLine;\n destMapping.generatedColumn = srcMapping.generatedColumn;\n\n if (srcMapping.source) {\n destMapping.source = sources.indexOf(srcMapping.source);\n destMapping.originalLine = srcMapping.originalLine;\n destMapping.originalColumn = srcMapping.originalColumn;\n\n if (srcMapping.name) {\n destMapping.name = names.indexOf(srcMapping.name);\n }\n\n destOriginalMappings.push(destMapping);\n }\n\n destGeneratedMappings.push(destMapping);\n }\n\n quickSort(smc.__originalMappings, util.compareByOriginalPositions);\n\n return smc;\n };\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nBasicSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {\n get: function () {\n return this._absoluteSources.slice();\n }\n});\n\n/**\n * Provide the JIT with a nice shape / hidden class.\n */\nfunction Mapping() {\n this.generatedLine = 0;\n this.generatedColumn = 0;\n this.source = null;\n this.originalLine = null;\n this.originalColumn = null;\n this.name = null;\n}\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\n\nconst compareGenerated = util.compareByGeneratedPositionsDeflatedNoLine;\nfunction sortGenerated(array, start) {\n let l = array.length;\n let n = array.length - start;\n if (n <= 1) {\n return;\n } else if (n == 2) {\n let a = array[start];\n let b = array[start + 1];\n if (compareGenerated(a, b) > 0) {\n array[start] = b;\n array[start + 1] = a;\n }\n } else if (n < 20) {\n for (let i = start; i < l; i++) {\n for (let j = i; j > start; j--) {\n let a = array[j - 1];\n let b = array[j];\n if (compareGenerated(a, b) <= 0) {\n break;\n }\n array[j - 1] = b;\n array[j] = a;\n }\n }\n } else {\n quickSort(array, compareGenerated, start);\n }\n}\nBasicSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n var generatedLine = 1;\n var previousGeneratedColumn = 0;\n var previousOriginalLine = 0;\n var previousOriginalColumn = 0;\n var previousSource = 0;\n var previousName = 0;\n var length = aStr.length;\n var index = 0;\n var cachedSegments = {};\n var temp = {};\n var originalMappings = [];\n var generatedMappings = [];\n var mapping, str, segment, end, value;\n\n let subarrayStart = 0;\n while (index < length) {\n if (aStr.charAt(index) === ';') {\n generatedLine++;\n index++;\n previousGeneratedColumn = 0;\n\n sortGenerated(generatedMappings, subarrayStart);\n subarrayStart = generatedMappings.length;\n }\n else if (aStr.charAt(index) === ',') {\n index++;\n }\n else {\n mapping = new Mapping();\n mapping.generatedLine = generatedLine;\n\n for (end = index; end < length; end++) {\n if (this._charIsMappingSeparator(aStr, end)) {\n break;\n }\n }\n str = aStr.slice(index, end);\n\n segment = [];\n while (index < end) {\n base64VLQ.decode(aStr, index, temp);\n value = temp.value;\n index = temp.rest;\n segment.push(value);\n }\n\n if (segment.length === 2) {\n throw new Error('Found a source, but no line and column');\n }\n\n if (segment.length === 3) {\n throw new Error('Found a source and line, but no column');\n }\n\n // Generated column.\n mapping.generatedColumn = previousGeneratedColumn + segment[0];\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (segment.length > 1) {\n // Original source.\n mapping.source = previousSource + segment[1];\n previousSource += segment[1];\n\n // Original line.\n mapping.originalLine = previousOriginalLine + segment[2];\n previousOriginalLine = mapping.originalLine;\n // Lines are stored 0-based\n mapping.originalLine += 1;\n\n // Original column.\n mapping.originalColumn = previousOriginalColumn + segment[3];\n previousOriginalColumn = mapping.originalColumn;\n\n if (segment.length > 4) {\n // Original name.\n mapping.name = previousName + segment[4];\n previousName += segment[4];\n }\n }\n\n generatedMappings.push(mapping);\n if (typeof mapping.originalLine === 'number') {\n let currentSource = mapping.source;\n while (originalMappings.length <= currentSource) {\n originalMappings.push(null);\n }\n if (originalMappings[currentSource] === null) {\n originalMappings[currentSource] = [];\n }\n originalMappings[currentSource].push(mapping);\n }\n }\n }\n\n sortGenerated(generatedMappings, subarrayStart);\n this.__generatedMappings = generatedMappings;\n\n for (var i = 0; i < originalMappings.length; i++) {\n if (originalMappings[i] != null) {\n quickSort(originalMappings[i], util.compareByOriginalPositionsNoSource);\n }\n }\n this.__originalMappings = [].concat(...originalMappings);\n };\n\n/**\n * Find the mapping that best matches the hypothetical \"needle\" mapping that\n * we are searching for in the given \"haystack\" of mappings.\n */\nBasicSourceMapConsumer.prototype._findMapping =\n function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,\n aColumnName, aComparator, aBias) {\n // To return the position we are searching for, we must first find the\n // mapping for the given position and then return the opposite position it\n // points to. Because the mappings are sorted, we can use binary search to\n // find the best mapping.\n\n if (aNeedle[aLineName] <= 0) {\n throw new TypeError('Line must be greater than or equal to 1, got '\n + aNeedle[aLineName]);\n }\n if (aNeedle[aColumnName] < 0) {\n throw new TypeError('Column must be greater than or equal to 0, got '\n + aNeedle[aColumnName]);\n }\n\n return binarySearch.search(aNeedle, aMappings, aComparator, aBias);\n };\n\n/**\n * Compute the last column for each generated mapping. The last column is\n * inclusive.\n */\nBasicSourceMapConsumer.prototype.computeColumnSpans =\n function SourceMapConsumer_computeColumnSpans() {\n for (var index = 0; index < this._generatedMappings.length; ++index) {\n var mapping = this._generatedMappings[index];\n\n // Mappings do not contain a field for the last generated columnt. We\n // can come up with an optimistic estimate, however, by assuming that\n // mappings are contiguous (i.e. given two consecutive mappings, the\n // first mapping ends where the second one starts).\n if (index + 1 < this._generatedMappings.length) {\n var nextMapping = this._generatedMappings[index + 1];\n\n if (mapping.generatedLine === nextMapping.generatedLine) {\n mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;\n continue;\n }\n }\n\n // The last mapping for each line spans the entire line.\n mapping.lastGeneratedColumn = Infinity;\n }\n };\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source. The line number\n * is 1-based.\n * - column: The column number in the generated source. The column\n * number is 0-based.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null. The\n * line number is 1-based.\n * - column: The column number in the original source, or null. The\n * column number is 0-based.\n * - name: The original identifier, or null.\n */\nBasicSourceMapConsumer.prototype.originalPositionFor =\n function SourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._generatedMappings,\n \"generatedLine\",\n \"generatedColumn\",\n util.compareByGeneratedPositionsDeflated,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._generatedMappings[index];\n\n if (mapping.generatedLine === needle.generatedLine) {\n var source = util.getArg(mapping, 'source', null);\n if (source !== null) {\n source = this._sources.at(source);\n source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);\n }\n var name = util.getArg(mapping, 'name', null);\n if (name !== null) {\n name = this._names.at(name);\n }\n return {\n source: source,\n line: util.getArg(mapping, 'originalLine', null),\n column: util.getArg(mapping, 'originalColumn', null),\n name: name\n };\n }\n }\n\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nBasicSourceMapConsumer.prototype.hasContentsOfAllSources =\n function BasicSourceMapConsumer_hasContentsOfAllSources() {\n if (!this.sourcesContent) {\n return false;\n }\n return this.sourcesContent.length >= this._sources.size() &&\n !this.sourcesContent.some(function (sc) { return sc == null; });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nBasicSourceMapConsumer.prototype.sourceContentFor =\n function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n if (!this.sourcesContent) {\n return null;\n }\n\n var index = this._findSourceIndex(aSource);\n if (index >= 0) {\n return this.sourcesContent[index];\n }\n\n var relativeSource = aSource;\n if (this.sourceRoot != null) {\n relativeSource = util.relative(this.sourceRoot, relativeSource);\n }\n\n var url;\n if (this.sourceRoot != null\n && (url = util.urlParse(this.sourceRoot))) {\n // XXX: file:// URIs and absolute paths lead to unexpected behavior for\n // many users. We can help them out when they expect file:// URIs to\n // behave like it would if they were running a local HTTP server. See\n // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.\n var fileUriAbsPath = relativeSource.replace(/^file:\\/\\//, \"\");\n if (url.scheme == \"file\"\n && this._sources.has(fileUriAbsPath)) {\n return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]\n }\n\n if ((!url.path || url.path == \"/\")\n && this._sources.has(\"/\" + relativeSource)) {\n return this.sourcesContent[this._sources.indexOf(\"/\" + relativeSource)];\n }\n }\n\n // This function is used recursively from\n // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we\n // don't want to throw if we can't find the source - we just want to\n // return null, so we provide a flag to exit gracefully.\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + relativeSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number\n * is 1-based.\n * - column: The column number in the original source. The column\n * number is 0-based.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based.\n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nBasicSourceMapConsumer.prototype.generatedPositionFor =\n function SourceMapConsumer_generatedPositionFor(aArgs) {\n var source = util.getArg(aArgs, 'source');\n source = this._findSourceIndex(source);\n if (source < 0) {\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n }\n\n var needle = {\n source: source,\n originalLine: util.getArg(aArgs, 'line'),\n originalColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (mapping.source === needle.source) {\n return {\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n };\n }\n }\n\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n };\n\nexports.BasicSourceMapConsumer = BasicSourceMapConsumer;\n\n/**\n * An IndexedSourceMapConsumer instance represents a parsed source map which\n * we can query for information. It differs from BasicSourceMapConsumer in\n * that it takes \"indexed\" source maps (i.e. ones with a \"sections\" field) as\n * input.\n *\n * The first parameter is a raw source map (either as a JSON string, or already\n * parsed to an object). According to the spec for indexed source maps, they\n * have the following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - file: Optional. The generated file this source map is associated with.\n * - sections: A list of section definitions.\n *\n * Each value under the \"sections\" field has two fields:\n * - offset: The offset into the original specified at which this section\n * begins to apply, defined as an object with a \"line\" and \"column\"\n * field.\n * - map: A source map definition. This source map could also be indexed,\n * but doesn't have to be.\n *\n * Instead of the \"map\" field, it's also possible to have a \"url\" field\n * specifying a URL to retrieve a source map from, but that's currently\n * unsupported.\n *\n * Here's an example source map, taken from the source map spec[0], but\n * modified to omit a section which uses the \"url\" field.\n *\n * {\n * version : 3,\n * file: \"app.js\",\n * sections: [{\n * offset: {line:100, column:10},\n * map: {\n * version : 3,\n * file: \"section.js\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AAAA,E;;ABCDE;\"\n * }\n * }],\n * }\n *\n * The second parameter, if given, is a string whose value is the URL\n * at which the source map was found. This URL is used to compute the\n * sources array.\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt\n */\nfunction IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sections = util.getArg(sourceMap, 'sections');\n\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n this._sources = new ArraySet();\n this._names = new ArraySet();\n\n var lastOffset = {\n line: -1,\n column: 0\n };\n this._sections = sections.map(function (s) {\n if (s.url) {\n // The url field will require support for asynchronicity.\n // See https://github.com/mozilla/source-map/issues/16\n throw new Error('Support for url field in sections not implemented.');\n }\n var offset = util.getArg(s, 'offset');\n var offsetLine = util.getArg(offset, 'line');\n var offsetColumn = util.getArg(offset, 'column');\n\n if (offsetLine < lastOffset.line ||\n (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {\n throw new Error('Section offsets must be ordered and non-overlapping.');\n }\n lastOffset = offset;\n\n return {\n generatedOffset: {\n // The offset fields are 0-based, but we use 1-based indices when\n // encoding/decoding from VLQ.\n generatedLine: offsetLine + 1,\n generatedColumn: offsetColumn + 1\n },\n consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)\n }\n });\n}\n\nIndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nIndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nIndexedSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {\n get: function () {\n var sources = [];\n for (var i = 0; i < this._sections.length; i++) {\n for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {\n sources.push(this._sections[i].consumer.sources[j]);\n }\n }\n return sources;\n }\n});\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source. The line number\n * is 1-based.\n * - column: The column number in the generated source. The column\n * number is 0-based.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null. The\n * line number is 1-based.\n * - column: The column number in the original source, or null. The\n * column number is 0-based.\n * - name: The original identifier, or null.\n */\nIndexedSourceMapConsumer.prototype.originalPositionFor =\n function IndexedSourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n // Find the section containing the generated position we're trying to map\n // to an original position.\n var sectionIndex = binarySearch.search(needle, this._sections,\n function(needle, section) {\n var cmp = needle.generatedLine - section.generatedOffset.generatedLine;\n if (cmp) {\n return cmp;\n }\n\n return (needle.generatedColumn -\n section.generatedOffset.generatedColumn);\n });\n var section = this._sections[sectionIndex];\n\n if (!section) {\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n }\n\n return section.consumer.originalPositionFor({\n line: needle.generatedLine -\n (section.generatedOffset.generatedLine - 1),\n column: needle.generatedColumn -\n (section.generatedOffset.generatedLine === needle.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n bias: aArgs.bias\n });\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nIndexedSourceMapConsumer.prototype.hasContentsOfAllSources =\n function IndexedSourceMapConsumer_hasContentsOfAllSources() {\n return this._sections.every(function (s) {\n return s.consumer.hasContentsOfAllSources();\n });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nIndexedSourceMapConsumer.prototype.sourceContentFor =\n function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n var content = section.consumer.sourceContentFor(aSource, true);\n if (content || content === '') {\n return content;\n }\n }\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number\n * is 1-based.\n * - column: The column number in the original source. The column\n * number is 0-based.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based. \n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nIndexedSourceMapConsumer.prototype.generatedPositionFor =\n function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n // Only consider this section if the requested source is in the list of\n // sources of the consumer.\n if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {\n continue;\n }\n var generatedPosition = section.consumer.generatedPositionFor(aArgs);\n if (generatedPosition) {\n var ret = {\n line: generatedPosition.line +\n (section.generatedOffset.generatedLine - 1),\n column: generatedPosition.column +\n (section.generatedOffset.generatedLine === generatedPosition.line\n ? section.generatedOffset.generatedColumn - 1\n : 0)\n };\n return ret;\n }\n }\n\n return {\n line: null,\n column: null\n };\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nIndexedSourceMapConsumer.prototype._parseMappings =\n function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n this.__generatedMappings = [];\n this.__originalMappings = [];\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n var sectionMappings = section.consumer._generatedMappings;\n for (var j = 0; j < sectionMappings.length; j++) {\n var mapping = sectionMappings[j];\n\n var source = section.consumer._sources.at(mapping.source);\n source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);\n this._sources.add(source);\n source = this._sources.indexOf(source);\n\n var name = null;\n if (mapping.name) {\n name = section.consumer._names.at(mapping.name);\n this._names.add(name);\n name = this._names.indexOf(name);\n }\n\n // The mappings coming from the consumer for the section have\n // generated positions relative to the start of the section, so we\n // need to offset them to be relative to the start of the concatenated\n // generated file.\n var adjustedMapping = {\n source: source,\n generatedLine: mapping.generatedLine +\n (section.generatedOffset.generatedLine - 1),\n generatedColumn: mapping.generatedColumn +\n (section.generatedOffset.generatedLine === mapping.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: name\n };\n\n this.__generatedMappings.push(adjustedMapping);\n if (typeof adjustedMapping.originalLine === 'number') {\n this.__originalMappings.push(adjustedMapping);\n }\n }\n }\n\n quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);\n quickSort(this.__originalMappings, util.compareByOriginalPositions);\n };\n\nexports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\n","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;\nvar util = require('./util');\n\n// Matches a Windows-style `\\r\\n` newline or a `\\n` newline used by all other\n// operating systems these days (capturing the result).\nvar REGEX_NEWLINE = /(\\r?\\n)/;\n\n// Newline character code for charCodeAt() comparisons\nvar NEWLINE_CODE = 10;\n\n// Private symbol for identifying `SourceNode`s when multiple versions of\n// the source-map library are loaded. This MUST NOT CHANGE across\n// versions!\nvar isSourceNode = \"$$$isSourceNode$$$\";\n\n/**\n * SourceNodes provide a way to abstract over interpolating/concatenating\n * snippets of generated JavaScript source code while maintaining the line and\n * column information associated with the original source code.\n *\n * @param aLine The original line number.\n * @param aColumn The original column number.\n * @param aSource The original source's filename.\n * @param aChunks Optional. An array of strings which are snippets of\n * generated JS, or other SourceNodes.\n * @param aName The original identifier.\n */\nfunction SourceNode(aLine, aColumn, aSource, aChunks, aName) {\n this.children = [];\n this.sourceContents = {};\n this.line = aLine == null ? null : aLine;\n this.column = aColumn == null ? null : aColumn;\n this.source = aSource == null ? null : aSource;\n this.name = aName == null ? null : aName;\n this[isSourceNode] = true;\n if (aChunks != null) this.add(aChunks);\n}\n\n/**\n * Creates a SourceNode from generated code and a SourceMapConsumer.\n *\n * @param aGeneratedCode The generated code\n * @param aSourceMapConsumer The SourceMap for the generated code\n * @param aRelativePath Optional. The path that relative sources in the\n * SourceMapConsumer should be relative to.\n */\nSourceNode.fromStringWithSourceMap =\n function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {\n // The SourceNode we want to fill with the generated code\n // and the SourceMap\n var node = new SourceNode();\n\n // All even indices of this array are one line of the generated code,\n // while all odd indices are the newlines between two adjacent lines\n // (since `REGEX_NEWLINE` captures its match).\n // Processed fragments are accessed by calling `shiftNextLine`.\n var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n var remainingLinesIndex = 0;\n var shiftNextLine = function() {\n var lineContents = getNextLine();\n // The last line of a file might not have a newline.\n var newLine = getNextLine() || \"\";\n return lineContents + newLine;\n\n function getNextLine() {\n return remainingLinesIndex < remainingLines.length ?\n remainingLines[remainingLinesIndex++] : undefined;\n }\n };\n\n // We need to remember the position of \"remainingLines\"\n var lastGeneratedLine = 1, lastGeneratedColumn = 0;\n\n // The generate SourceNodes we need a code range.\n // To extract it current and last mapping is used.\n // Here we store the last mapping.\n var lastMapping = null;\n\n aSourceMapConsumer.eachMapping(function (mapping) {\n if (lastMapping !== null) {\n // We add the code from \"lastMapping\" to \"mapping\":\n // First check if there is a new line in between.\n if (lastGeneratedLine < mapping.generatedLine) {\n // Associate first line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n lastGeneratedLine++;\n lastGeneratedColumn = 0;\n // The remaining code is added without mapping\n } else {\n // There is no new line in between.\n // Associate the code between \"lastGeneratedColumn\" and\n // \"mapping.generatedColumn\" with \"lastMapping\"\n var nextLine = remainingLines[remainingLinesIndex] || '';\n var code = nextLine.substr(0, mapping.generatedColumn -\n lastGeneratedColumn);\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -\n lastGeneratedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n addMappingWithCode(lastMapping, code);\n // No more remaining code, continue\n lastMapping = mapping;\n return;\n }\n }\n // We add the generated code until the first mapping\n // to the SourceNode without any mapping.\n // Each line is added as separate string.\n while (lastGeneratedLine < mapping.generatedLine) {\n node.add(shiftNextLine());\n lastGeneratedLine++;\n }\n if (lastGeneratedColumn < mapping.generatedColumn) {\n var nextLine = remainingLines[remainingLinesIndex] || '';\n node.add(nextLine.substr(0, mapping.generatedColumn));\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n }\n lastMapping = mapping;\n }, this);\n // We have processed all mappings.\n if (remainingLinesIndex < remainingLines.length) {\n if (lastMapping) {\n // Associate the remaining code in the current line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n }\n // and add the remaining lines without any mapping\n node.add(remainingLines.splice(remainingLinesIndex).join(\"\"));\n }\n\n // Copy sourcesContent into SourceNode\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aRelativePath != null) {\n sourceFile = util.join(aRelativePath, sourceFile);\n }\n node.setSourceContent(sourceFile, content);\n }\n });\n\n return node;\n\n function addMappingWithCode(mapping, code) {\n if (mapping === null || mapping.source === undefined) {\n node.add(code);\n } else {\n var source = aRelativePath\n ? util.join(aRelativePath, mapping.source)\n : mapping.source;\n node.add(new SourceNode(mapping.originalLine,\n mapping.originalColumn,\n source,\n code,\n mapping.name));\n }\n }\n };\n\n/**\n * Add a chunk of generated JS to this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\nSourceNode.prototype.add = function SourceNode_add(aChunk) {\n if (Array.isArray(aChunk)) {\n aChunk.forEach(function (chunk) {\n this.add(chunk);\n }, this);\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n if (aChunk) {\n this.children.push(aChunk);\n }\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n};\n\n/**\n * Add a chunk of generated JS to the beginning of this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\nSourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {\n if (Array.isArray(aChunk)) {\n for (var i = aChunk.length-1; i >= 0; i--) {\n this.prepend(aChunk[i]);\n }\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n this.children.unshift(aChunk);\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n};\n\n/**\n * Walk over the tree of JS snippets in this node and its children. The\n * walking function is called once for each snippet of JS and is passed that\n * snippet and the its original associated source's line/column location.\n *\n * @param aFn The traversal function.\n */\nSourceNode.prototype.walk = function SourceNode_walk(aFn) {\n var chunk;\n for (var i = 0, len = this.children.length; i < len; i++) {\n chunk = this.children[i];\n if (chunk[isSourceNode]) {\n chunk.walk(aFn);\n }\n else {\n if (chunk !== '') {\n aFn(chunk, { source: this.source,\n line: this.line,\n column: this.column,\n name: this.name });\n }\n }\n }\n};\n\n/**\n * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between\n * each of `this.children`.\n *\n * @param aSep The separator.\n */\nSourceNode.prototype.join = function SourceNode_join(aSep) {\n var newChildren;\n var i;\n var len = this.children.length;\n if (len > 0) {\n newChildren = [];\n for (i = 0; i < len-1; i++) {\n newChildren.push(this.children[i]);\n newChildren.push(aSep);\n }\n newChildren.push(this.children[i]);\n this.children = newChildren;\n }\n return this;\n};\n\n/**\n * Call String.prototype.replace on the very right-most source snippet. Useful\n * for trimming whitespace from the end of a source node, etc.\n *\n * @param aPattern The pattern to replace.\n * @param aReplacement The thing to replace the pattern with.\n */\nSourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {\n var lastChild = this.children[this.children.length - 1];\n if (lastChild[isSourceNode]) {\n lastChild.replaceRight(aPattern, aReplacement);\n }\n else if (typeof lastChild === 'string') {\n this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);\n }\n else {\n this.children.push(''.replace(aPattern, aReplacement));\n }\n return this;\n};\n\n/**\n * Set the source content for a source file. This will be added to the SourceMapGenerator\n * in the sourcesContent field.\n *\n * @param aSourceFile The filename of the source file\n * @param aSourceContent The content of the source file\n */\nSourceNode.prototype.setSourceContent =\n function SourceNode_setSourceContent(aSourceFile, aSourceContent) {\n this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;\n };\n\n/**\n * Walk over the tree of SourceNodes. The walking function is called for each\n * source file content and is passed the filename and source content.\n *\n * @param aFn The traversal function.\n */\nSourceNode.prototype.walkSourceContents =\n function SourceNode_walkSourceContents(aFn) {\n for (var i = 0, len = this.children.length; i < len; i++) {\n if (this.children[i][isSourceNode]) {\n this.children[i].walkSourceContents(aFn);\n }\n }\n\n var sources = Object.keys(this.sourceContents);\n for (var i = 0, len = sources.length; i < len; i++) {\n aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);\n }\n };\n\n/**\n * Return the string representation of this source node. Walks over the tree\n * and concatenates all the various snippets together to one string.\n */\nSourceNode.prototype.toString = function SourceNode_toString() {\n var str = \"\";\n this.walk(function (chunk) {\n str += chunk;\n });\n return str;\n};\n\n/**\n * Returns the string representation of this source node along with a source\n * map.\n */\nSourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {\n var generated = {\n code: \"\",\n line: 1,\n column: 0\n };\n var map = new SourceMapGenerator(aArgs);\n var sourceMappingActive = false;\n var lastOriginalSource = null;\n var lastOriginalLine = null;\n var lastOriginalColumn = null;\n var lastOriginalName = null;\n this.walk(function (chunk, original) {\n generated.code += chunk;\n if (original.source !== null\n && original.line !== null\n && original.column !== null) {\n if(lastOriginalSource !== original.source\n || lastOriginalLine !== original.line\n || lastOriginalColumn !== original.column\n || lastOriginalName !== original.name) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n lastOriginalSource = original.source;\n lastOriginalLine = original.line;\n lastOriginalColumn = original.column;\n lastOriginalName = original.name;\n sourceMappingActive = true;\n } else if (sourceMappingActive) {\n map.addMapping({\n generated: {\n line: generated.line,\n column: generated.column\n }\n });\n lastOriginalSource = null;\n sourceMappingActive = false;\n }\n for (var idx = 0, length = chunk.length; idx < length; idx++) {\n if (chunk.charCodeAt(idx) === NEWLINE_CODE) {\n generated.line++;\n generated.column = 0;\n // Mappings end at eol\n if (idx + 1 === length) {\n lastOriginalSource = null;\n sourceMappingActive = false;\n } else if (sourceMappingActive) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n } else {\n generated.column++;\n }\n }\n });\n this.walkSourceContents(function (sourceFile, sourceContent) {\n map.setSourceContent(sourceFile, sourceContent);\n });\n\n return { code: generated.code, map: map };\n};\n\nexports.SourceNode = SourceNode;\n","/*\n * Copyright 2009-2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE.txt or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\nexports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;\nexports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;\nexports.SourceNode = require('./lib/source-node').SourceNode;\n","// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,\n// backported and transplited with Babel, with backwards-compat fixes\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n var isAbsolute = exports.isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isAbsolute).join('/');\n\n if (!path && !isAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return exports.normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n from = exports.resolve(from).substr(1);\n to = exports.resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function (path) {\n if (typeof path !== 'string') path = path + '';\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) {\n // return '//';\n // Backwards-compat fix:\n return '/';\n }\n return path.slice(0, end);\n};\n\nfunction basename(path) {\n if (typeof path !== 'string') path = path + '';\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n}\n\n// Uses a mixed approach for backwards-compatibility, as ext behavior changed\n// in new Node.js versions, so only basename() above is backported here\nexports.basename = function (path, ext) {\n var f = basename(path);\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n};\n\nexports.extname = function (path) {\n if (typeof path !== 'string') path = path + '';\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n};\n\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n ? function (str, start, len) { return str.substr(start, len) }\n : function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n","let urlAlphabet =\n 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'\nlet customAlphabet = (alphabet, defaultSize = 21) => {\n return (size = defaultSize) => {\n let id = ''\n let i = size\n while (i--) {\n id += alphabet[(Math.random() * alphabet.length) | 0]\n }\n return id\n }\n}\nlet nanoid = (size = 21) => {\n let id = ''\n let i = size\n while (i--) {\n id += urlAlphabet[(Math.random() * 64) | 0]\n }\n return id\n}\nmodule.exports = { nanoid, customAlphabet }\n","/*global window:false, self:false, define:false, module:false */\n\n/**\n * @license IDBWrapper - A cross-browser wrapper for IndexedDB\n * Version 1.7.2\n * Copyright (c) 2011 - 2017 Jens Arps\n * http://jensarps.de/\n *\n * Licensed under the MIT license\n */\n\n(function (name, definition, global) {\n\n 'use strict';\n\n if (typeof define === 'function') {\n define(definition);\n } else if (typeof module !== 'undefined' && module.exports) {\n module.exports = definition();\n } else {\n global[name] = definition();\n }\n})('IDBStore', function () {\n\n 'use strict';\n\n var defaultErrorHandler = function (error) {\n throw error;\n };\n var defaultSuccessHandler = function () {\n };\n\n var defaults = {\n storeName: 'Store',\n storePrefix: 'IDBWrapper-',\n dbVersion: 1,\n keyPath: 'id',\n autoIncrement: true,\n onStoreReady: function () {\n },\n onError: defaultErrorHandler,\n indexes: [],\n implementationPreference: [\n 'indexedDB',\n 'webkitIndexedDB',\n 'mozIndexedDB',\n 'shimIndexedDB'\n ]\n };\n\n /**\n *\n * The IDBStore constructor\n *\n * @constructor\n * @name IDBStore\n * @version 1.7.2\n *\n * @param {Object} [kwArgs] An options object used to configure the store and\n * set callbacks\n * @param {String} [kwArgs.storeName='Store'] The name of the store\n * @param {String} [kwArgs.storePrefix='IDBWrapper-'] A prefix that is\n * internally used to construct the name of the database, which will be\n * kwArgs.storePrefix + kwArgs.storeName\n * @param {Number} [kwArgs.dbVersion=1] The version of the store\n * @param {String} [kwArgs.keyPath='id'] The key path to use. If you want to\n * setup IDBWrapper to work with out-of-line keys, you need to set this to\n * `null`\n * @param {Boolean} [kwArgs.autoIncrement=true] If set to true, IDBStore will\n * automatically make sure a unique keyPath value is present on each object\n * that is stored.\n * @param {Function} [kwArgs.onStoreReady] A callback to be called when the\n * store is ready to be used.\n * @param {Function} [kwArgs.onError=throw] A callback to be called when an\n * error occurred during instantiation of the store.\n * @param {Array} [kwArgs.indexes=[]] An array of indexData objects\n * defining the indexes to use with the store. For every index to be used\n * one indexData object needs to be passed in the array.\n * An indexData object is defined as follows:\n * @param {Object} [kwArgs.indexes.indexData] An object defining the index to\n * use\n * @param {String} kwArgs.indexes.indexData.name The name of the index\n * @param {String} [kwArgs.indexes.indexData.keyPath] The key path of the index\n * @param {Boolean} [kwArgs.indexes.indexData.unique] Whether the index is unique\n * @param {Boolean} [kwArgs.indexes.indexData.multiEntry] Whether the index is multi entry\n * @param {Array} [kwArgs.implementationPreference=['indexedDB','webkitIndexedDB','mozIndexedDB','shimIndexedDB']] An array of strings naming implementations to be used, in order or preference\n * @param {Function} [onStoreReady] A callback to be called when the store\n * is ready to be used.\n * @example\n // create a store for customers with an additional index over the\n // `lastname` property.\n var myCustomerStore = new IDBStore({\n dbVersion: 1,\n storeName: 'customer-index',\n keyPath: 'customerid',\n autoIncrement: true,\n onStoreReady: populateTable,\n indexes: [\n { name: 'lastname', keyPath: 'lastname', unique: false, multiEntry: false }\n ]\n });\n * @example\n // create a generic store\n var myCustomerStore = new IDBStore({\n storeName: 'my-data-store',\n onStoreReady: function(){\n // start working with the store.\n }\n });\n */\n var IDBStore = function (kwArgs, onStoreReady) {\n\n if (typeof onStoreReady == 'undefined' && typeof kwArgs == 'function') {\n onStoreReady = kwArgs;\n }\n if (Object.prototype.toString.call(kwArgs) != '[object Object]') {\n kwArgs = {};\n }\n\n for (var key in defaults) {\n this[key] = typeof kwArgs[key] != 'undefined' ? kwArgs[key] : defaults[key];\n }\n\n this.dbName = this.storePrefix + this.storeName;\n this.dbVersion = parseInt(this.dbVersion, 10) || 1;\n\n onStoreReady && (this.onStoreReady = onStoreReady);\n\n var env = typeof window == 'object' ? window : self;\n var availableImplementations = this.implementationPreference.filter(function (implName) {\n return implName in env;\n });\n this.implementation = availableImplementations[0];\n this.idb = env[this.implementation];\n this.keyRange = env.IDBKeyRange || env.webkitIDBKeyRange || env.mozIDBKeyRange;\n\n this.consts = {\n 'READ_ONLY': 'readonly',\n 'READ_WRITE': 'readwrite',\n 'VERSION_CHANGE': 'versionchange',\n 'NEXT': 'next',\n 'NEXT_NO_DUPLICATE': 'nextunique',\n 'PREV': 'prev',\n 'PREV_NO_DUPLICATE': 'prevunique'\n };\n\n this.openDB();\n };\n\n /** @lends IDBStore.prototype */\n var proto = {\n\n /**\n * A pointer to the IDBStore ctor\n *\n * @private\n * @type {Function}\n * @constructs\n */\n constructor: IDBStore,\n\n /**\n * The version of IDBStore\n *\n * @type {String}\n */\n version: '1.7.2',\n\n /**\n * A reference to the IndexedDB object\n *\n * @type {IDBDatabase}\n */\n db: null,\n\n /**\n * The full name of the IndexedDB used by IDBStore, composed of\n * this.storePrefix + this.storeName\n *\n * @type {String}\n */\n dbName: null,\n\n /**\n * The version of the IndexedDB used by IDBStore\n *\n * @type {Number}\n */\n dbVersion: null,\n\n /**\n * A reference to the objectStore used by IDBStore\n *\n * @type {IDBObjectStore}\n */\n store: null,\n\n /**\n * The store name\n *\n * @type {String}\n */\n storeName: null,\n\n /**\n * The prefix to prepend to the store name\n *\n * @type {String}\n */\n storePrefix: null,\n\n /**\n * The key path\n *\n * @type {String}\n */\n keyPath: null,\n\n /**\n * Whether IDBStore uses autoIncrement\n *\n * @type {Boolean}\n */\n autoIncrement: null,\n\n /**\n * The indexes used by IDBStore\n *\n * @type {Array}\n */\n indexes: null,\n\n /**\n * The implemantations to try to use, in order of preference\n *\n * @type {Array}\n */\n implementationPreference: null,\n\n /**\n * The actual implementation being used\n *\n * @type {String}\n */\n implementation: '',\n\n /**\n * The callback to be called when the store is ready to be used\n *\n * @type {Function}\n */\n onStoreReady: null,\n\n /**\n * The callback to be called if an error occurred during instantiation\n * of the store\n *\n * @type {Function}\n */\n onError: null,\n\n /**\n * The internal insertID counter\n *\n * @type {Number}\n * @private\n */\n _insertIdCount: 0,\n\n /**\n * Opens an IndexedDB; called by the constructor.\n *\n * Will check if versions match and compare provided index configuration\n * with existing ones, and update indexes if necessary.\n *\n * Will call this.onStoreReady() if everything went well and the store\n * is ready to use, and this.onError() is something went wrong.\n *\n * @private\n *\n */\n openDB: function () {\n\n var openRequest = this.idb.open(this.dbName, this.dbVersion);\n var preventSuccessCallback = false;\n\n openRequest.onerror = function (errorEvent) {\n\n if (hasVersionError(errorEvent)) {\n this.onError(new Error('The version number provided is lower than the existing one.'));\n } else {\n var error;\n\n if (errorEvent.target.error) {\n error = errorEvent.target.error;\n } else {\n var errorMessage = 'IndexedDB unknown error occurred when opening DB ' + this.dbName + ' version ' + this.dbVersion;\n if ('errorCode' in errorEvent.target) {\n errorMessage += ' with error code ' + errorEvent.target.errorCode;\n }\n error = new Error(errorMessage);\n }\n\n this.onError(error);\n }\n }.bind(this);\n\n openRequest.onsuccess = function (event) {\n\n if (preventSuccessCallback) {\n return;\n }\n\n if (this.db) {\n this.onStoreReady();\n return;\n }\n\n this.db = event.target.result;\n\n if (typeof this.db.version == 'string') {\n this.onError(new Error('The IndexedDB implementation in this browser is outdated. Please upgrade your browser.'));\n return;\n }\n\n if (!this.db.objectStoreNames.contains(this.storeName)) {\n // We should never ever get here.\n // Lets notify the user anyway.\n this.onError(new Error('Object store couldn\\'t be created.'));\n return;\n }\n\n var emptyTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);\n this.store = emptyTransaction.objectStore(this.storeName);\n\n // check indexes\n var existingIndexes = Array.prototype.slice.call(this.getIndexList());\n this.indexes.forEach(function (indexData) {\n var indexName = indexData.name;\n\n if (!indexName) {\n preventSuccessCallback = true;\n this.onError(new Error('Cannot create index: No index name given.'));\n return;\n }\n\n this.normalizeIndexData(indexData);\n\n if (this.hasIndex(indexName)) {\n // check if it complies\n var actualIndex = this.store.index(indexName);\n var complies = this.indexComplies(actualIndex, indexData);\n if (!complies) {\n preventSuccessCallback = true;\n this.onError(new Error('Cannot modify index \"' + indexName + '\" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.'));\n }\n\n existingIndexes.splice(existingIndexes.indexOf(indexName), 1);\n } else {\n preventSuccessCallback = true;\n this.onError(new Error('Cannot create new index \"' + indexName + '\" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.'));\n }\n\n }, this);\n\n if (existingIndexes.length) {\n preventSuccessCallback = true;\n this.onError(new Error('Cannot delete index(es) \"' + existingIndexes.toString() + '\" for current version. Please bump version number to ' + ( this.dbVersion + 1 ) + '.'));\n }\n\n preventSuccessCallback || this.onStoreReady();\n }.bind(this);\n\n openRequest.onupgradeneeded = function (/* IDBVersionChangeEvent */ event) {\n\n this.db = event.target.result;\n\n if (this.db.objectStoreNames.contains(this.storeName)) {\n this.store = event.target.transaction.objectStore(this.storeName);\n } else {\n var optionalParameters = {autoIncrement: this.autoIncrement};\n if (this.keyPath !== null) {\n optionalParameters.keyPath = this.keyPath;\n }\n this.store = this.db.createObjectStore(this.storeName, optionalParameters);\n }\n\n var existingIndexes = Array.prototype.slice.call(this.getIndexList());\n this.indexes.forEach(function (indexData) {\n var indexName = indexData.name;\n\n if (!indexName) {\n preventSuccessCallback = true;\n this.onError(new Error('Cannot create index: No index name given.'));\n }\n\n this.normalizeIndexData(indexData);\n\n if (this.hasIndex(indexName)) {\n // check if it complies\n var actualIndex = this.store.index(indexName);\n var complies = this.indexComplies(actualIndex, indexData);\n if (!complies) {\n // index differs, need to delete and re-create\n this.store.deleteIndex(indexName);\n this.store.createIndex(indexName, indexData.keyPath, {\n unique: indexData.unique,\n multiEntry: indexData.multiEntry\n });\n }\n\n existingIndexes.splice(existingIndexes.indexOf(indexName), 1);\n } else {\n this.store.createIndex(indexName, indexData.keyPath, {\n unique: indexData.unique,\n multiEntry: indexData.multiEntry\n });\n }\n\n }, this);\n\n if (existingIndexes.length) {\n existingIndexes.forEach(function (_indexName) {\n this.store.deleteIndex(_indexName);\n }, this);\n }\n\n }.bind(this);\n },\n\n /**\n * Deletes the database used for this store if the IDB implementations\n * provides that functionality.\n *\n * @param {Function} [onSuccess] A callback that is called if deletion\n * was successful.\n * @param {Function} [onError] A callback that is called if deletion\n * failed.\n */\n deleteDatabase: function (onSuccess, onError) {\n if (this.idb.deleteDatabase) {\n this.db.close();\n var deleteRequest = this.idb.deleteDatabase(this.dbName);\n deleteRequest.onsuccess = onSuccess;\n deleteRequest.onerror = onError;\n } else {\n onError(new Error('Browser does not support IndexedDB deleteDatabase!'));\n }\n },\n\n /*********************\n * data manipulation *\n *********************/\n\n /**\n * Puts an object into the store. If an entry with the given id exists,\n * it will be overwritten. This method has a different signature for inline\n * keys and out-of-line keys; please see the examples below.\n *\n * @param {*} [key] The key to store. This is only needed if IDBWrapper\n * is set to use out-of-line keys. For inline keys - the default scenario -\n * this can be omitted.\n * @param {Object} value The data object to store.\n * @param {Function} [onSuccess] A callback that is called if insertion\n * was successful.\n * @param {Function} [onError] A callback that is called if insertion\n * failed.\n * @returns {IDBTransaction} The transaction used for this operation.\n * @example\n // Storing an object, using inline keys (the default scenario):\n var myCustomer = {\n customerid: 2346223,\n lastname: 'Doe',\n firstname: 'John'\n };\n myCustomerStore.put(myCustomer, mySuccessHandler, myErrorHandler);\n // Note that passing success- and error-handlers is optional.\n * @example\n // Storing an object, using out-of-line keys:\n var myCustomer = {\n lastname: 'Doe',\n firstname: 'John'\n };\n myCustomerStore.put(2346223, myCustomer, mySuccessHandler, myErrorHandler);\n // Note that passing success- and error-handlers is optional.\n */\n put: function (key, value, onSuccess, onError) {\n if (this.keyPath !== null) {\n onError = onSuccess;\n onSuccess = value;\n value = key;\n }\n onError || (onError = defaultErrorHandler);\n onSuccess || (onSuccess = defaultSuccessHandler);\n\n var hasSuccess = false,\n result = null,\n putRequest;\n\n var putTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);\n putTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(result);\n };\n putTransaction.onabort = onError;\n putTransaction.onerror = onError;\n\n if (this.keyPath !== null) { // in-line keys\n this._addIdPropertyIfNeeded(value);\n putRequest = putTransaction.objectStore(this.storeName).put(value);\n } else { // out-of-line keys\n putRequest = putTransaction.objectStore(this.storeName).put(value, key);\n }\n putRequest.onsuccess = function (event) {\n hasSuccess = true;\n result = event.target.result;\n };\n putRequest.onerror = onError;\n\n return putTransaction;\n },\n\n /**\n * Retrieves an object from the store. If no entry exists with the given id,\n * the success handler will be called with null as first and only argument.\n *\n * @param {*} key The id of the object to fetch.\n * @param {Function} [onSuccess] A callback that is called if fetching\n * was successful. Will receive the object as only argument.\n * @param {Function} [onError] A callback that will be called if an error\n * occurred during the operation.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n get: function (key, onSuccess, onError) {\n onError || (onError = defaultErrorHandler);\n onSuccess || (onSuccess = defaultSuccessHandler);\n\n var hasSuccess = false,\n result = null;\n\n var getTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);\n getTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(result);\n };\n getTransaction.onabort = onError;\n getTransaction.onerror = onError;\n var getRequest = getTransaction.objectStore(this.storeName).get(key);\n getRequest.onsuccess = function (event) {\n hasSuccess = true;\n result = event.target.result;\n };\n getRequest.onerror = onError;\n\n return getTransaction;\n },\n\n /**\n * Removes an object from the store.\n *\n * @param {*} key The id of the object to remove.\n * @param {Function} [onSuccess] A callback that is called if the removal\n * was successful.\n * @param {Function} [onError] A callback that will be called if an error\n * occurred during the operation.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n remove: function (key, onSuccess, onError) {\n onError || (onError = defaultErrorHandler);\n onSuccess || (onSuccess = defaultSuccessHandler);\n\n var hasSuccess = false,\n result = null;\n\n var removeTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);\n removeTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(result);\n };\n removeTransaction.onabort = onError;\n removeTransaction.onerror = onError;\n\n var deleteRequest = removeTransaction.objectStore(this.storeName)['delete'](key);\n deleteRequest.onsuccess = function (event) {\n hasSuccess = true;\n result = event.target.result;\n };\n deleteRequest.onerror = onError;\n\n return removeTransaction;\n },\n\n /**\n * Runs a batch of put and/or remove operations on the store.\n *\n * @param {Array} dataArray An array of objects containing the operation to run\n * and the data object (for put operations).\n * @param {Function} [onSuccess] A callback that is called if all operations\n * were successful.\n * @param {Function} [onError] A callback that is called if an error\n * occurred during one of the operations.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n batch: function (dataArray, onSuccess, onError) {\n onError || (onError = defaultErrorHandler);\n onSuccess || (onSuccess = defaultSuccessHandler);\n\n if (Object.prototype.toString.call(dataArray) != '[object Array]') {\n onError(new Error('dataArray argument must be of type Array.'));\n } else if (dataArray.length === 0) {\n return onSuccess(true);\n }\n\n var count = dataArray.length;\n var called = false;\n var hasSuccess = false;\n\n var batchTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);\n batchTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(hasSuccess);\n };\n batchTransaction.onabort = onError;\n batchTransaction.onerror = onError;\n\n\n var onItemSuccess = function () {\n count--;\n if (count === 0 && !called) {\n called = true;\n hasSuccess = true;\n }\n };\n\n dataArray.forEach(function (operation) {\n var type = operation.type;\n var key = operation.key;\n var value = operation.value;\n\n var onItemError = function (err) {\n batchTransaction.abort();\n if (!called) {\n called = true;\n onError(err, type, key);\n }\n };\n\n if (type == 'remove') {\n var deleteRequest = batchTransaction.objectStore(this.storeName)['delete'](key);\n deleteRequest.onsuccess = onItemSuccess;\n deleteRequest.onerror = onItemError;\n } else if (type == 'put') {\n var putRequest;\n if (this.keyPath !== null) { // in-line keys\n this._addIdPropertyIfNeeded(value);\n putRequest = batchTransaction.objectStore(this.storeName).put(value);\n } else { // out-of-line keys\n putRequest = batchTransaction.objectStore(this.storeName).put(value, key);\n }\n putRequest.onsuccess = onItemSuccess;\n putRequest.onerror = onItemError;\n }\n }, this);\n\n return batchTransaction;\n },\n\n /**\n * Takes an array of objects and stores them in a single transaction.\n *\n * @param {Array} dataArray An array of objects to store\n * @param {Function} [onSuccess] A callback that is called if all operations\n * were successful.\n * @param {Function} [onError] A callback that is called if an error\n * occurred during one of the operations.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n putBatch: function (dataArray, onSuccess, onError) {\n var batchData = dataArray.map(function (item) {\n return {type: 'put', value: item};\n });\n\n return this.batch(batchData, onSuccess, onError);\n },\n\n /**\n * Like putBatch, takes an array of objects and stores them in a single\n * transaction, but allows processing of the result values. Returns the\n * processed records containing the key for newly created records to the\n * onSuccess calllback instead of only returning true or false for success.\n * In addition, added the option for the caller to specify a key field that\n * should be set to the newly created key.\n *\n * @param {Array} dataArray An array of objects to store\n * @param {Object} [options] An object containing optional options\n * @param {String} [options.keyField=this.keyPath] Specifies a field in the record to update\n * with the auto-incrementing key. Defaults to the store's keyPath.\n * @param {Function} [onSuccess] A callback that is called if all operations\n * were successful.\n * @param {Function} [onError] A callback that is called if an error\n * occurred during one of the operations.\n * @returns {IDBTransaction} The transaction used for this operation.\n *\n */\n upsertBatch: function (dataArray, options, onSuccess, onError) {\n // handle `dataArray, onSuccess, onError` signature\n if (typeof options == 'function') {\n onSuccess = options;\n onError = onSuccess;\n options = {};\n }\n\n onError || (onError = defaultErrorHandler);\n onSuccess || (onSuccess = defaultSuccessHandler);\n options || (options = {});\n\n if (Object.prototype.toString.call(dataArray) != '[object Array]') {\n onError(new Error('dataArray argument must be of type Array.'));\n }\n\n var keyField = options.keyField || this.keyPath;\n var count = dataArray.length;\n var called = false;\n var hasSuccess = false;\n var index = 0; // assume success callbacks are executed in order\n\n var batchTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);\n batchTransaction.oncomplete = function () {\n if (hasSuccess) {\n onSuccess(dataArray);\n } else {\n onError(false);\n }\n };\n batchTransaction.onabort = onError;\n batchTransaction.onerror = onError;\n\n var onItemSuccess = function (event) {\n var record = dataArray[index++];\n record[keyField] = event.target.result;\n\n count--;\n if (count === 0 && !called) {\n called = true;\n hasSuccess = true;\n }\n };\n\n dataArray.forEach(function (record) {\n var key = record.key;\n\n var onItemError = function (err) {\n batchTransaction.abort();\n if (!called) {\n called = true;\n onError(err);\n }\n };\n\n var putRequest;\n if (this.keyPath !== null) { // in-line keys\n this._addIdPropertyIfNeeded(record);\n putRequest = batchTransaction.objectStore(this.storeName).put(record);\n } else { // out-of-line keys\n putRequest = batchTransaction.objectStore(this.storeName).put(record, key);\n }\n putRequest.onsuccess = onItemSuccess;\n putRequest.onerror = onItemError;\n }, this);\n\n return batchTransaction;\n },\n\n /**\n * Takes an array of keys and removes matching objects in a single\n * transaction.\n *\n * @param {Array} keyArray An array of keys to remove\n * @param {Function} [onSuccess] A callback that is called if all operations\n * were successful.\n * @param {Function} [onError] A callback that is called if an error\n * occurred during one of the operations.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n removeBatch: function (keyArray, onSuccess, onError) {\n var batchData = keyArray.map(function (key) {\n return {type: 'remove', key: key};\n });\n\n return this.batch(batchData, onSuccess, onError);\n },\n\n /**\n * Takes an array of keys and fetches matching objects\n *\n * @param {Array} keyArray An array of keys identifying the objects to fetch\n * @param {Function} [onSuccess] A callback that is called if all operations\n * were successful.\n * @param {Function} [onError] A callback that is called if an error\n * occurred during one of the operations.\n * @param {String} [arrayType='sparse'] The type of array to pass to the\n * success handler. May be one of 'sparse', 'dense' or 'skip'. Defaults to\n * 'sparse'. This parameter specifies how to handle the situation if a get\n * operation did not throw an error, but there was no matching object in\n * the database. In most cases, 'sparse' provides the most desired\n * behavior. See the examples for details.\n * @returns {IDBTransaction} The transaction used for this operation.\n * @example\n // given that there are two objects in the database with the keypath\n // values 1 and 2, and the call looks like this:\n myStore.getBatch([1, 5, 2], onError, function (data) { … }, arrayType);\n\n // this is what the `data` array will be like:\n\n // arrayType == 'sparse':\n // data is a sparse array containing two entries and having a length of 3:\n [Object, 2: Object]\n 0: Object\n 2: Object\n length: 3\n // calling forEach on data will result in the callback being called two\n // times, with the index parameter matching the index of the key in the\n // keyArray.\n\n // arrayType == 'dense':\n // data is a dense array containing three entries and having a length of 3,\n // where data[1] is of type undefined:\n [Object, undefined, Object]\n 0: Object\n 1: undefined\n 2: Object\n length: 3\n // calling forEach on data will result in the callback being called three\n // times, with the index parameter matching the index of the key in the\n // keyArray, but the second call will have undefined as first argument.\n\n // arrayType == 'skip':\n // data is a dense array containing two entries and having a length of 2:\n [Object, Object]\n 0: Object\n 1: Object\n length: 2\n // calling forEach on data will result in the callback being called two\n // times, with the index parameter not matching the index of the key in the\n // keyArray.\n */\n getBatch: function (keyArray, onSuccess, onError, arrayType) {\n onError || (onError = defaultErrorHandler);\n onSuccess || (onSuccess = defaultSuccessHandler);\n arrayType || (arrayType = 'sparse');\n\n if (Object.prototype.toString.call(keyArray) != '[object Array]') {\n onError(new Error('keyArray argument must be of type Array.'));\n } else if (keyArray.length === 0) {\n return onSuccess([]);\n }\n\n var data = [];\n var count = keyArray.length;\n var called = false;\n var hasSuccess = false;\n var result = null;\n\n var batchTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);\n batchTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(result);\n };\n batchTransaction.onabort = onError;\n batchTransaction.onerror = onError;\n\n var onItemSuccess = function (event) {\n if (event.target.result || arrayType == 'dense') {\n data.push(event.target.result);\n } else if (arrayType == 'sparse') {\n data.length++;\n }\n count--;\n if (count === 0) {\n called = true;\n hasSuccess = true;\n result = data;\n }\n };\n\n keyArray.forEach(function (key) {\n\n var onItemError = function (err) {\n called = true;\n result = err;\n onError(err);\n batchTransaction.abort();\n };\n\n var getRequest = batchTransaction.objectStore(this.storeName).get(key);\n getRequest.onsuccess = onItemSuccess;\n getRequest.onerror = onItemError;\n\n }, this);\n\n return batchTransaction;\n },\n\n /**\n * Fetches all entries in the store.\n *\n * @param {Function} [onSuccess] A callback that is called if the operation\n * was successful. Will receive an array of objects.\n * @param {Function} [onError] A callback that will be called if an error\n * occurred during the operation.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n getAll: function (onSuccess, onError) {\n onError || (onError = defaultErrorHandler);\n onSuccess || (onSuccess = defaultSuccessHandler);\n var getAllTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);\n var store = getAllTransaction.objectStore(this.storeName);\n if (store.getAll) {\n this._getAllNative(getAllTransaction, store, onSuccess, onError);\n } else {\n this._getAllCursor(getAllTransaction, store, onSuccess, onError);\n }\n\n return getAllTransaction;\n },\n\n /**\n * Implements getAll for IDB implementations that have a non-standard\n * getAll() method.\n *\n * @param {IDBTransaction} getAllTransaction An open READ transaction.\n * @param {IDBObjectStore} store A reference to the store.\n * @param {Function} onSuccess A callback that will be called if the\n * operation was successful.\n * @param {Function} onError A callback that will be called if an\n * error occurred during the operation.\n * @private\n */\n _getAllNative: function (getAllTransaction, store, onSuccess, onError) {\n var hasSuccess = false,\n result = null;\n\n getAllTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(result);\n };\n getAllTransaction.onabort = onError;\n getAllTransaction.onerror = onError;\n\n var getAllRequest = store.getAll();\n getAllRequest.onsuccess = function (event) {\n hasSuccess = true;\n result = event.target.result;\n };\n getAllRequest.onerror = onError;\n },\n\n /**\n * Implements getAll for IDB implementations that do not have a getAll()\n * method.\n *\n * @param {IDBTransaction} getAllTransaction An open READ transaction.\n * @param {IDBObjectStore} store A reference to the store.\n * @param {Function} onSuccess A callback that will be called if the\n * operation was successful.\n * @param {Function} onError A callback that will be called if an\n * error occurred during the operation.\n * @private\n */\n _getAllCursor: function (getAllTransaction, store, onSuccess, onError) {\n var all = [],\n hasSuccess = false,\n result = null;\n\n getAllTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(result);\n };\n getAllTransaction.onabort = onError;\n getAllTransaction.onerror = onError;\n\n var cursorRequest = store.openCursor();\n cursorRequest.onsuccess = function (event) {\n var cursor = event.target.result;\n if (cursor) {\n all.push(cursor.value);\n cursor['continue']();\n }\n else {\n hasSuccess = true;\n result = all;\n }\n };\n cursorRequest.onError = onError;\n },\n\n /**\n * Clears the store, i.e. deletes all entries in the store.\n *\n * @param {Function} [onSuccess] A callback that will be called if the\n * operation was successful.\n * @param {Function} [onError] A callback that will be called if an\n * error occurred during the operation.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n clear: function (onSuccess, onError) {\n onError || (onError = defaultErrorHandler);\n onSuccess || (onSuccess = defaultSuccessHandler);\n\n var hasSuccess = false,\n result = null;\n\n var clearTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);\n clearTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(result);\n };\n clearTransaction.onabort = onError;\n clearTransaction.onerror = onError;\n\n var clearRequest = clearTransaction.objectStore(this.storeName).clear();\n clearRequest.onsuccess = function (event) {\n hasSuccess = true;\n result = event.target.result;\n };\n clearRequest.onerror = onError;\n\n return clearTransaction;\n },\n\n /**\n * Checks if an id property needs to present on a object and adds one if\n * necessary.\n *\n * @param {Object} dataObj The data object that is about to be stored\n * @private\n */\n _addIdPropertyIfNeeded: function (dataObj) {\n if (typeof dataObj[this.keyPath] == 'undefined') {\n dataObj[this.keyPath] = this._insertIdCount++ + Date.now();\n }\n },\n\n /************\n * indexing *\n ************/\n\n /**\n * Returns a DOMStringList of index names of the store.\n *\n * @return {DOMStringList} The list of index names\n */\n getIndexList: function () {\n return this.store.indexNames;\n },\n\n /**\n * Checks if an index with the given name exists in the store.\n *\n * @param {String} indexName The name of the index to look for\n * @return {Boolean} Whether the store contains an index with the given name\n */\n hasIndex: function (indexName) {\n return this.store.indexNames.contains(indexName);\n },\n\n /**\n * Normalizes an object containing index data and assures that all\n * properties are set.\n *\n * @param {Object} indexData The index data object to normalize\n * @param {String} indexData.name The name of the index\n * @param {String} [indexData.keyPath] The key path of the index\n * @param {Boolean} [indexData.unique] Whether the index is unique\n * @param {Boolean} [indexData.multiEntry] Whether the index is multi entry\n */\n normalizeIndexData: function (indexData) {\n indexData.keyPath = indexData.keyPath || indexData.name;\n indexData.unique = !!indexData.unique;\n indexData.multiEntry = !!indexData.multiEntry;\n },\n\n /**\n * Checks if an actual index complies with an expected index.\n *\n * @param {IDBIndex} actual The actual index found in the store\n * @param {Object} expected An Object describing an expected index\n * @return {Boolean} Whether both index definitions are identical\n */\n indexComplies: function (actual, expected) {\n var complies = ['keyPath', 'unique', 'multiEntry'].every(function (key) {\n // IE10 returns undefined for no multiEntry\n if (key == 'multiEntry' && actual[key] === undefined && expected[key] === false) {\n return true;\n }\n // Compound keys\n if (key == 'keyPath' && Object.prototype.toString.call(expected[key]) == '[object Array]') {\n var exp = expected.keyPath;\n var act = actual.keyPath;\n\n // IE10 can't handle keyPath sequences and stores them as a string.\n // The index will be unusable there, but let's still return true if\n // the keyPath sequence matches.\n if (typeof act == 'string') {\n return exp.toString() == act;\n }\n\n // Chrome/Opera stores keyPath squences as DOMStringList, Firefox\n // as Array\n if (!(typeof act.contains == 'function' || typeof act.indexOf == 'function')) {\n return false;\n }\n\n if (act.length !== exp.length) {\n return false;\n }\n\n for (var i = 0, m = exp.length; i < m; i++) {\n if (!( (act.contains && act.contains(exp[i])) || act.indexOf(exp[i] !== -1) )) {\n return false;\n }\n }\n return true;\n }\n return expected[key] == actual[key];\n });\n return complies;\n },\n\n /**********\n * cursor *\n **********/\n\n /**\n * Iterates over the store using the given options and calling onItem\n * for each entry matching the options.\n *\n * @param {Function} onItem A callback to be called for each match\n * @param {Object} [options] An object defining specific options\n * @param {String} [options.index=null] A name of an IDBIndex to operate on\n * @param {String} [options.order=ASC] The order in which to provide the\n * results, can be 'DESC' or 'ASC'\n * @param {Boolean} [options.autoContinue=true] Whether to automatically\n * iterate the cursor to the next result\n * @param {Boolean} [options.filterDuplicates=false] Whether to exclude\n * duplicate matches\n * @param {IDBKeyRange} [options.keyRange=null] An IDBKeyRange to use\n * @param {Boolean} [options.writeAccess=false] Whether grant write access\n * to the store in the onItem callback\n * @param {Function} [options.onEnd=null] A callback to be called after\n * iteration has ended\n * @param {Function} [options.onError=throw] A callback to be called\n * if an error occurred during the operation.\n * @param {Number} [options.limit=Infinity] Limit the number of returned\n * results to this number\n * @param {Number} [options.offset=0] Skip the provided number of results\n * in the resultset\n * @param {Boolean} [options.allowItemRejection=false] Allows the onItem\n * function to return a Boolean to accept or reject the current item\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n iterate: function (onItem, options) {\n options = mixin({\n index: null,\n order: 'ASC',\n autoContinue: true,\n filterDuplicates: false,\n keyRange: null,\n writeAccess: false,\n onEnd: null,\n onError: defaultErrorHandler,\n limit: Infinity,\n offset: 0,\n allowItemRejection: false\n }, options || {});\n\n var directionType = options.order.toLowerCase() == 'desc' ? 'PREV' : 'NEXT';\n if (options.filterDuplicates) {\n directionType += '_NO_DUPLICATE';\n }\n\n var hasSuccess = false;\n var cursorTransaction = this.db.transaction([this.storeName], this.consts[options.writeAccess ? 'READ_WRITE' : 'READ_ONLY']);\n var cursorTarget = cursorTransaction.objectStore(this.storeName);\n if (options.index) {\n cursorTarget = cursorTarget.index(options.index);\n }\n var recordCount = 0;\n\n cursorTransaction.oncomplete = function () {\n if (!hasSuccess) {\n options.onError(null);\n return;\n }\n if (options.onEnd) {\n options.onEnd();\n } else {\n onItem(null);\n }\n };\n cursorTransaction.onabort = options.onError;\n cursorTransaction.onerror = options.onError;\n\n var cursorRequest = cursorTarget.openCursor(options.keyRange, this.consts[directionType]);\n cursorRequest.onerror = options.onError;\n cursorRequest.onsuccess = function (event) {\n var cursor = event.target.result;\n if (cursor) {\n if (options.offset) {\n cursor.advance(options.offset);\n options.offset = 0;\n } else {\n var onItemReturn = onItem(cursor.value, cursor, cursorTransaction);\n if (!options.allowItemRejection || onItemReturn !== false) {\n recordCount++;\n }\n if (options.autoContinue) {\n if (recordCount + options.offset < options.limit) {\n cursor['continue']();\n } else {\n hasSuccess = true;\n }\n }\n }\n } else {\n hasSuccess = true;\n }\n };\n\n return cursorTransaction;\n },\n\n /**\n * Runs a query against the store and passes an array containing matched\n * objects to the success handler.\n *\n * @param {Function} onSuccess A callback to be called when the operation\n * was successful.\n * @param {Object} [options] An object defining specific options\n * @param {String} [options.index=null] A name of an IDBIndex to operate on\n * @param {String} [options.order=ASC] The order in which to provide the\n * results, can be 'DESC' or 'ASC'\n * @param {Boolean} [options.filterDuplicates=false] Whether to exclude\n * duplicate matches\n * @param {IDBKeyRange} [options.keyRange=null] An IDBKeyRange to use\n * @param {Function} [options.onError=throw] A callback to be called\n * if an error occurred during the operation.\n * @param {Number} [options.limit=Infinity] Limit the number of returned\n * results to this number\n * @param {Number} [options.offset=0] Skip the provided number of results\n * in the resultset\n * @param {Function} [options.filter=null] A custom filter function to\n * apply to query resuts before returning. Must return `false` to reject\n * an item. Can be combined with keyRanges.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n query: function (onSuccess, options) {\n var result = [],\n processedItems = 0;\n options = options || {};\n options.autoContinue = true;\n options.writeAccess = false;\n options.allowItemRejection = !!options.filter;\n options.onEnd = function () {\n onSuccess(result, processedItems);\n };\n return this.iterate(function (item) {\n processedItems++;\n var accept = options.filter ? options.filter(item) : true;\n if (accept !== false) {\n result.push(item);\n }\n return accept;\n }, options);\n },\n\n /**\n *\n * Runs a query against the store, but only returns the number of matches\n * instead of the matches itself.\n *\n * @param {Function} onSuccess A callback to be called if the opration\n * was successful.\n * @param {Object} [options] An object defining specific options\n * @param {String} [options.index=null] A name of an IDBIndex to operate on\n * @param {IDBKeyRange} [options.keyRange=null] An IDBKeyRange to use\n * @param {Function} [options.onError=throw] A callback to be called if an error\n * occurred during the operation.\n * @returns {IDBTransaction} The transaction used for this operation.\n */\n count: function (onSuccess, options) {\n\n options = mixin({\n index: null,\n keyRange: null\n }, options || {});\n\n var onError = options.onError || defaultErrorHandler;\n\n var hasSuccess = false,\n result = null;\n\n var cursorTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);\n cursorTransaction.oncomplete = function () {\n var callback = hasSuccess ? onSuccess : onError;\n callback(result);\n };\n cursorTransaction.onabort = onError;\n cursorTransaction.onerror = onError;\n\n var cursorTarget = cursorTransaction.objectStore(this.storeName);\n if (options.index) {\n cursorTarget = cursorTarget.index(options.index);\n }\n var countRequest = cursorTarget.count(options.keyRange);\n countRequest.onsuccess = function (evt) {\n hasSuccess = true;\n result = evt.target.result;\n };\n countRequest.onError = onError;\n\n return cursorTransaction;\n },\n\n /**************/\n /* key ranges */\n /**************/\n\n /**\n * Creates a key range using specified options. This key range can be\n * handed over to the count() and iterate() methods.\n *\n * Note: You must provide at least one or both of \"lower\" or \"upper\" value.\n *\n * @param {Object} options The options for the key range to create\n * @param {*} [options.lower] The lower bound\n * @param {Boolean} [options.excludeLower] Whether to exclude the lower\n * bound passed in options.lower from the key range\n * @param {*} [options.upper] The upper bound\n * @param {Boolean} [options.excludeUpper] Whether to exclude the upper\n * bound passed in options.upper from the key range\n * @param {*} [options.only] A single key value. Use this if you need a key\n * range that only includes one value for a key. Providing this\n * property invalidates all other properties.\n * @return {IDBKeyRange} The IDBKeyRange representing the specified options\n */\n makeKeyRange: function (options) {\n /*jshint onecase:true */\n var keyRange,\n hasLower = typeof options.lower != 'undefined',\n hasUpper = typeof options.upper != 'undefined',\n isOnly = typeof options.only != 'undefined';\n\n switch (true) {\n case isOnly:\n keyRange = this.keyRange.only(options.only);\n break;\n case hasLower && hasUpper:\n keyRange = this.keyRange.bound(options.lower, options.upper, options.excludeLower, options.excludeUpper);\n break;\n case hasLower:\n keyRange = this.keyRange.lowerBound(options.lower, options.excludeLower);\n break;\n case hasUpper:\n keyRange = this.keyRange.upperBound(options.upper, options.excludeUpper);\n break;\n default:\n throw new Error('Cannot create KeyRange. Provide one or both of \"lower\" or \"upper\" value, or an \"only\" value.');\n }\n\n return keyRange;\n\n }\n\n };\n\n /** helpers **/\n var empty = {};\n\n function mixin (target, source) {\n var name, s;\n for (name in source) {\n s = source[name];\n if (s !== empty[name] && s !== target[name]) {\n target[name] = s;\n }\n }\n return target;\n }\n\n function hasVersionError(errorEvent) {\n if ('error' in errorEvent.target) {\n return errorEvent.target.error.name == 'VersionError';\n } else if ('errorCode' in errorEvent.target) {\n return errorEvent.target.errorCode == 12;\n }\n return false;\n }\n\n IDBStore.prototype = proto;\n IDBStore.version = proto.version;\n\n return IDBStore;\n\n}, this);\n","module.exports = extend\n\nfunction extend() {\n var target = {}\n\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i]\n\n for (var key in source) {\n if (source.hasOwnProperty(key)) {\n target[key] = source[key]\n }\n }\n }\n\n return target\n}\n","/* Copyright (c) 2013 Rod Vagg, MIT License */\n\nfunction AbstractIterator (db) {\n this.db = db\n this._ended = false\n this._nexting = false\n}\n\nAbstractIterator.prototype.next = function (callback) {\n var self = this\n\n if (typeof callback != 'function')\n throw new Error('next() requires a callback argument')\n\n if (self._ended)\n return callback(new Error('cannot call next() after end()'))\n if (self._nexting)\n return callback(new Error('cannot call next() before previous next() has completed'))\n\n self._nexting = true\n if (typeof self._next == 'function') {\n return self._next(function () {\n self._nexting = false\n callback.apply(null, arguments)\n })\n }\n\n process.nextTick(function () {\n self._nexting = false\n callback()\n })\n}\n\nAbstractIterator.prototype.end = function (callback) {\n if (typeof callback != 'function')\n throw new Error('end() requires a callback argument')\n\n if (this._ended)\n return callback(new Error('end() already called on iterator'))\n\n this._ended = true\n\n if (typeof this._end == 'function')\n return this._end(callback)\n\n process.nextTick(callback)\n}\n\nmodule.exports = AbstractIterator\n","/* Copyright (c) 2013 Rod Vagg, MIT License */\n\nfunction AbstractChainedBatch (db) {\n this._db = db\n this._operations = []\n this._written = false\n}\n\nAbstractChainedBatch.prototype._checkWritten = function () {\n if (this._written)\n throw new Error('write() already called on this batch')\n}\n\nAbstractChainedBatch.prototype.put = function (key, value) {\n this._checkWritten()\n\n var err = this._db._checkKeyValue(key, 'key', this._db._isBuffer)\n if (err) throw err\n err = this._db._checkKeyValue(value, 'value', this._db._isBuffer)\n if (err) throw err\n\n if (!this._db._isBuffer(key)) key = String(key)\n if (!this._db._isBuffer(value)) value = String(value)\n\n if (typeof this._put == 'function' )\n this._put(key, value)\n else\n this._operations.push({ type: 'put', key: key, value: value })\n\n return this\n}\n\nAbstractChainedBatch.prototype.del = function (key) {\n this._checkWritten()\n\n var err = this._db._checkKeyValue(key, 'key', this._db._isBuffer)\n if (err) throw err\n\n if (!this._db._isBuffer(key)) key = String(key)\n\n if (typeof this._del == 'function' )\n this._del(key)\n else\n this._operations.push({ type: 'del', key: key })\n\n return this\n}\n\nAbstractChainedBatch.prototype.clear = function () {\n this._checkWritten()\n\n this._operations = []\n\n if (typeof this._clear == 'function' )\n this._clear()\n\n return this\n}\n\nAbstractChainedBatch.prototype.write = function (options, callback) {\n this._checkWritten()\n\n if (typeof options == 'function')\n callback = options\n if (typeof callback != 'function')\n throw new Error('write() requires a callback argument')\n if (typeof options != 'object')\n options = {}\n\n this._written = true\n\n if (typeof this._write == 'function' )\n return this._write(callback)\n\n if (typeof this._db._batch == 'function')\n return this._db._batch(this._operations, options, callback)\n\n process.nextTick(callback)\n}\n\nmodule.exports = AbstractChainedBatch","/* Copyright (c) 2013 Rod Vagg, MIT License */\n\nvar xtend = require('xtend')\n , AbstractIterator = require('./abstract-iterator')\n , AbstractChainedBatch = require('./abstract-chained-batch')\n\nfunction AbstractLevelDOWN (location) {\n if (!arguments.length || location === undefined)\n throw new Error('constructor requires at least a location argument')\n\n if (typeof location != 'string')\n throw new Error('constructor requires a location string argument')\n\n this.location = location\n}\n\nAbstractLevelDOWN.prototype.open = function (options, callback) {\n if (typeof options == 'function')\n callback = options\n\n if (typeof callback != 'function')\n throw new Error('open() requires a callback argument')\n\n if (typeof options != 'object')\n options = {}\n\n if (typeof this._open == 'function')\n return this._open(options, callback)\n\n process.nextTick(callback)\n}\n\nAbstractLevelDOWN.prototype.close = function (callback) {\n if (typeof callback != 'function')\n throw new Error('close() requires a callback argument')\n\n if (typeof this._close == 'function')\n return this._close(callback)\n\n process.nextTick(callback)\n}\n\nAbstractLevelDOWN.prototype.get = function (key, options, callback) {\n var err\n\n if (typeof options == 'function')\n callback = options\n\n if (typeof callback != 'function')\n throw new Error('get() requires a callback argument')\n\n if (err = this._checkKeyValue(key, 'key', this._isBuffer))\n return callback(err)\n\n if (!this._isBuffer(key))\n key = String(key)\n\n if (typeof options != 'object')\n options = {}\n\n if (typeof this._get == 'function')\n return this._get(key, options, callback)\n\n process.nextTick(function () { callback(new Error('NotFound')) })\n}\n\nAbstractLevelDOWN.prototype.put = function (key, value, options, callback) {\n var err\n\n if (typeof options == 'function')\n callback = options\n\n if (typeof callback != 'function')\n throw new Error('put() requires a callback argument')\n\n if (err = this._checkKeyValue(key, 'key', this._isBuffer))\n return callback(err)\n\n if (err = this._checkKeyValue(value, 'value', this._isBuffer))\n return callback(err)\n\n if (!this._isBuffer(key))\n key = String(key)\n\n // coerce value to string in node, don't touch it in browser\n // (indexeddb can store any JS type)\n if (!this._isBuffer(value) && !process.browser)\n value = String(value)\n\n if (typeof options != 'object')\n options = {}\n\n if (typeof this._put == 'function')\n return this._put(key, value, options, callback)\n\n process.nextTick(callback)\n}\n\nAbstractLevelDOWN.prototype.del = function (key, options, callback) {\n var err\n\n if (typeof options == 'function')\n callback = options\n\n if (typeof callback != 'function')\n throw new Error('del() requires a callback argument')\n\n if (err = this._checkKeyValue(key, 'key', this._isBuffer))\n return callback(err)\n\n if (!this._isBuffer(key))\n key = String(key)\n\n if (typeof options != 'object')\n options = {}\n\n if (typeof this._del == 'function')\n return this._del(key, options, callback)\n\n process.nextTick(callback)\n}\n\nAbstractLevelDOWN.prototype.batch = function (array, options, callback) {\n if (!arguments.length)\n return this._chainedBatch()\n\n if (typeof options == 'function')\n callback = options\n\n if (typeof callback != 'function')\n throw new Error('batch(array) requires a callback argument')\n\n if (!Array.isArray(array))\n return callback(new Error('batch(array) requires an array argument'))\n\n if (typeof options != 'object')\n options = {}\n\n var i = 0\n , l = array.length\n , e\n , err\n\n for (; i < l; i++) {\n e = array[i]\n if (typeof e != 'object')\n continue\n\n if (err = this._checkKeyValue(e.type, 'type', this._isBuffer))\n return callback(err)\n\n if (err = this._checkKeyValue(e.key, 'key', this._isBuffer))\n return callback(err)\n\n if (e.type == 'put') {\n if (err = this._checkKeyValue(e.value, 'value', this._isBuffer))\n return callback(err)\n }\n }\n\n if (typeof this._batch == 'function')\n return this._batch(array, options, callback)\n\n process.nextTick(callback)\n}\n\n//TODO: remove from here, not a necessary primitive\nAbstractLevelDOWN.prototype.approximateSize = function (start, end, callback) {\n if ( start == null\n || end == null\n || typeof start == 'function'\n || typeof end == 'function') {\n throw new Error('approximateSize() requires valid `start`, `end` and `callback` arguments')\n }\n\n if (typeof callback != 'function')\n throw new Error('approximateSize() requires a callback argument')\n\n if (!this._isBuffer(start))\n start = String(start)\n\n if (!this._isBuffer(end))\n end = String(end)\n\n if (typeof this._approximateSize == 'function')\n return this._approximateSize(start, end, callback)\n\n process.nextTick(function () {\n callback(null, 0)\n })\n}\n\nAbstractLevelDOWN.prototype._setupIteratorOptions = function (options) {\n var self = this\n\n options = xtend(options)\n\n ;[ 'start', 'end', 'gt', 'gte', 'lt', 'lte' ].forEach(function (o) {\n if (options[o] && self._isBuffer(options[o]) && options[o].length === 0)\n delete options[o]\n })\n\n options.reverse = !!options.reverse\n\n // fix `start` so it takes into account gt, gte, lt, lte as appropriate\n if (options.reverse && options.lt)\n options.start = options.lt\n if (options.reverse && options.lte)\n options.start = options.lte\n if (!options.reverse && options.gt)\n options.start = options.gt\n if (!options.reverse && options.gte)\n options.start = options.gte\n\n if ((options.reverse && options.lt && !options.lte)\n || (!options.reverse && options.gt && !options.gte))\n options.exclusiveStart = true // start should *not* include matching key\n\n return options\n}\n\nAbstractLevelDOWN.prototype.iterator = function (options) {\n if (typeof options != 'object')\n options = {}\n\n options = this._setupIteratorOptions(options)\n\n if (typeof this._iterator == 'function')\n return this._iterator(options)\n\n return new AbstractIterator(this)\n}\n\nAbstractLevelDOWN.prototype._chainedBatch = function () {\n return new AbstractChainedBatch(this)\n}\n\nAbstractLevelDOWN.prototype._isBuffer = function (obj) {\n return Buffer.isBuffer(obj)\n}\n\nAbstractLevelDOWN.prototype._checkKeyValue = function (obj, type) {\n\n if (obj === null || obj === undefined)\n return new Error(type + ' cannot be `null` or `undefined`')\n\n if (this._isBuffer(obj)) {\n if (obj.length === 0)\n return new Error(type + ' cannot be an empty Buffer')\n } else if (String(obj) === '')\n return new Error(type + ' cannot be an empty String')\n}\n\nmodule.exports.AbstractLevelDOWN = AbstractLevelDOWN\nmodule.exports.AbstractIterator = AbstractIterator\nmodule.exports.AbstractChainedBatch = AbstractChainedBatch\n","\nexports.compare = function (a, b) {\n\n if(Buffer.isBuffer(a)) {\n var l = Math.min(a.length, b.length)\n for(var i = 0; i < l; i++) {\n var cmp = a[i] - b[i]\n if(cmp) return cmp\n }\n return a.length - b.length\n }\n\n return a < b ? -1 : a > b ? 1 : 0\n}\n\n// to be compatible with the current abstract-leveldown tests\n// nullish or empty strings.\n// I could use !!val but I want to permit numbers and booleans,\n// if possible.\n\nfunction isDef (val) {\n return val !== undefined && val !== ''\n}\n\nfunction has (range, name) {\n return Object.hasOwnProperty.call(range, name)\n}\n\nfunction hasKey(range, name) {\n return Object.hasOwnProperty.call(range, name) && name\n}\n\nvar lowerBoundKey = exports.lowerBoundKey = function (range) {\n return (\n hasKey(range, 'gt')\n || hasKey(range, 'gte')\n || hasKey(range, 'min')\n || (range.reverse ? hasKey(range, 'end') : hasKey(range, 'start'))\n || undefined\n )\n}\n\nvar lowerBound = exports.lowerBound = function (range, def) {\n var k = lowerBoundKey(range)\n return k ? range[k] : def\n}\n\nvar lowerBoundInclusive = exports.lowerBoundInclusive = function (range) {\n return has(range, 'gt') ? false : true\n}\n\nvar upperBoundInclusive = exports.upperBoundInclusive =\n function (range) {\n return (has(range, 'lt') /*&& !range.maxEx*/) ? false : true\n }\n\nvar lowerBoundExclusive = exports.lowerBoundExclusive =\n function (range) {\n return !lowerBoundInclusive(range)\n }\n\nvar upperBoundExclusive = exports.upperBoundExclusive =\n function (range) {\n return !upperBoundInclusive(range)\n }\n\nvar upperBoundKey = exports.upperBoundKey = function (range) {\n return (\n hasKey(range, 'lt')\n || hasKey(range, 'lte')\n || hasKey(range, 'max')\n || (range.reverse ? hasKey(range, 'start') : hasKey(range, 'end'))\n || undefined\n )\n}\n\nvar upperBound = exports.upperBound = function (range, def) {\n var k = upperBoundKey(range)\n return k ? range[k] : def\n}\n\nexports.start = function (range, def) {\n return range.reverse ? upperBound(range, def) : lowerBound(range, def)\n}\nexports.end = function (range, def) {\n return range.reverse ? lowerBound(range, def) : upperBound(range, def)\n}\nexports.startInclusive = function (range) {\n return (\n range.reverse\n ? upperBoundInclusive(range)\n : lowerBoundInclusive(range)\n )\n}\nexports.endInclusive = function (range) {\n return (\n range.reverse\n ? lowerBoundInclusive(range)\n : upperBoundInclusive(range)\n )\n}\n\nfunction id (e) { return e }\n\nexports.toLtgt = function (range, _range, map, lower, upper) {\n _range = _range || {}\n map = map || id\n var defaults = arguments.length > 3\n var lb = exports.lowerBoundKey(range)\n var ub = exports.upperBoundKey(range)\n if(lb) {\n if(lb === 'gt') _range.gt = map(range.gt, false)\n else _range.gte = map(range[lb], false)\n }\n else if(defaults)\n _range.gte = map(lower, false)\n\n if(ub) {\n if(ub === 'lt') _range.lt = map(range.lt, true)\n else _range.lte = map(range[ub], true)\n }\n else if(defaults)\n _range.lte = map(upper, true)\n\n if(range.reverse != null)\n _range.reverse = !!range.reverse\n\n //if range was used mutably\n //(in level-sublevel it's part of an options object\n //that has more properties on it.)\n if(has(_range, 'max')) delete _range.max\n if(has(_range, 'min')) delete _range.min\n if(has(_range, 'start')) delete _range.start\n if(has(_range, 'end')) delete _range.end\n\n return _range\n}\n\nexports.contains = function (range, key, compare) {\n compare = compare || exports.compare\n\n var lb = lowerBound(range)\n if(isDef(lb)) {\n var cmp = compare(key, lb)\n if(cmp < 0 || (cmp === 0 && lowerBoundExclusive(range)))\n return false\n }\n\n var ub = upperBound(range)\n if(isDef(ub)) {\n var cmp = compare(key, ub)\n if(cmp > 0 || (cmp === 0) && upperBoundExclusive(range))\n return false\n }\n\n return true\n}\n\nexports.filter = function (range, compare) {\n return function (key) {\n return exports.contains(range, key, compare)\n }\n}\n\n\n","var util = require('util')\nvar AbstractIterator = require('abstract-leveldown').AbstractIterator\nvar ltgt = require('ltgt')\n\nmodule.exports = Iterator\n\nfunction Iterator (db, options) {\n if (!options) options = {}\n this.options = options\n AbstractIterator.call(this, db)\n this._order = options.reverse ? 'DESC': 'ASC'\n this._limit = options.limit\n this._count = 0\n this._done = false\n var lower = ltgt.lowerBound(options)\n var upper = ltgt.upperBound(options)\n try {\n this._keyRange = lower || upper ? this.db.makeKeyRange({\n lower: lower,\n upper: upper,\n excludeLower: ltgt.lowerBoundExclusive(options),\n excludeUpper: ltgt.upperBoundExclusive(options)\n }) : null\n } catch (e) {\n // The lower key is greater than the upper key.\n // IndexedDB throws an error, but we'll just return 0 results.\n this._keyRangeError = true\n }\n this.callback = null\n}\n\nutil.inherits(Iterator, AbstractIterator)\n\nIterator.prototype.createIterator = function() {\n var self = this\n\n self.iterator = self.db.iterate(function () {\n self.onItem.apply(self, arguments)\n }, {\n keyRange: self._keyRange,\n autoContinue: false,\n order: self._order,\n onError: function(err) { console.log('horrible error', err) },\n })\n}\n\n// TODO the limit implementation here just ignores all reads after limit has been reached\n// it should cancel the iterator instead but I don't know how\nIterator.prototype.onItem = function (value, cursor, cursorTransaction) {\n if (!cursor && this.callback) {\n this.callback()\n this.callback = false\n return\n }\n var shouldCall = true\n\n if (!!this._limit && this._limit > 0 && this._count++ >= this._limit)\n shouldCall = false\n\n if (shouldCall) this.callback(false, cursor.key, cursor.value)\n if (cursor) cursor['continue']()\n}\n\nIterator.prototype._next = function (callback) {\n if (!callback) return new Error('next() requires a callback argument')\n if (this._keyRangeError) return callback()\n if (!this._started) {\n this.createIterator()\n this._started = true\n }\n this.callback = callback\n}\n","var Buffer = require('buffer').Buffer;\n\nmodule.exports = isBuffer;\n\nfunction isBuffer (o) {\n return Buffer.isBuffer(o)\n || /\\[object (.+Array|Array.+)\\]/.test(Object.prototype.toString.call(o));\n}\n","var hasOwn = Object.prototype.hasOwnProperty;\nvar toString = Object.prototype.toString;\n\nvar isFunction = function (fn) {\n\tvar isFunc = (typeof fn === 'function' && !(fn instanceof RegExp)) || toString.call(fn) === '[object Function]';\n\tif (!isFunc && typeof window !== 'undefined') {\n\t\tisFunc = fn === window.setTimeout || fn === window.alert || fn === window.confirm || fn === window.prompt;\n\t}\n\treturn isFunc;\n};\n\nmodule.exports = function forEach(obj, fn) {\n\tif (!isFunction(fn)) {\n\t\tthrow new TypeError('iterator must be a function');\n\t}\n\tvar i, k,\n\t\tisString = typeof obj === 'string',\n\t\tl = obj.length,\n\t\tcontext = arguments.length > 2 ? arguments[2] : null;\n\tif (l === +l) {\n\t\tfor (i = 0; i < l; i++) {\n\t\t\tif (context === null) {\n\t\t\t\tfn(isString ? obj.charAt(i) : obj[i], i, obj);\n\t\t\t} else {\n\t\t\t\tfn.call(context, isString ? obj.charAt(i) : obj[i], i, obj);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor (k in obj) {\n\t\t\tif (hasOwn.call(obj, k)) {\n\t\t\t\tif (context === null) {\n\t\t\t\t\tfn(obj[k], k, obj);\n\t\t\t\t} else {\n\t\t\t\t\tfn.call(context, obj[k], k, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\n","var toString = Object.prototype.toString;\n\nmodule.exports = function isArguments(value) {\n\tvar str = toString.call(value);\n\tvar isArguments = str === '[object Arguments]';\n\tif (!isArguments) {\n\t\tisArguments = str !== '[object Array]'\n\t\t\t&& value !== null\n\t\t\t&& typeof value === 'object'\n\t\t\t&& typeof value.length === 'number'\n\t\t\t&& value.length >= 0\n\t\t\t&& toString.call(value.callee) === '[object Function]';\n\t}\n\treturn isArguments;\n};\n\n","(function () {\n\t\"use strict\";\n\n\t// modified from https://github.com/kriskowal/es5-shim\n\tvar has = Object.prototype.hasOwnProperty,\n\t\ttoString = Object.prototype.toString,\n\t\tforEach = require('./foreach'),\n\t\tisArgs = require('./isArguments'),\n\t\thasDontEnumBug = !({'toString': null}).propertyIsEnumerable('toString'),\n\t\thasProtoEnumBug = (function () {}).propertyIsEnumerable('prototype'),\n\t\tdontEnums = [\n\t\t\t\"toString\",\n\t\t\t\"toLocaleString\",\n\t\t\t\"valueOf\",\n\t\t\t\"hasOwnProperty\",\n\t\t\t\"isPrototypeOf\",\n\t\t\t\"propertyIsEnumerable\",\n\t\t\t\"constructor\"\n\t\t],\n\t\tkeysShim;\n\n\tkeysShim = function keys(object) {\n\t\tvar isObject = object !== null && typeof object === 'object',\n\t\t\tisFunction = toString.call(object) === '[object Function]',\n\t\t\tisArguments = isArgs(object),\n\t\t\ttheKeys = [];\n\n\t\tif (!isObject && !isFunction && !isArguments) {\n\t\t\tthrow new TypeError(\"Object.keys called on a non-object\");\n\t\t}\n\n\t\tif (isArguments) {\n\t\t\tforEach(object, function (value) {\n\t\t\t\ttheKeys.push(value);\n\t\t\t});\n\t\t} else {\n\t\t\tvar name,\n\t\t\t\tskipProto = hasProtoEnumBug && isFunction;\n\n\t\t\tfor (name in object) {\n\t\t\t\tif (!(skipProto && name === 'prototype') && has.call(object, name)) {\n\t\t\t\t\ttheKeys.push(name);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (hasDontEnumBug) {\n\t\t\tvar ctor = object.constructor,\n\t\t\t\tskipConstructor = ctor && ctor.prototype === object;\n\n\t\t\tforEach(dontEnums, function (dontEnum) {\n\t\t\t\tif (!(skipConstructor && dontEnum === 'constructor') && has.call(object, dontEnum)) {\n\t\t\t\t\ttheKeys.push(dontEnum);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn theKeys;\n\t};\n\n\tmodule.exports = keysShim;\n}());\n\n","module.exports = Object.keys || require('./shim');\n\n","module.exports = hasKeys\n\nfunction hasKeys(source) {\n return source !== null &&\n (typeof source === \"object\" ||\n typeof source === \"function\")\n}\n","var Keys = require(\"object-keys\")\nvar hasKeys = require(\"./has-keys\")\n\nmodule.exports = extend\n\nfunction extend() {\n var target = {}\n\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i]\n\n if (!hasKeys(source)) {\n continue\n }\n\n var keys = Keys(source)\n\n for (var j = 0; j < keys.length; j++) {\n var name = keys[j]\n target[name] = source[name]\n }\n }\n\n return target\n}\n","/**\n * Convert a typed array to a Buffer without a copy\n *\n * Author: Feross Aboukhadijeh \n * License: MIT\n *\n * `npm install typedarray-to-buffer`\n */\n\nmodule.exports = function (arr) {\n if (typeof Buffer._augment === 'function' && Buffer.TYPED_ARRAY_SUPPORT) {\n // If `Buffer` is from the `buffer` module and this browser supports typed arrays,\n // then augment it with all the `Buffer` methods.\n return Buffer._augment(arr)\n } else {\n // Otherwise, fallback to creating a `Buffer` with a copy.\n return new Buffer(arr)\n }\n}\n","module.exports = Level\n\nvar IDB = require('idb-wrapper')\nvar AbstractLevelDOWN = require('abstract-leveldown').AbstractLevelDOWN\nvar util = require('util')\nvar Iterator = require('./iterator')\nvar isBuffer = require('isbuffer')\nvar xtend = require('xtend')\nvar toBuffer = require('typedarray-to-buffer')\n\nfunction Level(location) {\n if (!(this instanceof Level)) return new Level(location)\n if (!location) throw new Error(\"constructor requires at least a location argument\")\n this.IDBOptions = {}\n this.location = location\n}\n\nutil.inherits(Level, AbstractLevelDOWN)\n\nLevel.prototype._open = function(options, callback) {\n var self = this\n \n var idbOpts = {\n storeName: this.location,\n autoIncrement: false,\n keyPath: null,\n onStoreReady: function () {\n callback && callback(null, self.idb)\n }, \n onError: function(err) {\n callback && callback(err)\n }\n }\n \n xtend(idbOpts, options)\n this.IDBOptions = idbOpts\n this.idb = new IDB(idbOpts)\n}\n\nLevel.prototype._get = function (key, options, callback) {\n this.idb.get(key, function (value) {\n if (value === undefined) {\n // 'NotFound' error, consistent with LevelDOWN API\n return callback(new Error('NotFound'))\n }\n // by default return buffers, unless explicitly told not to\n var asBuffer = true\n if (options.asBuffer === false) asBuffer = false\n if (options.raw) asBuffer = false\n if (asBuffer) {\n if (value instanceof Uint8Array) value = toBuffer(value)\n else value = new Buffer(String(value))\n }\n return callback(null, value, key)\n }, callback)\n}\n\nLevel.prototype._del = function(id, options, callback) {\n this.idb.remove(id, callback, callback)\n}\n\nLevel.prototype._put = function (key, value, options, callback) {\n if (value instanceof ArrayBuffer) {\n value = toBuffer(new Uint8Array(value))\n }\n var obj = this.convertEncoding(key, value, options)\n if (Buffer.isBuffer(obj.value)) {\n if (typeof value.toArrayBuffer === 'function') {\n obj.value = new Uint8Array(value.toArrayBuffer())\n } else {\n obj.value = new Uint8Array(value)\n }\n }\n this.idb.put(obj.key, obj.value, function() { callback() }, callback)\n}\n\nLevel.prototype.convertEncoding = function(key, value, options) {\n if (options.raw) return {key: key, value: value}\n if (value) {\n var stringed = value.toString()\n if (stringed === 'NaN') value = 'NaN'\n }\n var valEnc = options.valueEncoding\n var obj = {key: key, value: value}\n if (value && (!valEnc || valEnc !== 'binary')) {\n if (typeof obj.value !== 'object') {\n obj.value = stringed\n }\n }\n return obj\n}\n\nLevel.prototype.iterator = function (options) {\n if (typeof options !== 'object') options = {}\n return new Iterator(this.idb, options)\n}\n\nLevel.prototype._batch = function (array, options, callback) {\n var op\n var i\n var k\n var copiedOp\n var currentOp\n var modified = []\n \n if (array.length === 0) return setTimeout(callback, 0)\n \n for (i = 0; i < array.length; i++) {\n copiedOp = {}\n currentOp = array[i]\n modified[i] = copiedOp\n \n var converted = this.convertEncoding(currentOp.key, currentOp.value, options)\n currentOp.key = converted.key\n currentOp.value = converted.value\n\n for (k in currentOp) {\n if (k === 'type' && currentOp[k] == 'del') {\n copiedOp[k] = 'remove'\n } else {\n copiedOp[k] = currentOp[k]\n }\n }\n }\n\n return this.idb.batch(modified, function(){ callback() }, callback)\n}\n\nLevel.prototype._close = function (callback) {\n this.idb.db.close()\n callback()\n}\n\nLevel.prototype._approximateSize = function (start, end, callback) {\n var err = new Error('Not implemented')\n if (callback)\n return callback(err)\n\n throw err\n}\n\nLevel.prototype._isBuffer = function (obj) {\n return Buffer.isBuffer(obj)\n}\n\nLevel.destroy = function (db, callback) {\n if (typeof db === 'object') {\n var prefix = db.IDBOptions.storePrefix || 'IDBWrapper-'\n var dbname = db.location\n } else {\n var prefix = 'IDBWrapper-'\n var dbname = db\n }\n var request = indexedDB.deleteDatabase(prefix + dbname)\n request.onsuccess = function() {\n callback()\n }\n request.onerror = function(err) {\n callback(err)\n }\n}\n\nvar checkKeyValue = Level.prototype._checkKeyValue = function (obj, type) {\n if (obj === null || obj === undefined)\n return new Error(type + ' cannot be `null` or `undefined`')\n if (obj === null || obj === undefined)\n return new Error(type + ' cannot be `null` or `undefined`')\n if (isBuffer(obj) && obj.byteLength === 0)\n return new Error(type + ' cannot be an empty ArrayBuffer')\n if (String(obj) === '')\n return new Error(type + ' cannot be an empty String')\n if (obj.length === 0)\n return new Error(type + ' cannot be an empty Array')\n}\n","/*!\n * prr\n * (c) 2013 Rod Vagg \n * https://github.com/rvagg/prr\n * License: MIT\n */\n\n(function (name, context, definition) {\n if (typeof module != 'undefined' && module.exports)\n module.exports = definition()\n else\n context[name] = definition()\n})('prr', this, function() {\n\n var setProperty = typeof Object.defineProperty == 'function'\n ? function (obj, key, options) {\n Object.defineProperty(obj, key, options)\n return obj\n }\n : function (obj, key, options) { // < es5\n obj[key] = options.value\n return obj\n }\n\n , makeOptions = function (value, options) {\n var oo = typeof options == 'object'\n , os = !oo && typeof options == 'string'\n , op = function (p) {\n return oo\n ? !!options[p]\n : os\n ? options.indexOf(p[0]) > -1\n : false\n }\n\n return {\n enumerable : op('enumerable')\n , configurable : op('configurable')\n , writable : op('writable')\n , value : value\n }\n }\n\n , prr = function (obj, key, value, options) {\n var k\n\n options = makeOptions(value, options)\n\n if (typeof key == 'object') {\n for (k in key) {\n if (Object.hasOwnProperty.call(key, k)) {\n options.value = key[k]\n setProperty(obj, k, options)\n }\n }\n return obj\n }\n\n return setProperty(obj, key, options)\n }\n\n return prr\n})","var util = require('util')\n , AbstractLevelDOWN = require('abstract-leveldown').AbstractLevelDOWN\n\nfunction DeferredLevelDOWN (location) {\n AbstractLevelDOWN.call(this, typeof location == 'string' ? location : '') // optional location, who cares?\n this._db = undefined\n this._operations = []\n}\n\nutil.inherits(DeferredLevelDOWN, AbstractLevelDOWN)\n\n// called by LevelUP when we have a real DB to take its place\nDeferredLevelDOWN.prototype.setDb = function (db) {\n this._db = db\n this._operations.forEach(function (op) {\n db[op.method].apply(db, op.args)\n })\n}\n\nDeferredLevelDOWN.prototype._open = function (options, callback) {\n return process.nextTick(callback)\n}\n\n// queue a new deferred operation\nDeferredLevelDOWN.prototype._operation = function (method, args) {\n if (this._db)\n return this._db[method].apply(this._db, args)\n this._operations.push({ method: method, args: args })\n}\n\n// deferrables\n'put get del batch approximateSize'.split(' ').forEach(function (m) {\n DeferredLevelDOWN.prototype['_' + m] = function () {\n this._operation(m, arguments)\n }\n})\n\nDeferredLevelDOWN.prototype._isBuffer = function (obj) {\n return Buffer.isBuffer(obj)\n}\n\n// don't need to implement this as LevelUP's ReadStream checks for 'ready' state\nDeferredLevelDOWN.prototype._iterator = function () {\n throw new TypeError('not implemented')\n}\n\nmodule.exports = DeferredLevelDOWN\n","/*!\n * prr\n * (c) 2013 Rod Vagg \n * https://github.com/rvagg/prr\n * License: MIT\n */\n\n(function (name, context, definition) {\n if (typeof module != 'undefined' && module.exports)\n module.exports = definition()\n else\n context[name] = definition()\n})('prr', this, function() {\n\n var setProperty = typeof Object.defineProperty == 'function'\n ? function (obj, key, options) {\n Object.defineProperty(obj, key, options)\n return obj\n }\n : function (obj, key, options) { // < es5\n obj[key] = options.value\n return obj\n }\n\n , makeOptions = function (value, options) {\n var oo = typeof options == 'object'\n , os = !oo && typeof options == 'string'\n , op = function (p) {\n return oo\n ? !!options[p]\n : os\n ? options.indexOf(p[0]) > -1\n : false\n }\n\n return {\n enumerable : op('enumerable')\n , configurable : op('configurable')\n , writable : op('writable')\n , value : value\n }\n }\n\n , prr = function (obj, key, value, options) {\n var k\n\n options = makeOptions(value, options)\n\n if (typeof key == 'object') {\n for (k in key) {\n if (Object.hasOwnProperty.call(key, k)) {\n options.value = key[k]\n setProperty(obj, k, options)\n }\n }\n return obj\n }\n\n return setProperty(obj, key, options)\n }\n\n return prr\n})","var prr = require('prr')\n\nfunction init (type, message, cause) {\n if (!!message && typeof message != 'string') {\n message = message.message || message.name\n }\n prr(this, {\n type : type\n , name : type\n // can be passed just a 'cause'\n , cause : typeof message != 'string' ? message : cause\n , message : message\n }, 'ewr')\n}\n\n// generic prototype, not intended to be actually used - helpful for `instanceof`\nfunction CustomError (message, cause) {\n Error.call(this)\n if (Error.captureStackTrace)\n Error.captureStackTrace(this, this.constructor)\n init.call(this, 'CustomError', message, cause)\n}\n\nCustomError.prototype = new Error()\n\nfunction createError (errno, type, proto) {\n var err = function (message, cause) {\n init.call(this, type, message, cause)\n //TODO: the specificity here is stupid, errno should be available everywhere\n if (type == 'FilesystemError') {\n this.code = this.cause.code\n this.path = this.cause.path\n this.errno = this.cause.errno\n this.message =\n (errno.errno[this.cause.errno]\n ? errno.errno[this.cause.errno].description\n : this.cause.message)\n + (this.cause.path ? ' [' + this.cause.path + ']' : '')\n }\n Error.call(this)\n if (Error.captureStackTrace)\n Error.captureStackTrace(this, err)\n }\n err.prototype = !!proto ? new proto() : new CustomError()\n return err\n}\n\nmodule.exports = function (errno) {\n var ce = function (type, proto) {\n return createError(errno, type, proto)\n }\n return {\n CustomError : CustomError\n , FilesystemError : ce('FilesystemError')\n , createError : ce\n }\n}\n","var all = module.exports.all = [\n {\n errno: -2,\n code: 'ENOENT',\n description: 'no such file or directory'\n },\n {\n errno: -1,\n code: 'UNKNOWN',\n description: 'unknown error'\n },\n {\n errno: 0,\n code: 'OK',\n description: 'success'\n },\n {\n errno: 1,\n code: 'EOF',\n description: 'end of file'\n },\n {\n errno: 2,\n code: 'EADDRINFO',\n description: 'getaddrinfo error'\n },\n {\n errno: 3,\n code: 'EACCES',\n description: 'permission denied'\n },\n {\n errno: 4,\n code: 'EAGAIN',\n description: 'resource temporarily unavailable'\n },\n {\n errno: 5,\n code: 'EADDRINUSE',\n description: 'address already in use'\n },\n {\n errno: 6,\n code: 'EADDRNOTAVAIL',\n description: 'address not available'\n },\n {\n errno: 7,\n code: 'EAFNOSUPPORT',\n description: 'address family not supported'\n },\n {\n errno: 8,\n code: 'EALREADY',\n description: 'connection already in progress'\n },\n {\n errno: 9,\n code: 'EBADF',\n description: 'bad file descriptor'\n },\n {\n errno: 10,\n code: 'EBUSY',\n description: 'resource busy or locked'\n },\n {\n errno: 11,\n code: 'ECONNABORTED',\n description: 'software caused connection abort'\n },\n {\n errno: 12,\n code: 'ECONNREFUSED',\n description: 'connection refused'\n },\n {\n errno: 13,\n code: 'ECONNRESET',\n description: 'connection reset by peer'\n },\n {\n errno: 14,\n code: 'EDESTADDRREQ',\n description: 'destination address required'\n },\n {\n errno: 15,\n code: 'EFAULT',\n description: 'bad address in system call argument'\n },\n {\n errno: 16,\n code: 'EHOSTUNREACH',\n description: 'host is unreachable'\n },\n {\n errno: 17,\n code: 'EINTR',\n description: 'interrupted system call'\n },\n {\n errno: 18,\n code: 'EINVAL',\n description: 'invalid argument'\n },\n {\n errno: 19,\n code: 'EISCONN',\n description: 'socket is already connected'\n },\n {\n errno: 20,\n code: 'EMFILE',\n description: 'too many open files'\n },\n {\n errno: 21,\n code: 'EMSGSIZE',\n description: 'message too long'\n },\n {\n errno: 22,\n code: 'ENETDOWN',\n description: 'network is down'\n },\n {\n errno: 23,\n code: 'ENETUNREACH',\n description: 'network is unreachable'\n },\n {\n errno: 24,\n code: 'ENFILE',\n description: 'file table overflow'\n },\n {\n errno: 25,\n code: 'ENOBUFS',\n description: 'no buffer space available'\n },\n {\n errno: 26,\n code: 'ENOMEM',\n description: 'not enough memory'\n },\n {\n errno: 27,\n code: 'ENOTDIR',\n description: 'not a directory'\n },\n {\n errno: 28,\n code: 'EISDIR',\n description: 'illegal operation on a directory'\n },\n {\n errno: 29,\n code: 'ENONET',\n description: 'machine is not on the network'\n },\n {\n errno: 31,\n code: 'ENOTCONN',\n description: 'socket is not connected'\n },\n {\n errno: 32,\n code: 'ENOTSOCK',\n description: 'socket operation on non-socket'\n },\n {\n errno: 33,\n code: 'ENOTSUP',\n description: 'operation not supported on socket'\n },\n {\n errno: 34,\n code: 'ENOENT',\n description: 'no such file or directory'\n },\n {\n errno: 35,\n code: 'ENOSYS',\n description: 'function not implemented'\n },\n {\n errno: 36,\n code: 'EPIPE',\n description: 'broken pipe'\n },\n {\n errno: 37,\n code: 'EPROTO',\n description: 'protocol error'\n },\n {\n errno: 38,\n code: 'EPROTONOSUPPORT',\n description: 'protocol not supported'\n },\n {\n errno: 39,\n code: 'EPROTOTYPE',\n description: 'protocol wrong type for socket'\n },\n {\n errno: 40,\n code: 'ETIMEDOUT',\n description: 'connection timed out'\n },\n {\n errno: 41,\n code: 'ECHARSET',\n description: 'invalid Unicode character'\n },\n {\n errno: 42,\n code: 'EAIFAMNOSUPPORT',\n description: 'address family for hostname not supported'\n },\n {\n errno: 44,\n code: 'EAISERVICE',\n description: 'servname not supported for ai_socktype'\n },\n {\n errno: 45,\n code: 'EAISOCKTYPE',\n description: 'ai_socktype not supported'\n },\n {\n errno: 46,\n code: 'ESHUTDOWN',\n description: 'cannot send after transport endpoint shutdown'\n },\n {\n errno: 47,\n code: 'EEXIST',\n description: 'file already exists'\n },\n {\n errno: 48,\n code: 'ESRCH',\n description: 'no such process'\n },\n {\n errno: 49,\n code: 'ENAMETOOLONG',\n description: 'name too long'\n },\n {\n errno: 50,\n code: 'EPERM',\n description: 'operation not permitted'\n },\n {\n errno: 51,\n code: 'ELOOP',\n description: 'too many symbolic links encountered'\n },\n {\n errno: 52,\n code: 'EXDEV',\n description: 'cross-device link not permitted'\n },\n {\n errno: 53,\n code: 'ENOTEMPTY',\n description: 'directory not empty'\n },\n {\n errno: 54,\n code: 'ENOSPC',\n description: 'no space left on device'\n },\n {\n errno: 55,\n code: 'EIO',\n description: 'i/o error'\n },\n {\n errno: 56,\n code: 'EROFS',\n description: 'read-only file system'\n },\n {\n errno: 57,\n code: 'ENODEV',\n description: 'no such device'\n },\n {\n errno: 58,\n code: 'ESPIPE',\n description: 'invalid seek'\n },\n {\n errno: 59,\n code: 'ECANCELED',\n description: 'operation canceled'\n }\n]\n\nmodule.exports.errno = {}\nmodule.exports.code = {}\n\nall.forEach(function (error) {\n module.exports.errno[error.errno] = error\n module.exports.code[error.code] = error\n})\n\nmodule.exports.custom = require('./custom')(module.exports)\nmodule.exports.create = module.exports.custom.createError\n","/* Copyright (c) 2012-2014 LevelUP contributors\n * See list at \n * MIT License\n * \n */\n\nvar createError = require('errno').create\n , LevelUPError = createError('LevelUPError')\n , NotFoundError = createError('NotFoundError', LevelUPError)\n\nNotFoundError.prototype.notFound = true\nNotFoundError.prototype.status = 404\n\nmodule.exports = {\n LevelUPError : LevelUPError\n , InitializationError : createError('InitializationError', LevelUPError)\n , OpenError : createError('OpenError', LevelUPError)\n , ReadError : createError('ReadError', LevelUPError)\n , WriteError : createError('WriteError', LevelUPError)\n , NotFoundError : NotFoundError\n , EncodingError : createError('EncodingError', LevelUPError)\n}\n","module.exports = Array.isArray || function (arr) {\n return Object.prototype.toString.call(arr) == '[object Array]';\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Readable;\n\n/**/\nvar isArray = require('isarray');\n/**/\n\n\n/**/\nvar Buffer = require('buffer').Buffer;\n/**/\n\nReadable.ReadableState = ReadableState;\n\nvar EE = require('events').EventEmitter;\n\n/**/\nif (!EE.listenerCount) EE.listenerCount = function(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\nvar Stream = require('stream');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar StringDecoder;\n\nutil.inherits(Readable, Stream);\n\nfunction ReadableState(options, stream) {\n options = options || {};\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n var hwm = options.highWaterMark;\n this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;\n\n // cast to ints.\n this.highWaterMark = ~~this.highWaterMark;\n\n this.buffer = [];\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = false;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // In streams that never have any data, and do push(null) right away,\n // the consumer can miss the 'end' event if they do some I/O before\n // consuming the stream. So, we don't emit('end') until some reading\n // happens.\n this.calledRead = false;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, becuase any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // when piping, we only care about 'readable' events that happen\n // after read()ing all the bytes and not getting any pushback.\n this.ranOut = false;\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder)\n StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n if (!(this instanceof Readable))\n return new Readable(options);\n\n this._readableState = new ReadableState(options, this);\n\n // legacy\n this.readable = true;\n\n Stream.call(this);\n}\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function(chunk, encoding) {\n var state = this._readableState;\n\n if (typeof chunk === 'string' && !state.objectMode) {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = new Buffer(chunk, encoding);\n encoding = '';\n }\n }\n\n return readableAddChunk(this, state, chunk, encoding, false);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function(chunk) {\n var state = this._readableState;\n return readableAddChunk(this, state, chunk, '', true);\n};\n\nfunction readableAddChunk(stream, state, chunk, encoding, addToFront) {\n var er = chunkInvalid(state, chunk);\n if (er) {\n stream.emit('error', er);\n } else if (chunk === null || chunk === undefined) {\n state.reading = false;\n if (!state.ended)\n onEofChunk(stream, state);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (state.ended && !addToFront) {\n var e = new Error('stream.push() after EOF');\n stream.emit('error', e);\n } else if (state.endEmitted && addToFront) {\n var e = new Error('stream.unshift() after end event');\n stream.emit('error', e);\n } else {\n if (state.decoder && !addToFront && !encoding)\n chunk = state.decoder.write(chunk);\n\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) {\n state.buffer.unshift(chunk);\n } else {\n state.reading = false;\n state.buffer.push(chunk);\n }\n\n if (state.needReadable)\n emitReadable(stream);\n\n maybeReadMore(stream, state);\n }\n } else if (!addToFront) {\n state.reading = false;\n }\n\n return needMoreData(state);\n}\n\n\n\n// if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes. This is to work around cases where hwm=0,\n// such as the repl. Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\nfunction needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function(enc) {\n if (!StringDecoder)\n StringDecoder = require('string_decoder/').StringDecoder;\n this._readableState.decoder = new StringDecoder(enc);\n this._readableState.encoding = enc;\n};\n\n// Don't raise the hwm > 128MB\nvar MAX_HWM = 0x800000;\nfunction roundUpToNextPowerOf2(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2\n n--;\n for (var p = 1; p < 32; p <<= 1) n |= n >> p;\n n++;\n }\n return n;\n}\n\nfunction howMuchToRead(n, state) {\n if (state.length === 0 && state.ended)\n return 0;\n\n if (state.objectMode)\n return n === 0 ? 0 : 1;\n\n if (n === null || isNaN(n)) {\n // only flow one buffer at a time\n if (state.flowing && state.buffer.length)\n return state.buffer[0].length;\n else\n return state.length;\n }\n\n if (n <= 0)\n return 0;\n\n // If we're asking for more than the target buffer level,\n // then raise the water mark. Bump up to the next highest\n // power of 2, to prevent increasing it excessively in tiny\n // amounts.\n if (n > state.highWaterMark)\n state.highWaterMark = roundUpToNextPowerOf2(n);\n\n // don't have that much. return null, unless we've ended.\n if (n > state.length) {\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n } else\n return state.length;\n }\n\n return n;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function(n) {\n var state = this._readableState;\n state.calledRead = true;\n var nOrig = n;\n var ret;\n\n if (typeof n !== 'number' || n > 0)\n state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 &&\n state.needReadable &&\n (state.length >= state.highWaterMark || state.ended)) {\n emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n ret = null;\n\n // In cases where the decoder did not receive enough data\n // to produce a full chunk, then immediately received an\n // EOF, state.buffer will contain [, ].\n // howMuchToRead will see this and coerce the amount to\n // read to zero (because it's looking at the length of the\n // first in state.buffer), and we'll end up here.\n //\n // This can only happen via state.decoder -- no other venue\n // exists for pushing a zero-length chunk into state.buffer\n // and triggering this behavior. In this case, we return our\n // remaining data and end the stream, if appropriate.\n if (state.length > 0 && state.decoder) {\n ret = fromList(n, state);\n state.length -= ret.length;\n }\n\n if (state.length === 0)\n endReadable(this);\n\n return ret;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length - n <= state.highWaterMark)\n doRead = true;\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading)\n doRead = false;\n\n if (doRead) {\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0)\n state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n }\n\n // If _read called its callback synchronously, then `reading`\n // will be false, and we need to re-evaluate how much data we\n // can return to the user.\n if (doRead && !state.reading)\n n = howMuchToRead(nOrig, state);\n\n if (n > 0)\n ret = fromList(n, state);\n else\n ret = null;\n\n if (ret === null) {\n state.needReadable = true;\n n = 0;\n }\n\n state.length -= n;\n\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (state.length === 0 && !state.ended)\n state.needReadable = true;\n\n // If we happened to read() exactly the remaining amount in the\n // buffer, and the EOF has been seen at this point, then make sure\n // that we emit 'end' on the very next tick.\n if (state.ended && !state.endEmitted && state.length === 0)\n endReadable(this);\n\n return ret;\n};\n\nfunction chunkInvalid(state, chunk) {\n var er = null;\n if (!Buffer.isBuffer(chunk) &&\n 'string' !== typeof chunk &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n return er;\n}\n\n\nfunction onEofChunk(stream, state) {\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n\n // if we've ended and we have some data left, then emit\n // 'readable' now to make sure it gets picked up.\n if (state.length > 0)\n emitReadable(stream);\n else\n endReadable(stream);\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}\n\nfunction emitReadable_(stream) {\n stream.emit('readable');\n}\n\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(function() {\n maybeReadMore_(stream, state);\n });\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n var len = state.length;\n while (!state.reading && !state.flowing && !state.ended &&\n state.length < state.highWaterMark) {\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;\n else\n len = state.length;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function(n) {\n this.emit('error', new Error('not implemented'));\n};\n\nReadable.prototype.pipe = function(dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n\n var doEnd = (!pipeOpts || pipeOpts.end !== false) &&\n dest !== process.stdout &&\n dest !== process.stderr;\n\n var endFn = doEnd ? onend : cleanup;\n if (state.endEmitted)\n process.nextTick(endFn);\n else\n src.once('end', endFn);\n\n dest.on('unpipe', onunpipe);\n function onunpipe(readable) {\n if (readable !== src) return;\n cleanup();\n }\n\n function onend() {\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n\n function cleanup() {\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', cleanup);\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (!dest._writableState || dest._writableState.needDrain)\n ondrain();\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }\n // This is a brutally ugly hack to make sure that our error handler\n // is attached before any userland ones. NEVER DO THIS.\n if (!dest._events || !dest._events.error)\n dest.on('error', onerror);\n else if (isArray(dest._events.error))\n dest._events.error.unshift(onerror);\n else\n dest._events.error = [onerror, dest._events.error];\n\n\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n\n function unpipe() {\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n // the handler that waits for readable events after all\n // the data gets sucked out in flow.\n // This would be easier to follow with a .once() handler\n // in flow(), but that is too slow.\n this.on('readable', pipeOnReadable);\n\n state.flowing = true;\n process.nextTick(function() {\n flow(src);\n });\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function() {\n var dest = this;\n var state = src._readableState;\n state.awaitDrain--;\n if (state.awaitDrain === 0)\n flow(src);\n };\n}\n\nfunction flow(src) {\n var state = src._readableState;\n var chunk;\n state.awaitDrain = 0;\n\n function write(dest, i, list) {\n var written = dest.write(chunk);\n if (false === written) {\n state.awaitDrain++;\n }\n }\n\n while (state.pipesCount && null !== (chunk = src.read())) {\n\n if (state.pipesCount === 1)\n write(state.pipes, 0, null);\n else\n forEach(state.pipes, write);\n\n src.emit('data', chunk);\n\n // if anyone needs a drain, then we have to wait for that.\n if (state.awaitDrain > 0)\n return;\n }\n\n // if every destination was unpiped, either before entering this\n // function, or in the while loop, then stop flowing.\n //\n // NB: This is a pretty rare edge case.\n if (state.pipesCount === 0) {\n state.flowing = false;\n\n // if there were data event listeners added, then switch to old mode.\n if (EE.listenerCount(src, 'data') > 0)\n emitDataEvents(src);\n return;\n }\n\n // at this point, no one needed a drain, so we just ran out of data\n // on the next readable event, start it over again.\n state.ranOut = true;\n}\n\nfunction pipeOnReadable() {\n if (this._readableState.ranOut) {\n this._readableState.ranOut = false;\n flow(this);\n }\n}\n\n\nReadable.prototype.unpipe = function(dest) {\n var state = this._readableState;\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0)\n return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes)\n return this;\n\n if (!dest)\n dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n this.removeListener('readable', pipeOnReadable);\n state.flowing = false;\n if (dest)\n dest.emit('unpipe', this);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n this.removeListener('readable', pipeOnReadable);\n state.flowing = false;\n\n for (var i = 0; i < len; i++)\n dests[i].emit('unpipe', this);\n return this;\n }\n\n // try to find the right one.\n var i = indexOf(state.pipes, dest);\n if (i === -1)\n return this;\n\n state.pipes.splice(i, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1)\n state.pipes = state.pipes[0];\n\n dest.emit('unpipe', this);\n\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function(ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n\n if (ev === 'data' && !this._readableState.flowing)\n emitDataEvents(this);\n\n if (ev === 'readable' && this.readable) {\n var state = this._readableState;\n if (!state.readableListening) {\n state.readableListening = true;\n state.emittedReadable = false;\n state.needReadable = true;\n if (!state.reading) {\n this.read(0);\n } else if (state.length) {\n emitReadable(this, state);\n }\n }\n }\n\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function() {\n emitDataEvents(this);\n this.read(0);\n this.emit('resume');\n};\n\nReadable.prototype.pause = function() {\n emitDataEvents(this, true);\n this.emit('pause');\n};\n\nfunction emitDataEvents(stream, startPaused) {\n var state = stream._readableState;\n\n if (state.flowing) {\n // https://github.com/isaacs/readable-stream/issues/16\n throw new Error('Cannot switch to old mode now.');\n }\n\n var paused = startPaused || false;\n var readable = false;\n\n // convert to an old-style stream.\n stream.readable = true;\n stream.pipe = Stream.prototype.pipe;\n stream.on = stream.addListener = Stream.prototype.on;\n\n stream.on('readable', function() {\n readable = true;\n\n var c;\n while (!paused && (null !== (c = stream.read())))\n stream.emit('data', c);\n\n if (c === null) {\n readable = false;\n stream._readableState.needReadable = true;\n }\n });\n\n stream.pause = function() {\n paused = true;\n this.emit('pause');\n };\n\n stream.resume = function() {\n paused = false;\n if (readable)\n process.nextTick(function() {\n stream.emit('readable');\n });\n else\n this.read(0);\n this.emit('resume');\n };\n\n // now make it start, just in case it hadn't already.\n stream.emit('readable');\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function(stream) {\n var state = this._readableState;\n var paused = false;\n\n var self = this;\n stream.on('end', function() {\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length)\n self.push(chunk);\n }\n\n self.push(null);\n });\n\n stream.on('data', function(chunk) {\n if (state.decoder)\n chunk = state.decoder.write(chunk);\n\n // don't skip over falsy values in objectMode\n //if (state.objectMode && util.isNullOrUndefined(chunk))\n if (state.objectMode && (chunk === null || chunk === undefined))\n return;\n else if (!state.objectMode && (!chunk || !chunk.length))\n return;\n\n var ret = self.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (typeof stream[i] === 'function' &&\n typeof this[i] === 'undefined') {\n this[i] = function(method) { return function() {\n return stream[method].apply(stream, arguments);\n }}(i);\n }\n }\n\n // proxy certain important events.\n var events = ['error', 'close', 'destroy', 'pause', 'resume'];\n forEach(events, function(ev) {\n stream.on(ev, self.emit.bind(self, ev));\n });\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n self._read = function(n) {\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return self;\n};\n\n\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\nfunction fromList(n, state) {\n var list = state.buffer;\n var length = state.length;\n var stringMode = !!state.decoder;\n var objectMode = !!state.objectMode;\n var ret;\n\n // nothing in the list, definitely empty.\n if (list.length === 0)\n return null;\n\n if (length === 0)\n ret = null;\n else if (objectMode)\n ret = list.shift();\n else if (!n || n >= length) {\n // read it all, truncate the array.\n if (stringMode)\n ret = list.join('');\n else\n ret = Buffer.concat(list, length);\n list.length = 0;\n } else {\n // read just some of it.\n if (n < list[0].length) {\n // just take a part of the first list item.\n // slice is the same for buffers and strings.\n var buf = list[0];\n ret = buf.slice(0, n);\n list[0] = buf.slice(n);\n } else if (n === list[0].length) {\n // first list is a perfect match\n ret = list.shift();\n } else {\n // complex case.\n // we have enough to cover it, but it spans past the first buffer.\n if (stringMode)\n ret = '';\n else\n ret = new Buffer(n);\n\n var c = 0;\n for (var i = 0, l = list.length; i < l && c < n; i++) {\n var buf = list[0];\n var cpy = Math.min(n - c, buf.length);\n\n if (stringMode)\n ret += buf.slice(0, cpy);\n else\n buf.copy(ret, c, 0, cpy);\n\n if (cpy < buf.length)\n list[0] = buf.slice(cpy);\n else\n list.shift();\n\n c += cpy;\n }\n }\n }\n\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n\n // If we get here before consuming all the bytes, then that is a\n // bug in node. Should never happen.\n if (state.length > 0)\n throw new Error('endReadable called on non-empty stream');\n\n if (!state.endEmitted && state.calledRead) {\n state.ended = true;\n process.nextTick(function() {\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n }\n });\n }\n}\n\nfunction forEach (xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}\n\nfunction indexOf (xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\nmodule.exports = Duplex;\n\n/**/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n}\n/**/\n\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\n\nutil.inherits(Duplex, Readable);\n\nforEach(objectKeys(Writable.prototype), function(method) {\n if (!Duplex.prototype[method])\n Duplex.prototype[method] = Writable.prototype[method];\n});\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex))\n return new Duplex(options);\n\n Readable.call(this, options);\n Writable.call(this, options);\n\n if (options && options.readable === false)\n this.readable = false;\n\n if (options && options.writable === false)\n this.writable = false;\n\n this.allowHalfOpen = true;\n if (options && options.allowHalfOpen === false)\n this.allowHalfOpen = false;\n\n this.once('end', onend);\n}\n\n// the no-half-open enforcer\nfunction onend() {\n // if we allow half-open state, or if the writable side ended,\n // then we're ok.\n if (this.allowHalfOpen || this._writableState.ended)\n return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n process.nextTick(this.end.bind(this));\n}\n\nfunction forEach (xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, cb), and it'll handle all\n// the drain event emission and buffering.\n\nmodule.exports = Writable;\n\n/**/\nvar Buffer = require('buffer').Buffer;\n/**/\n\nWritable.WritableState = WritableState;\n\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar Stream = require('stream');\n\nutil.inherits(Writable, Stream);\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n}\n\nfunction WritableState(options, stream) {\n options = options || {};\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n var hwm = options.highWaterMark;\n this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n\n // cast to ints.\n this.highWaterMark = ~~this.highWaterMark;\n\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, becuase any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function(er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n\n this.buffer = [];\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n}\n\nfunction Writable(options) {\n var Duplex = require('./_stream_duplex');\n\n // Writable ctor is applied to Duplexes, though they're not\n // instanceof Writable, they're instanceof Readable.\n if (!(this instanceof Writable) && !(this instanceof Duplex))\n return new Writable(options);\n\n this._writableState = new WritableState(options, this);\n\n // legacy.\n this.writable = true;\n\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function() {\n this.emit('error', new Error('Cannot pipe. Not readable.'));\n};\n\n\nfunction writeAfterEnd(stream, state, cb) {\n var er = new Error('write after end');\n // TODO: defer error events consistently everywhere, not just the cb\n stream.emit('error', er);\n process.nextTick(function() {\n cb(er);\n });\n}\n\n// If we get something that is not a buffer, string, null, or undefined,\n// and we're not in objectMode, then that's an error.\n// Otherwise stream chunks are all considered to be of length=1, and the\n// watermarks determine how many objects to keep in the buffer, rather than\n// how many bytes or characters.\nfunction validChunk(stream, state, chunk, cb) {\n var valid = true;\n if (!Buffer.isBuffer(chunk) &&\n 'string' !== typeof chunk &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n process.nextTick(function() {\n cb(er);\n });\n valid = false;\n }\n return valid;\n}\n\nWritable.prototype.write = function(chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (Buffer.isBuffer(chunk))\n encoding = 'buffer';\n else if (!encoding)\n encoding = state.defaultEncoding;\n\n if (typeof cb !== 'function')\n cb = function() {};\n\n if (state.ended)\n writeAfterEnd(this, state, cb);\n else if (validChunk(this, state, chunk, cb))\n ret = writeOrBuffer(this, state, chunk, encoding, cb);\n\n return ret;\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode &&\n state.decodeStrings !== false &&\n typeof chunk === 'string') {\n chunk = new Buffer(chunk, encoding);\n }\n return chunk;\n}\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, chunk, encoding, cb) {\n chunk = decodeChunk(state, chunk, encoding);\n if (Buffer.isBuffer(chunk))\n encoding = 'buffer';\n var len = state.objectMode ? 1 : chunk.length;\n\n state.length += len;\n\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret)\n state.needDrain = true;\n\n if (state.writing)\n state.buffer.push(new WriteReq(chunk, encoding, cb));\n else\n doWrite(stream, state, len, chunk, encoding, cb);\n\n return ret;\n}\n\nfunction doWrite(stream, state, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n if (sync)\n process.nextTick(function() {\n cb(er);\n });\n else\n cb(er);\n\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n\n onwriteStateUpdate(state);\n\n if (er)\n onwriteError(stream, state, sync, er, cb);\n else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(stream, state);\n\n if (!finished && !state.bufferProcessing && state.buffer.length)\n clearBuffer(stream, state);\n\n if (sync) {\n process.nextTick(function() {\n afterWrite(stream, state, finished, cb);\n });\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished)\n onwriteDrain(stream, state);\n cb();\n if (finished)\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n\n for (var c = 0; c < state.buffer.length; c++) {\n var entry = state.buffer[c];\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n\n doWrite(stream, state, len, chunk, encoding, cb);\n\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n c++;\n break;\n }\n }\n\n state.bufferProcessing = false;\n if (c < state.buffer.length)\n state.buffer = state.buffer.slice(c);\n else\n state.buffer.length = 0;\n}\n\nWritable.prototype._write = function(chunk, encoding, cb) {\n cb(new Error('not implemented'));\n};\n\nWritable.prototype.end = function(chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (typeof chunk !== 'undefined' && chunk !== null)\n this.write(chunk, encoding);\n\n // ignore unnecessary end() calls.\n if (!state.ending && !state.finished)\n endWritable(this, state, cb);\n};\n\n\nfunction needFinish(stream, state) {\n return (state.ending &&\n state.length === 0 &&\n !state.finished &&\n !state.writing);\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(stream, state);\n if (need) {\n state.finished = true;\n stream.emit('finish');\n }\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished)\n process.nextTick(cb);\n else\n stream.once('finish', cb);\n }\n state.ended = true;\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(Transform, Duplex);\n\n\nfunction TransformState(options, stream) {\n this.afterTransform = function(er, data) {\n return afterTransform(stream, er, data);\n };\n\n this.needTransform = false;\n this.transforming = false;\n this.writecb = null;\n this.writechunk = null;\n}\n\nfunction afterTransform(stream, er, data) {\n var ts = stream._transformState;\n ts.transforming = false;\n\n var cb = ts.writecb;\n\n if (!cb)\n return stream.emit('error', new Error('no writecb in Transform class'));\n\n ts.writechunk = null;\n ts.writecb = null;\n\n if (data !== null && data !== undefined)\n stream.push(data);\n\n if (cb)\n cb(er);\n\n var rs = stream._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n stream._read(rs.highWaterMark);\n }\n}\n\n\nfunction Transform(options) {\n if (!(this instanceof Transform))\n return new Transform(options);\n\n Duplex.call(this, options);\n\n var ts = this._transformState = new TransformState(options, this);\n\n // when the writable side finishes, then flush out anything remaining.\n var stream = this;\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n\n this.once('finish', function() {\n if ('function' === typeof this._flush)\n this._flush(function(er) {\n done(stream, er);\n });\n else\n done(stream);\n });\n}\n\nTransform.prototype.push = function(chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function(chunk, encoding, cb) {\n throw new Error('not implemented');\n};\n\nTransform.prototype._write = function(chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform ||\n rs.needReadable ||\n rs.length < rs.highWaterMark)\n this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function(n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\n\nfunction done(stream, er) {\n if (er)\n return stream.emit('error', er);\n\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n var ws = stream._writableState;\n var rs = stream._readableState;\n var ts = stream._transformState;\n\n if (ws.length)\n throw new Error('calling transform done when ws.length != 0');\n\n if (ts.transforming)\n throw new Error('calling transform done when still transforming');\n\n return stream.push(null);\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\nmodule.exports = PassThrough;\n\nvar Transform = require('./_stream_transform');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough))\n return new PassThrough(options);\n\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function(chunk, encoding, cb) {\n cb(null, chunk);\n};\n","var Stream = require('stream'); // hack to fix a circular dependency issue when used with browserify\nexports = module.exports = require('./lib/_stream_readable.js');\nexports.Stream = Stream;\nexports.Readable = exports;\nexports.Writable = require('./lib/_stream_writable.js');\nexports.Duplex = require('./lib/_stream_duplex.js');\nexports.Transform = require('./lib/_stream_transform.js');\nexports.PassThrough = require('./lib/_stream_passthrough.js');\nif (!process.browser && process.env.READABLE_STREAM === 'disable') {\n module.exports = require('stream');\n}\n","{\n \"name\": \"levelup\",\n \"description\": \"Fast & simple storage - a Node.js-style LevelDB wrapper\",\n \"version\": \"0.18.6\",\n \"contributors\": [\n \"Rod Vagg (https://github.com/rvagg)\",\n \"John Chesley (https://github.com/chesles/)\",\n \"Jake Verbaten (https://github.com/raynos)\",\n \"Dominic Tarr (https://github.com/dominictarr)\",\n \"Max Ogden (https://github.com/maxogden)\",\n \"Lars-Magnus Skog (https://github.com/ralphtheninja)\",\n \"David Björklund (https://github.com/kesla)\",\n \"Julian Gruber (https://github.com/juliangruber)\",\n \"Paolo Fragomeni (https://github.com/hij1nx)\",\n \"Anton Whalley (https://github.com/No9)\",\n \"Matteo Collina (https://github.com/mcollina)\",\n \"Pedro Teixeira (https://github.com/pgte)\",\n \"James Halliday (https://github.com/substack)\"\n ],\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/rvagg/node-levelup.git\"\n },\n \"homepage\": \"https://github.com/rvagg/node-levelup\",\n \"keywords\": [\n \"leveldb\",\n \"stream\",\n \"database\",\n \"db\",\n \"store\",\n \"storage\",\n \"json\"\n ],\n \"main\": \"lib/levelup.js\",\n \"dependencies\": {\n \"bl\": \"~0.8.1\",\n \"deferred-leveldown\": \"~0.2.0\",\n \"errno\": \"~0.1.1\",\n \"prr\": \"~0.0.0\",\n \"readable-stream\": \"~1.0.26\",\n \"semver\": \"~2.3.1\",\n \"xtend\": \"~3.0.0\"\n },\n \"devDependencies\": {\n \"leveldown\": \"~0.10.0\",\n \"bustermove\": \"*\",\n \"tap\": \"*\",\n \"referee\": \"*\",\n \"rimraf\": \"*\",\n \"async\": \"*\",\n \"fstream\": \"*\",\n \"tar\": \"*\",\n \"mkfiletree\": \"*\",\n \"readfiletree\": \"*\",\n \"slow-stream\": \">=0.0.4\",\n \"delayed\": \"*\",\n \"boganipsum\": \"*\",\n \"du\": \"*\",\n \"memdown\": \"*\",\n \"msgpack-js\": \"*\"\n },\n \"browser\": {\n \"leveldown\": false,\n \"leveldown/package\": false,\n \"semver\": false\n },\n \"scripts\": {\n \"test\": \"tap test/*-test.js --stderr\",\n \"functionaltests\": \"node ./test/functional/fstream-test.js && node ./test/functional/binary-data-test.js && node ./test/functional/compat-test.js\",\n \"alltests\": \"npm test && npm run-script functionaltests\"\n },\n \"license\": \"MIT\"\n}\n",";(function(exports) {\n\n// export the class if we are in a Node-like system.\nif (typeof module === 'object' && module.exports === exports)\n exports = module.exports = SemVer;\n\n// The debug function is excluded entirely from the minified version.\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nexports.SEMVER_SPEC_VERSION = '2.0.0';\n\n// The actual regexps go on exports.re\nvar re = exports.re = [];\nvar src = exports.src = [];\nvar R = 0;\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\nvar NUMERICIDENTIFIER = R++;\nsrc[NUMERICIDENTIFIER] = '0|[1-9]\\\\d*';\nvar NUMERICIDENTIFIERLOOSE = R++;\nsrc[NUMERICIDENTIFIERLOOSE] = '[0-9]+';\n\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\nvar NONNUMERICIDENTIFIER = R++;\nsrc[NONNUMERICIDENTIFIER] = '\\\\d*[a-zA-Z-][a-zA-Z0-9-]*';\n\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\nvar MAINVERSION = R++;\nsrc[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\\\.' +\n '(' + src[NUMERICIDENTIFIER] + ')\\\\.' +\n '(' + src[NUMERICIDENTIFIER] + ')';\n\nvar MAINVERSIONLOOSE = R++;\nsrc[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\\\.' +\n '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\\\.' +\n '(' + src[NUMERICIDENTIFIERLOOSE] + ')';\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n\nvar PRERELEASEIDENTIFIER = R++;\nsrc[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] +\n '|' + src[NONNUMERICIDENTIFIER] + ')';\n\nvar PRERELEASEIDENTIFIERLOOSE = R++;\nsrc[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] +\n '|' + src[NONNUMERICIDENTIFIER] + ')';\n\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\nvar PRERELEASE = R++;\nsrc[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] +\n '(?:\\\\.' + src[PRERELEASEIDENTIFIER] + ')*))';\n\nvar PRERELEASELOOSE = R++;\nsrc[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] +\n '(?:\\\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))';\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\nvar BUILDIDENTIFIER = R++;\nsrc[BUILDIDENTIFIER] = '[0-9A-Za-z-]+';\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\nvar BUILD = R++;\nsrc[BUILD] = '(?:\\\\+(' + src[BUILDIDENTIFIER] +\n '(?:\\\\.' + src[BUILDIDENTIFIER] + ')*))';\n\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\nvar FULL = R++;\nvar FULLPLAIN = 'v?' + src[MAINVERSION] +\n src[PRERELEASE] + '?' +\n src[BUILD] + '?';\n\nsrc[FULL] = '^' + FULLPLAIN + '$';\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\nvar LOOSEPLAIN = '[v=\\\\s]*' + src[MAINVERSIONLOOSE] +\n src[PRERELEASELOOSE] + '?' +\n src[BUILD] + '?';\n\nvar LOOSE = R++;\nsrc[LOOSE] = '^' + LOOSEPLAIN + '$';\n\nvar GTLT = R++;\nsrc[GTLT] = '((?:<|>)?=?)';\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifer, meaning \"any version\"\n// Only the first item is strictly required.\nvar XRANGEIDENTIFIERLOOSE = R++;\nsrc[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\\\*';\nvar XRANGEIDENTIFIER = R++;\nsrc[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\\\*';\n\nvar XRANGEPLAIN = R++;\nsrc[XRANGEPLAIN] = '[v=\\\\s]*(' + src[XRANGEIDENTIFIER] + ')' +\n '(?:\\\\.(' + src[XRANGEIDENTIFIER] + ')' +\n '(?:\\\\.(' + src[XRANGEIDENTIFIER] + ')' +\n '(?:(' + src[PRERELEASE] + ')' +\n ')?)?)?';\n\nvar XRANGEPLAINLOOSE = R++;\nsrc[XRANGEPLAINLOOSE] = '[v=\\\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +\n '(?:\\\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +\n '(?:\\\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +\n '(?:(' + src[PRERELEASELOOSE] + ')' +\n ')?)?)?';\n\n// >=2.x, for example, means >=2.0.0-0\n// <1.x would be the same as \"<1.0.0-0\", though.\nvar XRANGE = R++;\nsrc[XRANGE] = '^' + src[GTLT] + '\\\\s*' + src[XRANGEPLAIN] + '$';\nvar XRANGELOOSE = R++;\nsrc[XRANGELOOSE] = '^' + src[GTLT] + '\\\\s*' + src[XRANGEPLAINLOOSE] + '$';\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\nvar LONETILDE = R++;\nsrc[LONETILDE] = '(?:~>?)';\n\nvar TILDETRIM = R++;\nsrc[TILDETRIM] = '(\\\\s*)' + src[LONETILDE] + '\\\\s+';\nre[TILDETRIM] = new RegExp(src[TILDETRIM], 'g');\nvar tildeTrimReplace = '$1~';\n\nvar TILDE = R++;\nsrc[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$';\nvar TILDELOOSE = R++;\nsrc[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$';\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\nvar LONECARET = R++;\nsrc[LONECARET] = '(?:\\\\^)';\n\nvar CARETTRIM = R++;\nsrc[CARETTRIM] = '(\\\\s*)' + src[LONECARET] + '\\\\s+';\nre[CARETTRIM] = new RegExp(src[CARETTRIM], 'g');\nvar caretTrimReplace = '$1^';\n\nvar CARET = R++;\nsrc[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$';\nvar CARETLOOSE = R++;\nsrc[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$';\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\nvar COMPARATORLOOSE = R++;\nsrc[COMPARATORLOOSE] = '^' + src[GTLT] + '\\\\s*(' + LOOSEPLAIN + ')$|^$';\nvar COMPARATOR = R++;\nsrc[COMPARATOR] = '^' + src[GTLT] + '\\\\s*(' + FULLPLAIN + ')$|^$';\n\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\nvar COMPARATORTRIM = R++;\nsrc[COMPARATORTRIM] = '(\\\\s*)' + src[GTLT] +\n '\\\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')';\n\n// this one has to use the /g flag\nre[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g');\nvar comparatorTrimReplace = '$1$2$3';\n\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\nvar HYPHENRANGE = R++;\nsrc[HYPHENRANGE] = '^\\\\s*(' + src[XRANGEPLAIN] + ')' +\n '\\\\s+-\\\\s+' +\n '(' + src[XRANGEPLAIN] + ')' +\n '\\\\s*$';\n\nvar HYPHENRANGELOOSE = R++;\nsrc[HYPHENRANGELOOSE] = '^\\\\s*(' + src[XRANGEPLAINLOOSE] + ')' +\n '\\\\s+-\\\\s+' +\n '(' + src[XRANGEPLAINLOOSE] + ')' +\n '\\\\s*$';\n\n// Star ranges basically just allow anything at all.\nvar STAR = R++;\nsrc[STAR] = '(<|>)?=?\\\\s*\\\\*';\n\n// Compile to actual regexp objects.\n// All are flag-free, unless they were created above with a flag.\nfor (var i = 0; i < R; i++) {\n ;\n if (!re[i])\n re[i] = new RegExp(src[i]);\n}\n\nexports.parse = parse;\nfunction parse(version, loose) {\n var r = loose ? re[LOOSE] : re[FULL];\n return (r.test(version)) ? new SemVer(version, loose) : null;\n}\n\nexports.valid = valid;\nfunction valid(version, loose) {\n var v = parse(version, loose);\n return v ? v.version : null;\n}\n\n\nexports.clean = clean;\nfunction clean(version, loose) {\n var s = parse(version, loose);\n return s ? s.version : null;\n}\n\nexports.SemVer = SemVer;\n\nfunction SemVer(version, loose) {\n if (version instanceof SemVer) {\n if (version.loose === loose)\n return version;\n else\n version = version.version;\n } else if (typeof version !== 'string') {\n throw new TypeError('Invalid Version: ' + version);\n }\n\n if (!(this instanceof SemVer))\n return new SemVer(version, loose);\n\n ;\n this.loose = loose;\n var m = version.trim().match(loose ? re[LOOSE] : re[FULL]);\n\n if (!m)\n throw new TypeError('Invalid Version: ' + version);\n\n this.raw = version;\n\n // these are actually numbers\n this.major = +m[1];\n this.minor = +m[2];\n this.patch = +m[3];\n\n // numberify any prerelease numeric ids\n if (!m[4])\n this.prerelease = [];\n else\n this.prerelease = m[4].split('.').map(function(id) {\n return (/^[0-9]+$/.test(id)) ? +id : id;\n });\n\n this.build = m[5] ? m[5].split('.') : [];\n this.format();\n}\n\nSemVer.prototype.format = function() {\n this.version = this.major + '.' + this.minor + '.' + this.patch;\n if (this.prerelease.length)\n this.version += '-' + this.prerelease.join('.');\n return this.version;\n};\n\nSemVer.prototype.inspect = function() {\n return '';\n};\n\nSemVer.prototype.toString = function() {\n return this.version;\n};\n\nSemVer.prototype.compare = function(other) {\n ;\n if (!(other instanceof SemVer))\n other = new SemVer(other, this.loose);\n\n return this.compareMain(other) || this.comparePre(other);\n};\n\nSemVer.prototype.compareMain = function(other) {\n if (!(other instanceof SemVer))\n other = new SemVer(other, this.loose);\n\n return compareIdentifiers(this.major, other.major) ||\n compareIdentifiers(this.minor, other.minor) ||\n compareIdentifiers(this.patch, other.patch);\n};\n\nSemVer.prototype.comparePre = function(other) {\n if (!(other instanceof SemVer))\n other = new SemVer(other, this.loose);\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length)\n return -1;\n else if (!this.prerelease.length && other.prerelease.length)\n return 1;\n else if (!this.prerelease.length && !other.prerelease.length)\n return 0;\n\n var i = 0;\n do {\n var a = this.prerelease[i];\n var b = other.prerelease[i];\n ;\n if (a === undefined && b === undefined)\n return 0;\n else if (b === undefined)\n return 1;\n else if (a === undefined)\n return -1;\n else if (a === b)\n continue;\n else\n return compareIdentifiers(a, b);\n } while (++i);\n};\n\n// preminor will bump the version up to the next minor release, and immediately\n// down to pre-release. premajor and prepatch work the same way.\nSemVer.prototype.inc = function(release) {\n switch (release) {\n case 'premajor':\n this.inc('major');\n this.inc('pre');\n break;\n case 'preminor':\n this.inc('minor');\n this.inc('pre');\n break;\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch');\n this.inc('pre');\n break;\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0)\n this.inc('patch');\n this.inc('pre');\n break;\n case 'major':\n this.major++;\n this.minor = -1;\n case 'minor':\n this.minor++;\n this.patch = 0;\n this.prerelease = [];\n break;\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0)\n this.patch++;\n this.prerelease = [];\n break;\n // This probably shouldn't be used publically.\n // 1.0.0 \"pre\" would become 1.0.0-0 which is the wrong direction.\n case 'pre':\n if (this.prerelease.length === 0)\n this.prerelease = [0];\n else {\n var i = this.prerelease.length;\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++;\n i = -2;\n }\n }\n if (i === -1) // didn't increment anything\n this.prerelease.push(0);\n }\n break;\n\n default:\n throw new Error('invalid increment argument: ' + release);\n }\n this.format();\n return this;\n};\n\nexports.inc = inc;\nfunction inc(version, release, loose) {\n try {\n return new SemVer(version, loose).inc(release).version;\n } catch (er) {\n return null;\n }\n}\n\nexports.compareIdentifiers = compareIdentifiers;\n\nvar numeric = /^[0-9]+$/;\nfunction compareIdentifiers(a, b) {\n var anum = numeric.test(a);\n var bnum = numeric.test(b);\n\n if (anum && bnum) {\n a = +a;\n b = +b;\n }\n\n return (anum && !bnum) ? -1 :\n (bnum && !anum) ? 1 :\n a < b ? -1 :\n a > b ? 1 :\n 0;\n}\n\nexports.rcompareIdentifiers = rcompareIdentifiers;\nfunction rcompareIdentifiers(a, b) {\n return compareIdentifiers(b, a);\n}\n\nexports.compare = compare;\nfunction compare(a, b, loose) {\n return new SemVer(a, loose).compare(b);\n}\n\nexports.compareLoose = compareLoose;\nfunction compareLoose(a, b) {\n return compare(a, b, true);\n}\n\nexports.rcompare = rcompare;\nfunction rcompare(a, b, loose) {\n return compare(b, a, loose);\n}\n\nexports.sort = sort;\nfunction sort(list, loose) {\n return list.sort(function(a, b) {\n return exports.compare(a, b, loose);\n });\n}\n\nexports.rsort = rsort;\nfunction rsort(list, loose) {\n return list.sort(function(a, b) {\n return exports.rcompare(a, b, loose);\n });\n}\n\nexports.gt = gt;\nfunction gt(a, b, loose) {\n return compare(a, b, loose) > 0;\n}\n\nexports.lt = lt;\nfunction lt(a, b, loose) {\n return compare(a, b, loose) < 0;\n}\n\nexports.eq = eq;\nfunction eq(a, b, loose) {\n return compare(a, b, loose) === 0;\n}\n\nexports.neq = neq;\nfunction neq(a, b, loose) {\n return compare(a, b, loose) !== 0;\n}\n\nexports.gte = gte;\nfunction gte(a, b, loose) {\n return compare(a, b, loose) >= 0;\n}\n\nexports.lte = lte;\nfunction lte(a, b, loose) {\n return compare(a, b, loose) <= 0;\n}\n\nexports.cmp = cmp;\nfunction cmp(a, op, b, loose) {\n var ret;\n switch (op) {\n case '===': ret = a === b; break;\n case '!==': ret = a !== b; break;\n case '': case '=': case '==': ret = eq(a, b, loose); break;\n case '!=': ret = neq(a, b, loose); break;\n case '>': ret = gt(a, b, loose); break;\n case '>=': ret = gte(a, b, loose); break;\n case '<': ret = lt(a, b, loose); break;\n case '<=': ret = lte(a, b, loose); break;\n default: throw new TypeError('Invalid operator: ' + op);\n }\n return ret;\n}\n\nexports.Comparator = Comparator;\nfunction Comparator(comp, loose) {\n if (comp instanceof Comparator) {\n if (comp.loose === loose)\n return comp;\n else\n comp = comp.value;\n }\n\n if (!(this instanceof Comparator))\n return new Comparator(comp, loose);\n\n ;\n this.loose = loose;\n this.parse(comp);\n\n if (this.semver === ANY)\n this.value = '';\n else\n this.value = this.operator + this.semver.version;\n}\n\nvar ANY = {};\nComparator.prototype.parse = function(comp) {\n var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];\n var m = comp.match(r);\n\n if (!m)\n throw new TypeError('Invalid comparator: ' + comp);\n\n this.operator = m[1];\n if (this.operator === '=')\n this.operator = '';\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2])\n this.semver = ANY;\n else {\n this.semver = new SemVer(m[2], this.loose);\n\n // <1.2.3-rc DOES allow 1.2.3-beta (has prerelease)\n // >=1.2.3 DOES NOT allow 1.2.3-beta\n // <=1.2.3 DOES allow 1.2.3-beta\n // However, <1.2.3 does NOT allow 1.2.3-beta,\n // even though `1.2.3-beta < 1.2.3`\n // The assumption is that the 1.2.3 version has something you\n // *don't* want, so we push the prerelease down to the minimum.\n if (this.operator === '<' && !this.semver.prerelease.length) {\n this.semver.prerelease = ['0'];\n this.semver.format();\n }\n }\n};\n\nComparator.prototype.inspect = function() {\n return '';\n};\n\nComparator.prototype.toString = function() {\n return this.value;\n};\n\nComparator.prototype.test = function(version) {\n ;\n return (this.semver === ANY) ? true :\n cmp(version, this.operator, this.semver, this.loose);\n};\n\n\nexports.Range = Range;\nfunction Range(range, loose) {\n if ((range instanceof Range) && range.loose === loose)\n return range;\n\n if (!(this instanceof Range))\n return new Range(range, loose);\n\n this.loose = loose;\n\n // First, split based on boolean or ||\n this.raw = range;\n this.set = range.split(/\\s*\\|\\|\\s*/).map(function(range) {\n return this.parseRange(range.trim());\n }, this).filter(function(c) {\n // throw out any that are not relevant for whatever reason\n return c.length;\n });\n\n if (!this.set.length) {\n throw new TypeError('Invalid SemVer Range: ' + range);\n }\n\n this.format();\n}\n\nRange.prototype.inspect = function() {\n return '';\n};\n\nRange.prototype.format = function() {\n this.range = this.set.map(function(comps) {\n return comps.join(' ').trim();\n }).join('||').trim();\n return this.range;\n};\n\nRange.prototype.toString = function() {\n return this.range;\n};\n\nRange.prototype.parseRange = function(range) {\n var loose = this.loose;\n range = range.trim();\n ;\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE];\n range = range.replace(hr, hyphenReplace);\n ;\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace);\n ;\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[TILDETRIM], tildeTrimReplace);\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[CARETTRIM], caretTrimReplace);\n\n // normalize spaces\n range = range.split(/\\s+/).join(' ');\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR];\n var set = range.split(' ').map(function(comp) {\n return parseComparator(comp, loose);\n }).join(' ').split(/\\s+/);\n if (this.loose) {\n // in loose mode, throw out any that are not valid comparators\n set = set.filter(function(comp) {\n return !!comp.match(compRe);\n });\n }\n set = set.map(function(comp) {\n return new Comparator(comp, loose);\n });\n\n return set;\n};\n\n// Mostly just for testing and legacy API reasons\nexports.toComparators = toComparators;\nfunction toComparators(range, loose) {\n return new Range(range, loose).set.map(function(comp) {\n return comp.map(function(c) {\n return c.value;\n }).join(' ').trim().split(' ');\n });\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nfunction parseComparator(comp, loose) {\n ;\n comp = replaceCarets(comp, loose);\n ;\n comp = replaceTildes(comp, loose);\n ;\n comp = replaceXRanges(comp, loose);\n ;\n comp = replaceStars(comp, loose);\n ;\n return comp;\n}\n\nfunction isX(id) {\n return !id || id.toLowerCase() === 'x' || id === '*';\n}\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0\nfunction replaceTildes(comp, loose) {\n return comp.trim().split(/\\s+/).map(function(comp) {\n return replaceTilde(comp, loose);\n }).join(' ');\n}\n\nfunction replaceTilde(comp, loose) {\n var r = loose ? re[TILDELOOSE] : re[TILDE];\n return comp.replace(r, function(_, M, m, p, pr) {\n ;\n var ret;\n\n if (isX(M))\n ret = '';\n else if (isX(m))\n ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0';\n else if (isX(p))\n // ~1.2 == >=1.2.0- <1.3.0-\n ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0';\n else if (pr) {\n ;\n if (pr.charAt(0) !== '-')\n pr = '-' + pr;\n ret = '>=' + M + '.' + m + '.' + p + pr +\n ' <' + M + '.' + (+m + 1) + '.0-0';\n } else\n // ~1.2.3 == >=1.2.3-0 <1.3.0-0\n ret = '>=' + M + '.' + m + '.' + p + '-0' +\n ' <' + M + '.' + (+m + 1) + '.0-0';\n\n ;\n return ret;\n });\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0\n// ^1.2.3 --> >=1.2.3 <2.0.0\n// ^1.2.0 --> >=1.2.0 <2.0.0\nfunction replaceCarets(comp, loose) {\n return comp.trim().split(/\\s+/).map(function(comp) {\n return replaceCaret(comp, loose);\n }).join(' ');\n}\n\nfunction replaceCaret(comp, loose) {\n var r = loose ? re[CARETLOOSE] : re[CARET];\n return comp.replace(r, function(_, M, m, p, pr) {\n ;\n var ret;\n\n if (isX(M))\n ret = '';\n else if (isX(m))\n ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0';\n else if (isX(p)) {\n if (M === '0')\n ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0';\n else\n ret = '>=' + M + '.' + m + '.0-0 <' + (+M + 1) + '.0.0-0';\n } else if (pr) {\n ;\n if (pr.charAt(0) !== '-')\n pr = '-' + pr;\n if (M === '0') {\n if (m === '0')\n ret = '=' + M + '.' + m + '.' + p + pr;\n else\n ret = '>=' + M + '.' + m + '.' + p + pr +\n ' <' + M + '.' + (+m + 1) + '.0-0';\n } else\n ret = '>=' + M + '.' + m + '.' + p + pr +\n ' <' + (+M + 1) + '.0.0-0';\n } else {\n if (M === '0') {\n if (m === '0')\n ret = '=' + M + '.' + m + '.' + p;\n else\n ret = '>=' + M + '.' + m + '.' + p + '-0' +\n ' <' + M + '.' + (+m + 1) + '.0-0';\n } else\n ret = '>=' + M + '.' + m + '.' + p + '-0' +\n ' <' + (+M + 1) + '.0.0-0';\n }\n\n ;\n return ret;\n });\n}\n\nfunction replaceXRanges(comp, loose) {\n ;\n return comp.split(/\\s+/).map(function(comp) {\n return replaceXRange(comp, loose);\n }).join(' ');\n}\n\nfunction replaceXRange(comp, loose) {\n comp = comp.trim();\n var r = loose ? re[XRANGELOOSE] : re[XRANGE];\n return comp.replace(r, function(ret, gtlt, M, m, p, pr) {\n ;\n var xM = isX(M);\n var xm = xM || isX(m);\n var xp = xm || isX(p);\n var anyX = xp;\n\n if (gtlt === '=' && anyX)\n gtlt = '';\n\n if (gtlt && anyX) {\n // replace X with 0, and then append the -0 min-prerelease\n if (xM)\n M = 0;\n if (xm)\n m = 0;\n if (xp)\n p = 0;\n\n if (gtlt === '>') {\n // >1 => >=2.0.0-0\n // >1.2 => >=1.3.0-0\n // >1.2.3 => >= 1.2.4-0\n gtlt = '>=';\n if (xM) {\n // no change\n } else if (xm) {\n M = +M + 1;\n m = 0;\n p = 0;\n } else if (xp) {\n m = +m + 1;\n p = 0;\n }\n }\n\n\n ret = gtlt + M + '.' + m + '.' + p + '-0';\n } else if (xM) {\n // allow any\n ret = '*';\n } else if (xm) {\n // append '-0' onto the version, otherwise\n // '1.x.x' matches '2.0.0-beta', since the tag\n // *lowers* the version value\n ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0';\n } else if (xp) {\n ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0';\n }\n\n ;\n\n return ret;\n });\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nfunction replaceStars(comp, loose) {\n ;\n // Looseness is ignored here. star is always as loose as it gets!\n return comp.trim().replace(re[STAR], '');\n}\n\n// This function is passed to string.replace(re[HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0-0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0-0 <3.5.0-0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0-0 <3.5.0-0\nfunction hyphenReplace($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr, tb) {\n\n if (isX(fM))\n from = '';\n else if (isX(fm))\n from = '>=' + fM + '.0.0-0';\n else if (isX(fp))\n from = '>=' + fM + '.' + fm + '.0-0';\n else\n from = '>=' + from;\n\n if (isX(tM))\n to = '';\n else if (isX(tm))\n to = '<' + (+tM + 1) + '.0.0-0';\n else if (isX(tp))\n to = '<' + tM + '.' + (+tm + 1) + '.0-0';\n else if (tpr)\n to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr;\n else\n to = '<=' + to;\n\n return (from + ' ' + to).trim();\n}\n\n\n// if ANY of the sets match ALL of its comparators, then pass\nRange.prototype.test = function(version) {\n if (!version)\n return false;\n for (var i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version))\n return true;\n }\n return false;\n};\n\nfunction testSet(set, version) {\n for (var i = 0; i < set.length; i++) {\n if (!set[i].test(version))\n return false;\n }\n return true;\n}\n\nexports.satisfies = satisfies;\nfunction satisfies(version, range, loose) {\n try {\n range = new Range(range, loose);\n } catch (er) {\n return false;\n }\n return range.test(version);\n}\n\nexports.maxSatisfying = maxSatisfying;\nfunction maxSatisfying(versions, range, loose) {\n return versions.filter(function(version) {\n return satisfies(version, range, loose);\n }).sort(function(a, b) {\n return rcompare(a, b, loose);\n })[0] || null;\n}\n\nexports.validRange = validRange;\nfunction validRange(range, loose) {\n try {\n // Return '*' instead of '' so that truthiness works.\n // This will throw if it's invalid anyway\n return new Range(range, loose).range || '*';\n } catch (er) {\n return null;\n }\n}\n\n// Determine if version is less than all the versions possible in the range\nexports.ltr = ltr;\nfunction ltr(version, range, loose) {\n return outside(version, range, '<', loose);\n}\n\n// Determine if version is greater than all the versions possible in the range.\nexports.gtr = gtr;\nfunction gtr(version, range, loose) {\n return outside(version, range, '>', loose);\n}\n\nexports.outside = outside;\nfunction outside(version, range, hilo, loose) {\n version = new SemVer(version, loose);\n range = new Range(range, loose);\n\n var gtfn, ltefn, ltfn, comp, ecomp;\n switch (hilo) {\n case '>':\n gtfn = gt;\n ltefn = lte;\n ltfn = lt;\n comp = '>';\n ecomp = '>=';\n break;\n case '<':\n gtfn = lt;\n ltefn = gte;\n ltfn = gt;\n comp = '<';\n ecomp = '<=';\n break;\n default:\n throw new TypeError('Must provide a hilo val of \"<\" or \">\"');\n }\n\n // If it satisifes the range it is not outside\n if (satisfies(version, range, loose)) {\n return false;\n }\n\n // From now on, variable terms are as if we're in \"gtr\" mode.\n // but note that everything is flipped for the \"ltr\" function.\n\n for (var i = 0; i < range.set.length; ++i) {\n var comparators = range.set[i];\n\n var high = null;\n var low = null;\n\n comparators.forEach(function(comparator) {\n high = high || comparator;\n low = low || comparator;\n if (gtfn(comparator.semver, high.semver, loose)) {\n high = comparator;\n } else if (ltfn(comparator.semver, low.semver, loose)) {\n low = comparator;\n }\n });\n\n // If the edge version comparator has a operator then our version\n // isn't outside it\n if (high.operator === comp || high.operator === ecomp) {\n return false;\n }\n\n // If the lowest version comparator has an operator and our version\n // is less than it then it isn't higher than the range\n if ((!low.operator || low.operator === comp) &&\n ltefn(version, low.semver)) {\n return false;\n } else if (low.operator === ecomp && ltfn(version, low.semver)) {\n return false;\n }\n }\n return true;\n}\n\n// Use the define() function if we're in AMD land\nif (typeof define === 'function' && define.amd)\n define(exports);\n\n})(\n typeof exports === 'object' ? exports :\n typeof define === 'function' && define.amd ? {} :\n semver = {}\n);\n","/* Copyright (c) 2012-2014 LevelUP contributors\n * See list at \n * MIT License\n * \n */\n\nvar extend = require('xtend')\n , LevelUPError = require('./errors').LevelUPError\n\n , encodingNames = [\n 'hex'\n , 'utf8'\n , 'utf-8'\n , 'ascii'\n , 'binary'\n , 'base64'\n , 'ucs2'\n , 'ucs-2'\n , 'utf16le'\n , 'utf-16le'\n ]\n\n , defaultOptions = {\n createIfMissing : true\n , errorIfExists : false\n , keyEncoding : 'utf8'\n , valueEncoding : 'utf8'\n , compression : true\n }\n\n , leveldown\n\n , encodings = (function () {\n function isBinary (data) {\n return data === undefined || data === null || Buffer.isBuffer(data)\n }\n\n var encodings = {}\n encodings.utf8 = encodings['utf-8'] = {\n encode : function (data) {\n return isBinary(data) ? data : String(data)\n }\n , decode : function (data) {\n return data\n }\n , buffer : false\n , type : 'utf8'\n }\n encodings.json = {\n encode : JSON.stringify\n , decode : JSON.parse\n , buffer : false\n , type : 'json'\n }\n encodingNames.forEach(function (type) {\n if (encodings[type])\n return\n encodings[type] = {\n encode : function (data) {\n return isBinary(data) ? data : new Buffer(data, type)\n }\n , decode : function (buffer) {\n return process.browser ? buffer.toString(type) : buffer;\n }\n , buffer : true\n , type : type // useful for debugging purposes\n }\n })\n return encodings\n })()\n\n , encodingOpts = (function () {\n var eo = {}\n encodingNames.forEach(function (e) {\n eo[e] = { valueEncoding : e }\n })\n return eo\n }())\n\nfunction copy (srcdb, dstdb, callback) {\n srcdb.readStream()\n .pipe(dstdb.writeStream())\n .on('close', callback ? callback : function () {})\n .on('error', callback ? callback : function (err) { throw err })\n}\n\nfunction getOptions (levelup, options) {\n var s = typeof options == 'string' // just an encoding\n if (!s && options && options.encoding && !options.valueEncoding)\n options.valueEncoding = options.encoding\n return extend(\n (levelup && levelup.options) || {}\n , s ? encodingOpts[options] || encodingOpts[defaultOptions.valueEncoding]\n : options\n )\n}\n\nfunction getLevelDOWN () {\n if (leveldown)\n return leveldown\n\n var requiredVersion = require('../package.json').devDependencies.leveldown\n , missingLevelDOWNError = 'Could not locate LevelDOWN, try `npm install leveldown`'\n , leveldownVersion\n\n try {\n leveldownVersion = require('leveldown/package').version\n } catch (e) {\n throw new LevelUPError(missingLevelDOWNError)\n }\n\n if (!require('semver').satisfies(leveldownVersion, requiredVersion)) {\n throw new LevelUPError(\n 'Installed version of LevelDOWN ('\n + leveldownVersion\n + ') does not match required version ('\n + requiredVersion\n + ')'\n )\n }\n\n try {\n return leveldown = require('leveldown')\n } catch (e) {\n throw new LevelUPError(missingLevelDOWNError)\n }\n}\n\nfunction dispatchError (levelup, error, callback) {\n return typeof callback == 'function'\n ? callback(error)\n : levelup.emit('error', error)\n}\n\nfunction getKeyEncoder (options, op) {\n var type = ((op && op.keyEncoding) || options.keyEncoding) || 'utf8'\n return encodings[type] || type\n}\n\nfunction getValueEncoder (options, op) {\n var type = (((op && (op.valueEncoding || op.encoding))\n || options.valueEncoding || options.encoding)) || 'utf8'\n return encodings[type] || type\n}\n\nfunction encodeKey (key, options, op) {\n return getKeyEncoder(options, op).encode(key)\n}\n\nfunction encodeValue (value, options, op) {\n return getValueEncoder(options, op).encode(value)\n}\n\nfunction decodeKey (key, options) {\n return getKeyEncoder(options).decode(key)\n}\n\nfunction decodeValue (value, options) {\n return getValueEncoder(options).decode(value)\n}\n\nfunction isValueAsBuffer (options, op) {\n return getValueEncoder(options, op).buffer\n}\n\nfunction isKeyAsBuffer (options, op) {\n return getKeyEncoder(options, op).buffer\n}\n\nmodule.exports = {\n defaultOptions : defaultOptions\n , copy : copy\n , getOptions : getOptions\n , getLevelDOWN : getLevelDOWN\n , dispatchError : dispatchError\n , encodeKey : encodeKey\n , encodeValue : encodeValue\n , isValueAsBuffer : isValueAsBuffer\n , isKeyAsBuffer : isKeyAsBuffer\n , decodeValue : decodeValue\n , decodeKey : decodeKey\n}\n","/* Copyright (c) 2012-2014 LevelUP contributors\n * See list at \n * MIT License \n */\n\n// NOTE: we are fixed to readable-stream@1.0.x for now\n// for pure Streams2 across Node versions\nvar Readable = require('readable-stream').Readable\n , inherits = require('util').inherits\n , extend = require('xtend')\n , EncodingError = require('./errors').EncodingError\n , util = require('./util')\n\n , defaultOptions = { keys: true, values: true }\n\n , makeKeyValueData = function (key, value) {\n return {\n key: util.decodeKey(key, this._options)\n , value: util.decodeValue(value, this._options)\n }\n }\n , makeKeyData = function (key) {\n return util.decodeKey(key, this._options)\n }\n , makeValueData = function (_, value) {\n return util.decodeValue(value, this._options)\n }\n , makeNoData = function () { return null }\n\nfunction ReadStream (options, db, iteratorFactory) {\n if (!(this instanceof ReadStream))\n return new ReadStream(options, db, iteratorFactory)\n\n Readable.call(this, { objectMode: true, highWaterMark: options.highWaterMark })\n\n // purely to keep `db` around until we're done so it's not GCed if the user doesn't keep a ref\n this._db = db\n\n options = this._options = extend(defaultOptions, options)\n\n this._keyEncoding = options.keyEncoding || options.encoding\n this._valueEncoding = options.valueEncoding || options.encoding\n\n if (typeof this._options.start != 'undefined')\n this._options.start = util.encodeKey(this._options.start, this._options)\n if (typeof this._options.end != 'undefined')\n this._options.end = util.encodeKey(this._options.end, this._options)\n if (typeof this._options.limit != 'number')\n this._options.limit = -1\n\n this._options.keyAsBuffer = util.isKeyAsBuffer(this._options)\n\n this._options.valueAsBuffer = util.isValueAsBuffer(this._options)\n\n this._makeData = this._options.keys && this._options.values\n ? makeKeyValueData : this._options.keys\n ? makeKeyData : this._options.values\n ? makeValueData : makeNoData\n\n var self = this\n if (!this._db.isOpen()) {\n this._db.once('ready', function () {\n if (!self._destroyed) {\n self._iterator = iteratorFactory(self._options)\n }\n })\n } else\n this._iterator = iteratorFactory(this._options)\n}\n\ninherits(ReadStream, Readable)\n\nReadStream.prototype._read = function read () {\n var self = this\n if (!self._db.isOpen()) {\n return self._db.once('ready', function () { read.call(self) })\n }\n if (self._destroyed)\n return\n \n self._iterator.next(function(err, key, value) {\n if (err || (key === undefined && value === undefined)) {\n if (!err && !self._destroyed)\n self.push(null)\n return self._cleanup(err)\n }\n\n try {\n value = self._makeData(key, value)\n } catch (e) {\n return self._cleanup(new EncodingError(e))\n }\n if (!self._destroyed)\n self.push(value)\n })\n}\n\nReadStream.prototype._cleanup = function (err) {\n if (this._destroyed)\n return\n\n this._destroyed = true\n\n var self = this\n if (err)\n self.emit('error', err)\n\n if (self._iterator) {\n self._iterator.end(function () {\n self._iterator = null\n self.emit('close')\n })\n } else {\n self.emit('close')\n }\n}\n\nReadStream.prototype.destroy = function () {\n this._cleanup()\n}\n\nReadStream.prototype.toString = function () {\n return 'LevelUP.ReadStream'\n}\n\nmodule.exports = ReadStream\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Readable;\n\n/**/\nvar isArray = require('isarray');\n/**/\n\n\n/**/\nvar Buffer = require('buffer').Buffer;\n/**/\n\nReadable.ReadableState = ReadableState;\n\nvar EE = require('events').EventEmitter;\n\n/**/\nif (!EE.listenerCount) EE.listenerCount = function(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\nvar Stream = require('stream');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar StringDecoder;\n\nutil.inherits(Readable, Stream);\n\nfunction ReadableState(options, stream) {\n options = options || {};\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n var hwm = options.highWaterMark;\n this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;\n\n // cast to ints.\n this.highWaterMark = ~~this.highWaterMark;\n\n this.buffer = [];\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = false;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // In streams that never have any data, and do push(null) right away,\n // the consumer can miss the 'end' event if they do some I/O before\n // consuming the stream. So, we don't emit('end') until some reading\n // happens.\n this.calledRead = false;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, becuase any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // when piping, we only care about 'readable' events that happen\n // after read()ing all the bytes and not getting any pushback.\n this.ranOut = false;\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder)\n StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n if (!(this instanceof Readable))\n return new Readable(options);\n\n this._readableState = new ReadableState(options, this);\n\n // legacy\n this.readable = true;\n\n Stream.call(this);\n}\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function(chunk, encoding) {\n var state = this._readableState;\n\n if (typeof chunk === 'string' && !state.objectMode) {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = new Buffer(chunk, encoding);\n encoding = '';\n }\n }\n\n return readableAddChunk(this, state, chunk, encoding, false);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function(chunk) {\n var state = this._readableState;\n return readableAddChunk(this, state, chunk, '', true);\n};\n\nfunction readableAddChunk(stream, state, chunk, encoding, addToFront) {\n var er = chunkInvalid(state, chunk);\n if (er) {\n stream.emit('error', er);\n } else if (chunk === null || chunk === undefined) {\n state.reading = false;\n if (!state.ended)\n onEofChunk(stream, state);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (state.ended && !addToFront) {\n var e = new Error('stream.push() after EOF');\n stream.emit('error', e);\n } else if (state.endEmitted && addToFront) {\n var e = new Error('stream.unshift() after end event');\n stream.emit('error', e);\n } else {\n if (state.decoder && !addToFront && !encoding)\n chunk = state.decoder.write(chunk);\n\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) {\n state.buffer.unshift(chunk);\n } else {\n state.reading = false;\n state.buffer.push(chunk);\n }\n\n if (state.needReadable)\n emitReadable(stream);\n\n maybeReadMore(stream, state);\n }\n } else if (!addToFront) {\n state.reading = false;\n }\n\n return needMoreData(state);\n}\n\n\n\n// if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes. This is to work around cases where hwm=0,\n// such as the repl. Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\nfunction needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function(enc) {\n if (!StringDecoder)\n StringDecoder = require('string_decoder/').StringDecoder;\n this._readableState.decoder = new StringDecoder(enc);\n this._readableState.encoding = enc;\n};\n\n// Don't raise the hwm > 128MB\nvar MAX_HWM = 0x800000;\nfunction roundUpToNextPowerOf2(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2\n n--;\n for (var p = 1; p < 32; p <<= 1) n |= n >> p;\n n++;\n }\n return n;\n}\n\nfunction howMuchToRead(n, state) {\n if (state.length === 0 && state.ended)\n return 0;\n\n if (state.objectMode)\n return n === 0 ? 0 : 1;\n\n if (n === null || isNaN(n)) {\n // only flow one buffer at a time\n if (state.flowing && state.buffer.length)\n return state.buffer[0].length;\n else\n return state.length;\n }\n\n if (n <= 0)\n return 0;\n\n // If we're asking for more than the target buffer level,\n // then raise the water mark. Bump up to the next highest\n // power of 2, to prevent increasing it excessively in tiny\n // amounts.\n if (n > state.highWaterMark)\n state.highWaterMark = roundUpToNextPowerOf2(n);\n\n // don't have that much. return null, unless we've ended.\n if (n > state.length) {\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n } else\n return state.length;\n }\n\n return n;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function(n) {\n var state = this._readableState;\n state.calledRead = true;\n var nOrig = n;\n var ret;\n\n if (typeof n !== 'number' || n > 0)\n state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 &&\n state.needReadable &&\n (state.length >= state.highWaterMark || state.ended)) {\n emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n ret = null;\n\n // In cases where the decoder did not receive enough data\n // to produce a full chunk, then immediately received an\n // EOF, state.buffer will contain [, ].\n // howMuchToRead will see this and coerce the amount to\n // read to zero (because it's looking at the length of the\n // first in state.buffer), and we'll end up here.\n //\n // This can only happen via state.decoder -- no other venue\n // exists for pushing a zero-length chunk into state.buffer\n // and triggering this behavior. In this case, we return our\n // remaining data and end the stream, if appropriate.\n if (state.length > 0 && state.decoder) {\n ret = fromList(n, state);\n state.length -= ret.length;\n }\n\n if (state.length === 0)\n endReadable(this);\n\n return ret;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length - n <= state.highWaterMark)\n doRead = true;\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading)\n doRead = false;\n\n if (doRead) {\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0)\n state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n }\n\n // If _read called its callback synchronously, then `reading`\n // will be false, and we need to re-evaluate how much data we\n // can return to the user.\n if (doRead && !state.reading)\n n = howMuchToRead(nOrig, state);\n\n if (n > 0)\n ret = fromList(n, state);\n else\n ret = null;\n\n if (ret === null) {\n state.needReadable = true;\n n = 0;\n }\n\n state.length -= n;\n\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (state.length === 0 && !state.ended)\n state.needReadable = true;\n\n // If we happened to read() exactly the remaining amount in the\n // buffer, and the EOF has been seen at this point, then make sure\n // that we emit 'end' on the very next tick.\n if (state.ended && !state.endEmitted && state.length === 0)\n endReadable(this);\n\n return ret;\n};\n\nfunction chunkInvalid(state, chunk) {\n var er = null;\n if (!Buffer.isBuffer(chunk) &&\n 'string' !== typeof chunk &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n return er;\n}\n\n\nfunction onEofChunk(stream, state) {\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n\n // if we've ended and we have some data left, then emit\n // 'readable' now to make sure it gets picked up.\n if (state.length > 0)\n emitReadable(stream);\n else\n endReadable(stream);\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}\n\nfunction emitReadable_(stream) {\n stream.emit('readable');\n}\n\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(function() {\n maybeReadMore_(stream, state);\n });\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n var len = state.length;\n while (!state.reading && !state.flowing && !state.ended &&\n state.length < state.highWaterMark) {\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;\n else\n len = state.length;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function(n) {\n this.emit('error', new Error('not implemented'));\n};\n\nReadable.prototype.pipe = function(dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n\n var doEnd = (!pipeOpts || pipeOpts.end !== false) &&\n dest !== process.stdout &&\n dest !== process.stderr;\n\n var endFn = doEnd ? onend : cleanup;\n if (state.endEmitted)\n process.nextTick(endFn);\n else\n src.once('end', endFn);\n\n dest.on('unpipe', onunpipe);\n function onunpipe(readable) {\n if (readable !== src) return;\n cleanup();\n }\n\n function onend() {\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n\n function cleanup() {\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', cleanup);\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (!dest._writableState || dest._writableState.needDrain)\n ondrain();\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }\n // This is a brutally ugly hack to make sure that our error handler\n // is attached before any userland ones. NEVER DO THIS.\n if (!dest._events || !dest._events.error)\n dest.on('error', onerror);\n else if (isArray(dest._events.error))\n dest._events.error.unshift(onerror);\n else\n dest._events.error = [onerror, dest._events.error];\n\n\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n\n function unpipe() {\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n // the handler that waits for readable events after all\n // the data gets sucked out in flow.\n // This would be easier to follow with a .once() handler\n // in flow(), but that is too slow.\n this.on('readable', pipeOnReadable);\n\n state.flowing = true;\n process.nextTick(function() {\n flow(src);\n });\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function() {\n var dest = this;\n var state = src._readableState;\n state.awaitDrain--;\n if (state.awaitDrain === 0)\n flow(src);\n };\n}\n\nfunction flow(src) {\n var state = src._readableState;\n var chunk;\n state.awaitDrain = 0;\n\n function write(dest, i, list) {\n var written = dest.write(chunk);\n if (false === written) {\n state.awaitDrain++;\n }\n }\n\n while (state.pipesCount && null !== (chunk = src.read())) {\n\n if (state.pipesCount === 1)\n write(state.pipes, 0, null);\n else\n forEach(state.pipes, write);\n\n src.emit('data', chunk);\n\n // if anyone needs a drain, then we have to wait for that.\n if (state.awaitDrain > 0)\n return;\n }\n\n // if every destination was unpiped, either before entering this\n // function, or in the while loop, then stop flowing.\n //\n // NB: This is a pretty rare edge case.\n if (state.pipesCount === 0) {\n state.flowing = false;\n\n // if there were data event listeners added, then switch to old mode.\n if (EE.listenerCount(src, 'data') > 0)\n emitDataEvents(src);\n return;\n }\n\n // at this point, no one needed a drain, so we just ran out of data\n // on the next readable event, start it over again.\n state.ranOut = true;\n}\n\nfunction pipeOnReadable() {\n if (this._readableState.ranOut) {\n this._readableState.ranOut = false;\n flow(this);\n }\n}\n\n\nReadable.prototype.unpipe = function(dest) {\n var state = this._readableState;\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0)\n return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes)\n return this;\n\n if (!dest)\n dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n this.removeListener('readable', pipeOnReadable);\n state.flowing = false;\n if (dest)\n dest.emit('unpipe', this);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n this.removeListener('readable', pipeOnReadable);\n state.flowing = false;\n\n for (var i = 0; i < len; i++)\n dests[i].emit('unpipe', this);\n return this;\n }\n\n // try to find the right one.\n var i = indexOf(state.pipes, dest);\n if (i === -1)\n return this;\n\n state.pipes.splice(i, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1)\n state.pipes = state.pipes[0];\n\n dest.emit('unpipe', this);\n\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function(ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n\n if (ev === 'data' && !this._readableState.flowing)\n emitDataEvents(this);\n\n if (ev === 'readable' && this.readable) {\n var state = this._readableState;\n if (!state.readableListening) {\n state.readableListening = true;\n state.emittedReadable = false;\n state.needReadable = true;\n if (!state.reading) {\n this.read(0);\n } else if (state.length) {\n emitReadable(this, state);\n }\n }\n }\n\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function() {\n emitDataEvents(this);\n this.read(0);\n this.emit('resume');\n};\n\nReadable.prototype.pause = function() {\n emitDataEvents(this, true);\n this.emit('pause');\n};\n\nfunction emitDataEvents(stream, startPaused) {\n var state = stream._readableState;\n\n if (state.flowing) {\n // https://github.com/isaacs/readable-stream/issues/16\n throw new Error('Cannot switch to old mode now.');\n }\n\n var paused = startPaused || false;\n var readable = false;\n\n // convert to an old-style stream.\n stream.readable = true;\n stream.pipe = Stream.prototype.pipe;\n stream.on = stream.addListener = Stream.prototype.on;\n\n stream.on('readable', function() {\n readable = true;\n\n var c;\n while (!paused && (null !== (c = stream.read())))\n stream.emit('data', c);\n\n if (c === null) {\n readable = false;\n stream._readableState.needReadable = true;\n }\n });\n\n stream.pause = function() {\n paused = true;\n this.emit('pause');\n };\n\n stream.resume = function() {\n paused = false;\n if (readable)\n process.nextTick(function() {\n stream.emit('readable');\n });\n else\n this.read(0);\n this.emit('resume');\n };\n\n // now make it start, just in case it hadn't already.\n stream.emit('readable');\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function(stream) {\n var state = this._readableState;\n var paused = false;\n\n var self = this;\n stream.on('end', function() {\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length)\n self.push(chunk);\n }\n\n self.push(null);\n });\n\n stream.on('data', function(chunk) {\n if (state.decoder)\n chunk = state.decoder.write(chunk);\n\n // don't skip over falsy values in objectMode\n //if (state.objectMode && util.isNullOrUndefined(chunk))\n if (state.objectMode && (chunk === null || chunk === undefined))\n return;\n else if (!state.objectMode && (!chunk || !chunk.length))\n return;\n\n var ret = self.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (typeof stream[i] === 'function' &&\n typeof this[i] === 'undefined') {\n this[i] = function(method) { return function() {\n return stream[method].apply(stream, arguments);\n }}(i);\n }\n }\n\n // proxy certain important events.\n var events = ['error', 'close', 'destroy', 'pause', 'resume'];\n forEach(events, function(ev) {\n stream.on(ev, self.emit.bind(self, ev));\n });\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n self._read = function(n) {\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return self;\n};\n\n\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\nfunction fromList(n, state) {\n var list = state.buffer;\n var length = state.length;\n var stringMode = !!state.decoder;\n var objectMode = !!state.objectMode;\n var ret;\n\n // nothing in the list, definitely empty.\n if (list.length === 0)\n return null;\n\n if (length === 0)\n ret = null;\n else if (objectMode)\n ret = list.shift();\n else if (!n || n >= length) {\n // read it all, truncate the array.\n if (stringMode)\n ret = list.join('');\n else\n ret = Buffer.concat(list, length);\n list.length = 0;\n } else {\n // read just some of it.\n if (n < list[0].length) {\n // just take a part of the first list item.\n // slice is the same for buffers and strings.\n var buf = list[0];\n ret = buf.slice(0, n);\n list[0] = buf.slice(n);\n } else if (n === list[0].length) {\n // first list is a perfect match\n ret = list.shift();\n } else {\n // complex case.\n // we have enough to cover it, but it spans past the first buffer.\n if (stringMode)\n ret = '';\n else\n ret = new Buffer(n);\n\n var c = 0;\n for (var i = 0, l = list.length; i < l && c < n; i++) {\n var buf = list[0];\n var cpy = Math.min(n - c, buf.length);\n\n if (stringMode)\n ret += buf.slice(0, cpy);\n else\n buf.copy(ret, c, 0, cpy);\n\n if (cpy < buf.length)\n list[0] = buf.slice(cpy);\n else\n list.shift();\n\n c += cpy;\n }\n }\n }\n\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n\n // If we get here before consuming all the bytes, then that is a\n // bug in node. Should never happen.\n if (state.length > 0)\n throw new Error('endReadable called on non-empty stream');\n\n if (!state.endEmitted && state.calledRead) {\n state.ended = true;\n process.nextTick(function() {\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n }\n });\n }\n}\n\nfunction forEach (xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}\n\nfunction indexOf (xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\nmodule.exports = Duplex;\n\n/**/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n}\n/**/\n\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\n\nutil.inherits(Duplex, Readable);\n\nforEach(objectKeys(Writable.prototype), function(method) {\n if (!Duplex.prototype[method])\n Duplex.prototype[method] = Writable.prototype[method];\n});\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex))\n return new Duplex(options);\n\n Readable.call(this, options);\n Writable.call(this, options);\n\n if (options && options.readable === false)\n this.readable = false;\n\n if (options && options.writable === false)\n this.writable = false;\n\n this.allowHalfOpen = true;\n if (options && options.allowHalfOpen === false)\n this.allowHalfOpen = false;\n\n this.once('end', onend);\n}\n\n// the no-half-open enforcer\nfunction onend() {\n // if we allow half-open state, or if the writable side ended,\n // then we're ok.\n if (this.allowHalfOpen || this._writableState.ended)\n return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n process.nextTick(this.end.bind(this));\n}\n\nfunction forEach (xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, cb), and it'll handle all\n// the drain event emission and buffering.\n\nmodule.exports = Writable;\n\n/**/\nvar Buffer = require('buffer').Buffer;\n/**/\n\nWritable.WritableState = WritableState;\n\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar Stream = require('stream');\n\nutil.inherits(Writable, Stream);\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n}\n\nfunction WritableState(options, stream) {\n options = options || {};\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n var hwm = options.highWaterMark;\n this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n\n // cast to ints.\n this.highWaterMark = ~~this.highWaterMark;\n\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, becuase any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function(er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n\n this.buffer = [];\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n}\n\nfunction Writable(options) {\n var Duplex = require('./_stream_duplex');\n\n // Writable ctor is applied to Duplexes, though they're not\n // instanceof Writable, they're instanceof Readable.\n if (!(this instanceof Writable) && !(this instanceof Duplex))\n return new Writable(options);\n\n this._writableState = new WritableState(options, this);\n\n // legacy.\n this.writable = true;\n\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function() {\n this.emit('error', new Error('Cannot pipe. Not readable.'));\n};\n\n\nfunction writeAfterEnd(stream, state, cb) {\n var er = new Error('write after end');\n // TODO: defer error events consistently everywhere, not just the cb\n stream.emit('error', er);\n process.nextTick(function() {\n cb(er);\n });\n}\n\n// If we get something that is not a buffer, string, null, or undefined,\n// and we're not in objectMode, then that's an error.\n// Otherwise stream chunks are all considered to be of length=1, and the\n// watermarks determine how many objects to keep in the buffer, rather than\n// how many bytes or characters.\nfunction validChunk(stream, state, chunk, cb) {\n var valid = true;\n if (!Buffer.isBuffer(chunk) &&\n 'string' !== typeof chunk &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n process.nextTick(function() {\n cb(er);\n });\n valid = false;\n }\n return valid;\n}\n\nWritable.prototype.write = function(chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (Buffer.isBuffer(chunk))\n encoding = 'buffer';\n else if (!encoding)\n encoding = state.defaultEncoding;\n\n if (typeof cb !== 'function')\n cb = function() {};\n\n if (state.ended)\n writeAfterEnd(this, state, cb);\n else if (validChunk(this, state, chunk, cb))\n ret = writeOrBuffer(this, state, chunk, encoding, cb);\n\n return ret;\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode &&\n state.decodeStrings !== false &&\n typeof chunk === 'string') {\n chunk = new Buffer(chunk, encoding);\n }\n return chunk;\n}\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, chunk, encoding, cb) {\n chunk = decodeChunk(state, chunk, encoding);\n if (Buffer.isBuffer(chunk))\n encoding = 'buffer';\n var len = state.objectMode ? 1 : chunk.length;\n\n state.length += len;\n\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret)\n state.needDrain = true;\n\n if (state.writing)\n state.buffer.push(new WriteReq(chunk, encoding, cb));\n else\n doWrite(stream, state, len, chunk, encoding, cb);\n\n return ret;\n}\n\nfunction doWrite(stream, state, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n if (sync)\n process.nextTick(function() {\n cb(er);\n });\n else\n cb(er);\n\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n\n onwriteStateUpdate(state);\n\n if (er)\n onwriteError(stream, state, sync, er, cb);\n else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(stream, state);\n\n if (!finished && !state.bufferProcessing && state.buffer.length)\n clearBuffer(stream, state);\n\n if (sync) {\n process.nextTick(function() {\n afterWrite(stream, state, finished, cb);\n });\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished)\n onwriteDrain(stream, state);\n cb();\n if (finished)\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n\n for (var c = 0; c < state.buffer.length; c++) {\n var entry = state.buffer[c];\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n\n doWrite(stream, state, len, chunk, encoding, cb);\n\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n c++;\n break;\n }\n }\n\n state.bufferProcessing = false;\n if (c < state.buffer.length)\n state.buffer = state.buffer.slice(c);\n else\n state.buffer.length = 0;\n}\n\nWritable.prototype._write = function(chunk, encoding, cb) {\n cb(new Error('not implemented'));\n};\n\nWritable.prototype.end = function(chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (typeof chunk !== 'undefined' && chunk !== null)\n this.write(chunk, encoding);\n\n // ignore unnecessary end() calls.\n if (!state.ending && !state.finished)\n endWritable(this, state, cb);\n};\n\n\nfunction needFinish(stream, state) {\n return (state.ending &&\n state.length === 0 &&\n !state.finished &&\n !state.writing);\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(stream, state);\n if (need) {\n state.finished = true;\n stream.emit('finish');\n }\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished)\n process.nextTick(cb);\n else\n stream.once('finish', cb);\n }\n state.ended = true;\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(Transform, Duplex);\n\n\nfunction TransformState(options, stream) {\n this.afterTransform = function(er, data) {\n return afterTransform(stream, er, data);\n };\n\n this.needTransform = false;\n this.transforming = false;\n this.writecb = null;\n this.writechunk = null;\n}\n\nfunction afterTransform(stream, er, data) {\n var ts = stream._transformState;\n ts.transforming = false;\n\n var cb = ts.writecb;\n\n if (!cb)\n return stream.emit('error', new Error('no writecb in Transform class'));\n\n ts.writechunk = null;\n ts.writecb = null;\n\n if (data !== null && data !== undefined)\n stream.push(data);\n\n if (cb)\n cb(er);\n\n var rs = stream._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n stream._read(rs.highWaterMark);\n }\n}\n\n\nfunction Transform(options) {\n if (!(this instanceof Transform))\n return new Transform(options);\n\n Duplex.call(this, options);\n\n var ts = this._transformState = new TransformState(options, this);\n\n // when the writable side finishes, then flush out anything remaining.\n var stream = this;\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n\n this.once('finish', function() {\n if ('function' === typeof this._flush)\n this._flush(function(er) {\n done(stream, er);\n });\n else\n done(stream);\n });\n}\n\nTransform.prototype.push = function(chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function(chunk, encoding, cb) {\n throw new Error('not implemented');\n};\n\nTransform.prototype._write = function(chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform ||\n rs.needReadable ||\n rs.length < rs.highWaterMark)\n this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function(n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\n\nfunction done(stream, er) {\n if (er)\n return stream.emit('error', er);\n\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n var ws = stream._writableState;\n var rs = stream._readableState;\n var ts = stream._transformState;\n\n if (ws.length)\n throw new Error('calling transform done when ws.length != 0');\n\n if (ts.transforming)\n throw new Error('calling transform done when still transforming');\n\n return stream.push(null);\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\nmodule.exports = PassThrough;\n\nvar Transform = require('./_stream_transform');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough))\n return new PassThrough(options);\n\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function(chunk, encoding, cb) {\n cb(null, chunk);\n};\n","var Stream = require('stream'); // hack to fix a circular dependency issue when used with browserify\nexports = module.exports = require('./lib/_stream_readable.js');\nexports.Stream = Stream;\nexports.Readable = exports;\nexports.Writable = require('./lib/_stream_writable.js');\nexports.Duplex = require('./lib/_stream_duplex.js');\nexports.Transform = require('./lib/_stream_transform.js');\nexports.PassThrough = require('./lib/_stream_passthrough.js');\nif (!process.browser && process.env.READABLE_STREAM === 'disable') {\n module.exports = require('stream');\n}\n","var DuplexStream = require('readable-stream').Duplex\n , util = require('util')\n\nfunction BufferList (callback) {\n if (!(this instanceof BufferList))\n return new BufferList(callback)\n\n this._bufs = []\n this.length = 0\n\n if (typeof callback == 'function') {\n this._callback = callback\n\n var piper = function (err) {\n if (this._callback) {\n this._callback(err)\n this._callback = null\n }\n }.bind(this)\n\n this.on('pipe', function (src) {\n src.on('error', piper)\n })\n this.on('unpipe', function (src) {\n src.removeListener('error', piper)\n })\n }\n else if (Buffer.isBuffer(callback))\n this.append(callback)\n else if (Array.isArray(callback)) {\n callback.forEach(function (b) {\n Buffer.isBuffer(b) && this.append(b)\n }.bind(this))\n }\n\n DuplexStream.call(this)\n}\n\nutil.inherits(BufferList, DuplexStream)\n\nBufferList.prototype._offset = function (offset) {\n var tot = 0, i = 0, _t\n for (; i < this._bufs.length; i++) {\n _t = tot + this._bufs[i].length\n if (offset < _t)\n return [ i, offset - tot ]\n tot = _t\n }\n}\n\nBufferList.prototype.append = function (buf) {\n this._bufs.push(Buffer.isBuffer(buf) ? buf : new Buffer(buf))\n this.length += buf.length\n return this\n}\n\nBufferList.prototype._write = function (buf, encoding, callback) {\n this.append(buf)\n if (callback)\n callback()\n}\n\nBufferList.prototype._read = function (size) {\n if (!this.length)\n return this.push(null)\n size = Math.min(size, this.length)\n this.push(this.slice(0, size))\n this.consume(size)\n}\n\nBufferList.prototype.end = function (chunk) {\n DuplexStream.prototype.end.call(this, chunk)\n\n if (this._callback) {\n this._callback(null, this.slice())\n this._callback = null\n }\n}\n\nBufferList.prototype.get = function (index) {\n return this.slice(index, index + 1)[0]\n}\n\nBufferList.prototype.slice = function (start, end) {\n return this.copy(null, 0, start, end)\n}\n\nBufferList.prototype.copy = function (dst, dstStart, srcStart, srcEnd) {\n if (typeof srcStart != 'number' || srcStart < 0)\n srcStart = 0\n if (typeof srcEnd != 'number' || srcEnd > this.length)\n srcEnd = this.length\n if (srcStart >= this.length)\n return dst || new Buffer(0)\n if (srcEnd <= 0)\n return dst || new Buffer(0)\n\n var copy = !!dst\n , off = this._offset(srcStart)\n , len = srcEnd - srcStart\n , bytes = len\n , bufoff = (copy && dstStart) || 0\n , start = off[1]\n , l\n , i\n\n // copy/slice everything\n if (srcStart === 0 && srcEnd == this.length) {\n if (!copy) // slice, just return a full concat\n return Buffer.concat(this._bufs)\n\n // copy, need to copy individual buffers\n for (i = 0; i < this._bufs.length; i++) {\n this._bufs[i].copy(dst, bufoff)\n bufoff += this._bufs[i].length\n }\n\n return dst\n }\n\n // easy, cheap case where it's a subset of one of the buffers\n if (bytes <= this._bufs[off[0]].length - start) {\n return copy\n ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes)\n : this._bufs[off[0]].slice(start, start + bytes)\n }\n\n if (!copy) // a slice, we need something to copy in to\n dst = new Buffer(len)\n\n for (i = off[0]; i < this._bufs.length; i++) {\n l = this._bufs[i].length - start\n\n if (bytes > l) {\n this._bufs[i].copy(dst, bufoff, start)\n } else {\n this._bufs[i].copy(dst, bufoff, start, start + bytes)\n break\n }\n\n bufoff += l\n bytes -= l\n\n if (start)\n start = 0\n }\n\n return dst\n}\n\nBufferList.prototype.toString = function (encoding, start, end) {\n return this.slice(start, end).toString(encoding)\n}\n\nBufferList.prototype.consume = function (bytes) {\n while (this._bufs.length) {\n if (bytes > this._bufs[0].length) {\n bytes -= this._bufs[0].length\n this.length -= this._bufs[0].length\n this._bufs.shift()\n } else {\n this._bufs[0] = this._bufs[0].slice(bytes)\n this.length -= bytes\n break\n }\n }\n return this\n}\n\nBufferList.prototype.duplicate = function () {\n var i = 0\n , copy = new BufferList()\n\n for (; i < this._bufs.length; i++)\n copy.append(this._bufs[i])\n\n return copy\n}\n\nBufferList.prototype.destroy = function () {\n this._bufs.length = 0;\n this.length = 0;\n this.push(null);\n}\n\n;(function () {\n var methods = {\n 'readDoubleBE' : 8\n , 'readDoubleLE' : 8\n , 'readFloatBE' : 4\n , 'readFloatLE' : 4\n , 'readInt32BE' : 4\n , 'readInt32LE' : 4\n , 'readUInt32BE' : 4\n , 'readUInt32LE' : 4\n , 'readInt16BE' : 2\n , 'readInt16LE' : 2\n , 'readUInt16BE' : 2\n , 'readUInt16LE' : 2\n , 'readInt8' : 1\n , 'readUInt8' : 1\n }\n\n for (var m in methods) {\n (function (m) {\n BufferList.prototype[m] = function (offset) {\n return this.slice(offset, offset + methods[m])[m](0)\n }\n }(m))\n }\n}())\n\nmodule.exports = BufferList\n","/* Copyright (c) 2012-2014 LevelUP contributors\n * See list at \n * MIT License\n * \n */\n\nvar Stream = require('stream').Stream\n , inherits = require('util').inherits\n , extend = require('xtend')\n , bl = require('bl')\n\n , setImmediate = global.setImmediate || process.nextTick\n\n , getOptions = require('./util').getOptions\n\n , defaultOptions = { type: 'put' }\n\nfunction WriteStream (options, db) {\n if (!(this instanceof WriteStream))\n return new WriteStream(options, db)\n\n Stream.call(this)\n this._options = extend(defaultOptions, getOptions(db, options))\n this._db = db\n this._buffer = []\n this._status = 'init'\n this._end = false\n this.writable = true\n this.readable = false\n\n var self = this\n , ready = function () {\n if (!self.writable)\n return\n self._status = 'ready'\n self.emit('ready')\n self._process()\n }\n\n if (db.isOpen())\n setImmediate(ready)\n else\n db.once('ready', ready)\n}\n\ninherits(WriteStream, Stream)\n\nWriteStream.prototype.write = function (data) {\n if (!this.writable)\n return false\n this._buffer.push(data)\n if (this._status != 'init')\n this._processDelayed()\n if (this._options.maxBufferLength &&\n this._buffer.length > this._options.maxBufferLength) {\n this._writeBlock = true\n return false\n }\n return true\n}\n\nWriteStream.prototype.end = function (data) {\n var self = this\n if (data)\n this.write(data)\n setImmediate(function () {\n self._end = true\n self._process()\n })\n}\n\nWriteStream.prototype.destroy = function () {\n this.writable = false\n this.end()\n}\n\nWriteStream.prototype.destroySoon = function () {\n this.end()\n}\n\nWriteStream.prototype.add = function (entry) {\n if (!entry.props)\n return\n if (entry.props.Directory)\n entry.pipe(this._db.writeStream(this._options))\n else if (entry.props.File || entry.File || entry.type == 'File')\n this._write(entry)\n return true\n}\n\nWriteStream.prototype._processDelayed = function () {\n var self = this\n setImmediate(function () {\n self._process()\n })\n}\n\nWriteStream.prototype._process = function () {\n var buffer\n , self = this\n\n , cb = function (err) {\n if (!self.writable)\n return\n if (self._status != 'closed')\n self._status = 'ready'\n if (err) {\n self.writable = false\n return self.emit('error', err)\n }\n self._process()\n }\n\n if (self._status != 'ready' && self.writable) {\n if (self._buffer.length && self._status != 'closed')\n self._processDelayed()\n return\n }\n\n if (self._buffer.length && self.writable) {\n self._status = 'writing'\n buffer = self._buffer\n self._buffer = []\n\n self._db.batch(buffer.map(function (d) {\n return {\n type : d.type || self._options.type\n , key : d.key\n , value : d.value\n , keyEncoding : d.keyEncoding || self._options.keyEncoding\n , valueEncoding : d.valueEncoding\n || d.encoding\n || self._options.valueEncoding\n }\n }), cb)\n\n if (self._writeBlock) {\n self._writeBlock = false\n self.emit('drain')\n }\n\n // don't allow close until callback has returned\n return\n }\n\n if (self._end && self._status != 'closed') {\n self._status = 'closed'\n self.writable = false\n self.emit('close')\n }\n}\n\nWriteStream.prototype._write = function (entry) {\n var key = entry.path || entry.props.path\n , self = this\n\n if (!key)\n return\n\n entry.pipe(bl(function (err, data) {\n if (err) {\n self.writable = false\n return self.emit('error', err)\n }\n\n if (self._options.fstreamRoot &&\n key.indexOf(self._options.fstreamRoot) > -1)\n key = key.substr(self._options.fstreamRoot.length + 1)\n\n self.write({ key: key, value: data.slice(0) })\n }))\n}\n\nWriteStream.prototype.toString = function () {\n return 'LevelUP.WriteStream'\n}\n\nmodule.exports = WriteStream\n","/* Copyright (c) 2012-2014 LevelUP contributors\n * See list at \n * MIT License\n * \n */\n\nvar util = require('./util')\n , WriteError = require('./errors').WriteError\n\n , getOptions = util.getOptions\n , dispatchError = util.dispatchError\n\nfunction Batch (levelup) {\n this._levelup = levelup\n this.batch = levelup.db.batch()\n this.ops = []\n}\n\nBatch.prototype.put = function (key_, value_, options) {\n options = getOptions(this._levelup, options)\n\n var key = util.encodeKey(key_, options)\n , value = util.encodeValue(value_, options)\n\n try {\n this.batch.put(key, value)\n } catch (e) {\n throw new WriteError(e)\n }\n this.ops.push({ type : 'put', key : key, value : value })\n\n return this\n}\n\nBatch.prototype.del = function (key_, options) {\n options = getOptions(this._levelup, options)\n\n var key = util.encodeKey(key_, options)\n\n try {\n this.batch.del(key)\n } catch (err) {\n throw new WriteError(err)\n }\n this.ops.push({ type : 'del', key : key })\n\n return this\n}\n\nBatch.prototype.clear = function () {\n try {\n this.batch.clear()\n } catch (err) {\n throw new WriteError(err)\n }\n\n this.ops = []\n return this\n}\n\nBatch.prototype.write = function (callback) {\n var levelup = this._levelup\n , ops = this.ops\n\n try {\n this.batch.write(function (err) {\n if (err)\n return dispatchError(levelup, new WriteError(err), callback)\n levelup.emit('batch', ops)\n if (callback)\n callback()\n })\n } catch (err) {\n throw new WriteError(err)\n }\n}\n\nmodule.exports = Batch\n","/* Copyright (c) 2012-2014 LevelUP contributors\n * See list at \n * MIT License\n * \n */\n\nvar EventEmitter = require('events').EventEmitter\n , inherits = require('util').inherits\n , extend = require('xtend')\n , prr = require('prr')\n , DeferredLevelDOWN = require('deferred-leveldown')\n\n , WriteError = require('./errors').WriteError\n , ReadError = require('./errors').ReadError\n , NotFoundError = require('./errors').NotFoundError\n , OpenError = require('./errors').OpenError\n , EncodingError = require('./errors').EncodingError\n , InitializationError = require('./errors').InitializationError\n\n , ReadStream = require('./read-stream')\n , WriteStream = require('./write-stream')\n , util = require('./util')\n , Batch = require('./batch')\n\n , getOptions = util.getOptions\n , defaultOptions = util.defaultOptions\n , getLevelDOWN = util.getLevelDOWN\n , dispatchError = util.dispatchError\n\nfunction getCallback (options, callback) {\n return typeof options == 'function' ? options : callback\n}\n\n// Possible LevelUP#_status values:\n// - 'new' - newly created, not opened or closed\n// - 'opening' - waiting for the database to be opened, post open()\n// - 'open' - successfully opened the database, available for use\n// - 'closing' - waiting for the database to be closed, post close()\n// - 'closed' - database has been successfully closed, should not be\n// used except for another open() operation\n\nfunction LevelUP (location, options, callback) {\n if (!(this instanceof LevelUP))\n return new LevelUP(location, options, callback)\n\n var error\n\n EventEmitter.call(this)\n this.setMaxListeners(Infinity)\n\n if (typeof location == 'function') {\n options = typeof options == 'object' ? options : {}\n options.db = location\n location = null\n } else if (typeof location == 'object' && typeof location.db == 'function') {\n options = location\n location = null\n }\n\n if (typeof options == 'function') {\n callback = options\n options = {}\n }\n\n if ((!options || typeof options.db != 'function') && typeof location != 'string') {\n error = new InitializationError(\n 'Must provide a location for the database')\n if (callback) {\n return process.nextTick(function () {\n callback(error)\n })\n }\n throw error\n }\n\n options = getOptions(this, options)\n this.options = extend(defaultOptions, options)\n this._status = 'new'\n // set this.location as enumerable but not configurable or writable\n prr(this, 'location', location, 'e')\n\n this.open(callback)\n}\n\ninherits(LevelUP, EventEmitter)\n\nLevelUP.prototype.open = function (callback) {\n var self = this\n , dbFactory\n , db\n\n if (this.isOpen()) {\n if (callback)\n process.nextTick(function () { callback(null, self) })\n return this\n }\n\n if (this._isOpening()) {\n return callback && this.once(\n 'open'\n , function () { callback(null, self) }\n )\n }\n\n this.emit('opening')\n\n this._status = 'opening'\n this.db = new DeferredLevelDOWN(this.location)\n dbFactory = this.options.db || getLevelDOWN()\n db = dbFactory(this.location)\n\n db.open(this.options, function (err) {\n if (err) {\n return dispatchError(self, new OpenError(err), callback)\n } else {\n self.db.setDb(db)\n self.db = db\n self._status = 'open'\n if (callback)\n callback(null, self)\n self.emit('open')\n self.emit('ready')\n }\n })\n}\n\nLevelUP.prototype.close = function (callback) {\n var self = this\n\n if (this.isOpen()) {\n this._status = 'closing'\n this.db.close(function () {\n self._status = 'closed'\n self.emit('closed')\n if (callback)\n callback.apply(null, arguments)\n })\n this.emit('closing')\n this.db = null\n } else if (this._status == 'closed' && callback) {\n return process.nextTick(callback)\n } else if (this._status == 'closing' && callback) {\n this.once('closed', callback)\n } else if (this._isOpening()) {\n this.once('open', function () {\n self.close(callback)\n })\n }\n}\n\nLevelUP.prototype.isOpen = function () {\n return this._status == 'open'\n}\n\nLevelUP.prototype._isOpening = function () {\n return this._status == 'opening'\n}\n\nLevelUP.prototype.isClosed = function () {\n return (/^clos/).test(this._status)\n}\n\nLevelUP.prototype.get = function (key_, options, callback) {\n var self = this\n , key\n\n callback = getCallback(options, callback)\n\n if (typeof callback != 'function') {\n return dispatchError(\n this\n , new ReadError('get() requires key and callback arguments')\n )\n }\n\n if (!this._isOpening() && !this.isOpen()) {\n return dispatchError(\n this\n , new ReadError('Database is not open')\n , callback\n )\n }\n\n options = util.getOptions(this, options)\n key = util.encodeKey(key_, options)\n\n options.asBuffer = util.isValueAsBuffer(options)\n\n this.db.get(key, options, function (err, value) {\n if (err) {\n if ((/notfound/i).test(err)) {\n err = new NotFoundError(\n 'Key not found in database [' + key_ + ']', err)\n } else {\n err = new ReadError(err)\n }\n return dispatchError(self, err, callback)\n }\n if (callback) {\n try {\n value = util.decodeValue(value, options)\n } catch (e) {\n return callback(new EncodingError(e))\n }\n callback(null, value)\n }\n })\n}\n\nLevelUP.prototype.put = function (key_, value_, options, callback) {\n var self = this\n , key\n , value\n\n callback = getCallback(options, callback)\n\n if (key_ === null || key_ === undefined\n || value_ === null || value_ === undefined) {\n return dispatchError(\n this\n , new WriteError('put() requires key and value arguments')\n , callback\n )\n }\n\n if (!this._isOpening() && !this.isOpen()) {\n return dispatchError(\n this\n , new WriteError('Database is not open')\n , callback\n )\n }\n\n options = getOptions(this, options)\n key = util.encodeKey(key_, options)\n value = util.encodeValue(value_, options)\n\n this.db.put(key, value, options, function (err) {\n if (err) {\n return dispatchError(self, new WriteError(err), callback)\n } else {\n self.emit('put', key_, value_)\n if (callback)\n callback()\n }\n })\n}\n\nLevelUP.prototype.del = function (key_, options, callback) {\n var self = this\n , key\n\n callback = getCallback(options, callback)\n\n if (key_ === null || key_ === undefined) {\n return dispatchError(\n this\n , new WriteError('del() requires a key argument')\n , callback\n )\n }\n\n if (!this._isOpening() && !this.isOpen()) {\n return dispatchError(\n this\n , new WriteError('Database is not open')\n , callback\n )\n }\n\n options = getOptions(this, options)\n key = util.encodeKey(key_, options)\n\n this.db.del(key, options, function (err) {\n if (err) {\n return dispatchError(self, new WriteError(err), callback)\n } else {\n self.emit('del', key_)\n if (callback)\n callback()\n }\n })\n}\n\nLevelUP.prototype.batch = function (arr_, options, callback) {\n var self = this\n , keyEnc\n , valueEnc\n , arr\n\n if (!arguments.length)\n return new Batch(this)\n\n callback = getCallback(options, callback)\n\n if (!Array.isArray(arr_)) {\n return dispatchError(\n this\n , new WriteError('batch() requires an array argument')\n , callback\n )\n }\n\n if (!this._isOpening() && !this.isOpen()) {\n return dispatchError(\n this\n , new WriteError('Database is not open')\n , callback\n )\n }\n\n options = getOptions(this, options)\n keyEnc = options.keyEncoding\n valueEnc = options.valueEncoding\n\n arr = arr_.map(function (e) {\n if (e.type === undefined || e.key === undefined)\n return {}\n\n // inherit encoding\n var kEnc = e.keyEncoding || keyEnc\n , vEnc = e.valueEncoding || e.encoding || valueEnc\n , o\n\n // If we're not dealing with plain utf8 strings or plain\n // Buffers then we have to do some work on the array to\n // encode the keys and/or values. This includes JSON types.\n\n if (kEnc != 'utf8' && kEnc != 'binary'\n || vEnc != 'utf8' && vEnc != 'binary') {\n o = {\n type: e.type\n , key: util.encodeKey(e.key, options, e)\n }\n\n if (e.value !== undefined)\n o.value = util.encodeValue(e.value, options, e)\n\n return o\n } else {\n return e\n }\n })\n\n this.db.batch(arr, options, function (err) {\n if (err) {\n return dispatchError(self, new WriteError(err), callback)\n } else {\n self.emit('batch', arr_)\n if (callback)\n callback()\n }\n })\n}\n\n// DEPRECATED: prefer accessing LevelDOWN for this: db.db.approximateSize()\nLevelUP.prototype.approximateSize = function (start_, end_, callback) {\n var self = this\n , start\n , end\n\n if (start_ === null || start_ === undefined\n || end_ === null || end_ === undefined\n || typeof callback != 'function') {\n return dispatchError(\n this\n , new ReadError('approximateSize() requires start, end and callback arguments')\n , callback\n )\n }\n\n start = util.encodeKey(start_, this.options)\n end = util.encodeKey(end_, this.options)\n\n if (!this._isOpening() && !this.isOpen()) {\n return dispatchError(\n this\n , new WriteError('Database is not open')\n , callback\n )\n }\n\n this.db.approximateSize(start, end, function (err, size) {\n if (err) {\n return dispatchError(self, new OpenError(err), callback)\n } else if (callback) {\n callback(null, size)\n }\n })\n}\n\nLevelUP.prototype.readStream =\nLevelUP.prototype.createReadStream = function (options) {\n var self = this\n options = extend(this.options, options)\n return new ReadStream(\n options\n , this\n , function (options) {\n return self.db.iterator(options)\n }\n )\n}\n\nLevelUP.prototype.keyStream =\nLevelUP.prototype.createKeyStream = function (options) {\n return this.createReadStream(extend(options, { keys: true, values: false }))\n}\n\nLevelUP.prototype.valueStream =\nLevelUP.prototype.createValueStream = function (options) {\n return this.createReadStream(extend(options, { keys: false, values: true }))\n}\n\nLevelUP.prototype.writeStream =\nLevelUP.prototype.createWriteStream = function (options) {\n return new WriteStream(extend(options), this)\n}\n\nLevelUP.prototype.toString = function () {\n return 'LevelUP'\n}\n\nfunction utilStatic (name) {\n return function (location, callback) {\n getLevelDOWN()[name](location, callback || function () {})\n }\n}\n\nmodule.exports = LevelUP\nmodule.exports.copy = util.copy\n// DEPRECATED: prefer accessing LevelDOWN for this: require('leveldown').destroy()\nmodule.exports.destroy = utilStatic('destroy')\n// DEPRECATED: prefer accessing LevelDOWN for this: require('leveldown').repair()\nmodule.exports.repair = utilStatic('repair')\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Readable;\n\n/**/\nvar isArray = require('isarray');\n/**/\n\n\n/**/\nvar Buffer = require('buffer').Buffer;\n/**/\n\nReadable.ReadableState = ReadableState;\n\nvar EE = require('events').EventEmitter;\n\n/**/\nif (!EE.listenerCount) EE.listenerCount = function(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\nvar Stream = require('stream');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar StringDecoder;\n\nutil.inherits(Readable, Stream);\n\nfunction ReadableState(options, stream) {\n options = options || {};\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n var hwm = options.highWaterMark;\n this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;\n\n // cast to ints.\n this.highWaterMark = ~~this.highWaterMark;\n\n this.buffer = [];\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = false;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // In streams that never have any data, and do push(null) right away,\n // the consumer can miss the 'end' event if they do some I/O before\n // consuming the stream. So, we don't emit('end') until some reading\n // happens.\n this.calledRead = false;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, becuase any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // when piping, we only care about 'readable' events that happen\n // after read()ing all the bytes and not getting any pushback.\n this.ranOut = false;\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder)\n StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n if (!(this instanceof Readable))\n return new Readable(options);\n\n this._readableState = new ReadableState(options, this);\n\n // legacy\n this.readable = true;\n\n Stream.call(this);\n}\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function(chunk, encoding) {\n var state = this._readableState;\n\n if (typeof chunk === 'string' && !state.objectMode) {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = new Buffer(chunk, encoding);\n encoding = '';\n }\n }\n\n return readableAddChunk(this, state, chunk, encoding, false);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function(chunk) {\n var state = this._readableState;\n return readableAddChunk(this, state, chunk, '', true);\n};\n\nfunction readableAddChunk(stream, state, chunk, encoding, addToFront) {\n var er = chunkInvalid(state, chunk);\n if (er) {\n stream.emit('error', er);\n } else if (chunk === null || chunk === undefined) {\n state.reading = false;\n if (!state.ended)\n onEofChunk(stream, state);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (state.ended && !addToFront) {\n var e = new Error('stream.push() after EOF');\n stream.emit('error', e);\n } else if (state.endEmitted && addToFront) {\n var e = new Error('stream.unshift() after end event');\n stream.emit('error', e);\n } else {\n if (state.decoder && !addToFront && !encoding)\n chunk = state.decoder.write(chunk);\n\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) {\n state.buffer.unshift(chunk);\n } else {\n state.reading = false;\n state.buffer.push(chunk);\n }\n\n if (state.needReadable)\n emitReadable(stream);\n\n maybeReadMore(stream, state);\n }\n } else if (!addToFront) {\n state.reading = false;\n }\n\n return needMoreData(state);\n}\n\n\n\n// if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes. This is to work around cases where hwm=0,\n// such as the repl. Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\nfunction needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function(enc) {\n if (!StringDecoder)\n StringDecoder = require('string_decoder/').StringDecoder;\n this._readableState.decoder = new StringDecoder(enc);\n this._readableState.encoding = enc;\n};\n\n// Don't raise the hwm > 128MB\nvar MAX_HWM = 0x800000;\nfunction roundUpToNextPowerOf2(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2\n n--;\n for (var p = 1; p < 32; p <<= 1) n |= n >> p;\n n++;\n }\n return n;\n}\n\nfunction howMuchToRead(n, state) {\n if (state.length === 0 && state.ended)\n return 0;\n\n if (state.objectMode)\n return n === 0 ? 0 : 1;\n\n if (n === null || isNaN(n)) {\n // only flow one buffer at a time\n if (state.flowing && state.buffer.length)\n return state.buffer[0].length;\n else\n return state.length;\n }\n\n if (n <= 0)\n return 0;\n\n // If we're asking for more than the target buffer level,\n // then raise the water mark. Bump up to the next highest\n // power of 2, to prevent increasing it excessively in tiny\n // amounts.\n if (n > state.highWaterMark)\n state.highWaterMark = roundUpToNextPowerOf2(n);\n\n // don't have that much. return null, unless we've ended.\n if (n > state.length) {\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n } else\n return state.length;\n }\n\n return n;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function(n) {\n var state = this._readableState;\n state.calledRead = true;\n var nOrig = n;\n var ret;\n\n if (typeof n !== 'number' || n > 0)\n state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 &&\n state.needReadable &&\n (state.length >= state.highWaterMark || state.ended)) {\n emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n ret = null;\n\n // In cases where the decoder did not receive enough data\n // to produce a full chunk, then immediately received an\n // EOF, state.buffer will contain [, ].\n // howMuchToRead will see this and coerce the amount to\n // read to zero (because it's looking at the length of the\n // first in state.buffer), and we'll end up here.\n //\n // This can only happen via state.decoder -- no other venue\n // exists for pushing a zero-length chunk into state.buffer\n // and triggering this behavior. In this case, we return our\n // remaining data and end the stream, if appropriate.\n if (state.length > 0 && state.decoder) {\n ret = fromList(n, state);\n state.length -= ret.length;\n }\n\n if (state.length === 0)\n endReadable(this);\n\n return ret;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length - n <= state.highWaterMark)\n doRead = true;\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading)\n doRead = false;\n\n if (doRead) {\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0)\n state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n }\n\n // If _read called its callback synchronously, then `reading`\n // will be false, and we need to re-evaluate how much data we\n // can return to the user.\n if (doRead && !state.reading)\n n = howMuchToRead(nOrig, state);\n\n if (n > 0)\n ret = fromList(n, state);\n else\n ret = null;\n\n if (ret === null) {\n state.needReadable = true;\n n = 0;\n }\n\n state.length -= n;\n\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (state.length === 0 && !state.ended)\n state.needReadable = true;\n\n // If we happened to read() exactly the remaining amount in the\n // buffer, and the EOF has been seen at this point, then make sure\n // that we emit 'end' on the very next tick.\n if (state.ended && !state.endEmitted && state.length === 0)\n endReadable(this);\n\n return ret;\n};\n\nfunction chunkInvalid(state, chunk) {\n var er = null;\n if (!Buffer.isBuffer(chunk) &&\n 'string' !== typeof chunk &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n return er;\n}\n\n\nfunction onEofChunk(stream, state) {\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n\n // if we've ended and we have some data left, then emit\n // 'readable' now to make sure it gets picked up.\n if (state.length > 0)\n emitReadable(stream);\n else\n endReadable(stream);\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}\n\nfunction emitReadable_(stream) {\n stream.emit('readable');\n}\n\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(function() {\n maybeReadMore_(stream, state);\n });\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n var len = state.length;\n while (!state.reading && !state.flowing && !state.ended &&\n state.length < state.highWaterMark) {\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;\n else\n len = state.length;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function(n) {\n this.emit('error', new Error('not implemented'));\n};\n\nReadable.prototype.pipe = function(dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n\n var doEnd = (!pipeOpts || pipeOpts.end !== false) &&\n dest !== process.stdout &&\n dest !== process.stderr;\n\n var endFn = doEnd ? onend : cleanup;\n if (state.endEmitted)\n process.nextTick(endFn);\n else\n src.once('end', endFn);\n\n dest.on('unpipe', onunpipe);\n function onunpipe(readable) {\n if (readable !== src) return;\n cleanup();\n }\n\n function onend() {\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n\n function cleanup() {\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', cleanup);\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (!dest._writableState || dest._writableState.needDrain)\n ondrain();\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }\n // This is a brutally ugly hack to make sure that our error handler\n // is attached before any userland ones. NEVER DO THIS.\n if (!dest._events || !dest._events.error)\n dest.on('error', onerror);\n else if (isArray(dest._events.error))\n dest._events.error.unshift(onerror);\n else\n dest._events.error = [onerror, dest._events.error];\n\n\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n\n function unpipe() {\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n // the handler that waits for readable events after all\n // the data gets sucked out in flow.\n // This would be easier to follow with a .once() handler\n // in flow(), but that is too slow.\n this.on('readable', pipeOnReadable);\n\n state.flowing = true;\n process.nextTick(function() {\n flow(src);\n });\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function() {\n var dest = this;\n var state = src._readableState;\n state.awaitDrain--;\n if (state.awaitDrain === 0)\n flow(src);\n };\n}\n\nfunction flow(src) {\n var state = src._readableState;\n var chunk;\n state.awaitDrain = 0;\n\n function write(dest, i, list) {\n var written = dest.write(chunk);\n if (false === written) {\n state.awaitDrain++;\n }\n }\n\n while (state.pipesCount && null !== (chunk = src.read())) {\n\n if (state.pipesCount === 1)\n write(state.pipes, 0, null);\n else\n forEach(state.pipes, write);\n\n src.emit('data', chunk);\n\n // if anyone needs a drain, then we have to wait for that.\n if (state.awaitDrain > 0)\n return;\n }\n\n // if every destination was unpiped, either before entering this\n // function, or in the while loop, then stop flowing.\n //\n // NB: This is a pretty rare edge case.\n if (state.pipesCount === 0) {\n state.flowing = false;\n\n // if there were data event listeners added, then switch to old mode.\n if (EE.listenerCount(src, 'data') > 0)\n emitDataEvents(src);\n return;\n }\n\n // at this point, no one needed a drain, so we just ran out of data\n // on the next readable event, start it over again.\n state.ranOut = true;\n}\n\nfunction pipeOnReadable() {\n if (this._readableState.ranOut) {\n this._readableState.ranOut = false;\n flow(this);\n }\n}\n\n\nReadable.prototype.unpipe = function(dest) {\n var state = this._readableState;\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0)\n return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes)\n return this;\n\n if (!dest)\n dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n this.removeListener('readable', pipeOnReadable);\n state.flowing = false;\n if (dest)\n dest.emit('unpipe', this);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n this.removeListener('readable', pipeOnReadable);\n state.flowing = false;\n\n for (var i = 0; i < len; i++)\n dests[i].emit('unpipe', this);\n return this;\n }\n\n // try to find the right one.\n var i = indexOf(state.pipes, dest);\n if (i === -1)\n return this;\n\n state.pipes.splice(i, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1)\n state.pipes = state.pipes[0];\n\n dest.emit('unpipe', this);\n\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function(ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n\n if (ev === 'data' && !this._readableState.flowing)\n emitDataEvents(this);\n\n if (ev === 'readable' && this.readable) {\n var state = this._readableState;\n if (!state.readableListening) {\n state.readableListening = true;\n state.emittedReadable = false;\n state.needReadable = true;\n if (!state.reading) {\n this.read(0);\n } else if (state.length) {\n emitReadable(this, state);\n }\n }\n }\n\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function() {\n emitDataEvents(this);\n this.read(0);\n this.emit('resume');\n};\n\nReadable.prototype.pause = function() {\n emitDataEvents(this, true);\n this.emit('pause');\n};\n\nfunction emitDataEvents(stream, startPaused) {\n var state = stream._readableState;\n\n if (state.flowing) {\n // https://github.com/isaacs/readable-stream/issues/16\n throw new Error('Cannot switch to old mode now.');\n }\n\n var paused = startPaused || false;\n var readable = false;\n\n // convert to an old-style stream.\n stream.readable = true;\n stream.pipe = Stream.prototype.pipe;\n stream.on = stream.addListener = Stream.prototype.on;\n\n stream.on('readable', function() {\n readable = true;\n\n var c;\n while (!paused && (null !== (c = stream.read())))\n stream.emit('data', c);\n\n if (c === null) {\n readable = false;\n stream._readableState.needReadable = true;\n }\n });\n\n stream.pause = function() {\n paused = true;\n this.emit('pause');\n };\n\n stream.resume = function() {\n paused = false;\n if (readable)\n process.nextTick(function() {\n stream.emit('readable');\n });\n else\n this.read(0);\n this.emit('resume');\n };\n\n // now make it start, just in case it hadn't already.\n stream.emit('readable');\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function(stream) {\n var state = this._readableState;\n var paused = false;\n\n var self = this;\n stream.on('end', function() {\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length)\n self.push(chunk);\n }\n\n self.push(null);\n });\n\n stream.on('data', function(chunk) {\n if (state.decoder)\n chunk = state.decoder.write(chunk);\n\n // don't skip over falsy values in objectMode\n //if (state.objectMode && util.isNullOrUndefined(chunk))\n if (state.objectMode && (chunk === null || chunk === undefined))\n return;\n else if (!state.objectMode && (!chunk || !chunk.length))\n return;\n\n var ret = self.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (typeof stream[i] === 'function' &&\n typeof this[i] === 'undefined') {\n this[i] = function(method) { return function() {\n return stream[method].apply(stream, arguments);\n }}(i);\n }\n }\n\n // proxy certain important events.\n var events = ['error', 'close', 'destroy', 'pause', 'resume'];\n forEach(events, function(ev) {\n stream.on(ev, self.emit.bind(self, ev));\n });\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n self._read = function(n) {\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return self;\n};\n\n\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\nfunction fromList(n, state) {\n var list = state.buffer;\n var length = state.length;\n var stringMode = !!state.decoder;\n var objectMode = !!state.objectMode;\n var ret;\n\n // nothing in the list, definitely empty.\n if (list.length === 0)\n return null;\n\n if (length === 0)\n ret = null;\n else if (objectMode)\n ret = list.shift();\n else if (!n || n >= length) {\n // read it all, truncate the array.\n if (stringMode)\n ret = list.join('');\n else\n ret = Buffer.concat(list, length);\n list.length = 0;\n } else {\n // read just some of it.\n if (n < list[0].length) {\n // just take a part of the first list item.\n // slice is the same for buffers and strings.\n var buf = list[0];\n ret = buf.slice(0, n);\n list[0] = buf.slice(n);\n } else if (n === list[0].length) {\n // first list is a perfect match\n ret = list.shift();\n } else {\n // complex case.\n // we have enough to cover it, but it spans past the first buffer.\n if (stringMode)\n ret = '';\n else\n ret = new Buffer(n);\n\n var c = 0;\n for (var i = 0, l = list.length; i < l && c < n; i++) {\n var buf = list[0];\n var cpy = Math.min(n - c, buf.length);\n\n if (stringMode)\n ret += buf.slice(0, cpy);\n else\n buf.copy(ret, c, 0, cpy);\n\n if (cpy < buf.length)\n list[0] = buf.slice(cpy);\n else\n list.shift();\n\n c += cpy;\n }\n }\n }\n\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n\n // If we get here before consuming all the bytes, then that is a\n // bug in node. Should never happen.\n if (state.length > 0)\n throw new Error('endReadable called on non-empty stream');\n\n if (!state.endEmitted && state.calledRead) {\n state.ended = true;\n process.nextTick(function() {\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n }\n });\n }\n}\n\nfunction forEach (xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}\n\nfunction indexOf (xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\nmodule.exports = Duplex;\n\n/**/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n}\n/**/\n\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\n\nutil.inherits(Duplex, Readable);\n\nforEach(objectKeys(Writable.prototype), function(method) {\n if (!Duplex.prototype[method])\n Duplex.prototype[method] = Writable.prototype[method];\n});\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex))\n return new Duplex(options);\n\n Readable.call(this, options);\n Writable.call(this, options);\n\n if (options && options.readable === false)\n this.readable = false;\n\n if (options && options.writable === false)\n this.writable = false;\n\n this.allowHalfOpen = true;\n if (options && options.allowHalfOpen === false)\n this.allowHalfOpen = false;\n\n this.once('end', onend);\n}\n\n// the no-half-open enforcer\nfunction onend() {\n // if we allow half-open state, or if the writable side ended,\n // then we're ok.\n if (this.allowHalfOpen || this._writableState.ended)\n return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n process.nextTick(this.end.bind(this));\n}\n\nfunction forEach (xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, cb), and it'll handle all\n// the drain event emission and buffering.\n\nmodule.exports = Writable;\n\n/**/\nvar Buffer = require('buffer').Buffer;\n/**/\n\nWritable.WritableState = WritableState;\n\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar Stream = require('stream');\n\nutil.inherits(Writable, Stream);\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n}\n\nfunction WritableState(options, stream) {\n options = options || {};\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n var hwm = options.highWaterMark;\n this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n\n // cast to ints.\n this.highWaterMark = ~~this.highWaterMark;\n\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, becuase any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function(er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n\n this.buffer = [];\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n}\n\nfunction Writable(options) {\n var Duplex = require('./_stream_duplex');\n\n // Writable ctor is applied to Duplexes, though they're not\n // instanceof Writable, they're instanceof Readable.\n if (!(this instanceof Writable) && !(this instanceof Duplex))\n return new Writable(options);\n\n this._writableState = new WritableState(options, this);\n\n // legacy.\n this.writable = true;\n\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function() {\n this.emit('error', new Error('Cannot pipe. Not readable.'));\n};\n\n\nfunction writeAfterEnd(stream, state, cb) {\n var er = new Error('write after end');\n // TODO: defer error events consistently everywhere, not just the cb\n stream.emit('error', er);\n process.nextTick(function() {\n cb(er);\n });\n}\n\n// If we get something that is not a buffer, string, null, or undefined,\n// and we're not in objectMode, then that's an error.\n// Otherwise stream chunks are all considered to be of length=1, and the\n// watermarks determine how many objects to keep in the buffer, rather than\n// how many bytes or characters.\nfunction validChunk(stream, state, chunk, cb) {\n var valid = true;\n if (!Buffer.isBuffer(chunk) &&\n 'string' !== typeof chunk &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n process.nextTick(function() {\n cb(er);\n });\n valid = false;\n }\n return valid;\n}\n\nWritable.prototype.write = function(chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (Buffer.isBuffer(chunk))\n encoding = 'buffer';\n else if (!encoding)\n encoding = state.defaultEncoding;\n\n if (typeof cb !== 'function')\n cb = function() {};\n\n if (state.ended)\n writeAfterEnd(this, state, cb);\n else if (validChunk(this, state, chunk, cb))\n ret = writeOrBuffer(this, state, chunk, encoding, cb);\n\n return ret;\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode &&\n state.decodeStrings !== false &&\n typeof chunk === 'string') {\n chunk = new Buffer(chunk, encoding);\n }\n return chunk;\n}\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, chunk, encoding, cb) {\n chunk = decodeChunk(state, chunk, encoding);\n if (Buffer.isBuffer(chunk))\n encoding = 'buffer';\n var len = state.objectMode ? 1 : chunk.length;\n\n state.length += len;\n\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret)\n state.needDrain = true;\n\n if (state.writing)\n state.buffer.push(new WriteReq(chunk, encoding, cb));\n else\n doWrite(stream, state, len, chunk, encoding, cb);\n\n return ret;\n}\n\nfunction doWrite(stream, state, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n if (sync)\n process.nextTick(function() {\n cb(er);\n });\n else\n cb(er);\n\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n\n onwriteStateUpdate(state);\n\n if (er)\n onwriteError(stream, state, sync, er, cb);\n else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(stream, state);\n\n if (!finished && !state.bufferProcessing && state.buffer.length)\n clearBuffer(stream, state);\n\n if (sync) {\n process.nextTick(function() {\n afterWrite(stream, state, finished, cb);\n });\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished)\n onwriteDrain(stream, state);\n cb();\n if (finished)\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n\n for (var c = 0; c < state.buffer.length; c++) {\n var entry = state.buffer[c];\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n\n doWrite(stream, state, len, chunk, encoding, cb);\n\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n c++;\n break;\n }\n }\n\n state.bufferProcessing = false;\n if (c < state.buffer.length)\n state.buffer = state.buffer.slice(c);\n else\n state.buffer.length = 0;\n}\n\nWritable.prototype._write = function(chunk, encoding, cb) {\n cb(new Error('not implemented'));\n};\n\nWritable.prototype.end = function(chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (typeof chunk !== 'undefined' && chunk !== null)\n this.write(chunk, encoding);\n\n // ignore unnecessary end() calls.\n if (!state.ending && !state.finished)\n endWritable(this, state, cb);\n};\n\n\nfunction needFinish(stream, state) {\n return (state.ending &&\n state.length === 0 &&\n !state.finished &&\n !state.writing);\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(stream, state);\n if (need) {\n state.finished = true;\n stream.emit('finish');\n }\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished)\n process.nextTick(cb);\n else\n stream.once('finish', cb);\n }\n state.ended = true;\n}\n","module.exports = require(\"./lib/_stream_writable.js\")\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(Transform, Duplex);\n\n\nfunction TransformState(options, stream) {\n this.afterTransform = function(er, data) {\n return afterTransform(stream, er, data);\n };\n\n this.needTransform = false;\n this.transforming = false;\n this.writecb = null;\n this.writechunk = null;\n}\n\nfunction afterTransform(stream, er, data) {\n var ts = stream._transformState;\n ts.transforming = false;\n\n var cb = ts.writecb;\n\n if (!cb)\n return stream.emit('error', new Error('no writecb in Transform class'));\n\n ts.writechunk = null;\n ts.writecb = null;\n\n if (data !== null && data !== undefined)\n stream.push(data);\n\n if (cb)\n cb(er);\n\n var rs = stream._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n stream._read(rs.highWaterMark);\n }\n}\n\n\nfunction Transform(options) {\n if (!(this instanceof Transform))\n return new Transform(options);\n\n Duplex.call(this, options);\n\n var ts = this._transformState = new TransformState(options, this);\n\n // when the writable side finishes, then flush out anything remaining.\n var stream = this;\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n\n this.once('finish', function() {\n if ('function' === typeof this._flush)\n this._flush(function(er) {\n done(stream, er);\n });\n else\n done(stream);\n });\n}\n\nTransform.prototype.push = function(chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function(chunk, encoding, cb) {\n throw new Error('not implemented');\n};\n\nTransform.prototype._write = function(chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform ||\n rs.needReadable ||\n rs.length < rs.highWaterMark)\n this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function(n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\n\nfunction done(stream, er) {\n if (er)\n return stream.emit('error', er);\n\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n var ws = stream._writableState;\n var rs = stream._readableState;\n var ts = stream._transformState;\n\n if (ws.length)\n throw new Error('calling transform done when ws.length != 0');\n\n if (ts.transforming)\n throw new Error('calling transform done when still transforming');\n\n return stream.push(null);\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\nmodule.exports = PassThrough;\n\nvar Transform = require('./_stream_transform');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough))\n return new PassThrough(options);\n\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function(chunk, encoding, cb) {\n cb(null, chunk);\n};\n","var Stream = require('stream'); // hack to fix a circular dependency issue when used with browserify\nexports = module.exports = require('./lib/_stream_readable.js');\nexports.Stream = Stream;\nexports.Readable = exports;\nexports.Writable = require('./lib/_stream_writable.js');\nexports.Duplex = require('./lib/_stream_duplex.js');\nexports.Transform = require('./lib/_stream_transform.js');\nexports.PassThrough = require('./lib/_stream_passthrough.js');\nif (!process.browser && process.env.READABLE_STREAM === 'disable') {\n module.exports = require('stream');\n}\n","module.exports = require(\"./lib/_stream_duplex.js\")\n","var Writable = require('readable-stream/writable');\nvar Readable = require('readable-stream/readable');\nvar Duplex = require('readable-stream/duplex');\n\nvar DUMMY = new Buffer(0);\nvar noop = function() {};\n\nvar toFunction = function(fn) {\n\tif (typeof fn === 'function') return fn;\n\treturn function(cb) {\n\t\tcb(null, fn);\n\t};\n};\n\nvar onreadable = function(rs, init) {\n\tvar reading = false;\n\tvar destroyed = false;\n\n\trs._read = function() {\n\t\treading = true;\n\t};\n\n\trs.destroy = function() {\n\t\tdestroyed = true;\n\t};\n\n\tinit(function(err, source) {\n\t\tif (err) return rs.emit('error', err);\n\n\t\tvar fwd = function() {\n\t\t\tvar data;\n\t\t\twhile ((data = source.read()) !== null) {\n\t\t\t\treading = false;\n\t\t\t\trs.push(data);\n\t\t\t}\n\t\t};\n\n\t\tsource.on('readable', function() {\n\t\t\tif (reading) fwd();\n\t\t});\n\n\t\tsource.on('end', function() {\n\t\t\tfwd();\n\t\t\trs.push(null);\n\t\t});\n\n\t\tsource.on('error', function(err) {\n\t\t\trs.emit('error', err);\n\t\t});\n\n\t\tsource.on('close', function() {\n\t\t\tfwd();\n\t\t\tprocess.nextTick(function() {\n\t\t\t\trs.emit('close');\n\t\t\t});\n\t\t});\n\n\t\trs._read = function() {\n\t\t\treading = true;\n\t\t\tfwd();\n\t\t};\n\n\t\trs.destroy = function() {\n\t\t\tif (destroyed) return;\n\t\t\tdestroyed = true;\n\t\t\tif (source.destroy) source.destroy();\n\t\t};\n\n\t\tif (destroyed) {\n\t\t\tdestroyed = false;\n\t\t\trs.destroy();\n\t\t\treturn;\n\t\t}\n\n\t\tif (reading) fwd();\n\t});\n\n\treturn rs;\n};\n\nvar onwritable = function(ws, init) {\n\tvar ready = noop;\n\tvar destroyed = false;\n\n\tws._write = function(data, enc, cb) {\n\t\tready = cb;\n\t};\n\n\tws.destroy = function() {\n\t\tdestroyed = true;\n\t};\n\n\tws.write(DUMMY);\n\n\tinit(function(err, source) {\n\t\tif (err) return ws.emit('error', err);\n\n\t\tsource.on('close', function() {\n\t\t\tws.emit('close');\n\t\t});\n\n\t\tsource.on('error', function(err) {\n\t\t\tws.emit('error', err);\n\t\t});\n\n\t\tws._write = function(data, enc, cb) {\n\t\t\tif (data === DUMMY) return cb();\n\t\t\tsource.write(data, enc, cb);\n\t\t};\n\n\t\tvar emit = ws.emit;\n\n\t\tsource.on('finish', function() {\n\t\t\temit.call(ws, 'finish');\n\t\t});\n\n\t\tws.destroy = function() {\n\t\t\tif (destroyed) return;\n\t\t\tdestroyed = true;\n\t\t\tif (source.destroy) source.destroy();\n\t\t};\n\n\t\tws.emit = function(name) {\n\t\t\tif (name !== 'finish') return emit.apply(ws, arguments);\n\t\t\tsource.end();\n\t\t};\n\n\t\tif (destroyed) {\n\t\t\tdestroyed = false;\n\t\t\tws.destroy();\n\t\t\treturn;\n\t\t}\n\n\t\tready();\n\t});\n\n\treturn ws;\n};\n\nexports.readable = function(opts, init) {\n\tif (arguments.length === 1) return exports.readable(null, opts);\n\tif (!opts) opts = {};\n\treturn onreadable(new Readable(opts), toFunction(init));\n};\n\nexports.writable = function(opts, init) {\n\tif (arguments.length === 1) return exports.writable(null, opts);\n\tif (!opts) opts = {};\n\treturn onwritable(new Writable(opts), toFunction(init));\n};\n\nexports.duplex = function(opts, initWritable, initReadable) {\n\tif (arguments.length === 2) return exports.duplex(null, opts, initWritable);\n\tif (!opts) opts = {};\n\tvar dupl = new Duplex(opts);\n\tonwritable(dupl, toFunction(initWritable));\n\tonreadable(dupl, toFunction(initReadable));\n\treturn dupl;\n};","\n//force to a valid range\nvar range = exports.range = function (obj) {\n return null == obj ? {} : 'string' === typeof range ? {\n min: range, max: range + '\\xff'\n } : obj\n}\n\n//turn into a sub range.\nvar prefix = exports.prefix = function (range, within, term) {\n range = exports.range(range)\n var _range = {}\n term = term || '\\xff'\n if(range instanceof RegExp || 'function' == typeof range) {\n _range.min = within\n _range.max = within + term,\n _range.inner = function (k) {\n var j = k.substring(within.length)\n if(range.test)\n return range.test(j)\n return range(j)\n }\n }\n else if('object' === typeof range) {\n _range.min = within + (range.min || range.start || '')\n _range.max = within + (range.max || range.end || (term || '~'))\n _range.reverse = !!range.reverse\n }\n return _range\n}\n\n//return a function that checks a range\nvar checker = exports.checker = function (range) {\n if(!range) range = {}\n\n if ('string' === typeof range)\n return function (key) {\n return key.indexOf(range) == 0\n }\n else if(range instanceof RegExp)\n return function (key) {\n return range.test(key)\n }\n else if('object' === typeof range)\n return function (key) {\n var min = range.min || range.start\n var max = range.max || range.end\n\n // fixes keys passed as ints from sublevels\n key = String(key)\n\n return (\n !min || key >= min\n ) && (\n !max || key <= max\n ) && (\n !range.inner || (\n range.inner.test \n ? range.inner.test(key)\n : range.inner(key)\n )\n )\n }\n else if('function' === typeof range)\n return range\n}\n//check if a key is within a range.\nvar satifies = exports.satisfies = function (key, range) {\n return checker(range)(key)\n}\n\n\n","'use strict';\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n// shim for Node's 'util' package\n// DO NOT REMOVE THIS! It is required for compatibility with EnderJS (http://enderjs.com/).\nvar util = {\n isArray: function (ar) {\n return Array.isArray(ar) || (typeof ar === 'object' && objectToString(ar) === '[object Array]');\n },\n isDate: function (d) {\n return typeof d === 'object' && objectToString(d) === '[object Date]';\n },\n isRegExp: function (re) {\n return typeof re === 'object' && objectToString(re) === '[object RegExp]';\n },\n getRegExpFlags: function (re) {\n var flags = '';\n re.global && (flags += 'g');\n re.ignoreCase && (flags += 'i');\n re.multiline && (flags += 'm');\n return flags;\n }\n};\n\n\nif (typeof module === 'object')\n module.exports = clone;\n\n/**\n * Clones (copies) an Object using deep copying.\n *\n * This function supports circular references by default, but if you are certain\n * there are no circular references in your object, you can save some CPU time\n * by calling clone(obj, false).\n *\n * Caution: if `circular` is false and `parent` contains circular references,\n * your program may enter an infinite loop and crash.\n *\n * @param `parent` - the object to be cloned\n * @param `circular` - set to true if the object to be cloned may contain\n * circular references. (optional - true by default)\n * @param `depth` - set to a number if the object is only to be cloned to\n * a particular depth. (optional - defaults to Infinity)\n * @param `prototype` - sets the prototype to be used when cloning an object.\n * (optional - defaults to parent prototype).\n*/\n\nfunction clone(parent, circular, depth, prototype) {\n // maintain two arrays for circular references, where corresponding parents\n // and children have the same index\n var allParents = [];\n var allChildren = [];\n\n var useBuffer = typeof Buffer != 'undefined';\n\n if (typeof circular == 'undefined')\n circular = true;\n\n if (typeof depth == 'undefined')\n depth = Infinity;\n\n // recurse this function so we don't reset allParents and allChildren\n function _clone(parent, depth) {\n // cloning null always returns null\n if (parent === null)\n return null;\n\n if (depth == 0)\n return parent;\n\n var child;\n var proto;\n if (typeof parent != 'object') {\n return parent;\n }\n\n if (util.isArray(parent)) {\n child = [];\n } else if (util.isRegExp(parent)) {\n child = new RegExp(parent.source, util.getRegExpFlags(parent));\n if (parent.lastIndex) child.lastIndex = parent.lastIndex;\n } else if (util.isDate(parent)) {\n child = new Date(parent.getTime());\n } else if (useBuffer && Buffer.isBuffer(parent)) {\n child = new Buffer(parent.length);\n parent.copy(child);\n return child;\n } else {\n if (typeof prototype == 'undefined') {\n proto = Object.getPrototypeOf(parent);\n child = Object.create(proto);\n }\n else {\n child = Object.create(prototype);\n proto = prototype;\n }\n }\n\n if (circular) {\n var index = allParents.indexOf(parent);\n\n if (index != -1) {\n return allChildren[index];\n }\n allParents.push(parent);\n allChildren.push(child);\n }\n\n for (var i in parent) {\n var attrs;\n if (proto) {\n attrs = Object.getOwnPropertyDescriptor(proto, i);\n }\n \n if (attrs && attrs.set == null) {\n continue;\n }\n child[i] = _clone(parent[i], depth - 1);\n }\n\n return child;\n }\n\n return _clone(parent, depth);\n}\n\n/**\n * Simple flat clone using prototype, accepts only objects, usefull for property\n * override on FLAT configuration object (no nested props).\n *\n * USE WITH CAUTION! This may not behave as you wish if you do not know how this\n * works.\n */\nclone.clonePrototype = function(parent) {\n if (parent === null)\n return null;\n\n var c = function () {};\n c.prototype = parent;\n return new c();\n};\n","var clone = require('clone')\n\nmodule.exports = \nfunction fixRange(opts) {\n opts = clone(opts)\n\n var reverse = opts.reverse\n var end = opts.max || opts.end\n var start = opts.min || opts.start\n\n var range = [start, end]\n if(start != null && end != null)\n range.sort()\n if(reverse)\n range = range.reverse()\n\n opts.start = range[0]\n opts.end = range[1]\n\n delete opts.min\n delete opts.max\n\n return opts\n}\n","\n/**!\n * is\n * the definitive JavaScript type testing library\n * \n * @copyright 2013 Enrico Marino\n * @license MIT\n */\n\nvar objProto = Object.prototype;\nvar owns = objProto.hasOwnProperty;\nvar toString = objProto.toString;\nvar isActualNaN = function (value) {\n return value !== value;\n};\nvar NON_HOST_TYPES = {\n \"boolean\": 1,\n \"number\": 1,\n \"string\": 1,\n \"undefined\": 1\n};\n\n/**\n * Expose `is`\n */\n\nvar is = module.exports = {};\n\n/**\n * Test general.\n */\n\n/**\n * is.type\n * Test if `value` is a type of `type`.\n *\n * @param {Mixed} value value to test\n * @param {String} type type\n * @return {Boolean} true if `value` is a type of `type`, false otherwise\n * @api public\n */\n\nis.a =\nis.type = function (value, type) {\n return typeof value === type;\n};\n\n/**\n * is.defined\n * Test if `value` is defined.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if 'value' is defined, false otherwise\n * @api public\n */\n\nis.defined = function (value) {\n return value !== undefined;\n};\n\n/**\n * is.empty\n * Test if `value` is empty.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is empty, false otherwise\n * @api public\n */\n\nis.empty = function (value) {\n var type = toString.call(value);\n var key;\n\n if ('[object Array]' === type || '[object Arguments]' === type) {\n return value.length === 0;\n }\n\n if ('[object Object]' === type) {\n for (key in value) if (owns.call(value, key)) return false;\n return true;\n }\n\n if ('[object String]' === type) {\n return '' === value;\n }\n\n return false;\n};\n\n/**\n * is.equal\n * Test if `value` is equal to `other`.\n *\n * @param {Mixed} value value to test\n * @param {Mixed} other value to compare with\n * @return {Boolean} true if `value` is equal to `other`, false otherwise\n */\n\nis.equal = function (value, other) {\n var type = toString.call(value)\n var key;\n\n if (type !== toString.call(other)) {\n return false;\n }\n\n if ('[object Object]' === type) {\n for (key in value) {\n if (!is.equal(value[key], other[key])) {\n return false;\n }\n }\n return true;\n }\n\n if ('[object Array]' === type) {\n key = value.length;\n if (key !== other.length) {\n return false;\n }\n while (--key) {\n if (!is.equal(value[key], other[key])) {\n return false;\n }\n }\n return true;\n }\n\n if ('[object Function]' === type) {\n return value.prototype === other.prototype;\n }\n\n if ('[object Date]' === type) {\n return value.getTime() === other.getTime();\n }\n\n return value === other;\n};\n\n/**\n * is.hosted\n * Test if `value` is hosted by `host`.\n *\n * @param {Mixed} value to test\n * @param {Mixed} host host to test with\n * @return {Boolean} true if `value` is hosted by `host`, false otherwise\n * @api public\n */\n\nis.hosted = function (value, host) {\n var type = typeof host[value];\n return type === 'object' ? !!host[value] : !NON_HOST_TYPES[type];\n};\n\n/**\n * is.instance\n * Test if `value` is an instance of `constructor`.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is an instance of `constructor`\n * @api public\n */\n\nis.instance = is['instanceof'] = function (value, constructor) {\n return value instanceof constructor;\n};\n\n/**\n * is.null\n * Test if `value` is null.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is null, false otherwise\n * @api public\n */\n\nis['null'] = function (value) {\n return value === null;\n};\n\n/**\n * is.undefined\n * Test if `value` is undefined.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is undefined, false otherwise\n * @api public\n */\n\nis.undefined = function (value) {\n return value === undefined;\n};\n\n/**\n * Test arguments.\n */\n\n/**\n * is.arguments\n * Test if `value` is an arguments object.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is an arguments object, false otherwise\n * @api public\n */\n\nis.arguments = function (value) {\n var isStandardArguments = '[object Arguments]' === toString.call(value);\n var isOldArguments = !is.array(value) && is.arraylike(value) && is.object(value) && is.fn(value.callee);\n return isStandardArguments || isOldArguments;\n};\n\n/**\n * Test array.\n */\n\n/**\n * is.array\n * Test if 'value' is an array.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is an array, false otherwise\n * @api public\n */\n\nis.array = function (value) {\n return '[object Array]' === toString.call(value);\n};\n\n/**\n * is.arguments.empty\n * Test if `value` is an empty arguments object.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is an empty arguments object, false otherwise\n * @api public\n */\nis.arguments.empty = function (value) {\n return is.arguments(value) && value.length === 0;\n};\n\n/**\n * is.array.empty\n * Test if `value` is an empty array.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is an empty array, false otherwise\n * @api public\n */\nis.array.empty = function (value) {\n return is.array(value) && value.length === 0;\n};\n\n/**\n * is.arraylike\n * Test if `value` is an arraylike object.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is an arguments object, false otherwise\n * @api public\n */\n\nis.arraylike = function (value) {\n return !!value && !is.boolean(value)\n && owns.call(value, 'length')\n && isFinite(value.length)\n && is.number(value.length)\n && value.length >= 0;\n};\n\n/**\n * Test boolean.\n */\n\n/**\n * is.boolean\n * Test if `value` is a boolean.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is a boolean, false otherwise\n * @api public\n */\n\nis.boolean = function (value) {\n return '[object Boolean]' === toString.call(value);\n};\n\n/**\n * is.false\n * Test if `value` is false.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is false, false otherwise\n * @api public\n */\n\nis['false'] = function (value) {\n return is.boolean(value) && (value === false || value.valueOf() === false);\n};\n\n/**\n * is.true\n * Test if `value` is true.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is true, false otherwise\n * @api public\n */\n\nis['true'] = function (value) {\n return is.boolean(value) && (value === true || value.valueOf() === true);\n};\n\n/**\n * Test date.\n */\n\n/**\n * is.date\n * Test if `value` is a date.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is a date, false otherwise\n * @api public\n */\n\nis.date = function (value) {\n return '[object Date]' === toString.call(value);\n};\n\n/**\n * Test element.\n */\n\n/**\n * is.element\n * Test if `value` is an html element.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is an HTML Element, false otherwise\n * @api public\n */\n\nis.element = function (value) {\n return value !== undefined\n && typeof HTMLElement !== 'undefined'\n && value instanceof HTMLElement\n && value.nodeType === 1;\n};\n\n/**\n * Test error.\n */\n\n/**\n * is.error\n * Test if `value` is an error object.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is an error object, false otherwise\n * @api public\n */\n\nis.error = function (value) {\n return '[object Error]' === toString.call(value);\n};\n\n/**\n * Test function.\n */\n\n/**\n * is.fn / is.function (deprecated)\n * Test if `value` is a function.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is a function, false otherwise\n * @api public\n */\n\nis.fn = is['function'] = function (value) {\n var isAlert = typeof window !== 'undefined' && value === window.alert;\n return isAlert || '[object Function]' === toString.call(value);\n};\n\n/**\n * Test number.\n */\n\n/**\n * is.number\n * Test if `value` is a number.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is a number, false otherwise\n * @api public\n */\n\nis.number = function (value) {\n return '[object Number]' === toString.call(value);\n};\n\n/**\n * is.infinite\n * Test if `value` is positive or negative infinity.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is positive or negative Infinity, false otherwise\n * @api public\n */\nis.infinite = function (value) {\n return value === Infinity || value === -Infinity;\n};\n\n/**\n * is.decimal\n * Test if `value` is a decimal number.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is a decimal number, false otherwise\n * @api public\n */\n\nis.decimal = function (value) {\n return is.number(value) && !isActualNaN(value) && !is.infinite(value) && value % 1 !== 0;\n};\n\n/**\n * is.divisibleBy\n * Test if `value` is divisible by `n`.\n *\n * @param {Number} value value to test\n * @param {Number} n dividend\n * @return {Boolean} true if `value` is divisible by `n`, false otherwise\n * @api public\n */\n\nis.divisibleBy = function (value, n) {\n var isDividendInfinite = is.infinite(value);\n var isDivisorInfinite = is.infinite(n);\n var isNonZeroNumber = is.number(value) && !isActualNaN(value) && is.number(n) && !isActualNaN(n) && n !== 0;\n return isDividendInfinite || isDivisorInfinite || (isNonZeroNumber && value % n === 0);\n};\n\n/**\n * is.int\n * Test if `value` is an integer.\n *\n * @param value to test\n * @return {Boolean} true if `value` is an integer, false otherwise\n * @api public\n */\n\nis.int = function (value) {\n return is.number(value) && !isActualNaN(value) && value % 1 === 0;\n};\n\n/**\n * is.maximum\n * Test if `value` is greater than 'others' values.\n *\n * @param {Number} value value to test\n * @param {Array} others values to compare with\n * @return {Boolean} true if `value` is greater than `others` values\n * @api public\n */\n\nis.maximum = function (value, others) {\n if (isActualNaN(value)) {\n throw new TypeError('NaN is not a valid value');\n } else if (!is.arraylike(others)) {\n throw new TypeError('second argument must be array-like');\n }\n var len = others.length;\n\n while (--len >= 0) {\n if (value < others[len]) {\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * is.minimum\n * Test if `value` is less than `others` values.\n *\n * @param {Number} value value to test\n * @param {Array} others values to compare with\n * @return {Boolean} true if `value` is less than `others` values\n * @api public\n */\n\nis.minimum = function (value, others) {\n if (isActualNaN(value)) {\n throw new TypeError('NaN is not a valid value');\n } else if (!is.arraylike(others)) {\n throw new TypeError('second argument must be array-like');\n }\n var len = others.length;\n\n while (--len >= 0) {\n if (value > others[len]) {\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * is.nan\n * Test if `value` is not a number.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is not a number, false otherwise\n * @api public\n */\n\nis.nan = function (value) {\n return !is.number(value) || value !== value;\n};\n\n/**\n * is.even\n * Test if `value` is an even number.\n *\n * @param {Number} value value to test\n * @return {Boolean} true if `value` is an even number, false otherwise\n * @api public\n */\n\nis.even = function (value) {\n return is.infinite(value) || (is.number(value) && value === value && value % 2 === 0);\n};\n\n/**\n * is.odd\n * Test if `value` is an odd number.\n *\n * @param {Number} value value to test\n * @return {Boolean} true if `value` is an odd number, false otherwise\n * @api public\n */\n\nis.odd = function (value) {\n return is.infinite(value) || (is.number(value) && value === value && value % 2 !== 0);\n};\n\n/**\n * is.ge\n * Test if `value` is greater than or equal to `other`.\n *\n * @param {Number} value value to test\n * @param {Number} other value to compare with\n * @return {Boolean}\n * @api public\n */\n\nis.ge = function (value, other) {\n if (isActualNaN(value) || isActualNaN(other)) {\n throw new TypeError('NaN is not a valid value');\n }\n return !is.infinite(value) && !is.infinite(other) && value >= other;\n};\n\n/**\n * is.gt\n * Test if `value` is greater than `other`.\n *\n * @param {Number} value value to test\n * @param {Number} other value to compare with\n * @return {Boolean}\n * @api public\n */\n\nis.gt = function (value, other) {\n if (isActualNaN(value) || isActualNaN(other)) {\n throw new TypeError('NaN is not a valid value');\n }\n return !is.infinite(value) && !is.infinite(other) && value > other;\n};\n\n/**\n * is.le\n * Test if `value` is less than or equal to `other`.\n *\n * @param {Number} value value to test\n * @param {Number} other value to compare with\n * @return {Boolean} if 'value' is less than or equal to 'other'\n * @api public\n */\n\nis.le = function (value, other) {\n if (isActualNaN(value) || isActualNaN(other)) {\n throw new TypeError('NaN is not a valid value');\n }\n return !is.infinite(value) && !is.infinite(other) && value <= other;\n};\n\n/**\n * is.lt\n * Test if `value` is less than `other`.\n *\n * @param {Number} value value to test\n * @param {Number} other value to compare with\n * @return {Boolean} if `value` is less than `other`\n * @api public\n */\n\nis.lt = function (value, other) {\n if (isActualNaN(value) || isActualNaN(other)) {\n throw new TypeError('NaN is not a valid value');\n }\n return !is.infinite(value) && !is.infinite(other) && value < other;\n};\n\n/**\n * is.within\n * Test if `value` is within `start` and `finish`.\n *\n * @param {Number} value value to test\n * @param {Number} start lower bound\n * @param {Number} finish upper bound\n * @return {Boolean} true if 'value' is is within 'start' and 'finish'\n * @api public\n */\nis.within = function (value, start, finish) {\n if (isActualNaN(value) || isActualNaN(start) || isActualNaN(finish)) {\n throw new TypeError('NaN is not a valid value');\n } else if (!is.number(value) || !is.number(start) || !is.number(finish)) {\n throw new TypeError('all arguments must be numbers');\n }\n var isAnyInfinite = is.infinite(value) || is.infinite(start) || is.infinite(finish);\n return isAnyInfinite || (value >= start && value <= finish);\n};\n\n/**\n * Test object.\n */\n\n/**\n * is.object\n * Test if `value` is an object.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is an object, false otherwise\n * @api public\n */\n\nis.object = function (value) {\n return value && '[object Object]' === toString.call(value);\n};\n\n/**\n * is.hash\n * Test if `value` is a hash - a plain object literal.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is a hash, false otherwise\n * @api public\n */\n\nis.hash = function (value) {\n return is.object(value) && value.constructor === Object && !value.nodeType && !value.setInterval;\n};\n\n/**\n * Test regexp.\n */\n\n/**\n * is.regexp\n * Test if `value` is a regular expression.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if `value` is a regexp, false otherwise\n * @api public\n */\n\nis.regexp = function (value) {\n return '[object RegExp]' === toString.call(value);\n};\n\n/**\n * Test string.\n */\n\n/**\n * is.string\n * Test if `value` is a string.\n *\n * @param {Mixed} value value to test\n * @return {Boolean} true if 'value' is a string, false otherwise\n * @api public\n */\n\nis.string = function (value) {\n return '[object String]' === toString.call(value);\n};\n\n","\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toString = Object.prototype.toString;\n\nmodule.exports = function forEach (obj, fn, ctx) {\n if (toString.call(fn) !== '[object Function]') {\n throw new TypeError('iterator must be a function');\n }\n var l = obj.length;\n if (l === +l) {\n for (var i = 0; i < l; i++) {\n fn.call(ctx, obj[i], i, obj);\n }\n } else {\n for (var k in obj) {\n if (hasOwn.call(obj, k)) {\n fn.call(ctx, obj[k], k, obj);\n }\n }\n }\n};\n\n","(function () {\n\t\"use strict\";\n\n\t// modified from https://github.com/kriskowal/es5-shim\n\tvar has = Object.prototype.hasOwnProperty,\n\t\tis = require('is'),\n\t\tforEach = require('foreach'),\n\t\thasDontEnumBug = !({'toString': null}).propertyIsEnumerable('toString'),\n\t\tdontEnums = [\n\t\t\t\"toString\",\n\t\t\t\"toLocaleString\",\n\t\t\t\"valueOf\",\n\t\t\t\"hasOwnProperty\",\n\t\t\t\"isPrototypeOf\",\n\t\t\t\"propertyIsEnumerable\",\n\t\t\t\"constructor\"\n\t\t],\n\t\tkeysShim;\n\n\tkeysShim = function keys(object) {\n\t\tif (!is.object(object) && !is.array(object)) {\n\t\t\tthrow new TypeError(\"Object.keys called on a non-object\");\n\t\t}\n\n\t\tvar name, theKeys = [];\n\t\tfor (name in object) {\n\t\t\tif (has.call(object, name)) {\n\t\t\t\ttheKeys.push(name);\n\t\t\t}\n\t\t}\n\n\t\tif (hasDontEnumBug) {\n\t\t\tforEach(dontEnums, function (dontEnum) {\n\t\t\t\tif (has.call(object, dontEnum)) {\n\t\t\t\t\ttheKeys.push(dontEnum);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn theKeys;\n\t};\n\n\tmodule.exports = keysShim;\n}());\n\n","module.exports = Object.keys || require('./shim');\n\n","module.exports = hasKeys\n\nfunction hasKeys(source) {\n return source !== null &&\n (typeof source === \"object\" ||\n typeof source === \"function\")\n}\n","var Keys = require(\"object-keys\")\nvar hasKeys = require(\"./has-keys\")\n\nmodule.exports = extend\n\nfunction extend() {\n var target = {}\n\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i]\n\n if (!hasKeys(source)) {\n continue\n }\n\n var keys = Keys(source)\n\n for (var j = 0; j < keys.length; j++) {\n var name = keys[j]\n target[name] = source[name]\n }\n }\n\n return target\n}\n","function addOperation (type, key, value, options) {\n var operation = {\n type: type,\n key: key,\n value: value,\n options: options\n }\n\n if (options && options.prefix) {\n operation.prefix = options.prefix\n delete options.prefix\n }\n\n this._operations.push(operation)\n\n return this\n}\n\nfunction Batch(sdb) {\n this._operations = []\n this._sdb = sdb\n\n this.put = addOperation.bind(this, 'put')\n this.del = addOperation.bind(this, 'del')\n}\n\nvar B = Batch.prototype\n\n\nB.clear = function () {\n this._operations = []\n}\n\nB.write = function (cb) {\n this._sdb.batch(this._operations, cb)\n}\n\nmodule.exports = Batch\n","var EventEmitter = require('events').EventEmitter\nvar inherits = require('util').inherits\nvar ranges = require('string-range')\nvar fixRange = require('level-fix-range')\nvar xtend = require('xtend')\nvar Batch = require('./batch')\n\ninherits(SubDB, EventEmitter)\n\nfunction SubDB (db, prefix, options) {\n if('string' === typeof options) {\n console.error('db.sublevel(name, seperator) is depreciated')\n console.error('use db.sublevel(name, {sep: separator})) if you must')\n options = {sep: options}\n }\n if(!(this instanceof SubDB)) return new SubDB(db, prefix, options)\n if(!db) throw new Error('must provide db')\n if(!prefix) throw new Error('must provide prefix')\n\n options = options || {}\n options.sep = options.sep || '\\xff'\n\n this._parent = db\n this._options = options\n this.options = options\n this._prefix = prefix\n this._root = root(this)\n db.sublevels[prefix] = this\n this.sublevels = {}\n this.methods = {}\n var self = this\n this.hooks = {\n pre: function () {\n return self.pre.apply(self, arguments)\n },\n post: function () {\n return self.post.apply(self, arguments)\n }\n }\n}\n\nvar SDB = SubDB.prototype\n\nSDB._key = function (key) {\n var sep = this._options.sep\n return sep\n + this._prefix\n + sep\n + key\n}\n\nSDB._getOptsAndCb = function (opts, cb) {\n if (typeof opts == 'function') {\n cb = opts\n opts = {}\n }\n return { opts: xtend(opts, this._options), cb: cb }\n}\n\nSDB.sublevel = function (prefix, options) {\n if(this.sublevels[prefix])\n return this.sublevels[prefix]\n return new SubDB(this, prefix, options || this._options)\n}\n\nSDB.put = function (key, value, opts, cb) {\n var res = this._getOptsAndCb(opts, cb)\n this._root.put(this.prefix(key), value, res.opts, res.cb)\n}\n\nSDB.get = function (key, opts, cb) {\n var res = this._getOptsAndCb(opts, cb)\n this._root.get(this.prefix(key), res.opts, res.cb)\n}\n\nSDB.del = function (key, opts, cb) {\n var res = this._getOptsAndCb(opts, cb)\n this._root.del(this.prefix(key), res.opts, res.cb)\n}\n\nSDB.batch = function (changes, opts, cb) {\n if(!Array.isArray(changes))\n return new Batch(this)\n var self = this,\n res = this._getOptsAndCb(opts, cb)\n changes.forEach(function (ch) {\n\n //OH YEAH, WE NEED TO VALIDATE THAT UPDATING THIS KEY/PREFIX IS ALLOWED\n if('string' === typeof ch.prefix)\n ch.key = ch.prefix + ch.key\n else\n ch.key = (ch.prefix || self).prefix(ch.key)\n\n if(ch.prefix) ch.prefix = null\n })\n this._root.batch(changes, res.opts, res.cb)\n}\n\nSDB._getKeyEncoding = function () {\n if(this.options.keyEncoding)\n return this.options.keyEncoding\n if(this._parent && this._parent._getKeyEncoding)\n return this._parent._getKeyEncoding()\n}\n\nSDB._getValueEncoding = function () {\n if(this.options.valueEncoding)\n return this.options.valueEncoding\n if(this._parent && this._parent._getValueEncoding)\n return this._parent._getValueEncoding()\n}\n\nSDB.prefix = function (key) {\n var sep = this._options.sep\n return this._parent.prefix() + sep + this._prefix + sep + (key || '')\n}\n\nSDB.keyStream =\nSDB.createKeyStream = function (opts) {\n opts = opts || {}\n opts.keys = true\n opts.values = false\n return this.createReadStream(opts)\n}\n\nSDB.valueStream =\nSDB.createValueStream = function (opts) {\n opts = opts || {}\n opts.keys = false\n opts.values = true\n opts.keys = false\n return this.createReadStream(opts)\n}\n\nfunction selectivelyMerge(_opts, opts) {\n [ 'valueEncoding'\n , 'encoding'\n , 'keyEncoding'\n , 'reverse'\n , 'values'\n , 'keys'\n , 'limit'\n , 'fillCache'\n ]\n .forEach(function (k) {\n if (opts.hasOwnProperty(k)) _opts[k] = opts[k]\n })\n}\n\nSDB.readStream =\nSDB.createReadStream = function (opts) {\n opts = opts || {}\n var r = root(this)\n var p = this.prefix()\n\n var _opts = ranges.prefix(opts, p)\n selectivelyMerge(_opts, xtend(opts, this._options))\n\n var s = r.createReadStream(_opts)\n\n if(_opts.values === false) {\n var read = s.read\n if (read) {\n s.read = function (size) {\n var val = read.call(this, size)\n if (val) val = val.substring(p.length)\n return val\n }\n } else {\n var emit = s.emit\n s.emit = function (event, val) {\n if(event === 'data') {\n emit.call(this, 'data', val.substring(p.length))\n } else\n emit.call(this, event, val)\n }\n }\n return s\n } else if(_opts.keys === false)\n return s\n else {\n var read = s.read\n if (read) {\n s.read = function (size) {\n var d = read.call(this, size)\n if (d) d.key = d.key.substring(p.length)\n return d\n }\n } else {\n s.on('data', function (d) {\n //mutate the prefix!\n //this doesn't work for createKeyStream admittedly.\n d.key = d.key.substring(p.length)\n })\n }\n return s\n }\n}\n\n\nSDB.writeStream =\nSDB.createWriteStream = function () {\n var r = root(this)\n var p = this.prefix()\n var ws = r.createWriteStream.apply(r, arguments)\n var write = ws.write\n\n var encoding = this._options.encoding\n var valueEncoding = this._options.valueEncoding\n var keyEncoding = this._options.keyEncoding\n\n // slight optimization, if no encoding was specified at all,\n // which will be the case most times, make write not check at all\n var nocheck = !encoding && !valueEncoding && !keyEncoding\n\n ws.write = nocheck\n ? function (data) {\n data.key = p + data.key\n return write.call(ws, data)\n }\n : function (data) {\n data.key = p + data.key\n\n // not merging all options here since this happens on every write and things could get slowed down\n // at this point we only consider encoding important to propagate\n if (encoding && typeof data.encoding === 'undefined')\n data.encoding = encoding\n if (valueEncoding && typeof data.valueEncoding === 'undefined')\n data.valueEncoding = valueEncoding\n if (keyEncoding && typeof data.keyEncoding === 'undefined')\n data.keyEncoding = keyEncoding\n\n return write.call(ws, data)\n }\n return ws\n}\n\nSDB.approximateSize = function () {\n var r = root(db)\n return r.approximateSize.apply(r, arguments)\n}\n\nfunction root(db) {\n if(!db._parent) return db\n return root(db._parent)\n}\n\nSDB.pre = function (range, hook) {\n if(!hook) hook = range, range = null\n range = ranges.prefix(range, this.prefix(), this._options.sep)\n var r = root(this._parent)\n var p = this.prefix()\n return r.hooks.pre(fixRange(range), function (ch, add, batch) {\n hook({\n key: ch.key.substring(p.length),\n value: ch.value,\n type: ch.type\n }, function (ch, _p) {\n //maybe remove the second add arg now\n //that op can have prefix?\n add(ch, ch.prefix ? _p : (_p || p))\n }, batch)\n })\n}\n\nSDB.post = function (range, hook) {\n if(!hook) hook = range, range = null\n var r = root(this._parent)\n var p = this.prefix()\n range = ranges.prefix(range, p, this._options.sep)\n return r.hooks.post(fixRange(range), function (data) {\n hook({key: data.key.substring(p.length), value: data.value, type: data.type})\n })\n}\n\nvar exports = module.exports = SubDB\n\n","var ranges = require('string-range')\n\nmodule.exports = function (db) {\n\n if(db.hooks) {\n return \n }\n\n var posthooks = []\n var prehooks = []\n\n function getPrefix (p) {\n return p && (\n 'string' === typeof p ? p\n : 'string' === typeof p.prefix ? p.prefix\n : 'function' === typeof p.prefix ? p.prefix()\n : ''\n )\n }\n\n function getKeyEncoding (db) {\n if(db && db._getKeyEncoding)\n return db._getKeyEncoding(db)\n }\n\n function getValueEncoding (db) {\n if(db && db._getValueEncoding)\n return db._getValueEncoding(db)\n }\n\n function remover (array, item) {\n return function () {\n var i = array.indexOf(item)\n if(!~i) return false \n array.splice(i, 1)\n return true\n }\n }\n\n db.hooks = {\n post: function (prefix, hook) {\n if(!hook) hook = prefix, prefix = ''\n var h = {test: ranges.checker(prefix), hook: hook}\n posthooks.push(h)\n return remover(posthooks, h)\n },\n pre: function (prefix, hook) {\n if(!hook) hook = prefix, prefix = ''\n var h = {\n test: ranges.checker(prefix),\n hook: hook,\n safe: false !== prefix.safe\n }\n prehooks.push(h)\n return remover(prehooks, h)\n },\n posthooks: posthooks,\n prehooks: prehooks\n }\n\n //POST HOOKS\n\n function each (e) {\n if(e && e.type) {\n posthooks.forEach(function (h) {\n if(h.test(e.key)) h.hook(e)\n })\n }\n }\n\n db.on('put', function (key, val) {\n each({type: 'put', key: key, value: val})\n })\n db.on('del', function (key, val) {\n each({type: 'del', key: key, value: val})\n })\n db.on('batch', function onBatch (ary) {\n ary.forEach(each)\n })\n\n //PRE HOOKS\n\n var put = db.put\n var del = db.del\n var batch = db.batch\n\n function callHooks (isBatch, b, opts, cb) {\n try {\n b.forEach(function hook(e, i) {\n prehooks.forEach(function (h) {\n if(h.test(String(e.key))) {\n //optimize this?\n //maybe faster to not create a new object each time?\n //have one object and expose scope to it?\n var context = {\n add: function (ch, db) {\n if(typeof ch === 'undefined') {\n return this\n }\n if(ch === false)\n return delete b[i]\n var prefix = (\n getPrefix(ch.prefix) || \n getPrefix(db) || \n h.prefix || ''\n ) \n //don't leave a circular json object there incase using multilevel.\n if(prefix) ch.prefix = prefix\n ch.key = prefix + ch.key\n if(h.safe && h.test(String(ch.key))) {\n //this usually means a stack overflow.\n throw new Error('prehook cannot insert into own range')\n }\n var ke = ch.keyEncoding || getKeyEncoding(ch.prefix)\n var ve = ch.valueEncoding || getValueEncoding(ch.prefix)\n if(ke) ch.keyEncoding = ke\n if(ve) ch.valueEncoding = ve\n\n b.push(ch)\n hook(ch, b.length - 1)\n return this\n },\n put: function (ch, db) {\n if('object' === typeof ch) ch.type = 'put'\n return this.add(ch, db)\n },\n del: function (ch, db) {\n if('object' === typeof ch) ch.type = 'del'\n return this.add(ch, db)\n },\n veto: function () {\n return this.add(false)\n }\n }\n h.hook.call(context, e, context.add, b)\n }\n })\n })\n } catch (err) {\n return (cb || opts)(err)\n }\n b = b.filter(function (e) {\n return e && e.type //filter out empty items\n })\n\n if(b.length == 1 && !isBatch) {\n var change = b[0]\n return change.type == 'put' \n ? put.call(db, change.key, change.value, opts, cb) \n : del.call(db, change.key, opts, cb) \n }\n return batch.call(db, b, opts, cb)\n }\n\n db.put = function (key, value, opts, cb ) {\n var batch = [{key: key, value: value, type: 'put'}]\n return callHooks(false, batch, opts, cb)\n }\n\n db.del = function (key, opts, cb) {\n var batch = [{key: key, type: 'del'}]\n return callHooks(false, batch, opts, cb)\n }\n\n db.batch = function (batch, opts, cb) {\n return callHooks(true, batch, opts, cb)\n }\n}\n","var EventEmitter = require('events').EventEmitter\nvar next = process.nextTick\nvar SubDb = require('./sub')\nvar Batch = require('./batch')\nvar fixRange = require('level-fix-range')\n\nvar Hooks = require('level-hooks')\n\nmodule.exports = function (_db, options) {\n function DB () {}\n DB.prototype = _db\n var db = new DB()\n\n if (db.sublevel) return db\n\n options = options || {}\n\n //use \\xff (255) as the seperator,\n //so that sections of the database will sort after the regular keys\n var sep = options.sep = options.sep || '\\xff'\n db._options = options\n\n Hooks(db)\n\n db.sublevels = {}\n\n db.sublevel = function (prefix, options) {\n if(db.sublevels[prefix])\n return db.sublevels[prefix]\n return new SubDb(db, prefix, options || this._options)\n }\n\n db.methods = {}\n\n db.prefix = function (key) {\n return '' + (key || '')\n }\n\n db.pre = function (range, hook) {\n if(!hook)\n hook = range, range = {\n max : sep\n }\n return db.hooks.pre(range, hook)\n }\n\n db.post = function (range, hook) {\n if(!hook)\n hook = range, range = {\n max : sep\n }\n return db.hooks.post(range, hook)\n }\n\n function safeRange(fun) {\n return function (opts) {\n opts = opts || {}\n opts = fixRange(opts)\n\n if(opts.reverse) opts.start = opts.start || sep\n else opts.end = opts.end || sep\n\n return fun.call(db, opts)\n }\n }\n\n db.readStream =\n db.createReadStream = safeRange(db.createReadStream)\n db.keyStream =\n db.createKeyStream = safeRange(db.createKeyStream)\n db.valuesStream =\n db.createValueStream = safeRange(db.createValueStream)\n\n var batch = db.batch\n db.batch = function (changes, opts, cb) {\n if(!Array.isArray(changes))\n return new Batch(db)\n changes.forEach(function (e) {\n if(e.prefix) {\n if('function' === typeof e.prefix.prefix)\n e.key = e.prefix.prefix(e.key)\n else if('string' === typeof e.prefix)\n e.key = e.prefix + e.key\n }\n })\n batch.call(db, changes, opts, cb)\n }\n return db\n}\n\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Readable;\n\n/**/\nvar isArray = require('isarray');\n/**/\n\n\n/**/\nvar Buffer = require('buffer').Buffer;\n/**/\n\nReadable.ReadableState = ReadableState;\n\nvar EE = require('events').EventEmitter;\n\n/**/\nif (!EE.listenerCount) EE.listenerCount = function(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\nvar Stream = require('stream');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar StringDecoder;\n\n\n/**/\nvar debug = require('util');\nif (debug && debug.debuglog) {\n debug = debug.debuglog('stream');\n} else {\n debug = function () {};\n}\n/**/\n\n\nutil.inherits(Readable, Stream);\n\nfunction ReadableState(options, stream) {\n var Duplex = require('./_stream_duplex');\n\n options = options || {};\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n var hwm = options.highWaterMark;\n var defaultHwm = options.objectMode ? 16 : 16 * 1024;\n this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;\n\n // cast to ints.\n this.highWaterMark = ~~this.highWaterMark;\n\n this.buffer = [];\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n\n if (stream instanceof Duplex)\n this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // when piping, we only care about 'readable' events that happen\n // after read()ing all the bytes and not getting any pushback.\n this.ranOut = false;\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder)\n StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n var Duplex = require('./_stream_duplex');\n\n if (!(this instanceof Readable))\n return new Readable(options);\n\n this._readableState = new ReadableState(options, this);\n\n // legacy\n this.readable = true;\n\n Stream.call(this);\n}\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function(chunk, encoding) {\n var state = this._readableState;\n\n if (util.isString(chunk) && !state.objectMode) {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = new Buffer(chunk, encoding);\n encoding = '';\n }\n }\n\n return readableAddChunk(this, state, chunk, encoding, false);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function(chunk) {\n var state = this._readableState;\n return readableAddChunk(this, state, chunk, '', true);\n};\n\nfunction readableAddChunk(stream, state, chunk, encoding, addToFront) {\n var er = chunkInvalid(state, chunk);\n if (er) {\n stream.emit('error', er);\n } else if (util.isNullOrUndefined(chunk)) {\n state.reading = false;\n if (!state.ended)\n onEofChunk(stream, state);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (state.ended && !addToFront) {\n var e = new Error('stream.push() after EOF');\n stream.emit('error', e);\n } else if (state.endEmitted && addToFront) {\n var e = new Error('stream.unshift() after end event');\n stream.emit('error', e);\n } else {\n if (state.decoder && !addToFront && !encoding)\n chunk = state.decoder.write(chunk);\n\n if (!addToFront)\n state.reading = false;\n\n // if we want the data now, just emit it.\n if (state.flowing && state.length === 0 && !state.sync) {\n stream.emit('data', chunk);\n stream.read(0);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront)\n state.buffer.unshift(chunk);\n else\n state.buffer.push(chunk);\n\n if (state.needReadable)\n emitReadable(stream);\n }\n\n maybeReadMore(stream, state);\n }\n } else if (!addToFront) {\n state.reading = false;\n }\n\n return needMoreData(state);\n}\n\n\n\n// if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes. This is to work around cases where hwm=0,\n// such as the repl. Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\nfunction needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function(enc) {\n if (!StringDecoder)\n StringDecoder = require('string_decoder/').StringDecoder;\n this._readableState.decoder = new StringDecoder(enc);\n this._readableState.encoding = enc;\n return this;\n};\n\n// Don't raise the hwm > 128MB\nvar MAX_HWM = 0x800000;\nfunction roundUpToNextPowerOf2(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2\n n--;\n for (var p = 1; p < 32; p <<= 1) n |= n >> p;\n n++;\n }\n return n;\n}\n\nfunction howMuchToRead(n, state) {\n if (state.length === 0 && state.ended)\n return 0;\n\n if (state.objectMode)\n return n === 0 ? 0 : 1;\n\n if (isNaN(n) || util.isNull(n)) {\n // only flow one buffer at a time\n if (state.flowing && state.buffer.length)\n return state.buffer[0].length;\n else\n return state.length;\n }\n\n if (n <= 0)\n return 0;\n\n // If we're asking for more than the target buffer level,\n // then raise the water mark. Bump up to the next highest\n // power of 2, to prevent increasing it excessively in tiny\n // amounts.\n if (n > state.highWaterMark)\n state.highWaterMark = roundUpToNextPowerOf2(n);\n\n // don't have that much. return null, unless we've ended.\n if (n > state.length) {\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n } else\n return state.length;\n }\n\n return n;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function(n) {\n debug('read', n);\n var state = this._readableState;\n var nOrig = n;\n\n if (!util.isNumber(n) || n > 0)\n state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 &&\n state.needReadable &&\n (state.length >= state.highWaterMark || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended)\n endReadable(this);\n else\n emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0)\n endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug('need readable', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n }\n\n if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0)\n state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n }\n\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (doRead && !state.reading)\n n = howMuchToRead(nOrig, state);\n\n var ret;\n if (n > 0)\n ret = fromList(n, state);\n else\n ret = null;\n\n if (util.isNull(ret)) {\n state.needReadable = true;\n n = 0;\n }\n\n state.length -= n;\n\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (state.length === 0 && !state.ended)\n state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended && state.length === 0)\n endReadable(this);\n\n if (!util.isNull(ret))\n this.emit('data', ret);\n\n return ret;\n};\n\nfunction chunkInvalid(state, chunk) {\n var er = null;\n if (!util.isBuffer(chunk) &&\n !util.isString(chunk) &&\n !util.isNullOrUndefined(chunk) &&\n !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n return er;\n}\n\n\nfunction onEofChunk(stream, state) {\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n\n // emit 'readable' now to make sure it gets picked up.\n emitReadable(stream);\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n }\n}\n\nfunction emitReadable_(stream) {\n debug('emit readable');\n stream.emit('readable');\n flow(stream);\n}\n\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(function() {\n maybeReadMore_(stream, state);\n });\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n var len = state.length;\n while (!state.reading && !state.flowing && !state.ended &&\n state.length < state.highWaterMark) {\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;\n else\n len = state.length;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function(n) {\n this.emit('error', new Error('not implemented'));\n};\n\nReadable.prototype.pipe = function(dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n\n var doEnd = (!pipeOpts || pipeOpts.end !== false) &&\n dest !== process.stdout &&\n dest !== process.stderr;\n\n var endFn = doEnd ? onend : cleanup;\n if (state.endEmitted)\n process.nextTick(endFn);\n else\n src.once('end', endFn);\n\n dest.on('unpipe', onunpipe);\n function onunpipe(readable) {\n debug('onunpipe');\n if (readable === src) {\n cleanup();\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n\n function cleanup() {\n debug('cleanup');\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', cleanup);\n src.removeListener('data', ondata);\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (state.awaitDrain &&\n (!dest._writableState || dest._writableState.needDrain))\n ondrain();\n }\n\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n if (false === ret) {\n debug('false write response, pause',\n src._readableState.awaitDrain);\n src._readableState.awaitDrain++;\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }\n // This is a brutally ugly hack to make sure that our error handler\n // is attached before any userland ones. NEVER DO THIS.\n if (!dest._events || !dest._events.error)\n dest.on('error', onerror);\n else if (isArray(dest._events.error))\n dest._events.error.unshift(onerror);\n else\n dest._events.error = [onerror, dest._events.error];\n\n\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain)\n state.awaitDrain--;\n if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\n\nReadable.prototype.unpipe = function(dest) {\n var state = this._readableState;\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0)\n return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes)\n return this;\n\n if (!dest)\n dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest)\n dest.emit('unpipe', this);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++)\n dests[i].emit('unpipe', this);\n return this;\n }\n\n // try to find the right one.\n var i = indexOf(state.pipes, dest);\n if (i === -1)\n return this;\n\n state.pipes.splice(i, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1)\n state.pipes = state.pipes[0];\n\n dest.emit('unpipe', this);\n\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function(ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n\n // If listening to data, and it has not explicitly been paused,\n // then call resume to start the flow of data on the next tick.\n if (ev === 'data' && false !== this._readableState.flowing) {\n this.resume();\n }\n\n if (ev === 'readable' && this.readable) {\n var state = this._readableState;\n if (!state.readableListening) {\n state.readableListening = true;\n state.emittedReadable = false;\n state.needReadable = true;\n if (!state.reading) {\n var self = this;\n process.nextTick(function() {\n debug('readable nexttick read 0');\n self.read(0);\n });\n } else if (state.length) {\n emitReadable(this, state);\n }\n }\n }\n\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function() {\n var state = this._readableState;\n if (!state.flowing) {\n debug('resume');\n state.flowing = true;\n if (!state.reading) {\n debug('resume read 0');\n this.read(0);\n }\n resume(this, state);\n }\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(function() {\n resume_(stream, state);\n });\n }\n}\n\nfunction resume_(stream, state) {\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading)\n stream.read(0);\n}\n\nReadable.prototype.pause = function() {\n debug('call pause flowing=%j', this._readableState.flowing);\n if (false !== this._readableState.flowing) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n if (state.flowing) {\n do {\n var chunk = stream.read();\n } while (null !== chunk && state.flowing);\n }\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function(stream) {\n var state = this._readableState;\n var paused = false;\n\n var self = this;\n stream.on('end', function() {\n debug('wrapped end');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length)\n self.push(chunk);\n }\n\n self.push(null);\n });\n\n stream.on('data', function(chunk) {\n debug('wrapped data');\n if (state.decoder)\n chunk = state.decoder.write(chunk);\n if (!chunk || !state.objectMode && !chunk.length)\n return;\n\n var ret = self.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (util.isFunction(stream[i]) && util.isUndefined(this[i])) {\n this[i] = function(method) { return function() {\n return stream[method].apply(stream, arguments);\n }}(i);\n }\n }\n\n // proxy certain important events.\n var events = ['error', 'close', 'destroy', 'pause', 'resume'];\n forEach(events, function(ev) {\n stream.on(ev, self.emit.bind(self, ev));\n });\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n self._read = function(n) {\n debug('wrapped _read', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return self;\n};\n\n\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\nfunction fromList(n, state) {\n var list = state.buffer;\n var length = state.length;\n var stringMode = !!state.decoder;\n var objectMode = !!state.objectMode;\n var ret;\n\n // nothing in the list, definitely empty.\n if (list.length === 0)\n return null;\n\n if (length === 0)\n ret = null;\n else if (objectMode)\n ret = list.shift();\n else if (!n || n >= length) {\n // read it all, truncate the array.\n if (stringMode)\n ret = list.join('');\n else\n ret = Buffer.concat(list, length);\n list.length = 0;\n } else {\n // read just some of it.\n if (n < list[0].length) {\n // just take a part of the first list item.\n // slice is the same for buffers and strings.\n var buf = list[0];\n ret = buf.slice(0, n);\n list[0] = buf.slice(n);\n } else if (n === list[0].length) {\n // first list is a perfect match\n ret = list.shift();\n } else {\n // complex case.\n // we have enough to cover it, but it spans past the first buffer.\n if (stringMode)\n ret = '';\n else\n ret = new Buffer(n);\n\n var c = 0;\n for (var i = 0, l = list.length; i < l && c < n; i++) {\n var buf = list[0];\n var cpy = Math.min(n - c, buf.length);\n\n if (stringMode)\n ret += buf.slice(0, cpy);\n else\n buf.copy(ret, c, 0, cpy);\n\n if (cpy < buf.length)\n list[0] = buf.slice(cpy);\n else\n list.shift();\n\n c += cpy;\n }\n }\n }\n\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n\n // If we get here before consuming all the bytes, then that is a\n // bug in node. Should never happen.\n if (state.length > 0)\n throw new Error('endReadable called on non-empty stream');\n\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(function() {\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n }\n });\n }\n}\n\nfunction forEach (xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}\n\nfunction indexOf (xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\nmodule.exports = Duplex;\n\n/**/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n}\n/**/\n\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\n\nutil.inherits(Duplex, Readable);\n\nforEach(objectKeys(Writable.prototype), function(method) {\n if (!Duplex.prototype[method])\n Duplex.prototype[method] = Writable.prototype[method];\n});\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex))\n return new Duplex(options);\n\n Readable.call(this, options);\n Writable.call(this, options);\n\n if (options && options.readable === false)\n this.readable = false;\n\n if (options && options.writable === false)\n this.writable = false;\n\n this.allowHalfOpen = true;\n if (options && options.allowHalfOpen === false)\n this.allowHalfOpen = false;\n\n this.once('end', onend);\n}\n\n// the no-half-open enforcer\nfunction onend() {\n // if we allow half-open state, or if the writable side ended,\n // then we're ok.\n if (this.allowHalfOpen || this._writableState.ended)\n return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n process.nextTick(this.end.bind(this));\n}\n\nfunction forEach (xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, cb), and it'll handle all\n// the drain event emission and buffering.\n\nmodule.exports = Writable;\n\n/**/\nvar Buffer = require('buffer').Buffer;\n/**/\n\nWritable.WritableState = WritableState;\n\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar Stream = require('stream');\n\nutil.inherits(Writable, Stream);\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n}\n\nfunction WritableState(options, stream) {\n var Duplex = require('./_stream_duplex');\n\n options = options || {};\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n var hwm = options.highWaterMark;\n var defaultHwm = options.objectMode ? 16 : 16 * 1024;\n this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n\n if (stream instanceof Duplex)\n this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // cast to ints.\n this.highWaterMark = ~~this.highWaterMark;\n\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function(er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n\n this.buffer = [];\n\n // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n}\n\nfunction Writable(options) {\n var Duplex = require('./_stream_duplex');\n\n // Writable ctor is applied to Duplexes, though they're not\n // instanceof Writable, they're instanceof Readable.\n if (!(this instanceof Writable) && !(this instanceof Duplex))\n return new Writable(options);\n\n this._writableState = new WritableState(options, this);\n\n // legacy.\n this.writable = true;\n\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function() {\n this.emit('error', new Error('Cannot pipe. Not readable.'));\n};\n\n\nfunction writeAfterEnd(stream, state, cb) {\n var er = new Error('write after end');\n // TODO: defer error events consistently everywhere, not just the cb\n stream.emit('error', er);\n process.nextTick(function() {\n cb(er);\n });\n}\n\n// If we get something that is not a buffer, string, null, or undefined,\n// and we're not in objectMode, then that's an error.\n// Otherwise stream chunks are all considered to be of length=1, and the\n// watermarks determine how many objects to keep in the buffer, rather than\n// how many bytes or characters.\nfunction validChunk(stream, state, chunk, cb) {\n var valid = true;\n if (!util.isBuffer(chunk) &&\n !util.isString(chunk) &&\n !util.isNullOrUndefined(chunk) &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n process.nextTick(function() {\n cb(er);\n });\n valid = false;\n }\n return valid;\n}\n\nWritable.prototype.write = function(chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n if (util.isFunction(encoding)) {\n cb = encoding;\n encoding = null;\n }\n\n if (util.isBuffer(chunk))\n encoding = 'buffer';\n else if (!encoding)\n encoding = state.defaultEncoding;\n\n if (!util.isFunction(cb))\n cb = function() {};\n\n if (state.ended)\n writeAfterEnd(this, state, cb);\n else if (validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, chunk, encoding, cb);\n }\n\n return ret;\n};\n\nWritable.prototype.cork = function() {\n var state = this._writableState;\n\n state.corked++;\n};\n\nWritable.prototype.uncork = function() {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n\n if (!state.writing &&\n !state.corked &&\n !state.finished &&\n !state.bufferProcessing &&\n state.buffer.length)\n clearBuffer(this, state);\n }\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode &&\n state.decodeStrings !== false &&\n util.isString(chunk)) {\n chunk = new Buffer(chunk, encoding);\n }\n return chunk;\n}\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, chunk, encoding, cb) {\n chunk = decodeChunk(state, chunk, encoding);\n if (util.isBuffer(chunk))\n encoding = 'buffer';\n var len = state.objectMode ? 1 : chunk.length;\n\n state.length += len;\n\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret)\n state.needDrain = true;\n\n if (state.writing || state.corked)\n state.buffer.push(new WriteReq(chunk, encoding, cb));\n else\n doWrite(stream, state, false, len, chunk, encoding, cb);\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (writev)\n stream._writev(chunk, state.onwrite);\n else\n stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n if (sync)\n process.nextTick(function() {\n state.pendingcb--;\n cb(er);\n });\n else {\n state.pendingcb--;\n cb(er);\n }\n\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n\n onwriteStateUpdate(state);\n\n if (er)\n onwriteError(stream, state, sync, er, cb);\n else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(stream, state);\n\n if (!finished &&\n !state.corked &&\n !state.bufferProcessing &&\n state.buffer.length) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n process.nextTick(function() {\n afterWrite(stream, state, finished, cb);\n });\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished)\n onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n\n if (stream._writev && state.buffer.length > 1) {\n // Fast case, write everything using _writev()\n var cbs = [];\n for (var c = 0; c < state.buffer.length; c++)\n cbs.push(state.buffer[c].callback);\n\n // count the one we are adding, as well.\n // TODO(isaacs) clean this up\n state.pendingcb++;\n doWrite(stream, state, true, state.length, state.buffer, '', function(err) {\n for (var i = 0; i < cbs.length; i++) {\n state.pendingcb--;\n cbs[i](err);\n }\n });\n\n // Clear buffer\n state.buffer = [];\n } else {\n // Slow case, write chunks one-by-one\n for (var c = 0; c < state.buffer.length; c++) {\n var entry = state.buffer[c];\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n\n doWrite(stream, state, false, len, chunk, encoding, cb);\n\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n c++;\n break;\n }\n }\n\n if (c < state.buffer.length)\n state.buffer = state.buffer.slice(c);\n else\n state.buffer.length = 0;\n }\n\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function(chunk, encoding, cb) {\n cb(new Error('not implemented'));\n\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function(chunk, encoding, cb) {\n var state = this._writableState;\n\n if (util.isFunction(chunk)) {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (util.isFunction(encoding)) {\n cb = encoding;\n encoding = null;\n }\n\n if (!util.isNullOrUndefined(chunk))\n this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending && !state.finished)\n endWritable(this, state, cb);\n};\n\n\nfunction needFinish(stream, state) {\n return (state.ending &&\n state.length === 0 &&\n !state.finished &&\n !state.writing);\n}\n\nfunction prefinish(stream, state) {\n if (!state.prefinished) {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(stream, state);\n if (need) {\n if (state.pendingcb === 0) {\n prefinish(stream, state);\n state.finished = true;\n stream.emit('finish');\n } else\n prefinish(stream, state);\n }\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished)\n process.nextTick(cb);\n else\n stream.once('finish', cb);\n }\n state.ended = true;\n}\n","module.exports = require(\"./lib/_stream_writable.js\")\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(Transform, Duplex);\n\n\nfunction TransformState(options, stream) {\n this.afterTransform = function(er, data) {\n return afterTransform(stream, er, data);\n };\n\n this.needTransform = false;\n this.transforming = false;\n this.writecb = null;\n this.writechunk = null;\n}\n\nfunction afterTransform(stream, er, data) {\n var ts = stream._transformState;\n ts.transforming = false;\n\n var cb = ts.writecb;\n\n if (!cb)\n return stream.emit('error', new Error('no writecb in Transform class'));\n\n ts.writechunk = null;\n ts.writecb = null;\n\n if (!util.isNullOrUndefined(data))\n stream.push(data);\n\n if (cb)\n cb(er);\n\n var rs = stream._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n stream._read(rs.highWaterMark);\n }\n}\n\n\nfunction Transform(options) {\n if (!(this instanceof Transform))\n return new Transform(options);\n\n Duplex.call(this, options);\n\n this._transformState = new TransformState(options, this);\n\n // when the writable side finishes, then flush out anything remaining.\n var stream = this;\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n\n this.once('prefinish', function() {\n if (util.isFunction(this._flush))\n this._flush(function(er) {\n done(stream, er);\n });\n else\n done(stream);\n });\n}\n\nTransform.prototype.push = function(chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function(chunk, encoding, cb) {\n throw new Error('not implemented');\n};\n\nTransform.prototype._write = function(chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform ||\n rs.needReadable ||\n rs.length < rs.highWaterMark)\n this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function(n) {\n var ts = this._transformState;\n\n if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\n\nfunction done(stream, er) {\n if (er)\n return stream.emit('error', er);\n\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n var ws = stream._writableState;\n var ts = stream._transformState;\n\n if (ws.length)\n throw new Error('calling transform done when ws.length != 0');\n\n if (ts.transforming)\n throw new Error('calling transform done when still transforming');\n\n return stream.push(null);\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\nmodule.exports = PassThrough;\n\nvar Transform = require('./_stream_transform');\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough))\n return new PassThrough(options);\n\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function(chunk, encoding, cb) {\n cb(null, chunk);\n};\n","exports = module.exports = require('./lib/_stream_readable.js');\nexports.Stream = require('stream');\nexports.Readable = exports;\nexports.Writable = require('./lib/_stream_writable.js');\nexports.Duplex = require('./lib/_stream_duplex.js');\nexports.Transform = require('./lib/_stream_transform.js');\nexports.PassThrough = require('./lib/_stream_passthrough.js');\nif (!process.browser && process.env.READABLE_STREAM === 'disable') {\n module.exports = require('stream');\n}\n","\nmodule.exports = \nfunction fixRange(opts) {\n var reverse = opts.reverse\n var end = opts.end\n var start = opts.start\n\n var range = [start, end]\n if(start != null && end != null)\n range.sort()\n if(reverse)\n range = range.reverse()\n\n opts.start = range[0]\n opts.end = range[1]\n return opts\n}\n\n","var fixRange = require('level-fix-range')\n//get the first/last record in a range\n\nexports = module.exports = peek\nexports.first = first\nexports.last = last\n\nfunction once(emitter, events, listener) {\n var remove = []\n events.forEach(function (e) {\n function onEvent (arg) {\n if(listener(e, arg) === false) return\n remove.forEach(function (r) {\n r()\n })\n }\n emitter.on(e, onEvent)\n remove.push(function () {\n emitter.removeListener(e, onEvent)\n })\n })\n return emitter\n}\n\n\nfunction peek (db, opts, cb) {\n opts.limit = opts.reverse ? 2 : 1\n var stream = once(db.createReadStream(opts), \n ['data', 'error', 'end'],\n function (event, data) {\n if(opts.reverse && data && opts.start \n && (data.key.toString() > opts.start))\n return false\n if(event == 'error') cb(data)\n else if(event == 'end') cb(new Error('range not found'), null, null)\n else cb(null, data.key, data.value)\n })\n}\n\nfunction first (db, opts, cb) {\n if (!cb) {\n cb = opts;\n opts = {};\n }\n opts.reverse = false\n return peek(db, fixRange(opts), cb) \n}\n\n//SO, this is pretty horrible,\n//but it's works around an issue here\n//https://github.com/rvagg/node-levelup/issues/110\n\nfunction last (db, opts, cb) {\n if (!cb) {\n cb = opts;\n opts = {};\n }\n var start = opts.start\n opts.reverse = true\n return peek(db, fixRange(opts), function (err, key, value) {\n if(err) {\n var _start = opts.start\n opts.start = null\n peek (db, opts, function (_, key, value) {\n if(!key) return cb(err, null, null)\n var _key = key.toString()\n if(_key <= _start && (!opts.end || _key >= opts.end))\n cb(_, key, value)\n else cb(err, null, null)\n })\n }\n else cb(err, key, value)\n })\n}\n\n","// Returns a wrapper function that returns a wrapped callback\n// The wrapper function should do some stuff, and return a\n// presumably different callback function.\n// This makes sure that own properties are retained, so that\n// decorations and such are not lost along the way.\nmodule.exports = wrappy\nfunction wrappy (fn, cb) {\n if (fn && cb) return wrappy(fn)(cb)\n\n if (typeof fn !== 'function')\n throw new TypeError('need wrapper function')\n\n Object.keys(fn).forEach(function (k) {\n wrapper[k] = fn[k]\n })\n\n return wrapper\n\n function wrapper() {\n var args = new Array(arguments.length)\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i]\n }\n var ret = fn.apply(this, args)\n var cb = args[args.length-1]\n if (typeof ret === 'function' && ret !== cb) {\n Object.keys(cb).forEach(function (k) {\n ret[k] = cb[k]\n })\n }\n return ret\n }\n}\n","var wrappy = require('wrappy')\nmodule.exports = wrappy(once)\nmodule.exports.strict = wrappy(onceStrict)\n\nonce.proto = once(function () {\n Object.defineProperty(Function.prototype, 'once', {\n value: function () {\n return once(this)\n },\n configurable: true\n })\n\n Object.defineProperty(Function.prototype, 'onceStrict', {\n value: function () {\n return onceStrict(this)\n },\n configurable: true\n })\n})\n\nfunction once (fn) {\n var f = function () {\n if (f.called) return f.value\n f.called = true\n return f.value = fn.apply(this, arguments)\n }\n f.called = false\n return f\n}\n\nfunction onceStrict (fn) {\n var f = function () {\n if (f.called)\n throw new Error(f.onceError)\n f.called = true\n return f.value = fn.apply(this, arguments)\n }\n var name = fn.name || 'Function wrapped with `once`'\n f.onceError = name + \" shouldn't be called more than once\"\n f.called = false\n return f\n}\n","var Writable = require('readable-stream/writable');\nvar Readable = require('readable-stream/readable');\nvar peek = require('level-peek');\nvar util = require('util');\nvar once = require('once');\n\nvar EMPTY = new Buffer(0);\nvar ENCODER = {\n\tencode: function(data) {\n\t\treturn typeof data === 'string' ? data = new Buffer(data) : data;\n\t},\n\tdecode: function(data) {\n\t\treturn Buffer.isBuffer(data) ? data : new Buffer(data);\n\t},\n\tbuffer: true,\n\ttype: 'raw'\n};\n\nvar noop = function() {};\n\nvar pad = function(n) {\n\tn = n.toString(16);\n\treturn '00000000'.slice(0, -n.length)+n;\n};\n\nvar expand = function(buf, len) {\n\tvar tmp = new Buffer(len);\n\tbuf.copy(tmp);\n\treturn tmp;\n};\n\nmodule.exports = function(db, opts) {\n\tif (!opts) opts = {};\n\n\tvar blobs = {};\n\n\tvar blockSize = opts.blockSize || 65536;\n\tvar maxBatch = opts.batch || 100;\n\tvar blank = new Buffer(blockSize);\n\n\tdb.put('\\x00', 'ignore', noop); // memdown#12 workaround\n\n\tvar reservations = {};\n\tvar mutateBlock = function(key, offset, block, append, cb) {\n\t\tvar release = function() {\n\t\t\tif (!--reservations[key].locks) delete reservations[key];\n\t\t};\n\n\t\tvar onreservation = function(r) {\n\t\t\tr.locks++;\n\n\t\t\tif (!r.block && !offset) {\n\t\t\t\tr.block = block;\n\t\t\t\tcb(null, r.block, release);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!r.block) r.block = new Buffer(blockSize);\n\t\t\tif (r.block.length < offset + block.length) r.block = expand(r.block, offset + block.length);\n\n\t\t\tblock.copy(r.block, offset);\n\n\t\t\tif (!append && offset + block.length < r.block.length) r.block = r.block.slice(0, offset+block.length);\n\t\t\tcb(null, r.block, release);\n\t\t};\n\n\t\tif (reservations[key]) return onreservation(reservations[key]);\n\n\t\tdb.get(key, {valueEncoding:ENCODER}, function(err, block) {\n\t\t\tif (err && !err.notFound) return cb(err);\n\t\t\tif (!reservations[key]) reservations[key] = {locks:0, block:block};\n\t\t\tonreservation(reservations[key]);\n\t\t});\n\t};\n\n\tvar WriteStream = function(name, opts) {\n\t\tif (!(this instanceof WriteStream)) return new WriteStream(name, opts);\n\t\tif (!opts) opts = {};\n\n\t\tthis.name = name;\n\t\tthis.blocks = [];\n\t\tthis.batch = [];\n\t\tthis.bytesWritten = 0;\n\t\tthis.truncate = !opts.append;\n\t\tthis.append = opts.append;\n\n\t\tthis._shouldInitAppend = this.append && opts.start === undefined;\n\t\tthis._destroyed = false;\n\t\tthis._init(opts.start || 0);\n\n\t\tWritable.call(this);\n\t};\n\n\tutil.inherits(WriteStream, Writable);\n\n\tWriteStream.prototype._init = function(start) {\n\t\tthis.blockIndex = (start / blockSize) | 0;\n\t\tthis.blockOffset = start - this.blockIndex * blockSize;\n\t\tthis.blockLength = this.blockOffset;\n\t};\n\n\tWriteStream.prototype._flush = function(cb) {\n\t\tif (!this.batch.length) return cb();\n\n\t\tvar key = this.batch[this.batch.length-1].key;\n\t\tvar batch = this.batch;\n\t\tthis.batch = [];\n\n\t\tif (!this.truncate) return db.batch(batch, cb);\n\t\tthis.truncate = false;\n\t\tthis._truncate(batch, key, cb);\n\t};\n\n\tWriteStream.prototype._truncate = function(batch, key, cb) {\n\t\tcb = once(cb);\n\n\t\tvar dels = [];\n\t\tvar keys = db.createKeyStream({\n\t\t\tstart: key,\n\t\t\tend: this.name+'\\xff\\xff'\n\t\t});\n\n\t\tkeys.on('error', cb);\n\n\t\tkeys.on('data', function(key) {\n\t\t\tdels.push({type:'del', key:key});\n\t\t});\n\n\t\tkeys.on('end', function() {\n\t\t\tdels.push.apply(dels, batch);\n\t\t\tdb.batch(dels, cb);\n\t\t});\n\t};\n\n\tWriteStream.prototype._writeBlock = function(cb) {\n\t\tvar block = this.blocks.length === 1 ? this.blocks[0] : Buffer.concat(this.blocks, this.blockLength - this.blockOffset);\n\t\tvar index = this.blockIndex;\n\t\tvar offset = this.blockOffset;\n\t\tvar self = this;\n\n\t\tthis.blockOffset = 0;\n\t\tthis.blockLength = 0;\n\t\tthis.blockIndex++;\n\t\tthis.blocks = [];\n\n\t\tvar key = this.name+'\\xff'+pad(index);\n\n\t\tvar append = function(block, force, cb) {\n\t\t\tif (block.length) {\n\t\t\t\tself.batch.push({\n\t\t\t\t\ttype: 'put',\n\t\t\t\t\tkey: key,\n\t\t\t\t\tvalue: block,\n\t\t\t\t\tvalueEncoding: ENCODER\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (!force && self.batch.length < maxBatch) return cb();\n\t\t\treturn self._flush(cb);\n\t\t};\n\n\t\tif (!offset && block.length === blockSize) return append(block, false, cb);\n\t\tif (!offset && !this.append) return append(block, false, cb);\n\n\t\t// partial write\n\t\tmutateBlock(key, offset, block, this.append, function(err, block, release) {\n\t\t\tif (err) return cb(err);\n\t\t\tappend(block, true, function(err) {\n\t\t\t\trelease();\n\t\t\t\tcb(err);\n\t\t\t});\n\t\t});\n\t};\n\n\tWriteStream.prototype._initAppend = function(data, enc, cb) {\n\t\tvar self = this;\n\t\tthis._shouldInitAppend = false;\n\t\tblobs.size(this.name, function(err, size) {\n\t\t\tif (err) return cb(err);\n\t\t\tself._init(size);\n\t\t\tself._write(data, enc, cb);\n\t\t});\n\t};\n\n\tWriteStream.prototype._write = function(data, enc, cb) {\n\t\tif (!data.length || this._destroyed) return cb();\n\t\tif (this._shouldInitAppend) return this._initAppend(data, enc, cb);\n\n\t\tvar self = this;\n\t\tvar overflow;\n\t\tvar free = blockSize - this.blockLength;\n\n\t\tvar done = function(err) {\n\t\t\tif (err) return cb(err);\n\t\t\tif (overflow) return self._write(overflow, enc, cb);\n\t\t\tcb();\n\t\t};\n\n\t\tif (data.length > free) {\n\t\t\toverflow = data.slice(free);\n\t\t\tdata = data.slice(0, free);\n\t\t}\n\n\t\tthis.bytesWritten += data.length;\n\t\tthis.blockLength += data.length;\n\t\tthis.blocks.push(data);\n\n\t\tif (data.length < free) return done();\n\t\tthis._writeBlock(done);\n\t};\n\n\tWriteStream.prototype.destroy = function() {\n\t\tif (this._destroyed) return;\n\t\tthis._destroyed = true;\n\t\tprocess.nextTick(this.emit.bind(this, 'close'));\n\t};\n\n\tWriteStream.prototype.end = function(data) {\n\t\tvar self = this;\n\t\tvar args = arguments;\n\n\t\tif (data && typeof data !== 'function') {\n\t\t\tthis.write(data);\n\t\t\tdata = EMPTY;\n\t\t}\n\n\t\tthis.write(EMPTY, function() {\n\t\t\tself._writeBlock(function(err) {\n\t\t\t\tif (err) return self.emit('error', err);\n\t\t\t\tself._flush(function(err) {\n\t\t\t\t\tif (err) return self.emit('error', err);\n\t\t\t\t\tWritable.prototype.end.apply(self, args);\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t};\n\n\tvar ReadStream = function(name, opts) {\n\t\tif (!opts) opts = {};\n\n\t\tvar self = this;\n\n\t\tvar start = opts.start || 0;\n\t\tvar blockIndex = (start / blockSize) | 0;\n\t\tvar blockOffset = start - blockIndex * blockSize;\n\t\tvar key = name+'\\xff'+pad(blockIndex);\n\n\t\tthis.name = name;\n\t\tthis._missing = (typeof opts.end === 'number' ? opts.end : Infinity) - start + 1;\n\t\tthis._paused = false;\n\t\tthis._destroyed = false;\n\n\t\tthis._reader = db.createReadStream({\n\t\t\tstart: key,\n\t\t\tend: name+'\\xff\\xff',\n\t\t\tvalueEncoding: ENCODER\n\t\t});\n\n\t\tvar onblock = function(val) {\n\t\t\tkey = name+'\\xff'+pad(++blockIndex);\n\n\t\t\tif (!self._missing) return false;\n\n\t\t\tif (blockOffset) {\n\t\t\t\tval = val.slice(blockOffset);\n\t\t\t\tblockOffset = 0;\n\t\t\t\tif (!val.length) return true;\n\t\t\t}\n\n\t\t\tif (val.length > self._missing) val = val.slice(0, self._missing);\n\n\t\t\tself._missing -= val.length;\n\t\t\tself._pause(!self.push(val));\n\n\t\t\treturn !!self._missing;\n\t\t};\n\n\t\tthis._reader.on('data', function(data) {\n\t\t\twhile (data.key > key) {\n\t\t\t\tif (!onblock(blank)) return;\n\t\t\t}\n\n\t\t\tonblock(data.value);\n\t\t});\n\n\t\tthis._reader.on('error', function(err) {\n\t\t\tself.emit('error', err);\n\t\t});\n\n\t\tthis._reader.on('end', function() {\n\t\t\tself.push(null);\n\t\t});\n\n\t\tReadable.call(this);\n\t};\n\n\tutil.inherits(ReadStream, Readable);\n\n\tReadStream.prototype.destroy = function() {\n\t\tif (this._destroyed) return;\n\t\tthis._destroyed = true;\n\t\tthis._reader.destroy();\n\t\tprocess.nextTick(this.emit.bind(this, 'close'));\n\t};\n\n\tReadStream.prototype._pause = function(paused) {\n\t\tif (this._paused === paused) return;\n\t\tthis._paused = paused;\n\t\tif (this._paused) this._reader.pause();\n\t\telse this._reader.resume();\n\t};\n\n\tReadStream.prototype._read = function() {\n\t\tthis._pause(false);\n\t};\n\n\tblobs.remove = function(name, cb) {\n\t\tcb = once(cb || noop);\n\n\t\tvar batch = [];\n\t\tvar keys = db.createKeyStream({\n\t\t\tstart: name+'\\xff',\n\t\t\tend: name+'\\xff\\xff'\n\t\t});\n\n\t\tkeys.on('error', cb);\n\n\t\tkeys.on('data', function(key) {\n\t\t\tbatch.push({type:'del', key:key});\n\t\t});\n\n\t\tkeys.on('end', function() {\n\t\t\tdb.batch(batch, cb);\n\t\t});\n\t};\n\n\tblobs.size = function(name, cb) {\n\t\tpeek.last(db, {\n\t\t\tstart: name+'\\xff',\n\t\t\tend: name+'\\xff\\xff',\n\t\t\tvalueEncoding:ENCODER\n\t\t}, function(err, latest, val) {\n\t\t\tif (err && err.message === 'range not found') return cb(null, 0);\n\t\t\tif (err) return cb(err);\n\t\t\tif (latest.slice(0, name.length+1) !== name+'\\xff') return cb(null, 0);\n\n\t\t\tcb(null, parseInt(latest.toString().slice(name.length+1), 16) * blockSize + val.length);\n\t\t});\n\t};\n\n\tblobs.write = function(name, data, opts, cb) {\n\t\tif (typeof opts === 'function') return blobs.write(name, data, null, opts);\n\t\tif (!opts) opts = {};\n\t\tif (!cb) cb = noop;\n\n\t\tvar ws = blobs.createWriteStream(name, opts);\n\n\t\tws.on('error', cb);\n\t\tws.on('finish', function() {\n\t\t\tcb();\n\t\t});\n\n\t\tws.write(data);\n\t\tws.end();\n\t}\n\n\tblobs.read = function(name, opts, cb) {\n\t\tif (typeof opts === 'function') return blobs.read(name, null, opts);\n\t\tif (!opts) opts = {};\n\n\t\tvar rs = blobs.createReadStream(name, opts);\n\t\tvar list = [];\n\n\t\trs.on('error', cb);\n\t\trs.on('data', function(data) {\n\t\t\tlist.push(data);\n\t\t});\n\t\trs.on('end', function() {\n\t\t\tcb(null, list.length === 1 ? list[0] : Buffer.concat(list));\n\t\t});\n\t};\n\n\tblobs.createReadStream = function(name, opts) {\n\t\treturn new ReadStream(name, opts);\n\t};\n\n\tblobs.createWriteStream = function(name, opts) {\n\t\treturn new WriteStream(name, opts);\n\t};\n\n\treturn blobs;\n};","module.exports = function (num, base) {\n return parseInt(num.toString(), base || 8)\n}\n","var errno = require('errno');\n\nObject.keys(errno.code).forEach(function(code) {\n\tvar e = errno.code[code];\n\n\texports[code] = function(path) {\n\t\tvar err = new Error(code+', '+e.description+(path ? ' \\''+path+'\\'' : ''));\n\t\terr.errno = e.errno;\n\t\terr.code = code;\n\t\terr.path = path;\n\t\treturn err;\n\t};\n});","/* eslint-disable node/no-deprecated-api */\n\nvar toString = Object.prototype.toString\n\nvar isModern = (\n typeof Buffer !== 'undefined' &&\n typeof Buffer.alloc === 'function' &&\n typeof Buffer.allocUnsafe === 'function' &&\n typeof Buffer.from === 'function'\n)\n\nfunction isArrayBuffer (input) {\n return toString.call(input).slice(8, -1) === 'ArrayBuffer'\n}\n\nfunction fromArrayBuffer (obj, byteOffset, length) {\n byteOffset >>>= 0\n\n var maxLength = obj.byteLength - byteOffset\n\n if (maxLength < 0) {\n throw new RangeError(\"'offset' is out of bounds\")\n }\n\n if (length === undefined) {\n length = maxLength\n } else {\n length >>>= 0\n\n if (length > maxLength) {\n throw new RangeError(\"'length' is out of bounds\")\n }\n }\n\n return isModern\n ? Buffer.from(obj.slice(byteOffset, byteOffset + length))\n : new Buffer(new Uint8Array(obj.slice(byteOffset, byteOffset + length)))\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n return isModern\n ? Buffer.from(string, encoding)\n : new Buffer(string, encoding)\n}\n\nfunction bufferFrom (value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (isArrayBuffer(value)) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n return isModern\n ? Buffer.from(value)\n : new Buffer(value)\n}\n\nmodule.exports = bufferFrom\n","var undefined = (void 0); // Paranoia\n\n// Beyond this value, index getters/setters (i.e. array[0], array[1]) are so slow to\n// create, and consume so much memory, that the browser appears frozen.\nvar MAX_ARRAY_LENGTH = 1e5;\n\n// Approximations of internal ECMAScript conversion functions\nvar ECMAScript = (function() {\n // Stash a copy in case other scripts modify these\n var opts = Object.prototype.toString,\n ophop = Object.prototype.hasOwnProperty;\n\n return {\n // Class returns internal [[Class]] property, used to avoid cross-frame instanceof issues:\n Class: function(v) { return opts.call(v).replace(/^\\[object *|\\]$/g, ''); },\n HasProperty: function(o, p) { return p in o; },\n HasOwnProperty: function(o, p) { return ophop.call(o, p); },\n IsCallable: function(o) { return typeof o === 'function'; },\n ToInt32: function(v) { return v >> 0; },\n ToUint32: function(v) { return v >>> 0; }\n };\n}());\n\n// Snapshot intrinsics\nvar LN2 = Math.LN2,\n abs = Math.abs,\n floor = Math.floor,\n log = Math.log,\n min = Math.min,\n pow = Math.pow,\n round = Math.round;\n\n// ES5: lock down object properties\nfunction configureProperties(obj) {\n if (getOwnPropNames && defineProp) {\n var props = getOwnPropNames(obj), i;\n for (i = 0; i < props.length; i += 1) {\n defineProp(obj, props[i], {\n value: obj[props[i]],\n writable: false,\n enumerable: false,\n configurable: false\n });\n }\n }\n}\n\n// emulate ES5 getter/setter API using legacy APIs\n// http://blogs.msdn.com/b/ie/archive/2010/09/07/transitioning-existing-code-to-the-es5-getter-setter-apis.aspx\n// (second clause tests for Object.defineProperty() in IE<9 that only supports extending DOM prototypes, but\n// note that IE<9 does not support __defineGetter__ or __defineSetter__ so it just renders the method harmless)\nvar defineProp\nif (Object.defineProperty && (function() {\n try {\n Object.defineProperty({}, 'x', {});\n return true;\n } catch (e) {\n return false;\n }\n })()) {\n defineProp = Object.defineProperty;\n} else {\n defineProp = function(o, p, desc) {\n if (!o === Object(o)) throw new TypeError(\"Object.defineProperty called on non-object\");\n if (ECMAScript.HasProperty(desc, 'get') && Object.prototype.__defineGetter__) { Object.prototype.__defineGetter__.call(o, p, desc.get); }\n if (ECMAScript.HasProperty(desc, 'set') && Object.prototype.__defineSetter__) { Object.prototype.__defineSetter__.call(o, p, desc.set); }\n if (ECMAScript.HasProperty(desc, 'value')) { o[p] = desc.value; }\n return o;\n };\n}\n\nvar getOwnPropNames = Object.getOwnPropertyNames || function (o) {\n if (o !== Object(o)) throw new TypeError(\"Object.getOwnPropertyNames called on non-object\");\n var props = [], p;\n for (p in o) {\n if (ECMAScript.HasOwnProperty(o, p)) {\n props.push(p);\n }\n }\n return props;\n};\n\n// ES5: Make obj[index] an alias for obj._getter(index)/obj._setter(index, value)\n// for index in 0 ... obj.length\nfunction makeArrayAccessors(obj) {\n if (!defineProp) { return; }\n\n if (obj.length > MAX_ARRAY_LENGTH) throw new RangeError(\"Array too large for polyfill\");\n\n function makeArrayAccessor(index) {\n defineProp(obj, index, {\n 'get': function() { return obj._getter(index); },\n 'set': function(v) { obj._setter(index, v); },\n enumerable: true,\n configurable: false\n });\n }\n\n var i;\n for (i = 0; i < obj.length; i += 1) {\n makeArrayAccessor(i);\n }\n}\n\n// Internal conversion functions:\n// pack() - take a number (interpreted as Type), output a byte array\n// unpack() - take a byte array, output a Type-like number\n\nfunction as_signed(value, bits) { var s = 32 - bits; return (value << s) >> s; }\nfunction as_unsigned(value, bits) { var s = 32 - bits; return (value << s) >>> s; }\n\nfunction packI8(n) { return [n & 0xff]; }\nfunction unpackI8(bytes) { return as_signed(bytes[0], 8); }\n\nfunction packU8(n) { return [n & 0xff]; }\nfunction unpackU8(bytes) { return as_unsigned(bytes[0], 8); }\n\nfunction packU8Clamped(n) { n = round(Number(n)); return [n < 0 ? 0 : n > 0xff ? 0xff : n & 0xff]; }\n\nfunction packI16(n) { return [(n >> 8) & 0xff, n & 0xff]; }\nfunction unpackI16(bytes) { return as_signed(bytes[0] << 8 | bytes[1], 16); }\n\nfunction packU16(n) { return [(n >> 8) & 0xff, n & 0xff]; }\nfunction unpackU16(bytes) { return as_unsigned(bytes[0] << 8 | bytes[1], 16); }\n\nfunction packI32(n) { return [(n >> 24) & 0xff, (n >> 16) & 0xff, (n >> 8) & 0xff, n & 0xff]; }\nfunction unpackI32(bytes) { return as_signed(bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], 32); }\n\nfunction packU32(n) { return [(n >> 24) & 0xff, (n >> 16) & 0xff, (n >> 8) & 0xff, n & 0xff]; }\nfunction unpackU32(bytes) { return as_unsigned(bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], 32); }\n\nfunction packIEEE754(v, ebits, fbits) {\n\n var bias = (1 << (ebits - 1)) - 1,\n s, e, f, ln,\n i, bits, str, bytes;\n\n function roundToEven(n) {\n var w = floor(n), f = n - w;\n if (f < 0.5)\n return w;\n if (f > 0.5)\n return w + 1;\n return w % 2 ? w + 1 : w;\n }\n\n // Compute sign, exponent, fraction\n if (v !== v) {\n // NaN\n // http://dev.w3.org/2006/webapi/WebIDL/#es-type-mapping\n e = (1 << ebits) - 1; f = pow(2, fbits - 1); s = 0;\n } else if (v === Infinity || v === -Infinity) {\n e = (1 << ebits) - 1; f = 0; s = (v < 0) ? 1 : 0;\n } else if (v === 0) {\n e = 0; f = 0; s = (1 / v === -Infinity) ? 1 : 0;\n } else {\n s = v < 0;\n v = abs(v);\n\n if (v >= pow(2, 1 - bias)) {\n e = min(floor(log(v) / LN2), 1023);\n f = roundToEven(v / pow(2, e) * pow(2, fbits));\n if (f / pow(2, fbits) >= 2) {\n e = e + 1;\n f = 1;\n }\n if (e > bias) {\n // Overflow\n e = (1 << ebits) - 1;\n f = 0;\n } else {\n // Normalized\n e = e + bias;\n f = f - pow(2, fbits);\n }\n } else {\n // Denormalized\n e = 0;\n f = roundToEven(v / pow(2, 1 - bias - fbits));\n }\n }\n\n // Pack sign, exponent, fraction\n bits = [];\n for (i = fbits; i; i -= 1) { bits.push(f % 2 ? 1 : 0); f = floor(f / 2); }\n for (i = ebits; i; i -= 1) { bits.push(e % 2 ? 1 : 0); e = floor(e / 2); }\n bits.push(s ? 1 : 0);\n bits.reverse();\n str = bits.join('');\n\n // Bits to bytes\n bytes = [];\n while (str.length) {\n bytes.push(parseInt(str.substring(0, 8), 2));\n str = str.substring(8);\n }\n return bytes;\n}\n\nfunction unpackIEEE754(bytes, ebits, fbits) {\n\n // Bytes to bits\n var bits = [], i, j, b, str,\n bias, s, e, f;\n\n for (i = bytes.length; i; i -= 1) {\n b = bytes[i - 1];\n for (j = 8; j; j -= 1) {\n bits.push(b % 2 ? 1 : 0); b = b >> 1;\n }\n }\n bits.reverse();\n str = bits.join('');\n\n // Unpack sign, exponent, fraction\n bias = (1 << (ebits - 1)) - 1;\n s = parseInt(str.substring(0, 1), 2) ? -1 : 1;\n e = parseInt(str.substring(1, 1 + ebits), 2);\n f = parseInt(str.substring(1 + ebits), 2);\n\n // Produce number\n if (e === (1 << ebits) - 1) {\n return f !== 0 ? NaN : s * Infinity;\n } else if (e > 0) {\n // Normalized\n return s * pow(2, e - bias) * (1 + f / pow(2, fbits));\n } else if (f !== 0) {\n // Denormalized\n return s * pow(2, -(bias - 1)) * (f / pow(2, fbits));\n } else {\n return s < 0 ? -0 : 0;\n }\n}\n\nfunction unpackF64(b) { return unpackIEEE754(b, 11, 52); }\nfunction packF64(v) { return packIEEE754(v, 11, 52); }\nfunction unpackF32(b) { return unpackIEEE754(b, 8, 23); }\nfunction packF32(v) { return packIEEE754(v, 8, 23); }\n\n\n//\n// 3 The ArrayBuffer Type\n//\n\n(function() {\n\n /** @constructor */\n var ArrayBuffer = function ArrayBuffer(length) {\n length = ECMAScript.ToInt32(length);\n if (length < 0) throw new RangeError('ArrayBuffer size is not a small enough positive integer');\n\n this.byteLength = length;\n this._bytes = [];\n this._bytes.length = length;\n\n var i;\n for (i = 0; i < this.byteLength; i += 1) {\n this._bytes[i] = 0;\n }\n\n configureProperties(this);\n };\n\n exports.ArrayBuffer = exports.ArrayBuffer || ArrayBuffer;\n\n //\n // 4 The ArrayBufferView Type\n //\n\n // NOTE: this constructor is not exported\n /** @constructor */\n var ArrayBufferView = function ArrayBufferView() {\n //this.buffer = null;\n //this.byteOffset = 0;\n //this.byteLength = 0;\n };\n\n //\n // 5 The Typed Array View Types\n //\n\n function makeConstructor(bytesPerElement, pack, unpack) {\n // Each TypedArray type requires a distinct constructor instance with\n // identical logic, which this produces.\n\n var ctor;\n ctor = function(buffer, byteOffset, length) {\n var array, sequence, i, s;\n\n if (!arguments.length || typeof arguments[0] === 'number') {\n // Constructor(unsigned long length)\n this.length = ECMAScript.ToInt32(arguments[0]);\n if (length < 0) throw new RangeError('ArrayBufferView size is not a small enough positive integer');\n\n this.byteLength = this.length * this.BYTES_PER_ELEMENT;\n this.buffer = new ArrayBuffer(this.byteLength);\n this.byteOffset = 0;\n } else if (typeof arguments[0] === 'object' && arguments[0].constructor === ctor) {\n // Constructor(TypedArray array)\n array = arguments[0];\n\n this.length = array.length;\n this.byteLength = this.length * this.BYTES_PER_ELEMENT;\n this.buffer = new ArrayBuffer(this.byteLength);\n this.byteOffset = 0;\n\n for (i = 0; i < this.length; i += 1) {\n this._setter(i, array._getter(i));\n }\n } else if (typeof arguments[0] === 'object' &&\n !(arguments[0] instanceof ArrayBuffer || ECMAScript.Class(arguments[0]) === 'ArrayBuffer')) {\n // Constructor(sequence array)\n sequence = arguments[0];\n\n this.length = ECMAScript.ToUint32(sequence.length);\n this.byteLength = this.length * this.BYTES_PER_ELEMENT;\n this.buffer = new ArrayBuffer(this.byteLength);\n this.byteOffset = 0;\n\n for (i = 0; i < this.length; i += 1) {\n s = sequence[i];\n this._setter(i, Number(s));\n }\n } else if (typeof arguments[0] === 'object' &&\n (arguments[0] instanceof ArrayBuffer || ECMAScript.Class(arguments[0]) === 'ArrayBuffer')) {\n // Constructor(ArrayBuffer buffer,\n // optional unsigned long byteOffset, optional unsigned long length)\n this.buffer = buffer;\n\n this.byteOffset = ECMAScript.ToUint32(byteOffset);\n if (this.byteOffset > this.buffer.byteLength) {\n throw new RangeError(\"byteOffset out of range\");\n }\n\n if (this.byteOffset % this.BYTES_PER_ELEMENT) {\n // The given byteOffset must be a multiple of the element\n // size of the specific type, otherwise an exception is raised.\n throw new RangeError(\"ArrayBuffer length minus the byteOffset is not a multiple of the element size.\");\n }\n\n if (arguments.length < 3) {\n this.byteLength = this.buffer.byteLength - this.byteOffset;\n\n if (this.byteLength % this.BYTES_PER_ELEMENT) {\n throw new RangeError(\"length of buffer minus byteOffset not a multiple of the element size\");\n }\n this.length = this.byteLength / this.BYTES_PER_ELEMENT;\n } else {\n this.length = ECMAScript.ToUint32(length);\n this.byteLength = this.length * this.BYTES_PER_ELEMENT;\n }\n\n if ((this.byteOffset + this.byteLength) > this.buffer.byteLength) {\n throw new RangeError(\"byteOffset and length reference an area beyond the end of the buffer\");\n }\n } else {\n throw new TypeError(\"Unexpected argument type(s)\");\n }\n\n this.constructor = ctor;\n\n configureProperties(this);\n makeArrayAccessors(this);\n };\n\n ctor.prototype = new ArrayBufferView();\n ctor.prototype.BYTES_PER_ELEMENT = bytesPerElement;\n ctor.prototype._pack = pack;\n ctor.prototype._unpack = unpack;\n ctor.BYTES_PER_ELEMENT = bytesPerElement;\n\n // getter type (unsigned long index);\n ctor.prototype._getter = function(index) {\n if (arguments.length < 1) throw new SyntaxError(\"Not enough arguments\");\n\n index = ECMAScript.ToUint32(index);\n if (index >= this.length) {\n return undefined;\n }\n\n var bytes = [], i, o;\n for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT;\n i < this.BYTES_PER_ELEMENT;\n i += 1, o += 1) {\n bytes.push(this.buffer._bytes[o]);\n }\n return this._unpack(bytes);\n };\n\n // NONSTANDARD: convenience alias for getter: type get(unsigned long index);\n ctor.prototype.get = ctor.prototype._getter;\n\n // setter void (unsigned long index, type value);\n ctor.prototype._setter = function(index, value) {\n if (arguments.length < 2) throw new SyntaxError(\"Not enough arguments\");\n\n index = ECMAScript.ToUint32(index);\n if (index >= this.length) {\n return undefined;\n }\n\n var bytes = this._pack(value), i, o;\n for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT;\n i < this.BYTES_PER_ELEMENT;\n i += 1, o += 1) {\n this.buffer._bytes[o] = bytes[i];\n }\n };\n\n // void set(TypedArray array, optional unsigned long offset);\n // void set(sequence array, optional unsigned long offset);\n ctor.prototype.set = function(index, value) {\n if (arguments.length < 1) throw new SyntaxError(\"Not enough arguments\");\n var array, sequence, offset, len,\n i, s, d,\n byteOffset, byteLength, tmp;\n\n if (typeof arguments[0] === 'object' && arguments[0].constructor === this.constructor) {\n // void set(TypedArray array, optional unsigned long offset);\n array = arguments[0];\n offset = ECMAScript.ToUint32(arguments[1]);\n\n if (offset + array.length > this.length) {\n throw new RangeError(\"Offset plus length of array is out of range\");\n }\n\n byteOffset = this.byteOffset + offset * this.BYTES_PER_ELEMENT;\n byteLength = array.length * this.BYTES_PER_ELEMENT;\n\n if (array.buffer === this.buffer) {\n tmp = [];\n for (i = 0, s = array.byteOffset; i < byteLength; i += 1, s += 1) {\n tmp[i] = array.buffer._bytes[s];\n }\n for (i = 0, d = byteOffset; i < byteLength; i += 1, d += 1) {\n this.buffer._bytes[d] = tmp[i];\n }\n } else {\n for (i = 0, s = array.byteOffset, d = byteOffset;\n i < byteLength; i += 1, s += 1, d += 1) {\n this.buffer._bytes[d] = array.buffer._bytes[s];\n }\n }\n } else if (typeof arguments[0] === 'object' && typeof arguments[0].length !== 'undefined') {\n // void set(sequence array, optional unsigned long offset);\n sequence = arguments[0];\n len = ECMAScript.ToUint32(sequence.length);\n offset = ECMAScript.ToUint32(arguments[1]);\n\n if (offset + len > this.length) {\n throw new RangeError(\"Offset plus length of array is out of range\");\n }\n\n for (i = 0; i < len; i += 1) {\n s = sequence[i];\n this._setter(offset + i, Number(s));\n }\n } else {\n throw new TypeError(\"Unexpected argument type(s)\");\n }\n };\n\n // TypedArray subarray(long begin, optional long end);\n ctor.prototype.subarray = function(start, end) {\n function clamp(v, min, max) { return v < min ? min : v > max ? max : v; }\n\n start = ECMAScript.ToInt32(start);\n end = ECMAScript.ToInt32(end);\n\n if (arguments.length < 1) { start = 0; }\n if (arguments.length < 2) { end = this.length; }\n\n if (start < 0) { start = this.length + start; }\n if (end < 0) { end = this.length + end; }\n\n start = clamp(start, 0, this.length);\n end = clamp(end, 0, this.length);\n\n var len = end - start;\n if (len < 0) {\n len = 0;\n }\n\n return new this.constructor(\n this.buffer, this.byteOffset + start * this.BYTES_PER_ELEMENT, len);\n };\n\n return ctor;\n }\n\n var Int8Array = makeConstructor(1, packI8, unpackI8);\n var Uint8Array = makeConstructor(1, packU8, unpackU8);\n var Uint8ClampedArray = makeConstructor(1, packU8Clamped, unpackU8);\n var Int16Array = makeConstructor(2, packI16, unpackI16);\n var Uint16Array = makeConstructor(2, packU16, unpackU16);\n var Int32Array = makeConstructor(4, packI32, unpackI32);\n var Uint32Array = makeConstructor(4, packU32, unpackU32);\n var Float32Array = makeConstructor(4, packF32, unpackF32);\n var Float64Array = makeConstructor(8, packF64, unpackF64);\n\n exports.Int8Array = exports.Int8Array || Int8Array;\n exports.Uint8Array = exports.Uint8Array || Uint8Array;\n exports.Uint8ClampedArray = exports.Uint8ClampedArray || Uint8ClampedArray;\n exports.Int16Array = exports.Int16Array || Int16Array;\n exports.Uint16Array = exports.Uint16Array || Uint16Array;\n exports.Int32Array = exports.Int32Array || Int32Array;\n exports.Uint32Array = exports.Uint32Array || Uint32Array;\n exports.Float32Array = exports.Float32Array || Float32Array;\n exports.Float64Array = exports.Float64Array || Float64Array;\n}());\n\n//\n// 6 The DataView View Type\n//\n\n(function() {\n function r(array, index) {\n return ECMAScript.IsCallable(array.get) ? array.get(index) : array[index];\n }\n\n var IS_BIG_ENDIAN = (function() {\n var u16array = new(exports.Uint16Array)([0x1234]),\n u8array = new(exports.Uint8Array)(u16array.buffer);\n return r(u8array, 0) === 0x12;\n }());\n\n // Constructor(ArrayBuffer buffer,\n // optional unsigned long byteOffset,\n // optional unsigned long byteLength)\n /** @constructor */\n var DataView = function DataView(buffer, byteOffset, byteLength) {\n if (arguments.length === 0) {\n buffer = new exports.ArrayBuffer(0);\n } else if (!(buffer instanceof exports.ArrayBuffer || ECMAScript.Class(buffer) === 'ArrayBuffer')) {\n throw new TypeError(\"TypeError\");\n }\n\n this.buffer = buffer || new exports.ArrayBuffer(0);\n\n this.byteOffset = ECMAScript.ToUint32(byteOffset);\n if (this.byteOffset > this.buffer.byteLength) {\n throw new RangeError(\"byteOffset out of range\");\n }\n\n if (arguments.length < 3) {\n this.byteLength = this.buffer.byteLength - this.byteOffset;\n } else {\n this.byteLength = ECMAScript.ToUint32(byteLength);\n }\n\n if ((this.byteOffset + this.byteLength) > this.buffer.byteLength) {\n throw new RangeError(\"byteOffset and length reference an area beyond the end of the buffer\");\n }\n\n configureProperties(this);\n };\n\n function makeGetter(arrayType) {\n return function(byteOffset, littleEndian) {\n\n byteOffset = ECMAScript.ToUint32(byteOffset);\n\n if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength) {\n throw new RangeError(\"Array index out of range\");\n }\n byteOffset += this.byteOffset;\n\n var uint8Array = new exports.Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT),\n bytes = [], i;\n for (i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1) {\n bytes.push(r(uint8Array, i));\n }\n\n if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN)) {\n bytes.reverse();\n }\n\n return r(new arrayType(new exports.Uint8Array(bytes).buffer), 0);\n };\n }\n\n DataView.prototype.getUint8 = makeGetter(exports.Uint8Array);\n DataView.prototype.getInt8 = makeGetter(exports.Int8Array);\n DataView.prototype.getUint16 = makeGetter(exports.Uint16Array);\n DataView.prototype.getInt16 = makeGetter(exports.Int16Array);\n DataView.prototype.getUint32 = makeGetter(exports.Uint32Array);\n DataView.prototype.getInt32 = makeGetter(exports.Int32Array);\n DataView.prototype.getFloat32 = makeGetter(exports.Float32Array);\n DataView.prototype.getFloat64 = makeGetter(exports.Float64Array);\n\n function makeSetter(arrayType) {\n return function(byteOffset, value, littleEndian) {\n\n byteOffset = ECMAScript.ToUint32(byteOffset);\n if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength) {\n throw new RangeError(\"Array index out of range\");\n }\n\n // Get bytes\n var typeArray = new arrayType([value]),\n byteArray = new exports.Uint8Array(typeArray.buffer),\n bytes = [], i, byteView;\n\n for (i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1) {\n bytes.push(r(byteArray, i));\n }\n\n // Flip if necessary\n if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN)) {\n bytes.reverse();\n }\n\n // Write them\n byteView = new exports.Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT);\n byteView.set(bytes);\n };\n }\n\n DataView.prototype.setUint8 = makeSetter(exports.Uint8Array);\n DataView.prototype.setInt8 = makeSetter(exports.Int8Array);\n DataView.prototype.setUint16 = makeSetter(exports.Uint16Array);\n DataView.prototype.setInt16 = makeSetter(exports.Int16Array);\n DataView.prototype.setUint32 = makeSetter(exports.Uint32Array);\n DataView.prototype.setInt32 = makeSetter(exports.Int32Array);\n DataView.prototype.setFloat32 = makeSetter(exports.Float32Array);\n DataView.prototype.setFloat64 = makeSetter(exports.Float64Array);\n\n exports.DataView = exports.DataView || DataView;\n\n}());\n","var Writable = require('readable-stream').Writable\nvar inherits = require('inherits')\nvar bufferFrom = require('buffer-from')\n\nif (typeof Uint8Array === 'undefined') {\n var U8 = require('typedarray').Uint8Array\n} else {\n var U8 = Uint8Array\n}\n\nfunction ConcatStream(opts, cb) {\n if (!(this instanceof ConcatStream)) return new ConcatStream(opts, cb)\n\n if (typeof opts === 'function') {\n cb = opts\n opts = {}\n }\n if (!opts) opts = {}\n\n var encoding = opts.encoding\n var shouldInferEncoding = false\n\n if (!encoding) {\n shouldInferEncoding = true\n } else {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'u8' || encoding === 'uint8') {\n encoding = 'uint8array'\n }\n }\n\n Writable.call(this, { objectMode: true })\n\n this.encoding = encoding\n this.shouldInferEncoding = shouldInferEncoding\n\n if (cb) this.on('finish', function () { cb(this.getBody()) })\n this.body = []\n}\n\nmodule.exports = ConcatStream\ninherits(ConcatStream, Writable)\n\nConcatStream.prototype._write = function(chunk, enc, next) {\n this.body.push(chunk)\n next()\n}\n\nConcatStream.prototype.inferEncoding = function (buff) {\n var firstBuffer = buff === undefined ? this.body[0] : buff;\n if (Buffer.isBuffer(firstBuffer)) return 'buffer'\n if (typeof Uint8Array !== 'undefined' && firstBuffer instanceof Uint8Array) return 'uint8array'\n if (Array.isArray(firstBuffer)) return 'array'\n if (typeof firstBuffer === 'string') return 'string'\n if (Object.prototype.toString.call(firstBuffer) === \"[object Object]\") return 'object'\n return 'buffer'\n}\n\nConcatStream.prototype.getBody = function () {\n if (!this.encoding && this.body.length === 0) return []\n if (this.shouldInferEncoding) this.encoding = this.inferEncoding()\n if (this.encoding === 'array') return arrayConcat(this.body)\n if (this.encoding === 'string') return stringConcat(this.body)\n if (this.encoding === 'buffer') return bufferConcat(this.body)\n if (this.encoding === 'uint8array') return u8Concat(this.body)\n return this.body\n}\n\nvar isArray = Array.isArray || function (arr) {\n return Object.prototype.toString.call(arr) == '[object Array]'\n}\n\nfunction isArrayish (arr) {\n return /Array\\]$/.test(Object.prototype.toString.call(arr))\n}\n\nfunction isBufferish (p) {\n return typeof p === 'string' || isArrayish(p) || (p && typeof p.subarray === 'function')\n}\n\nfunction stringConcat (parts) {\n var strings = []\n var needsToString = false\n for (var i = 0; i < parts.length; i++) {\n var p = parts[i]\n if (typeof p === 'string') {\n strings.push(p)\n } else if (Buffer.isBuffer(p)) {\n strings.push(p)\n } else if (isBufferish(p)) {\n strings.push(bufferFrom(p))\n } else {\n strings.push(bufferFrom(String(p)))\n }\n }\n if (Buffer.isBuffer(parts[0])) {\n strings = Buffer.concat(strings)\n strings = strings.toString('utf8')\n } else {\n strings = strings.join('')\n }\n return strings\n}\n\nfunction bufferConcat (parts) {\n var bufs = []\n for (var i = 0; i < parts.length; i++) {\n var p = parts[i]\n if (Buffer.isBuffer(p)) {\n bufs.push(p)\n } else if (isBufferish(p)) {\n bufs.push(bufferFrom(p))\n } else {\n bufs.push(bufferFrom(String(p)))\n }\n }\n return Buffer.concat(bufs)\n}\n\nfunction arrayConcat (parts) {\n var res = []\n for (var i = 0; i < parts.length; i++) {\n res.push.apply(res, parts[i])\n }\n return res\n}\n\nfunction u8Concat (parts) {\n var len = 0\n for (var i = 0; i < parts.length; i++) {\n if (typeof parts[i] === 'string') {\n parts[i] = bufferFrom(parts[i])\n }\n len += parts[i].length\n }\n var u8 = new U8(len)\n for (var i = 0, offset = 0; i < parts.length; i++) {\n var part = parts[i]\n for (var j = 0; j < part.length; j++) {\n u8[offset++] = part[j]\n }\n }\n return u8\n}\n","var toDate = function(date) {\n\tif (!date) return new Date();\n\tif (typeof date === 'string') return new Date(date);\n\treturn date;\n};\n\nvar Stat = function(opts) {\n\tthis.uid = opts.uid || 0;\n\tthis.gid = opts.gid || 0;\n\tthis.mode = opts.mode || 0;\n\tthis.size = opts.size || 0;\n\tthis.mtime = toDate(opts.mtime);\n\tthis.atime = toDate(opts.atime);\n\tthis.ctime = toDate(opts.ctime);\n\tthis.type = opts.type;\n\tthis.target = opts.target;\n\tthis.link = opts.link;\n\tthis.blob = opts.blob;\n};\n\nStat.prototype.isDirectory = function() {\n\treturn this.type === 'directory';\n};\n\nStat.prototype.isFile = function() {\n\treturn this.type === 'file';\n};\n\nStat.prototype.isBlockDevice = function() {\n\treturn false;\n};\n\nStat.prototype.isCharacterDevice = function() {\n\treturn false;\n};\n\nStat.prototype.isSymbolicLink = function() {\n\treturn this.type === 'symlink';\n};\n\nStat.prototype.isFIFO = function() {\n\treturn false;\n};\n\nStat.prototype.isSocket = function() {\n\treturn false;\n};\n\nmodule.exports = function(opts) {\n\treturn new Stat(opts);\n};","module.exports = hasKeys\n\nfunction hasKeys(source) {\n return source !== null &&\n (typeof source === \"object\" ||\n typeof source === \"function\")\n}\n","var hasKeys = require(\"./has-keys\")\n\nmodule.exports = extend\n\nfunction extend() {\n var target = {}\n\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i]\n\n if (!hasKeys(source)) {\n continue\n }\n\n for (var key in source) {\n if (source.hasOwnProperty(key)) {\n target[key] = source[key]\n }\n }\n }\n\n return target\n}\n","var path = require('path');\nvar once = require('once');\nvar concat = require('concat-stream');\nvar octal = require('octal')\nvar stat = require('./stat');\nvar xtend = require('xtend');\nvar errno = require('./errno');\n\nvar ROOT = stat({\n\ttype: 'directory',\n\tmode: octal(777),\n\tsize: 4096\n});\n\nvar normalize = function(key) {\n\tkey = key[0] === '/' ? key : '/' + key;\n\tkey = path.normalize(key);\n\tif (key === '/') return key;\n\treturn key[key.length-1] === '/' ? key.slice(0, -1) : key;\n};\n\nvar prefix = function(key) {\n\tvar depth = key.split('/').length.toString(36);\n\treturn '0000000000'.slice(depth.length)+depth+key;\n};\n\nmodule.exports = function(db) {\n\tvar that = {};\n\n\tthat.normalize = normalize;\n\n\tthat.get = function(key, cb) {\n\t\tkey = normalize(key);\n\t\tif (key === '/') return process.nextTick(cb.bind(null, null, ROOT, '/'));\n\t\tdb.get(prefix(key), {valueEncoding:'json'}, function(err, doc) {\n\t\t\tif (err && err.notFound) return cb(errno.ENOENT(key), null, key);\n\t\t\tif (err) return cb(err, null, key);\n\t\t\tcb(null, stat(doc), key);\n\t\t});\n\t};\n\n\tthat.writable = function(key, cb) {\n\t\tkey = normalize(key);\n\t\tif (key === '/') return process.nextTick(cb.bind(null, errno.EPERM(key)));\n\t\tthat.follow(path.dirname(key), function(err, parent) {\n\t\t\tif (err) return cb(err);\n\t\t\tif (!parent.isDirectory()) return cb(errno.ENOTDIR(key));\n\t\t\tcb(null, key);\n\t\t});\n\t};\n\n\tthat.list = function(key, cb) {\n\t\tkey = normalize(key);\n\n\t\tvar start = prefix(key === '/' ? key : key + '/');\n\t\tvar keys = db.createKeyStream({start: start, end: start+'\\xff'});\n\n\t\tcb = once(cb);\n\n\t\tkeys.on('error', cb);\n\t\tkeys.pipe(concat({encoding:'object'}, function(files) {\n\t\t\tfiles = files.map(function(file) {\n\t\t\t\treturn file.split('/').pop();\n\t\t\t});\n\n\t\t\tcb(null, files);\n\t\t}));\n\t};\n\n\tvar resolve = function(dir, cb) {\n\t\tvar root = '/';\n\t\tvar parts = dir.split('/').slice(1);\n\n\t\tvar loop = function() {\n\t\t\tthat.get(path.join(root, parts.shift()), function(err, doc, key) {\n\t\t\t\tif (err) return cb(err, doc, dir);\n\t\t\t\troot = doc.target || key;\n\t\t\t\tif (!parts.length) return cb(null, doc, key);\n\t\t\t\tloop();\n\t\t\t});\n\t\t};\n\n\t\tloop();\n\t};\n\n\tthat.follow = function(key, cb) {\n\t\tresolve(normalize(key), function loop(err, doc, key) {\n\t\t\tif (err) return cb(err, null, key);\n\t\t\tif (doc.target) return that.get(doc.target, loop);\n\t\t\tcb(null, stat(doc), key);\n\t\t});\n\t};\n\n\tthat.update = function(key, opts, cb) {\n\t\tthat.get(key, function(err, doc, key) {\n\t\t\tif (err) return cb(err);\n\t\t\tif (key === '/') return cb(errno.EPERM(key));\n\t\t\tthat.put(key, xtend(doc, opts), cb);\n\t\t});\n\t};\n\n\tthat.put = function(key, opts, cb) {\n\t\tthat.writable(key, function(err, key) {\n\t\t\tif (err) return cb(err);\n\t\t\tdb.put(prefix(key), stat(opts), {valueEncoding:'json'}, cb);\n\t\t});\n\t};\n\n\tthat.del = function(key, cb) {\n\t\tkey = normalize(key);\n\t\tif (key === '/') return process.nextTick(cb.bind(null, errno.EPERM(key)));\n\t\tdb.del(prefix(key), cb);\n\t};\n\n\treturn that;\n};\n","var events = require('events');\n\nmodule.exports = function() {\n\tvar listeners = {};\n\tvar that = new events.EventEmitter();\n\n\tthat.watch = function(key, cb) {\n\t\tif (!listeners[key]) {\n\t\t\tlisteners[key] = new events.EventEmitter();\n\t\t\tlisteners[key].setMaxListeners(0);\n\t\t}\n\n\t\tif (cb) listeners[key].on('change', cb);\n\t\treturn listeners[key];\n\t};\n\n\tthat.watcher = function(key, cb) {\n\t\tvar watcher = new events.EventEmitter();\n\t\tvar onchange = function() {\n\t\t\twatcher.emit('change', 'change', key);\n\t\t};\n\n\t\tthat.watch(key, onchange);\n\t\tif (cb) watcher.on('change', cb);\n\t\twatcher.close = function() {\n\t\t\tthat.unwatch(key, onchange);\n\t\t};\n\n\t\treturn watcher;\n\t};\n\n\tthat.unwatch = function(key, cb) {\n\t\tif (!listeners[key]) return;\n\t\tif (cb) listeners[key].removeListener('change', cb);\n\t\telse listeners[key].removeAllListeners('change');\n\t\tif (!listeners[key].listeners('change').length) delete listeners[key];;\n\t};\n\n\tthat.change = function(key) {\n\t\tif (listeners[key]) listeners[key].emit('change');\n\t\tthat.emit('change', key);\n\t};\n\n\tthat.cb = function(key, cb) {\n\t\treturn function(err, val) {\n\t\t\tif (key) that.change(key);\n\t\t\tif (cb) cb(err, val);\n\t\t};\n\t};\n\n\treturn that;\n};","var fwd = require('fwd-stream');\nvar sublevel = require('level-sublevel');\nvar blobs = require('level-blobs');\nvar peek = require('level-peek');\nvar once = require('once');\nvar octal = require('octal')\nvar errno = require('./errno');\nvar paths = require('./paths');\nvar watchers = require('./watchers');\n\nvar nextTick = function(cb, err, val) {\n\tprocess.nextTick(function() {\n\t\tcb(err, val);\n\t});\n};\n\nvar noop = function() {};\n\nmodule.exports = function(db, opts) {\n\tvar fs = {};\n\n\tdb = sublevel(db);\n\n\tvar bl = blobs(db.sublevel('blobs'), opts);\n\tvar ps = paths(db.sublevel('stats'));\n\tvar links = db.sublevel('links');\n\n\tvar listeners = watchers();\n\tvar fds = [];\n\n\tvar now = Date.now();\n\tvar inc = function() {\n\t\treturn ++now;\n\t};\n\n\tfs.mkdir = function(key, mode, cb) {\n\t\tif (typeof mode === 'function') return fs.mkdir(key, null, mode);\n\t\tif (!mode) mode = octal(777);\n\t\tif (!cb) cb = noop;\n\n\t\tps.follow(key, function(err, stat, key) {\n\t\t\tif (err && err.code !== 'ENOENT') return cb(err);\n\t\t\tif (stat) return cb(errno.EEXIST(key));\n\n\t\t\tps.put(key, {\n\t\t\t\ttype:'directory',\n\t\t\t\tmode: mode,\n\t\t\t\tsize: 4096\n\t\t\t}, listeners.cb(key, cb));\n\t\t});\n\t};\n\n\tfs.rmdir = function(key, cb) {\n\t\tif (!cb) cb = noop;\n\t\tps.follow(key, function(err, stat, key) {\n\t\t\tif (err) return cb(err);\n\t\t\tfs.readdir(key, function(err, files) {\n\t\t\t\tif (err) return cb(err);\n\t\t\t\tif (files.length) return cb(errno.ENOTEMPTY(key));\n\t\t\t\tps.del(key, listeners.cb(key, cb));\n\t\t\t});\n\t\t});\n\n\t};\n\n\tfs.readdir = function(key, cb) {\n\t\tps.follow(key, function(err, stat, key) {\n\t\t\tif (err) return cb(err);\n\t\t\tif (!stat) return cb(errno.ENOENT(key));\n\t\t\tif (!stat.isDirectory()) return cb(errno.ENOTDIR(key));\n\t\t\tps.list(key, cb);\n\t\t});\n\t};\n\n\tvar stat = function(key, lookup, cb) {\n\t\tlookup(key, function(err, stat, key) {\n\t\t\tif (err) return cb(err);\n\t\t\tif (!stat.isFile()) return cb(null, stat);\n\t\t\tvar blob = stat && stat.blob || key;\n\t\t\tbl.size(blob, function(err, size) {\n\t\t\t\tif (err) return cb(err);\n\t\t\t\tstat.size = size;\n\t\t\t\tcb(null, stat);\n\t\t\t});\n\t\t});\n\t};\n\n\tfs.stat = function(key, cb) {\n\t\tstat(key, ps.follow, cb);\n\t};\n\n\tfs.lstat = function(key, cb) {\n\t\tstat(key, ps.get, cb);\n\t};\n\n\tfs.exists = function(key, cb) {\n\t\tps.follow(key, function(err) {\n\t\t\tcb(!err);\n\t\t});\n\t};\n\n\tvar chmod = function(key, lookup, mode, cb) {\n\t\tif (!cb) cb = noop;\n\t\tlookup(key, function(err, stat, key) {\n\t\t\tif (err) return cb(err);\n\t\t\tps.update(key, {mode:mode}, listeners.cb(key, cb));\n\t\t});\n\t};\n\n\tfs.chmod = function(key, mode, cb) {\n\t\tchmod(key, ps.follow, mode, cb);\n\t};\n\n\tfs.lchmod = function(key, mode, cb) {\n\t\tchmod(key, ps.get, mode, cb);\n\t};\n\n\tvar chown = function(key, lookup, uid, gid, cb) {\n\t\tif (!cb) cb = noop;\n\t\tlookup(key, function(err, stat, key) {\n\t\t\tif (err) return cb(err);\n\t\t\tps.update(key, {uid:uid, gid:gid}, listeners.cb(key, cb));\n\t\t});\n\t};\n\n\tfs.chown = function(key, uid, gid, cb) {\n\t\tchown(key, ps.follow, uid, gid, cb);\n\t};\n\n\tfs.lchown = function(key, uid, gid, cb) {\n\t\tchown(key, ps.get, uid, gid, cb);\n\t};\n\n\tfs.utimes = function(key, atime, mtime, cb) {\n\t\tif (!cb) cb = noop;\n\t\tps.follow(key, function(err, stat, key) {\n\t\t\tif (err) return cb(err);\n\t\t\tvar upd = {};\n\t\t\tif (atime) upd.atime = atime;\n\t\t\tif (mtime) upd.mtime = mtime;\n\t\t\tps.update(key, upd, listeners.cb(key, cb));\n\t\t});\n\t};\n\n\tfs.rename = function(from, to, cb) {\n\t\tif (!cb) cb = noop;\n\n\t\tps.follow(from, function(err, statFrom, from) {\n\t\t\tif (err) return cb(err);\n\n\t\t\tvar rename = function() {\n\t\t\t\tcb = listeners.cb(to, listeners.cb(from, cb));\n\t\t\t\tps.put(to, statFrom, function(err) {\n\t\t\t\t\tif (err) return cb(err);\n\t\t\t\t\tps.del(from, cb);\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tps.follow(to, function(err, statTo, to) {\n\t\t\t\tif (err && err.code !== 'ENOENT') return cb(err);\n\t\t\t\tif (!statTo) return rename();\n\t\t\t\tif (statFrom.isDirectory() !== statTo.isDirectory()) return cb(errno.EISDIR(from));\n\n\t\t\t\tif (statTo.isDirectory()) {\n\t\t\t\t\tfs.readdir(to, function(err, list) {\n\t\t\t\t\t\tif (err) return cb(err);\n\t\t\t\t\t\tif (list.length) return cb(errno.ENOTEMPTY(from));\n\t\t\t\t\t\trename();\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\trename();\n\t\t\t});\n\t\t});\n\t};\n\n\tfs.realpath = function(key, cache, cb) {\n\t\tif (typeof cache === 'function') return fs.realpath(key, null, cache);\n\t\tps.follow(key, function(err, stat, key) {\n\t\t\tif (err) return cb(err);\n\t\t\tcb(null, key);\n\t\t});\n\t};\n\n\tfs.writeFile = function(key, data, opts, cb) {\n\t\tif (typeof opts === 'function') return fs.writeFile(key, data, null, opts);\n\t\tif (typeof opts === 'string') opts = {encoding:opts};\n\t\tif (!opts) opts = {};\n\t\tif (!cb) cb = noop;\n\n\t\tif (!Buffer.isBuffer(data)) data = new Buffer(data, opts.encoding || 'utf-8');\n\n\t\tvar flags = opts.flags || 'w';\n\t\topts.append = flags[0] !== 'w';\n\n\t\tps.follow(key, function(err, stat, key) {\n\t\t\tif (err && err.code !== 'ENOENT') return cb(err);\n\t\t\tif (stat && stat.isDirectory()) return cb(errno.EISDIR(key));\n\t\t\tif (stat && flags[1] === 'x') return cb(errno.EEXIST(key));\n\n\t\t\tvar blob = stat && stat.blob || key;\n\t\t\tps.writable(key, function(err) {\n\t\t\t\tif (err) return cb(err);\n\n\t\t\t\tbl.write(blob, data, opts, function(err) {\n\t\t\t\t\tif (err) return cb(err);\n\n\t\t\t\t\tps.put(key, {\n\t\t\t\t\t\tctime: stat && stat.ctime,\n\t\t\t\t\t\tmtime: new Date(),\n\t\t\t\t\t\tmode: opts.mode || octal(666),\n\t\t\t\t\t\ttype:'file'\n\t\t\t\t\t}, listeners.cb(key, cb));\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t};\n\n\tfs.appendFile = function(key, data, opts, cb) {\n\t\tif (typeof opts === 'function') return fs.appendFile(key, data, null, opts);\n\t\tif (typeof opts === 'string') opts = {encoding:opts};\n\t\tif (!opts) opts = {};\n\n\t\topts.flags = 'a';\n\t\tfs.writeFile(key, data, opts, cb);\n\t};\n\n\tfs.unlink = function(key, cb) {\n\t\tif (!cb) cb = noop;\n\n\t\tps.get(key, function(err, stat, key) {\n\t\t\tif (err) return cb(err);\n\t\t\tif (stat.isDirectory()) return cb(errno.EISDIR(key));\n\n\t\t\tvar clean = function(target) {\n\t\t\t\tpeek(links, {start:target+'\\xff', end:target+'\\xff\\xff'}, function(err) {\n\t\t\t\t\tif (err) return bl.remove(target, cb); // no more links\n\t\t\t\t\tcb();\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tvar onlink = function() {\n\t\t\t\tvar target = stat.link.slice(0, stat.link.indexOf('\\xff'));\n\t\t\t\tlinks.del(stat.link, function(err) {\n\t\t\t\t\tif (err) return cb(err);\n\t\t\t\t\tclean(target);\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tps.del(key, listeners.cb(key, function(err) {\n\t\t\t\tif (err) return cb(err);\n\t\t\t\tif (stat.link) return onlink();\n\t\t\t\tlinks.del(key+'\\xff', function(err) {\n\t\t\t\t\tif (err) return cb(err);\n\t\t\t\t\tclean(key);\n\t\t\t\t});\n\t\t\t}));\n\t\t});\n\t};\n\n\tfs.readFile = function(key, opts, cb) {\n\t\tif (typeof opts === 'function') return fs.readFile(key, null, opts);\n\t\tif (typeof opts === 'string') opts = {encoding:opts};\n\t\tif (!opts) opts = {};\n\n\t\tvar encoding = opts.encoding || 'binary';\n\t\tvar flag = opts.flag || 'r';\n\n\t\tps.follow(key, function(err, stat, key) {\n\t\t\tif (err) return cb(err);\n\t\t\tif (stat.isDirectory()) return cb(errno.EISDIR(key));\n\n\t\t\tvar blob = stat && stat.blob || key;\n\t\t\tbl.read(blob, function(err, data) {\n\t\t\t\tif (err) return cb(err);\n\t\t\t\tcb(null, opts.encoding ? data.toString(opts.encoding) : data);\n\t\t\t});\n\t\t});\n\t};\n\n\tfs.createReadStream = function(key, opts) {\n\t\tif (!opts) opts = {};\n\n\t\tvar closed = false;\n\t\tvar rs = fwd.readable(function(cb) {\n\t\t\tps.follow(key, function(err, stat, key) {\n\t\t\t\tif (err) return cb(err);\n\t\t\t\tif (stat.isDirectory()) return cb(errno.EISDIR(key));\n\n\t\t\t\tvar blob = stat && stat.blob || key;\n\t\t\t\tvar r = bl.createReadStream(blob, opts);\n\n\t\t\t\trs.emit('open');\n\t\t\t\tr.on('end', function() {\n\t\t\t\t\tprocess.nextTick(function() {\n\t\t\t\t\t\tif (!closed) rs.emit('close');\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tcb(null, r);\n\t\t\t});\n\t\t});\n\n\t\trs.on('close', function() {\n\t\t\tclosed = true;\n\t\t});\n\n\t\treturn rs;\n\t};\n\n\tfs.createWriteStream = function(key, opts) {\n\t\tif (!opts) opts = {};\n\n\t\tvar flags = opts.flags || 'w';\n\t\tvar closed = false;\n\t\tvar mode = opts.mode || octal(666);\n\n\t\topts.append = flags[0] === 'a';\n\n\t\tvar ws = fwd.writable(function(cb) {\n\t\t\tps.follow(key, function(err, stat, key) {\n\t\t\t\tif (err && err.code !== 'ENOENT') return cb(err);\n\t\t\t\tif (stat && stat.isDirectory()) return cb(errno.EISDIR(key));\n\t\t\t\tif (stat && flags[1] === 'x') return cb(errno.EEXIST(key));\n\n\t\t\t\tvar blob = stat && stat.blob || key;\n\t\t\t\tps.writable(blob, function(err) {\n\t\t\t\t\tif (err) return cb(err);\n\n\t\t\t\t\tvar ctime = stat ? stat.ctime : new Date();\n\t\t\t\t\tvar s = {\n\t\t\t\t\t\tctime: ctime,\n\t\t\t\t\t\tmtime: new Date(),\n\t\t\t\t\t\tmode: mode,\n\t\t\t\t\t\ttype:'file'\n\t\t\t\t\t};\n\n\t\t\t\t\tps.put(key, s, function(err) {\n\t\t\t\t\t\tif (err) return cb(err);\n\n\t\t\t\t\t\tvar w = bl.createWriteStream(blob, opts);\n\n\t\t\t\t\t\tws.emit('open');\n\t\t\t\t\t\tw.on('finish', function() {\n\t\t\t\t\t\t\ts.mtime = new Date();\n\t\t\t\t\t\t\tps.put(key, s, function() {\n\t\t\t\t\t\t\t\tlisteners.change(key);\n\t\t\t\t\t\t\t\tif (!closed) ws.emit('close');\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tcb(null, w);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tws.on('close', function() {\n\t\t\tclosed = true;\n\t\t});\n\n\t\treturn ws;\n\t};\n\n\tfs.truncate = function(key, len, cb) {\n\t\tps.follow(key, function(err, stat, key) {\n\t\t\tif (err) return cb(err);\n\n\t\t\tvar blob = stat && stat.blob || key;\n\t\t\tbl.size(blob, function(err, size) {\n\t\t\t\tif (err) return cb(err);\n\n\t\t\t\tps.writable(key, function(err) {\n\t\t\t\t\tif (err) return cb(err);\n\n\t\t\t\t\tcb = once(listeners.cb(key, cb));\n\t\t\t\t\tif (!len) return bl.remove(blob, cb);\n\n\t\t\t\t\tvar ws = bl.createWriteStream(blob, {\n\t\t\t\t\t\tstart:size < len ? len-1 : len\n\t\t\t\t\t});\n\n\t\t\t\t\tws.on('error', cb);\n\t\t\t\t\tws.on('finish', cb);\n\n\t\t\t\t\tif (size < len) ws.write(new Buffer([0]));\n\t\t\t\t\tws.end();\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t};\n\n\tfs.watchFile = function(key, opts, cb) {\n\t\tif (typeof opts === 'function') return fs.watchFile(key, null, opts);\n\t\treturn listeners.watch(ps.normalize(key), cb);\n\t};\n\n\tfs.unwatchFile = function(key, cb) {\n\t\tlisteners.unwatch(ps.normalize(key), cb);\n\t};\n\n\tfs.watch = function(key, opts, cb) {\n\t\tif (typeof opts === 'function') return fs.watch(key, null, opts)\n\t\treturn listeners.watcher(ps.normalize(key), cb);\n\t};\n\n\tfs.notify = function(cb) {\n\t\tlisteners.on('change', cb)\n\t}\n\n\tfs.open = function(key, flags, mode, cb) {\n\t\tif (typeof mode === 'function') return fs.open(key, flags, null, mode);\n\n\t\tps.follow(key, function(err, stat, key) {\n\t\t\tif (err && err.code !== 'ENOENT') return cb(err);\n\n\t\t\tvar fl = flags[0];\n\t\t\tvar plus = flags[1] === '+' || flags[2] === '+';\n\t\t\tvar blob = stat && stat.blob || key;\n\n\t\t\tvar f = {\n\t\t\t\tkey: key,\n\t\t\t\tblob: blob,\n\t\t\t\tmode: mode || octal(666),\n\t\t\t\treadable: fl === 'r' || ((fl === 'w' || fl === 'a') && plus),\n\t\t\t\twritable: fl === 'w' || fl === 'a' || (fl === 'r' && plus),\n\t\t\t\tappend: fl === 'a'\n\t\t\t};\n\n\t\t\tif (fl === 'r' && err) return cb(err);\n\t\t\tif (flags[1] === 'x' && stat) return cb(errno.EEXIST(key));\n\t\t\tif (stat && stat.isDirectory()) return cb(errno.EISDIR(key));\n\n\t\t\tbl.size(blob, function(err, size) {\n\t\t\t\tif (err) return cb(err);\n\n\t\t\t\tif (f.append) f.writePos = size;\n\n\t\t\t\tps.writable(key, function(err) {\n\t\t\t\t\tif (err) return cb(err);\n\n\t\t\t\t\tvar onready = function(err) {\n\t\t\t\t\t\tif (err) return cb(err);\n\n\t\t\t\t\t\tvar i = fds.indexOf(null);\n\t\t\t\t\t\tif (i === -1) i = 10+fds.push(fds.length+10)-1;\n\n\t\t\t\t\t\tf.fd = i;\n\t\t\t\t\t\tfds[i] = f;\n\t\t\t\t\t\tlisteners.change(key);\n\n\t\t\t\t\t\tcb(null, f.fd);\n\t\t\t\t\t};\n\n\t\t\t\t\tvar ontruncate = function(err) {\n\t\t\t\t\t\tif (err) return cb(err);\n\t\t\t\t\t\tif (stat) return onready();\n\t\t\t\t\t\tps.put(blob, {ctime:stat && stat.ctime, type:'file'}, onready);\n\t\t\t\t\t};\n\n\t\t\t\t\tif (!f.append && f.writable) return bl.remove(blob, ontruncate);\n\t\t\t\t\tontruncate();\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t};\n\n\tfs.close = function(fd, cb) {\n\t\tvar f = fds[fd];\n\t\tif (!f) return nextTick(cb, errno.EBADF());\n\n\t\tfds[fd] = null;\n\t\tnextTick(listeners.cb(f.key, cb));\n\t};\n\n\tfs.write = function(fd, buf, off, len, pos, cb) {\n\t\tvar f = fds[fd];\n\t\tif (!cb) cb = noop;\n\t\tif (!f || !f.writable) return nextTick(cb, errno.EBADF());\n\n\t\tif (pos === null) pos = f.writePos || 0;\n\n\t\tvar slice = buf.slice(off, off+len);\n\t\tf.writePos = pos + slice.length;\n\n\t\tbl.write(f.blob, slice, {start:pos, append:true}, function(err) {\n\t\t\tif (err) return cb(err);\n\t\t\tcb(null, len, buf);\n\t\t});\n\t};\n\n\tfs.read = function(fd, buf, off, len, pos, cb) {\n\t\tvar f = fds[fd];\n\t\tif (!cb) cb = noop;\n\t\tif (!f || !f.readable) return nextTick(cb, errno.EBADF());\n\n\t\tif (pos === null) pos = fs.readPos || 0;\n\n\t\tbl.read(f.blob, {start:pos, end:pos+len-1}, function(err, read) {\n\t\t\tif (err) return cb(err);\n\t\t\tvar slice = read.slice(0, len);\n\t\t\tslice.copy(buf, off);\n\t\t\tfs.readPos = pos+slice.length;\n\t\t\tcb(null, slice.length, buf);\n\t\t});\n\t};\n\n\tfs.fsync = function(fd, cb) {\n\t\tvar f = fds[fd];\n\t\tif (!cb) cb = noop;\n\t\tif (!f || !f.writable) return nextTick(cb, errno.EBADF());\n\n\t\tnextTick(cb);\n\t};\n\n\tfs.ftruncate = function(fd, len, cb) {\n\t\tvar f = fds[fd];\n\t\tif (!cb) cb = noop;\n\t\tif (!f) return nextTick(cb, errno.EBADF());\n\n\t\tfs.truncate(f.blob, len, cb);\n\t};\n\n\tfs.fchown = function(fd, uid, gid, cb) {\n\t\tvar f = fds[fd];\n\t\tif (!cb) cb = noop;\n\t\tif (!f) return nextTick(cb, errno.EBADF());\n\n\t\tfs.chown(f.key, uid, gid, cb);\n\t};\n\n\tfs.fchmod = function(fd, mode, cb) {\n\t\tvar f = fds[fd];\n\t\tif (!cb) cb = noop;\n\t\tif (!f) return nextTick(cb, errno.EBADF());\n\n\t\tfs.chmod(f.key, mode, cb);\n\t};\n\n\tfs.futimes = function(fd, atime, mtime, cb) {\n\t\tvar f = fds[fd];\n\t\tif (!cb) cb = noop;\n\t\tif (!f) return nextTick(cb, errno.EBADF());\n\n\t\tfs.utimes(f.key, atime, mtime, cb);\n\t};\n\n\tfs.fstat = function(fd, cb) {\n\t\tvar f = fds[fd];\n\t\tif (!f) return nextTick(cb, errno.EBADF());\n\n\t\tfs.stat(f.key, cb);\n\t};\n\n\tfs.symlink = function(target, name, cb) {\n\t\tif (!cb) cb = noop;\n\t\tps.follow(target, function(err, stat, target) {\n\t\t\tif (err) return cb(err);\n\t\t\tps.get(name, function(err, stat) {\n\t\t\t\tif (err && err.code !== 'ENOENT') return cb(err);\n\t\t\t\tif (stat) return cb(errno.EEXIST(name));\n\t\t\t\tps.put(name, {type:'symlink', target:target, mode:octal(777)}, cb);\n\t\t\t});\n\t\t});\n\t};\n\n\tfs.readlink = function(key, cb) {\n\t\tps.get(key, function(err, stat) {\n\t\t\tif (err) return cb(err);\n\t\t\tif (!stat.target) return cb(errno.EINVAL(key));\n\t\t\tcb(null, stat.target);\n\t\t});\n\t};\n\n\tfs.link = function(target, name, cb) {\n\t\tif (!cb) cb = noop;\n\t\tps.follow(target, function(err, stat, target) {\n\t\t\tif (err) return cb(err);\n\t\t\tif (!stat.isFile()) return cb(errno.EINVAL(target));\n\t\t\tps.get(name, function(err, st) {\n\t\t\t\tif (err && err.code !== 'ENOENT') return cb(err);\n\t\t\t\tif (st) return cb(errno.EEXIST(name));\n\t\t\t\tvar link = target+'\\xff'+inc();\n\t\t\t\tlinks.put(target+'\\xff', target, function(err) {\n\t\t\t\t\tif (err) return cb(err);\n\t\t\t\t\tlinks.put(link, target, function(err) {\n\t\t\t\t\t\tif (err) return cb(err);\n\t\t\t\t\t\tps.put(name, {type:'file', link:link, blob:target, mode:stat.mode}, cb);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t};\n\n\treturn fs;\n};\n","var leveljs = require('level-js');\nvar levelup = require('levelup');\nvar fs = require('level-filesystem');\n\nvar db = levelup('level-filesystem', {db:leveljs});\nmodule.exports = fs(db);","'use strict'\n\nlet { SourceMapConsumer, SourceMapGenerator } = require('source-map-js')\nlet { existsSync, readFileSync } = require('fs')\nlet { dirname, join } = require('path')\n\nfunction fromBase64(str) {\n if (Buffer) {\n return Buffer.from(str, 'base64').toString()\n } else {\n /* c8 ignore next 2 */\n return window.atob(str)\n }\n}\n\nclass PreviousMap {\n constructor(css, opts) {\n if (opts.map === false) return\n this.loadAnnotation(css)\n this.inline = this.startWith(this.annotation, 'data:')\n\n let prev = opts.map ? opts.map.prev : undefined\n let text = this.loadMap(opts.from, prev)\n if (!this.mapFile && opts.from) {\n this.mapFile = opts.from\n }\n if (this.mapFile) this.root = dirname(this.mapFile)\n if (text) this.text = text\n }\n\n consumer() {\n if (!this.consumerCache) {\n this.consumerCache = new SourceMapConsumer(this.text)\n }\n return this.consumerCache\n }\n\n decodeInline(text) {\n let baseCharsetUri = /^data:application\\/json;charset=utf-?8;base64,/\n let baseUri = /^data:application\\/json;base64,/\n let charsetUri = /^data:application\\/json;charset=utf-?8,/\n let uri = /^data:application\\/json,/\n\n if (charsetUri.test(text) || uri.test(text)) {\n return decodeURIComponent(text.substr(RegExp.lastMatch.length))\n }\n\n if (baseCharsetUri.test(text) || baseUri.test(text)) {\n return fromBase64(text.substr(RegExp.lastMatch.length))\n }\n\n let encoding = text.match(/data:application\\/json;([^,]+),/)[1]\n throw new Error('Unsupported source map encoding ' + encoding)\n }\n\n getAnnotationURL(sourceMapString) {\n return sourceMapString.replace(/^\\/\\*\\s*# sourceMappingURL=/, '').trim()\n }\n\n isMap(map) {\n if (typeof map !== 'object') return false\n return (\n typeof map.mappings === 'string' ||\n typeof map._mappings === 'string' ||\n Array.isArray(map.sections)\n )\n }\n\n loadAnnotation(css) {\n let comments = css.match(/\\/\\*\\s*# sourceMappingURL=/gm)\n if (!comments) return\n\n // sourceMappingURLs from comments, strings, etc.\n let start = css.lastIndexOf(comments.pop())\n let end = css.indexOf('*/', start)\n\n if (start > -1 && end > -1) {\n // Locate the last sourceMappingURL to avoid pickin\n this.annotation = this.getAnnotationURL(css.substring(start, end))\n }\n }\n\n loadFile(path) {\n this.root = dirname(path)\n if (existsSync(path)) {\n this.mapFile = path\n return readFileSync(path, 'utf-8').toString().trim()\n }\n }\n\n loadMap(file, prev) {\n if (prev === false) return false\n\n if (prev) {\n if (typeof prev === 'string') {\n return prev\n } else if (typeof prev === 'function') {\n let prevPath = prev(file)\n if (prevPath) {\n let map = this.loadFile(prevPath)\n if (!map) {\n throw new Error(\n 'Unable to load previous source map: ' + prevPath.toString()\n )\n }\n return map\n }\n } else if (prev instanceof SourceMapConsumer) {\n return SourceMapGenerator.fromSourceMap(prev).toString()\n } else if (prev instanceof SourceMapGenerator) {\n return prev.toString()\n } else if (this.isMap(prev)) {\n return JSON.stringify(prev)\n } else {\n throw new Error(\n 'Unsupported previous source map format: ' + prev.toString()\n )\n }\n } else if (this.inline) {\n return this.decodeInline(this.annotation)\n } else if (this.annotation) {\n let map = this.annotation\n if (file) map = join(dirname(file), map)\n return this.loadFile(map)\n }\n }\n\n startWith(string, start) {\n if (!string) return false\n return string.substr(0, start.length) === start\n }\n\n withContent() {\n return !!(\n this.consumer().sourcesContent &&\n this.consumer().sourcesContent.length > 0\n )\n }\n}\n\nmodule.exports = PreviousMap\nPreviousMap.default = PreviousMap\n","'use strict'\n\nlet { SourceMapConsumer, SourceMapGenerator } = require('source-map-js')\nlet { fileURLToPath, pathToFileURL } = require('url')\nlet { isAbsolute, resolve } = require('path')\nlet { nanoid } = require('nanoid/non-secure')\n\nlet terminalHighlight = require('./terminal-highlight')\nlet CssSyntaxError = require('./css-syntax-error')\nlet PreviousMap = require('./previous-map')\n\nlet fromOffsetCache = Symbol('fromOffsetCache')\n\nlet sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator)\nlet pathAvailable = Boolean(resolve && isAbsolute)\n\nclass Input {\n constructor(css, opts = {}) {\n if (\n css === null ||\n typeof css === 'undefined' ||\n (typeof css === 'object' && !css.toString)\n ) {\n throw new Error(`PostCSS received ${css} instead of CSS string`)\n }\n\n this.css = css.toString()\n\n if (this.css[0] === '\\uFEFF' || this.css[0] === '\\uFFFE') {\n this.hasBOM = true\n this.css = this.css.slice(1)\n } else {\n this.hasBOM = false\n }\n\n if (opts.from) {\n if (\n !pathAvailable ||\n /^\\w+:\\/\\//.test(opts.from) ||\n isAbsolute(opts.from)\n ) {\n this.file = opts.from\n } else {\n this.file = resolve(opts.from)\n }\n }\n\n if (pathAvailable && sourceMapAvailable) {\n let map = new PreviousMap(this.css, opts)\n if (map.text) {\n this.map = map\n let file = map.consumer().file\n if (!this.file && file) this.file = this.mapResolve(file)\n }\n }\n\n if (!this.file) {\n this.id = ''\n }\n if (this.map) this.map.file = this.from\n }\n\n error(message, line, column, opts = {}) {\n let result, endLine, endColumn\n\n if (line && typeof line === 'object') {\n let start = line\n let end = column\n if (typeof start.offset === 'number') {\n let pos = this.fromOffset(start.offset)\n line = pos.line\n column = pos.col\n } else {\n line = start.line\n column = start.column\n }\n if (typeof end.offset === 'number') {\n let pos = this.fromOffset(end.offset)\n endLine = pos.line\n endColumn = pos.col\n } else {\n endLine = end.line\n endColumn = end.column\n }\n } else if (!column) {\n let pos = this.fromOffset(line)\n line = pos.line\n column = pos.col\n }\n\n let origin = this.origin(line, column, endLine, endColumn)\n if (origin) {\n result = new CssSyntaxError(\n message,\n origin.endLine === undefined\n ? origin.line\n : { column: origin.column, line: origin.line },\n origin.endLine === undefined\n ? origin.column\n : { column: origin.endColumn, line: origin.endLine },\n origin.source,\n origin.file,\n opts.plugin\n )\n } else {\n result = new CssSyntaxError(\n message,\n endLine === undefined ? line : { column, line },\n endLine === undefined ? column : { column: endColumn, line: endLine },\n this.css,\n this.file,\n opts.plugin\n )\n }\n\n result.input = { column, endColumn, endLine, line, source: this.css }\n if (this.file) {\n if (pathToFileURL) {\n result.input.url = pathToFileURL(this.file).toString()\n }\n result.input.file = this.file\n }\n\n return result\n }\n\n fromOffset(offset) {\n let lastLine, lineToIndex\n if (!this[fromOffsetCache]) {\n let lines = this.css.split('\\n')\n lineToIndex = new Array(lines.length)\n let prevIndex = 0\n\n for (let i = 0, l = lines.length; i < l; i++) {\n lineToIndex[i] = prevIndex\n prevIndex += lines[i].length + 1\n }\n\n this[fromOffsetCache] = lineToIndex\n } else {\n lineToIndex = this[fromOffsetCache]\n }\n lastLine = lineToIndex[lineToIndex.length - 1]\n\n let min = 0\n if (offset >= lastLine) {\n min = lineToIndex.length - 1\n } else {\n let max = lineToIndex.length - 2\n let mid\n while (min < max) {\n mid = min + ((max - min) >> 1)\n if (offset < lineToIndex[mid]) {\n max = mid - 1\n } else if (offset >= lineToIndex[mid + 1]) {\n min = mid + 1\n } else {\n min = mid\n break\n }\n }\n }\n return {\n col: offset - lineToIndex[min] + 1,\n line: min + 1\n }\n }\n\n mapResolve(file) {\n if (/^\\w+:\\/\\//.test(file)) {\n return file\n }\n return resolve(this.map.consumer().sourceRoot || this.map.root || '.', file)\n }\n\n origin(line, column, endLine, endColumn) {\n if (!this.map) return false\n let consumer = this.map.consumer()\n\n let from = consumer.originalPositionFor({ column, line })\n if (!from.source) return false\n\n let to\n if (typeof endLine === 'number') {\n to = consumer.originalPositionFor({ column: endColumn, line: endLine })\n }\n\n let fromUrl\n\n if (isAbsolute(from.source)) {\n fromUrl = pathToFileURL(from.source)\n } else {\n fromUrl = new URL(\n from.source,\n this.map.consumer().sourceRoot || pathToFileURL(this.map.mapFile)\n )\n }\n\n let result = {\n column: from.column,\n endColumn: to && to.column,\n endLine: to && to.line,\n line: from.line,\n url: fromUrl.toString()\n }\n\n if (fromUrl.protocol === 'file:') {\n if (fileURLToPath) {\n result.file = fileURLToPath(fromUrl)\n } else {\n /* c8 ignore next 2 */\n throw new Error(`file: protocol is not available in this PostCSS build`)\n }\n }\n\n let source = consumer.sourceContentFor(from.source)\n if (source) result.source = source\n\n return result\n }\n\n toJSON() {\n let json = {}\n for (let name of ['hasBOM', 'css', 'file', 'id']) {\n if (this[name] != null) {\n json[name] = this[name]\n }\n }\n if (this.map) {\n json.map = { ...this.map }\n if (json.map.consumerCache) {\n json.map.consumerCache = undefined\n }\n }\n return json\n }\n\n get from() {\n return this.file || this.id\n }\n}\n\nmodule.exports = Input\nInput.default = Input\n\nif (terminalHighlight && terminalHighlight.registerInput) {\n terminalHighlight.registerInput(Input)\n}\n","'use strict'\n\nlet { SourceMapConsumer, SourceMapGenerator } = require('source-map-js')\nlet { dirname, relative, resolve, sep } = require('path')\nlet { pathToFileURL } = require('url')\n\nlet Input = require('./input')\n\nlet sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator)\nlet pathAvailable = Boolean(dirname && resolve && relative && sep)\n\nclass MapGenerator {\n constructor(stringify, root, opts, cssString) {\n this.stringify = stringify\n this.mapOpts = opts.map || {}\n this.root = root\n this.opts = opts\n this.css = cssString\n this.originalCSS = cssString\n this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute\n\n this.memoizedFileURLs = new Map()\n this.memoizedPaths = new Map()\n this.memoizedURLs = new Map()\n }\n\n addAnnotation() {\n let content\n\n if (this.isInline()) {\n content =\n 'data:application/json;base64,' + this.toBase64(this.map.toString())\n } else if (typeof this.mapOpts.annotation === 'string') {\n content = this.mapOpts.annotation\n } else if (typeof this.mapOpts.annotation === 'function') {\n content = this.mapOpts.annotation(this.opts.to, this.root)\n } else {\n content = this.outputFile() + '.map'\n }\n let eol = '\\n'\n if (this.css.includes('\\r\\n')) eol = '\\r\\n'\n\n this.css += eol + '/*# sourceMappingURL=' + content + ' */'\n }\n\n applyPrevMaps() {\n for (let prev of this.previous()) {\n let from = this.toUrl(this.path(prev.file))\n let root = prev.root || dirname(prev.file)\n let map\n\n if (this.mapOpts.sourcesContent === false) {\n map = new SourceMapConsumer(prev.text)\n if (map.sourcesContent) {\n map.sourcesContent = null\n }\n } else {\n map = prev.consumer()\n }\n\n this.map.applySourceMap(map, from, this.toUrl(this.path(root)))\n }\n }\n\n clearAnnotation() {\n if (this.mapOpts.annotation === false) return\n\n if (this.root) {\n let node\n for (let i = this.root.nodes.length - 1; i >= 0; i--) {\n node = this.root.nodes[i]\n if (node.type !== 'comment') continue\n if (node.text.indexOf('# sourceMappingURL=') === 0) {\n this.root.removeChild(i)\n }\n }\n } else if (this.css) {\n this.css = this.css.replace(/\\n*?\\/\\*#[\\S\\s]*?\\*\\/$/gm, '')\n }\n }\n\n generate() {\n this.clearAnnotation()\n if (pathAvailable && sourceMapAvailable && this.isMap()) {\n return this.generateMap()\n } else {\n let result = ''\n this.stringify(this.root, i => {\n result += i\n })\n return [result]\n }\n }\n\n generateMap() {\n if (this.root) {\n this.generateString()\n } else if (this.previous().length === 1) {\n let prev = this.previous()[0].consumer()\n prev.file = this.outputFile()\n this.map = SourceMapGenerator.fromSourceMap(prev, {\n ignoreInvalidMapping: true\n })\n } else {\n this.map = new SourceMapGenerator({\n file: this.outputFile(),\n ignoreInvalidMapping: true\n })\n this.map.addMapping({\n generated: { column: 0, line: 1 },\n original: { column: 0, line: 1 },\n source: this.opts.from\n ? this.toUrl(this.path(this.opts.from))\n : ''\n })\n }\n\n if (this.isSourcesContent()) this.setSourcesContent()\n if (this.root && this.previous().length > 0) this.applyPrevMaps()\n if (this.isAnnotation()) this.addAnnotation()\n\n if (this.isInline()) {\n return [this.css]\n } else {\n return [this.css, this.map]\n }\n }\n\n generateString() {\n this.css = ''\n this.map = new SourceMapGenerator({\n file: this.outputFile(),\n ignoreInvalidMapping: true\n })\n\n let line = 1\n let column = 1\n\n let noSource = ''\n let mapping = {\n generated: { column: 0, line: 0 },\n original: { column: 0, line: 0 },\n source: ''\n }\n\n let lines, last\n this.stringify(this.root, (str, node, type) => {\n this.css += str\n\n if (node && type !== 'end') {\n mapping.generated.line = line\n mapping.generated.column = column - 1\n if (node.source && node.source.start) {\n mapping.source = this.sourcePath(node)\n mapping.original.line = node.source.start.line\n mapping.original.column = node.source.start.column - 1\n this.map.addMapping(mapping)\n } else {\n mapping.source = noSource\n mapping.original.line = 1\n mapping.original.column = 0\n this.map.addMapping(mapping)\n }\n }\n\n lines = str.match(/\\n/g)\n if (lines) {\n line += lines.length\n last = str.lastIndexOf('\\n')\n column = str.length - last\n } else {\n column += str.length\n }\n\n if (node && type !== 'start') {\n let p = node.parent || { raws: {} }\n let childless =\n node.type === 'decl' || (node.type === 'atrule' && !node.nodes)\n if (!childless || node !== p.last || p.raws.semicolon) {\n if (node.source && node.source.end) {\n mapping.source = this.sourcePath(node)\n mapping.original.line = node.source.end.line\n mapping.original.column = node.source.end.column - 1\n mapping.generated.line = line\n mapping.generated.column = column - 2\n this.map.addMapping(mapping)\n } else {\n mapping.source = noSource\n mapping.original.line = 1\n mapping.original.column = 0\n mapping.generated.line = line\n mapping.generated.column = column - 1\n this.map.addMapping(mapping)\n }\n }\n }\n })\n }\n\n isAnnotation() {\n if (this.isInline()) {\n return true\n }\n if (typeof this.mapOpts.annotation !== 'undefined') {\n return this.mapOpts.annotation\n }\n if (this.previous().length) {\n return this.previous().some(i => i.annotation)\n }\n return true\n }\n\n isInline() {\n if (typeof this.mapOpts.inline !== 'undefined') {\n return this.mapOpts.inline\n }\n\n let annotation = this.mapOpts.annotation\n if (typeof annotation !== 'undefined' && annotation !== true) {\n return false\n }\n\n if (this.previous().length) {\n return this.previous().some(i => i.inline)\n }\n return true\n }\n\n isMap() {\n if (typeof this.opts.map !== 'undefined') {\n return !!this.opts.map\n }\n return this.previous().length > 0\n }\n\n isSourcesContent() {\n if (typeof this.mapOpts.sourcesContent !== 'undefined') {\n return this.mapOpts.sourcesContent\n }\n if (this.previous().length) {\n return this.previous().some(i => i.withContent())\n }\n return true\n }\n\n outputFile() {\n if (this.opts.to) {\n return this.path(this.opts.to)\n } else if (this.opts.from) {\n return this.path(this.opts.from)\n } else {\n return 'to.css'\n }\n }\n\n path(file) {\n if (this.mapOpts.absolute) return file\n if (file.charCodeAt(0) === 60 /* `<` */) return file\n if (/^\\w+:\\/\\//.test(file)) return file\n let cached = this.memoizedPaths.get(file)\n if (cached) return cached\n\n let from = this.opts.to ? dirname(this.opts.to) : '.'\n\n if (typeof this.mapOpts.annotation === 'string') {\n from = dirname(resolve(from, this.mapOpts.annotation))\n }\n\n let path = relative(from, file)\n this.memoizedPaths.set(file, path)\n\n return path\n }\n\n previous() {\n if (!this.previousMaps) {\n this.previousMaps = []\n if (this.root) {\n this.root.walk(node => {\n if (node.source && node.source.input.map) {\n let map = node.source.input.map\n if (!this.previousMaps.includes(map)) {\n this.previousMaps.push(map)\n }\n }\n })\n } else {\n let input = new Input(this.originalCSS, this.opts)\n if (input.map) this.previousMaps.push(input.map)\n }\n }\n\n return this.previousMaps\n }\n\n setSourcesContent() {\n let already = {}\n if (this.root) {\n this.root.walk(node => {\n if (node.source) {\n let from = node.source.input.from\n if (from && !already[from]) {\n already[from] = true\n let fromUrl = this.usesFileUrls\n ? this.toFileUrl(from)\n : this.toUrl(this.path(from))\n this.map.setSourceContent(fromUrl, node.source.input.css)\n }\n }\n })\n } else if (this.css) {\n let from = this.opts.from\n ? this.toUrl(this.path(this.opts.from))\n : ''\n this.map.setSourceContent(from, this.css)\n }\n }\n\n sourcePath(node) {\n if (this.mapOpts.from) {\n return this.toUrl(this.mapOpts.from)\n } else if (this.usesFileUrls) {\n return this.toFileUrl(node.source.input.from)\n } else {\n return this.toUrl(this.path(node.source.input.from))\n }\n }\n\n toBase64(str) {\n if (Buffer) {\n return Buffer.from(str).toString('base64')\n } else {\n return window.btoa(unescape(encodeURIComponent(str)))\n }\n }\n\n toFileUrl(path) {\n let cached = this.memoizedFileURLs.get(path)\n if (cached) return cached\n\n if (pathToFileURL) {\n let fileURL = pathToFileURL(path).toString()\n this.memoizedFileURLs.set(path, fileURL)\n\n return fileURL\n } else {\n throw new Error(\n '`map.absolute` option is not available in this PostCSS build'\n )\n }\n }\n\n toUrl(path) {\n let cached = this.memoizedURLs.get(path)\n if (cached) return cached\n\n if (sep === '\\\\') {\n path = path.replace(/\\\\/g, '/')\n }\n\n let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent)\n this.memoizedURLs.set(path, url)\n\n return url\n }\n}\n\nmodule.exports = MapGenerator\n","'use strict'\n\nlet Node = require('./node')\n\nclass Comment extends Node {\n constructor(defaults) {\n super(defaults)\n this.type = 'comment'\n }\n}\n\nmodule.exports = Comment\nComment.default = Comment\n","'use strict'\n\nlet { isClean, my } = require('./symbols')\nlet Declaration = require('./declaration')\nlet Comment = require('./comment')\nlet Node = require('./node')\n\nlet parse, Rule, AtRule, Root\n\nfunction cleanSource(nodes) {\n return nodes.map(i => {\n if (i.nodes) i.nodes = cleanSource(i.nodes)\n delete i.source\n return i\n })\n}\n\nfunction markDirtyUp(node) {\n node[isClean] = false\n if (node.proxyOf.nodes) {\n for (let i of node.proxyOf.nodes) {\n markDirtyUp(i)\n }\n }\n}\n\nclass Container extends Node {\n append(...children) {\n for (let child of children) {\n let nodes = this.normalize(child, this.last)\n for (let node of nodes) this.proxyOf.nodes.push(node)\n }\n\n this.markDirty()\n\n return this\n }\n\n cleanRaws(keepBetween) {\n super.cleanRaws(keepBetween)\n if (this.nodes) {\n for (let node of this.nodes) node.cleanRaws(keepBetween)\n }\n }\n\n each(callback) {\n if (!this.proxyOf.nodes) return undefined\n let iterator = this.getIterator()\n\n let index, result\n while (this.indexes[iterator] < this.proxyOf.nodes.length) {\n index = this.indexes[iterator]\n result = callback(this.proxyOf.nodes[index], index)\n if (result === false) break\n\n this.indexes[iterator] += 1\n }\n\n delete this.indexes[iterator]\n return result\n }\n\n every(condition) {\n return this.nodes.every(condition)\n }\n\n getIterator() {\n if (!this.lastEach) this.lastEach = 0\n if (!this.indexes) this.indexes = {}\n\n this.lastEach += 1\n let iterator = this.lastEach\n this.indexes[iterator] = 0\n\n return iterator\n }\n\n getProxyProcessor() {\n return {\n get(node, prop) {\n if (prop === 'proxyOf') {\n return node\n } else if (!node[prop]) {\n return node[prop]\n } else if (\n prop === 'each' ||\n (typeof prop === 'string' && prop.startsWith('walk'))\n ) {\n return (...args) => {\n return node[prop](\n ...args.map(i => {\n if (typeof i === 'function') {\n return (child, index) => i(child.toProxy(), index)\n } else {\n return i\n }\n })\n )\n }\n } else if (prop === 'every' || prop === 'some') {\n return cb => {\n return node[prop]((child, ...other) =>\n cb(child.toProxy(), ...other)\n )\n }\n } else if (prop === 'root') {\n return () => node.root().toProxy()\n } else if (prop === 'nodes') {\n return node.nodes.map(i => i.toProxy())\n } else if (prop === 'first' || prop === 'last') {\n return node[prop].toProxy()\n } else {\n return node[prop]\n }\n },\n\n set(node, prop, value) {\n if (node[prop] === value) return true\n node[prop] = value\n if (prop === 'name' || prop === 'params' || prop === 'selector') {\n node.markDirty()\n }\n return true\n }\n }\n }\n\n index(child) {\n if (typeof child === 'number') return child\n if (child.proxyOf) child = child.proxyOf\n return this.proxyOf.nodes.indexOf(child)\n }\n\n insertAfter(exist, add) {\n let existIndex = this.index(exist)\n let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse()\n existIndex = this.index(exist)\n for (let node of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node)\n\n let index\n for (let id in this.indexes) {\n index = this.indexes[id]\n if (existIndex < index) {\n this.indexes[id] = index + nodes.length\n }\n }\n\n this.markDirty()\n\n return this\n }\n\n insertBefore(exist, add) {\n let existIndex = this.index(exist)\n let type = existIndex === 0 ? 'prepend' : false\n let nodes = this.normalize(add, this.proxyOf.nodes[existIndex], type).reverse()\n existIndex = this.index(exist)\n for (let node of nodes) this.proxyOf.nodes.splice(existIndex, 0, node)\n\n let index\n for (let id in this.indexes) {\n index = this.indexes[id]\n if (existIndex <= index) {\n this.indexes[id] = index + nodes.length\n }\n }\n\n this.markDirty()\n\n return this\n }\n\n normalize(nodes, sample) {\n if (typeof nodes === 'string') {\n nodes = cleanSource(parse(nodes).nodes)\n } else if (typeof nodes === 'undefined') {\n nodes = []\n } else if (Array.isArray(nodes)) {\n nodes = nodes.slice(0)\n for (let i of nodes) {\n if (i.parent) i.parent.removeChild(i, 'ignore')\n }\n } else if (nodes.type === 'root' && this.type !== 'document') {\n nodes = nodes.nodes.slice(0)\n for (let i of nodes) {\n if (i.parent) i.parent.removeChild(i, 'ignore')\n }\n } else if (nodes.type) {\n nodes = [nodes]\n } else if (nodes.prop) {\n if (typeof nodes.value === 'undefined') {\n throw new Error('Value field is missed in node creation')\n } else if (typeof nodes.value !== 'string') {\n nodes.value = String(nodes.value)\n }\n nodes = [new Declaration(nodes)]\n } else if (nodes.selector) {\n nodes = [new Rule(nodes)]\n } else if (nodes.name) {\n nodes = [new AtRule(nodes)]\n } else if (nodes.text) {\n nodes = [new Comment(nodes)]\n } else {\n throw new Error('Unknown node type in node creation')\n }\n\n let processed = nodes.map(i => {\n /* c8 ignore next */\n if (!i[my]) Container.rebuild(i)\n i = i.proxyOf\n if (i.parent) i.parent.removeChild(i)\n if (i[isClean]) markDirtyUp(i)\n if (typeof i.raws.before === 'undefined') {\n if (sample && typeof sample.raws.before !== 'undefined') {\n i.raws.before = sample.raws.before.replace(/\\S/g, '')\n }\n }\n i.parent = this.proxyOf\n return i\n })\n\n return processed\n }\n\n prepend(...children) {\n children = children.reverse()\n for (let child of children) {\n let nodes = this.normalize(child, this.first, 'prepend').reverse()\n for (let node of nodes) this.proxyOf.nodes.unshift(node)\n for (let id in this.indexes) {\n this.indexes[id] = this.indexes[id] + nodes.length\n }\n }\n\n this.markDirty()\n\n return this\n }\n\n push(child) {\n child.parent = this\n this.proxyOf.nodes.push(child)\n return this\n }\n\n removeAll() {\n for (let node of this.proxyOf.nodes) node.parent = undefined\n this.proxyOf.nodes = []\n\n this.markDirty()\n\n return this\n }\n\n removeChild(child) {\n child = this.index(child)\n this.proxyOf.nodes[child].parent = undefined\n this.proxyOf.nodes.splice(child, 1)\n\n let index\n for (let id in this.indexes) {\n index = this.indexes[id]\n if (index >= child) {\n this.indexes[id] = index - 1\n }\n }\n\n this.markDirty()\n\n return this\n }\n\n replaceValues(pattern, opts, callback) {\n if (!callback) {\n callback = opts\n opts = {}\n }\n\n this.walkDecls(decl => {\n if (opts.props && !opts.props.includes(decl.prop)) return\n if (opts.fast && !decl.value.includes(opts.fast)) return\n\n decl.value = decl.value.replace(pattern, callback)\n })\n\n this.markDirty()\n\n return this\n }\n\n some(condition) {\n return this.nodes.some(condition)\n }\n\n walk(callback) {\n return this.each((child, i) => {\n let result\n try {\n result = callback(child, i)\n } catch (e) {\n throw child.addToError(e)\n }\n if (result !== false && child.walk) {\n result = child.walk(callback)\n }\n\n return result\n })\n }\n\n walkAtRules(name, callback) {\n if (!callback) {\n callback = name\n return this.walk((child, i) => {\n if (child.type === 'atrule') {\n return callback(child, i)\n }\n })\n }\n if (name instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === 'atrule' && name.test(child.name)) {\n return callback(child, i)\n }\n })\n }\n return this.walk((child, i) => {\n if (child.type === 'atrule' && child.name === name) {\n return callback(child, i)\n }\n })\n }\n\n walkComments(callback) {\n return this.walk((child, i) => {\n if (child.type === 'comment') {\n return callback(child, i)\n }\n })\n }\n\n walkDecls(prop, callback) {\n if (!callback) {\n callback = prop\n return this.walk((child, i) => {\n if (child.type === 'decl') {\n return callback(child, i)\n }\n })\n }\n if (prop instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === 'decl' && prop.test(child.prop)) {\n return callback(child, i)\n }\n })\n }\n return this.walk((child, i) => {\n if (child.type === 'decl' && child.prop === prop) {\n return callback(child, i)\n }\n })\n }\n\n walkRules(selector, callback) {\n if (!callback) {\n callback = selector\n\n return this.walk((child, i) => {\n if (child.type === 'rule') {\n return callback(child, i)\n }\n })\n }\n if (selector instanceof RegExp) {\n return this.walk((child, i) => {\n if (child.type === 'rule' && selector.test(child.selector)) {\n return callback(child, i)\n }\n })\n }\n return this.walk((child, i) => {\n if (child.type === 'rule' && child.selector === selector) {\n return callback(child, i)\n }\n })\n }\n\n get first() {\n if (!this.proxyOf.nodes) return undefined\n return this.proxyOf.nodes[0]\n }\n\n get last() {\n if (!this.proxyOf.nodes) return undefined\n return this.proxyOf.nodes[this.proxyOf.nodes.length - 1]\n }\n}\n\nContainer.registerParse = dependant => {\n parse = dependant\n}\n\nContainer.registerRule = dependant => {\n Rule = dependant\n}\n\nContainer.registerAtRule = dependant => {\n AtRule = dependant\n}\n\nContainer.registerRoot = dependant => {\n Root = dependant\n}\n\nmodule.exports = Container\nContainer.default = Container\n\n/* c8 ignore start */\nContainer.rebuild = node => {\n if (node.type === 'atrule') {\n Object.setPrototypeOf(node, AtRule.prototype)\n } else if (node.type === 'rule') {\n Object.setPrototypeOf(node, Rule.prototype)\n } else if (node.type === 'decl') {\n Object.setPrototypeOf(node, Declaration.prototype)\n } else if (node.type === 'comment') {\n Object.setPrototypeOf(node, Comment.prototype)\n } else if (node.type === 'root') {\n Object.setPrototypeOf(node, Root.prototype)\n }\n\n node[my] = true\n\n if (node.nodes) {\n node.nodes.forEach(child => {\n Container.rebuild(child)\n })\n }\n}\n/* c8 ignore stop */\n","'use strict'\n\nlet Container = require('./container')\n\nlet LazyResult, Processor\n\nclass Document extends Container {\n constructor(defaults) {\n // type needs to be passed to super, otherwise child roots won't be normalized correctly\n super({ type: 'document', ...defaults })\n\n if (!this.nodes) {\n this.nodes = []\n }\n }\n\n toResult(opts = {}) {\n let lazy = new LazyResult(new Processor(), this, opts)\n\n return lazy.stringify()\n }\n}\n\nDocument.registerLazyResult = dependant => {\n LazyResult = dependant\n}\n\nDocument.registerProcessor = dependant => {\n Processor = dependant\n}\n\nmodule.exports = Document\nDocument.default = Document\n","/* eslint-disable no-console */\n'use strict'\n\nlet printed = {}\n\nmodule.exports = function warnOnce(message) {\n if (printed[message]) return\n printed[message] = true\n\n if (typeof console !== 'undefined' && console.warn) {\n console.warn(message)\n }\n}\n","'use strict'\n\nclass Warning {\n constructor(text, opts = {}) {\n this.type = 'warning'\n this.text = text\n\n if (opts.node && opts.node.source) {\n let range = opts.node.rangeBy(opts)\n this.line = range.start.line\n this.column = range.start.column\n this.endLine = range.end.line\n this.endColumn = range.end.column\n }\n\n for (let opt in opts) this[opt] = opts[opt]\n }\n\n toString() {\n if (this.node) {\n return this.node.error(this.text, {\n index: this.index,\n plugin: this.plugin,\n word: this.word\n }).message\n }\n\n if (this.plugin) {\n return this.plugin + ': ' + this.text\n }\n\n return this.text\n }\n}\n\nmodule.exports = Warning\nWarning.default = Warning\n","'use strict'\n\nlet Warning = require('./warning')\n\nclass Result {\n constructor(processor, root, opts) {\n this.processor = processor\n this.messages = []\n this.root = root\n this.opts = opts\n this.css = undefined\n this.map = undefined\n }\n\n toString() {\n return this.css\n }\n\n warn(text, opts = {}) {\n if (!opts.plugin) {\n if (this.lastPlugin && this.lastPlugin.postcssPlugin) {\n opts.plugin = this.lastPlugin.postcssPlugin\n }\n }\n\n let warning = new Warning(text, opts)\n this.messages.push(warning)\n\n return warning\n }\n\n warnings() {\n return this.messages.filter(i => i.type === 'warning')\n }\n\n get content() {\n return this.css\n }\n}\n\nmodule.exports = Result\nResult.default = Result\n","'use strict'\n\nlet Container = require('./container')\n\nclass AtRule extends Container {\n constructor(defaults) {\n super(defaults)\n this.type = 'atrule'\n }\n\n append(...children) {\n if (!this.proxyOf.nodes) this.nodes = []\n return super.append(...children)\n }\n\n prepend(...children) {\n if (!this.proxyOf.nodes) this.nodes = []\n return super.prepend(...children)\n }\n}\n\nmodule.exports = AtRule\nAtRule.default = AtRule\n\nContainer.registerAtRule(AtRule)\n","'use strict'\n\nlet Container = require('./container')\n\nlet LazyResult, Processor\n\nclass Root extends Container {\n constructor(defaults) {\n super(defaults)\n this.type = 'root'\n if (!this.nodes) this.nodes = []\n }\n\n normalize(child, sample, type) {\n let nodes = super.normalize(child)\n\n if (sample) {\n if (type === 'prepend') {\n if (this.nodes.length > 1) {\n sample.raws.before = this.nodes[1].raws.before\n } else {\n delete sample.raws.before\n }\n } else if (this.first !== sample) {\n for (let node of nodes) {\n node.raws.before = sample.raws.before\n }\n }\n }\n\n return nodes\n }\n\n removeChild(child, ignore) {\n let index = this.index(child)\n\n if (!ignore && index === 0 && this.nodes.length > 1) {\n this.nodes[1].raws.before = this.nodes[index].raws.before\n }\n\n return super.removeChild(child)\n }\n\n toResult(opts = {}) {\n let lazy = new LazyResult(new Processor(), this, opts)\n return lazy.stringify()\n }\n}\n\nRoot.registerLazyResult = dependant => {\n LazyResult = dependant\n}\n\nRoot.registerProcessor = dependant => {\n Processor = dependant\n}\n\nmodule.exports = Root\nRoot.default = Root\n\nContainer.registerRoot(Root)\n","'use strict'\n\nlet list = {\n comma(string) {\n return list.split(string, [','], true)\n },\n\n space(string) {\n let spaces = [' ', '\\n', '\\t']\n return list.split(string, spaces)\n },\n\n split(string, separators, last) {\n let array = []\n let current = ''\n let split = false\n\n let func = 0\n let inQuote = false\n let prevQuote = ''\n let escape = false\n\n for (let letter of string) {\n if (escape) {\n escape = false\n } else if (letter === '\\\\') {\n escape = true\n } else if (inQuote) {\n if (letter === prevQuote) {\n inQuote = false\n }\n } else if (letter === '\"' || letter === \"'\") {\n inQuote = true\n prevQuote = letter\n } else if (letter === '(') {\n func += 1\n } else if (letter === ')') {\n if (func > 0) func -= 1\n } else if (func === 0) {\n if (separators.includes(letter)) split = true\n }\n\n if (split) {\n if (current !== '') array.push(current.trim())\n current = ''\n split = false\n } else {\n current += letter\n }\n }\n\n if (last || current !== '') array.push(current.trim())\n return array\n }\n}\n\nmodule.exports = list\nlist.default = list\n","'use strict'\n\nlet Container = require('./container')\nlet list = require('./list')\n\nclass Rule extends Container {\n constructor(defaults) {\n super(defaults)\n this.type = 'rule'\n if (!this.nodes) this.nodes = []\n }\n\n get selectors() {\n return list.comma(this.selector)\n }\n\n set selectors(values) {\n let match = this.selector ? this.selector.match(/,\\s*/) : null\n let sep = match ? match[0] : ',' + this.raw('between', 'beforeOpen')\n this.selector = values.join(sep)\n }\n}\n\nmodule.exports = Rule\nRule.default = Rule\n\nContainer.registerRule(Rule)\n","'use strict'\n\nlet Declaration = require('./declaration')\nlet tokenizer = require('./tokenize')\nlet Comment = require('./comment')\nlet AtRule = require('./at-rule')\nlet Root = require('./root')\nlet Rule = require('./rule')\n\nconst SAFE_COMMENT_NEIGHBOR = {\n empty: true,\n space: true\n}\n\nfunction findLastWithPosition(tokens) {\n for (let i = tokens.length - 1; i >= 0; i--) {\n let token = tokens[i]\n let pos = token[3] || token[2]\n if (pos) return pos\n }\n}\n\nclass Parser {\n constructor(input) {\n this.input = input\n\n this.root = new Root()\n this.current = this.root\n this.spaces = ''\n this.semicolon = false\n\n this.createTokenizer()\n this.root.source = { input, start: { column: 1, line: 1, offset: 0 } }\n }\n\n atrule(token) {\n let node = new AtRule()\n node.name = token[1].slice(1)\n if (node.name === '') {\n this.unnamedAtrule(node, token)\n }\n this.init(node, token[2])\n\n let type\n let prev\n let shift\n let last = false\n let open = false\n let params = []\n let brackets = []\n\n while (!this.tokenizer.endOfFile()) {\n token = this.tokenizer.nextToken()\n type = token[0]\n\n if (type === '(' || type === '[') {\n brackets.push(type === '(' ? ')' : ']')\n } else if (type === '{' && brackets.length > 0) {\n brackets.push('}')\n } else if (type === brackets[brackets.length - 1]) {\n brackets.pop()\n }\n\n if (brackets.length === 0) {\n if (type === ';') {\n node.source.end = this.getPosition(token[2])\n node.source.end.offset++\n this.semicolon = true\n break\n } else if (type === '{') {\n open = true\n break\n } else if (type === '}') {\n if (params.length > 0) {\n shift = params.length - 1\n prev = params[shift]\n while (prev && prev[0] === 'space') {\n prev = params[--shift]\n }\n if (prev) {\n node.source.end = this.getPosition(prev[3] || prev[2])\n node.source.end.offset++\n }\n }\n this.end(token)\n break\n } else {\n params.push(token)\n }\n } else {\n params.push(token)\n }\n\n if (this.tokenizer.endOfFile()) {\n last = true\n break\n }\n }\n\n node.raws.between = this.spacesAndCommentsFromEnd(params)\n if (params.length) {\n node.raws.afterName = this.spacesAndCommentsFromStart(params)\n this.raw(node, 'params', params)\n if (last) {\n token = params[params.length - 1]\n node.source.end = this.getPosition(token[3] || token[2])\n node.source.end.offset++\n this.spaces = node.raws.between\n node.raws.between = ''\n }\n } else {\n node.raws.afterName = ''\n node.params = ''\n }\n\n if (open) {\n node.nodes = []\n this.current = node\n }\n }\n\n checkMissedSemicolon(tokens) {\n let colon = this.colon(tokens)\n if (colon === false) return\n\n let founded = 0\n let token\n for (let j = colon - 1; j >= 0; j--) {\n token = tokens[j]\n if (token[0] !== 'space') {\n founded += 1\n if (founded === 2) break\n }\n }\n // If the token is a word, e.g. `!important`, `red` or any other valid property's value.\n // Then we need to return the colon after that word token. [3] is the \"end\" colon of that word.\n // And because we need it after that one we do +1 to get the next one.\n throw this.input.error(\n 'Missed semicolon',\n token[0] === 'word' ? token[3] + 1 : token[2]\n )\n }\n\n colon(tokens) {\n let brackets = 0\n let token, type, prev\n for (let [i, element] of tokens.entries()) {\n token = element\n type = token[0]\n\n if (type === '(') {\n brackets += 1\n }\n if (type === ')') {\n brackets -= 1\n }\n if (brackets === 0 && type === ':') {\n if (!prev) {\n this.doubleColon(token)\n } else if (prev[0] === 'word' && prev[1] === 'progid') {\n continue\n } else {\n return i\n }\n }\n\n prev = token\n }\n return false\n }\n\n comment(token) {\n let node = new Comment()\n this.init(node, token[2])\n node.source.end = this.getPosition(token[3] || token[2])\n node.source.end.offset++\n\n let text = token[1].slice(2, -2)\n if (/^\\s*$/.test(text)) {\n node.text = ''\n node.raws.left = text\n node.raws.right = ''\n } else {\n let match = text.match(/^(\\s*)([^]*\\S)(\\s*)$/)\n node.text = match[2]\n node.raws.left = match[1]\n node.raws.right = match[3]\n }\n }\n\n createTokenizer() {\n this.tokenizer = tokenizer(this.input)\n }\n\n decl(tokens, customProperty) {\n let node = new Declaration()\n this.init(node, tokens[0][2])\n\n let last = tokens[tokens.length - 1]\n if (last[0] === ';') {\n this.semicolon = true\n tokens.pop()\n }\n\n node.source.end = this.getPosition(\n last[3] || last[2] || findLastWithPosition(tokens)\n )\n node.source.end.offset++\n\n while (tokens[0][0] !== 'word') {\n if (tokens.length === 1) this.unknownWord(tokens)\n node.raws.before += tokens.shift()[1]\n }\n node.source.start = this.getPosition(tokens[0][2])\n\n node.prop = ''\n while (tokens.length) {\n let type = tokens[0][0]\n if (type === ':' || type === 'space' || type === 'comment') {\n break\n }\n node.prop += tokens.shift()[1]\n }\n\n node.raws.between = ''\n\n let token\n while (tokens.length) {\n token = tokens.shift()\n\n if (token[0] === ':') {\n node.raws.between += token[1]\n break\n } else {\n if (token[0] === 'word' && /\\w/.test(token[1])) {\n this.unknownWord([token])\n }\n node.raws.between += token[1]\n }\n }\n\n if (node.prop[0] === '_' || node.prop[0] === '*') {\n node.raws.before += node.prop[0]\n node.prop = node.prop.slice(1)\n }\n\n let firstSpaces = []\n let next\n while (tokens.length) {\n next = tokens[0][0]\n if (next !== 'space' && next !== 'comment') break\n firstSpaces.push(tokens.shift())\n }\n\n this.precheckMissedSemicolon(tokens)\n\n for (let i = tokens.length - 1; i >= 0; i--) {\n token = tokens[i]\n if (token[1].toLowerCase() === '!important') {\n node.important = true\n let string = this.stringFrom(tokens, i)\n string = this.spacesFromEnd(tokens) + string\n if (string !== ' !important') node.raws.important = string\n break\n } else if (token[1].toLowerCase() === 'important') {\n let cache = tokens.slice(0)\n let str = ''\n for (let j = i; j > 0; j--) {\n let type = cache[j][0]\n if (str.trim().indexOf('!') === 0 && type !== 'space') {\n break\n }\n str = cache.pop()[1] + str\n }\n if (str.trim().indexOf('!') === 0) {\n node.important = true\n node.raws.important = str\n tokens = cache\n }\n }\n\n if (token[0] !== 'space' && token[0] !== 'comment') {\n break\n }\n }\n\n let hasWord = tokens.some(i => i[0] !== 'space' && i[0] !== 'comment')\n\n if (hasWord) {\n node.raws.between += firstSpaces.map(i => i[1]).join('')\n firstSpaces = []\n }\n this.raw(node, 'value', firstSpaces.concat(tokens), customProperty)\n\n if (node.value.includes(':') && !customProperty) {\n this.checkMissedSemicolon(tokens)\n }\n }\n\n doubleColon(token) {\n throw this.input.error(\n 'Double colon',\n { offset: token[2] },\n { offset: token[2] + token[1].length }\n )\n }\n\n emptyRule(token) {\n let node = new Rule()\n this.init(node, token[2])\n node.selector = ''\n node.raws.between = ''\n this.current = node\n }\n\n end(token) {\n if (this.current.nodes && this.current.nodes.length) {\n this.current.raws.semicolon = this.semicolon\n }\n this.semicolon = false\n\n this.current.raws.after = (this.current.raws.after || '') + this.spaces\n this.spaces = ''\n\n if (this.current.parent) {\n this.current.source.end = this.getPosition(token[2])\n this.current.source.end.offset++\n this.current = this.current.parent\n } else {\n this.unexpectedClose(token)\n }\n }\n\n endFile() {\n if (this.current.parent) this.unclosedBlock()\n if (this.current.nodes && this.current.nodes.length) {\n this.current.raws.semicolon = this.semicolon\n }\n this.current.raws.after = (this.current.raws.after || '') + this.spaces\n this.root.source.end = this.getPosition(this.tokenizer.position())\n }\n\n freeSemicolon(token) {\n this.spaces += token[1]\n if (this.current.nodes) {\n let prev = this.current.nodes[this.current.nodes.length - 1]\n if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) {\n prev.raws.ownSemicolon = this.spaces\n this.spaces = ''\n }\n }\n }\n\n // Helpers\n\n getPosition(offset) {\n let pos = this.input.fromOffset(offset)\n return {\n column: pos.col,\n line: pos.line,\n offset\n }\n }\n\n init(node, offset) {\n this.current.push(node)\n node.source = {\n input: this.input,\n start: this.getPosition(offset)\n }\n node.raws.before = this.spaces\n this.spaces = ''\n if (node.type !== 'comment') this.semicolon = false\n }\n\n other(start) {\n let end = false\n let type = null\n let colon = false\n let bracket = null\n let brackets = []\n let customProperty = start[1].startsWith('--')\n\n let tokens = []\n let token = start\n while (token) {\n type = token[0]\n tokens.push(token)\n\n if (type === '(' || type === '[') {\n if (!bracket) bracket = token\n brackets.push(type === '(' ? ')' : ']')\n } else if (customProperty && colon && type === '{') {\n if (!bracket) bracket = token\n brackets.push('}')\n } else if (brackets.length === 0) {\n if (type === ';') {\n if (colon) {\n this.decl(tokens, customProperty)\n return\n } else {\n break\n }\n } else if (type === '{') {\n this.rule(tokens)\n return\n } else if (type === '}') {\n this.tokenizer.back(tokens.pop())\n end = true\n break\n } else if (type === ':') {\n colon = true\n }\n } else if (type === brackets[brackets.length - 1]) {\n brackets.pop()\n if (brackets.length === 0) bracket = null\n }\n\n token = this.tokenizer.nextToken()\n }\n\n if (this.tokenizer.endOfFile()) end = true\n if (brackets.length > 0) this.unclosedBracket(bracket)\n\n if (end && colon) {\n if (!customProperty) {\n while (tokens.length) {\n token = tokens[tokens.length - 1][0]\n if (token !== 'space' && token !== 'comment') break\n this.tokenizer.back(tokens.pop())\n }\n }\n this.decl(tokens, customProperty)\n } else {\n this.unknownWord(tokens)\n }\n }\n\n parse() {\n let token\n while (!this.tokenizer.endOfFile()) {\n token = this.tokenizer.nextToken()\n\n switch (token[0]) {\n case 'space':\n this.spaces += token[1]\n break\n\n case ';':\n this.freeSemicolon(token)\n break\n\n case '}':\n this.end(token)\n break\n\n case 'comment':\n this.comment(token)\n break\n\n case 'at-word':\n this.atrule(token)\n break\n\n case '{':\n this.emptyRule(token)\n break\n\n default:\n this.other(token)\n break\n }\n }\n this.endFile()\n }\n\n precheckMissedSemicolon(/* tokens */) {\n // Hook for Safe Parser\n }\n\n raw(node, prop, tokens, customProperty) {\n let token, type\n let length = tokens.length\n let value = ''\n let clean = true\n let next, prev\n\n for (let i = 0; i < length; i += 1) {\n token = tokens[i]\n type = token[0]\n if (type === 'space' && i === length - 1 && !customProperty) {\n clean = false\n } else if (type === 'comment') {\n prev = tokens[i - 1] ? tokens[i - 1][0] : 'empty'\n next = tokens[i + 1] ? tokens[i + 1][0] : 'empty'\n if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) {\n if (value.slice(-1) === ',') {\n clean = false\n } else {\n value += token[1]\n }\n } else {\n clean = false\n }\n } else {\n value += token[1]\n }\n }\n if (!clean) {\n let raw = tokens.reduce((all, i) => all + i[1], '')\n node.raws[prop] = { raw, value }\n }\n node[prop] = value\n }\n\n rule(tokens) {\n tokens.pop()\n\n let node = new Rule()\n this.init(node, tokens[0][2])\n\n node.raws.between = this.spacesAndCommentsFromEnd(tokens)\n this.raw(node, 'selector', tokens)\n this.current = node\n }\n\n spacesAndCommentsFromEnd(tokens) {\n let lastTokenType\n let spaces = ''\n while (tokens.length) {\n lastTokenType = tokens[tokens.length - 1][0]\n if (lastTokenType !== 'space' && lastTokenType !== 'comment') break\n spaces = tokens.pop()[1] + spaces\n }\n return spaces\n }\n\n // Errors\n\n spacesAndCommentsFromStart(tokens) {\n let next\n let spaces = ''\n while (tokens.length) {\n next = tokens[0][0]\n if (next !== 'space' && next !== 'comment') break\n spaces += tokens.shift()[1]\n }\n return spaces\n }\n\n spacesFromEnd(tokens) {\n let lastTokenType\n let spaces = ''\n while (tokens.length) {\n lastTokenType = tokens[tokens.length - 1][0]\n if (lastTokenType !== 'space') break\n spaces = tokens.pop()[1] + spaces\n }\n return spaces\n }\n\n stringFrom(tokens, from) {\n let result = ''\n for (let i = from; i < tokens.length; i++) {\n result += tokens[i][1]\n }\n tokens.splice(from, tokens.length - from)\n return result\n }\n\n unclosedBlock() {\n let pos = this.current.source.start\n throw this.input.error('Unclosed block', pos.line, pos.column)\n }\n\n unclosedBracket(bracket) {\n throw this.input.error(\n 'Unclosed bracket',\n { offset: bracket[2] },\n { offset: bracket[2] + 1 }\n )\n }\n\n unexpectedClose(token) {\n throw this.input.error(\n 'Unexpected }',\n { offset: token[2] },\n { offset: token[2] + 1 }\n )\n }\n\n unknownWord(tokens) {\n throw this.input.error(\n 'Unknown word',\n { offset: tokens[0][2] },\n { offset: tokens[0][2] + tokens[0][1].length }\n )\n }\n\n unnamedAtrule(node, token) {\n throw this.input.error(\n 'At-rule without name',\n { offset: token[2] },\n { offset: token[2] + token[1].length }\n )\n }\n}\n\nmodule.exports = Parser\n","'use strict'\n\nlet Container = require('./container')\nlet Parser = require('./parser')\nlet Input = require('./input')\n\nfunction parse(css, opts) {\n let input = new Input(css, opts)\n let parser = new Parser(input)\n try {\n parser.parse()\n } catch (e) {\n if (process.env.NODE_ENV !== 'production') {\n if (e.name === 'CssSyntaxError' && opts && opts.from) {\n if (/\\.scss$/i.test(opts.from)) {\n e.message +=\n '\\nYou tried to parse SCSS with ' +\n 'the standard CSS parser; ' +\n 'try again with the postcss-scss parser'\n } else if (/\\.sass/i.test(opts.from)) {\n e.message +=\n '\\nYou tried to parse Sass with ' +\n 'the standard CSS parser; ' +\n 'try again with the postcss-sass parser'\n } else if (/\\.less$/i.test(opts.from)) {\n e.message +=\n '\\nYou tried to parse Less with ' +\n 'the standard CSS parser; ' +\n 'try again with the postcss-less parser'\n }\n }\n }\n throw e\n }\n\n return parser.root\n}\n\nmodule.exports = parse\nparse.default = parse\n\nContainer.registerParse(parse)\n","'use strict'\n\nlet { isClean, my } = require('./symbols')\nlet MapGenerator = require('./map-generator')\nlet stringify = require('./stringify')\nlet Container = require('./container')\nlet Document = require('./document')\nlet warnOnce = require('./warn-once')\nlet Result = require('./result')\nlet parse = require('./parse')\nlet Root = require('./root')\n\nconst TYPE_TO_CLASS_NAME = {\n atrule: 'AtRule',\n comment: 'Comment',\n decl: 'Declaration',\n document: 'Document',\n root: 'Root',\n rule: 'Rule'\n}\n\nconst PLUGIN_PROPS = {\n AtRule: true,\n AtRuleExit: true,\n Comment: true,\n CommentExit: true,\n Declaration: true,\n DeclarationExit: true,\n Document: true,\n DocumentExit: true,\n Once: true,\n OnceExit: true,\n postcssPlugin: true,\n prepare: true,\n Root: true,\n RootExit: true,\n Rule: true,\n RuleExit: true\n}\n\nconst NOT_VISITORS = {\n Once: true,\n postcssPlugin: true,\n prepare: true\n}\n\nconst CHILDREN = 0\n\nfunction isPromise(obj) {\n return typeof obj === 'object' && typeof obj.then === 'function'\n}\n\nfunction getEvents(node) {\n let key = false\n let type = TYPE_TO_CLASS_NAME[node.type]\n if (node.type === 'decl') {\n key = node.prop.toLowerCase()\n } else if (node.type === 'atrule') {\n key = node.name.toLowerCase()\n }\n\n if (key && node.append) {\n return [\n type,\n type + '-' + key,\n CHILDREN,\n type + 'Exit',\n type + 'Exit-' + key\n ]\n } else if (key) {\n return [type, type + '-' + key, type + 'Exit', type + 'Exit-' + key]\n } else if (node.append) {\n return [type, CHILDREN, type + 'Exit']\n } else {\n return [type, type + 'Exit']\n }\n}\n\nfunction toStack(node) {\n let events\n if (node.type === 'document') {\n events = ['Document', CHILDREN, 'DocumentExit']\n } else if (node.type === 'root') {\n events = ['Root', CHILDREN, 'RootExit']\n } else {\n events = getEvents(node)\n }\n\n return {\n eventIndex: 0,\n events,\n iterator: 0,\n node,\n visitorIndex: 0,\n visitors: []\n }\n}\n\nfunction cleanMarks(node) {\n node[isClean] = false\n if (node.nodes) node.nodes.forEach(i => cleanMarks(i))\n return node\n}\n\nlet postcss = {}\n\nclass LazyResult {\n constructor(processor, css, opts) {\n this.stringified = false\n this.processed = false\n\n let root\n if (\n typeof css === 'object' &&\n css !== null &&\n (css.type === 'root' || css.type === 'document')\n ) {\n root = cleanMarks(css)\n } else if (css instanceof LazyResult || css instanceof Result) {\n root = cleanMarks(css.root)\n if (css.map) {\n if (typeof opts.map === 'undefined') opts.map = {}\n if (!opts.map.inline) opts.map.inline = false\n opts.map.prev = css.map\n }\n } else {\n let parser = parse\n if (opts.syntax) parser = opts.syntax.parse\n if (opts.parser) parser = opts.parser\n if (parser.parse) parser = parser.parse\n\n try {\n root = parser(css, opts)\n } catch (error) {\n this.processed = true\n this.error = error\n }\n\n if (root && !root[my]) {\n /* c8 ignore next 2 */\n Container.rebuild(root)\n }\n }\n\n this.result = new Result(processor, root, opts)\n this.helpers = { ...postcss, postcss, result: this.result }\n this.plugins = this.processor.plugins.map(plugin => {\n if (typeof plugin === 'object' && plugin.prepare) {\n return { ...plugin, ...plugin.prepare(this.result) }\n } else {\n return plugin\n }\n })\n }\n\n async() {\n if (this.error) return Promise.reject(this.error)\n if (this.processed) return Promise.resolve(this.result)\n if (!this.processing) {\n this.processing = this.runAsync()\n }\n return this.processing\n }\n\n catch(onRejected) {\n return this.async().catch(onRejected)\n }\n\n finally(onFinally) {\n return this.async().then(onFinally, onFinally)\n }\n\n getAsyncError() {\n throw new Error('Use process(css).then(cb) to work with async plugins')\n }\n\n handleError(error, node) {\n let plugin = this.result.lastPlugin\n try {\n if (node) node.addToError(error)\n this.error = error\n if (error.name === 'CssSyntaxError' && !error.plugin) {\n error.plugin = plugin.postcssPlugin\n error.setMessage()\n } else if (plugin.postcssVersion) {\n if (process.env.NODE_ENV !== 'production') {\n let pluginName = plugin.postcssPlugin\n let pluginVer = plugin.postcssVersion\n let runtimeVer = this.result.processor.version\n let a = pluginVer.split('.')\n let b = runtimeVer.split('.')\n\n if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) {\n // eslint-disable-next-line no-console\n console.error(\n 'Unknown error from PostCSS plugin. Your current PostCSS ' +\n 'version is ' +\n runtimeVer +\n ', but ' +\n pluginName +\n ' uses ' +\n pluginVer +\n '. Perhaps this is the source of the error below.'\n )\n }\n }\n }\n } catch (err) {\n /* c8 ignore next 3 */\n // eslint-disable-next-line no-console\n if (console && console.error) console.error(err)\n }\n return error\n }\n\n prepareVisitors() {\n this.listeners = {}\n let add = (plugin, type, cb) => {\n if (!this.listeners[type]) this.listeners[type] = []\n this.listeners[type].push([plugin, cb])\n }\n for (let plugin of this.plugins) {\n if (typeof plugin === 'object') {\n for (let event in plugin) {\n if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {\n throw new Error(\n `Unknown event ${event} in ${plugin.postcssPlugin}. ` +\n `Try to update PostCSS (${this.processor.version} now).`\n )\n }\n if (!NOT_VISITORS[event]) {\n if (typeof plugin[event] === 'object') {\n for (let filter in plugin[event]) {\n if (filter === '*') {\n add(plugin, event, plugin[event][filter])\n } else {\n add(\n plugin,\n event + '-' + filter.toLowerCase(),\n plugin[event][filter]\n )\n }\n }\n } else if (typeof plugin[event] === 'function') {\n add(plugin, event, plugin[event])\n }\n }\n }\n }\n }\n this.hasListener = Object.keys(this.listeners).length > 0\n }\n\n async runAsync() {\n this.plugin = 0\n for (let i = 0; i < this.plugins.length; i++) {\n let plugin = this.plugins[i]\n let promise = this.runOnRoot(plugin)\n if (isPromise(promise)) {\n try {\n await promise\n } catch (error) {\n throw this.handleError(error)\n }\n }\n }\n\n this.prepareVisitors()\n if (this.hasListener) {\n let root = this.result.root\n while (!root[isClean]) {\n root[isClean] = true\n let stack = [toStack(root)]\n while (stack.length > 0) {\n let promise = this.visitTick(stack)\n if (isPromise(promise)) {\n try {\n await promise\n } catch (e) {\n let node = stack[stack.length - 1].node\n throw this.handleError(e, node)\n }\n }\n }\n }\n\n if (this.listeners.OnceExit) {\n for (let [plugin, visitor] of this.listeners.OnceExit) {\n this.result.lastPlugin = plugin\n try {\n if (root.type === 'document') {\n let roots = root.nodes.map(subRoot =>\n visitor(subRoot, this.helpers)\n )\n\n await Promise.all(roots)\n } else {\n await visitor(root, this.helpers)\n }\n } catch (e) {\n throw this.handleError(e)\n }\n }\n }\n }\n\n this.processed = true\n return this.stringify()\n }\n\n runOnRoot(plugin) {\n this.result.lastPlugin = plugin\n try {\n if (typeof plugin === 'object' && plugin.Once) {\n if (this.result.root.type === 'document') {\n let roots = this.result.root.nodes.map(root =>\n plugin.Once(root, this.helpers)\n )\n\n if (isPromise(roots[0])) {\n return Promise.all(roots)\n }\n\n return roots\n }\n\n return plugin.Once(this.result.root, this.helpers)\n } else if (typeof plugin === 'function') {\n return plugin(this.result.root, this.result)\n }\n } catch (error) {\n throw this.handleError(error)\n }\n }\n\n stringify() {\n if (this.error) throw this.error\n if (this.stringified) return this.result\n this.stringified = true\n\n this.sync()\n\n let opts = this.result.opts\n let str = stringify\n if (opts.syntax) str = opts.syntax.stringify\n if (opts.stringifier) str = opts.stringifier\n if (str.stringify) str = str.stringify\n\n let map = new MapGenerator(str, this.result.root, this.result.opts)\n let data = map.generate()\n this.result.css = data[0]\n this.result.map = data[1]\n\n return this.result\n }\n\n sync() {\n if (this.error) throw this.error\n if (this.processed) return this.result\n this.processed = true\n\n if (this.processing) {\n throw this.getAsyncError()\n }\n\n for (let plugin of this.plugins) {\n let promise = this.runOnRoot(plugin)\n if (isPromise(promise)) {\n throw this.getAsyncError()\n }\n }\n\n this.prepareVisitors()\n if (this.hasListener) {\n let root = this.result.root\n while (!root[isClean]) {\n root[isClean] = true\n this.walkSync(root)\n }\n if (this.listeners.OnceExit) {\n if (root.type === 'document') {\n for (let subRoot of root.nodes) {\n this.visitSync(this.listeners.OnceExit, subRoot)\n }\n } else {\n this.visitSync(this.listeners.OnceExit, root)\n }\n }\n }\n\n return this.result\n }\n\n then(onFulfilled, onRejected) {\n if (process.env.NODE_ENV !== 'production') {\n if (!('from' in this.opts)) {\n warnOnce(\n 'Without `from` option PostCSS could generate wrong source map ' +\n 'and will not find Browserslist config. Set it to CSS file path ' +\n 'or to `undefined` to prevent this warning.'\n )\n }\n }\n return this.async().then(onFulfilled, onRejected)\n }\n\n toString() {\n return this.css\n }\n\n visitSync(visitors, node) {\n for (let [plugin, visitor] of visitors) {\n this.result.lastPlugin = plugin\n let promise\n try {\n promise = visitor(node, this.helpers)\n } catch (e) {\n throw this.handleError(e, node.proxyOf)\n }\n if (node.type !== 'root' && node.type !== 'document' && !node.parent) {\n return true\n }\n if (isPromise(promise)) {\n throw this.getAsyncError()\n }\n }\n }\n\n visitTick(stack) {\n let visit = stack[stack.length - 1]\n let { node, visitors } = visit\n\n if (node.type !== 'root' && node.type !== 'document' && !node.parent) {\n stack.pop()\n return\n }\n\n if (visitors.length > 0 && visit.visitorIndex < visitors.length) {\n let [plugin, visitor] = visitors[visit.visitorIndex]\n visit.visitorIndex += 1\n if (visit.visitorIndex === visitors.length) {\n visit.visitors = []\n visit.visitorIndex = 0\n }\n this.result.lastPlugin = plugin\n try {\n return visitor(node.toProxy(), this.helpers)\n } catch (e) {\n throw this.handleError(e, node)\n }\n }\n\n if (visit.iterator !== 0) {\n let iterator = visit.iterator\n let child\n while ((child = node.nodes[node.indexes[iterator]])) {\n node.indexes[iterator] += 1\n if (!child[isClean]) {\n child[isClean] = true\n stack.push(toStack(child))\n return\n }\n }\n visit.iterator = 0\n delete node.indexes[iterator]\n }\n\n let events = visit.events\n while (visit.eventIndex < events.length) {\n let event = events[visit.eventIndex]\n visit.eventIndex += 1\n if (event === CHILDREN) {\n if (node.nodes && node.nodes.length) {\n node[isClean] = true\n visit.iterator = node.getIterator()\n }\n return\n } else if (this.listeners[event]) {\n visit.visitors = this.listeners[event]\n return\n }\n }\n stack.pop()\n }\n\n walkSync(node) {\n node[isClean] = true\n let events = getEvents(node)\n for (let event of events) {\n if (event === CHILDREN) {\n if (node.nodes) {\n node.each(child => {\n if (!child[isClean]) this.walkSync(child)\n })\n }\n } else {\n let visitors = this.listeners[event]\n if (visitors) {\n if (this.visitSync(visitors, node.toProxy())) return\n }\n }\n }\n }\n\n warnings() {\n return this.sync().warnings()\n }\n\n get content() {\n return this.stringify().content\n }\n\n get css() {\n return this.stringify().css\n }\n\n get map() {\n return this.stringify().map\n }\n\n get messages() {\n return this.sync().messages\n }\n\n get opts() {\n return this.result.opts\n }\n\n get processor() {\n return this.result.processor\n }\n\n get root() {\n return this.sync().root\n }\n\n get [Symbol.toStringTag]() {\n return 'LazyResult'\n }\n}\n\nLazyResult.registerPostcss = dependant => {\n postcss = dependant\n}\n\nmodule.exports = LazyResult\nLazyResult.default = LazyResult\n\nRoot.registerLazyResult(LazyResult)\nDocument.registerLazyResult(LazyResult)\n","'use strict'\n\nlet MapGenerator = require('./map-generator')\nlet stringify = require('./stringify')\nlet warnOnce = require('./warn-once')\nlet parse = require('./parse')\nconst Result = require('./result')\n\nclass NoWorkResult {\n constructor(processor, css, opts) {\n css = css.toString()\n this.stringified = false\n\n this._processor = processor\n this._css = css\n this._opts = opts\n this._map = undefined\n let root\n\n let str = stringify\n this.result = new Result(this._processor, root, this._opts)\n this.result.css = css\n\n let self = this\n Object.defineProperty(this.result, 'root', {\n get() {\n return self.root\n }\n })\n\n let map = new MapGenerator(str, root, this._opts, css)\n if (map.isMap()) {\n let [generatedCSS, generatedMap] = map.generate()\n if (generatedCSS) {\n this.result.css = generatedCSS\n }\n if (generatedMap) {\n this.result.map = generatedMap\n }\n } else {\n map.clearAnnotation()\n this.result.css = map.css\n }\n }\n\n async() {\n if (this.error) return Promise.reject(this.error)\n return Promise.resolve(this.result)\n }\n\n catch(onRejected) {\n return this.async().catch(onRejected)\n }\n\n finally(onFinally) {\n return this.async().then(onFinally, onFinally)\n }\n\n sync() {\n if (this.error) throw this.error\n return this.result\n }\n\n then(onFulfilled, onRejected) {\n if (process.env.NODE_ENV !== 'production') {\n if (!('from' in this._opts)) {\n warnOnce(\n 'Without `from` option PostCSS could generate wrong source map ' +\n 'and will not find Browserslist config. Set it to CSS file path ' +\n 'or to `undefined` to prevent this warning.'\n )\n }\n }\n\n return this.async().then(onFulfilled, onRejected)\n }\n\n toString() {\n return this._css\n }\n\n warnings() {\n return []\n }\n\n get content() {\n return this.result.css\n }\n\n get css() {\n return this.result.css\n }\n\n get map() {\n return this.result.map\n }\n\n get messages() {\n return []\n }\n\n get opts() {\n return this.result.opts\n }\n\n get processor() {\n return this.result.processor\n }\n\n get root() {\n if (this._root) {\n return this._root\n }\n\n let root\n let parser = parse\n\n try {\n root = parser(this._css, this._opts)\n } catch (error) {\n this.error = error\n }\n\n if (this.error) {\n throw this.error\n } else {\n this._root = root\n return root\n }\n }\n\n get [Symbol.toStringTag]() {\n return 'NoWorkResult'\n }\n}\n\nmodule.exports = NoWorkResult\nNoWorkResult.default = NoWorkResult\n","'use strict'\n\nlet NoWorkResult = require('./no-work-result')\nlet LazyResult = require('./lazy-result')\nlet Document = require('./document')\nlet Root = require('./root')\n\nclass Processor {\n constructor(plugins = []) {\n this.version = '8.4.38'\n this.plugins = this.normalize(plugins)\n }\n\n normalize(plugins) {\n let normalized = []\n for (let i of plugins) {\n if (i.postcss === true) {\n i = i()\n } else if (i.postcss) {\n i = i.postcss\n }\n\n if (typeof i === 'object' && Array.isArray(i.plugins)) {\n normalized = normalized.concat(i.plugins)\n } else if (typeof i === 'object' && i.postcssPlugin) {\n normalized.push(i)\n } else if (typeof i === 'function') {\n normalized.push(i)\n } else if (typeof i === 'object' && (i.parse || i.stringify)) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n 'PostCSS syntaxes cannot be used as plugins. Instead, please use ' +\n 'one of the syntax/parser/stringifier options as outlined ' +\n 'in your PostCSS runner documentation.'\n )\n }\n } else {\n throw new Error(i + ' is not a PostCSS plugin')\n }\n }\n return normalized\n }\n\n process(css, opts = {}) {\n if (\n !this.plugins.length &&\n !opts.parser &&\n !opts.stringifier &&\n !opts.syntax\n ) {\n return new NoWorkResult(this, css, opts)\n } else {\n return new LazyResult(this, css, opts)\n }\n }\n\n use(plugin) {\n this.plugins = this.plugins.concat(this.normalize([plugin]))\n return this\n }\n}\n\nmodule.exports = Processor\nProcessor.default = Processor\n\nRoot.registerProcessor(Processor)\nDocument.registerProcessor(Processor)\n","'use strict'\n\nlet Declaration = require('./declaration')\nlet PreviousMap = require('./previous-map')\nlet Comment = require('./comment')\nlet AtRule = require('./at-rule')\nlet Input = require('./input')\nlet Root = require('./root')\nlet Rule = require('./rule')\n\nfunction fromJSON(json, inputs) {\n if (Array.isArray(json)) return json.map(n => fromJSON(n))\n\n let { inputs: ownInputs, ...defaults } = json\n if (ownInputs) {\n inputs = []\n for (let input of ownInputs) {\n let inputHydrated = { ...input, __proto__: Input.prototype }\n if (inputHydrated.map) {\n inputHydrated.map = {\n ...inputHydrated.map,\n __proto__: PreviousMap.prototype\n }\n }\n inputs.push(inputHydrated)\n }\n }\n if (defaults.nodes) {\n defaults.nodes = json.nodes.map(n => fromJSON(n, inputs))\n }\n if (defaults.source) {\n let { inputId, ...source } = defaults.source\n defaults.source = source\n if (inputId != null) {\n defaults.source.input = inputs[inputId]\n }\n }\n if (defaults.type === 'root') {\n return new Root(defaults)\n } else if (defaults.type === 'decl') {\n return new Declaration(defaults)\n } else if (defaults.type === 'rule') {\n return new Rule(defaults)\n } else if (defaults.type === 'comment') {\n return new Comment(defaults)\n } else if (defaults.type === 'atrule') {\n return new AtRule(defaults)\n } else {\n throw new Error('Unknown node type: ' + json.type)\n }\n}\n\nmodule.exports = fromJSON\nfromJSON.default = fromJSON\n","'use strict'\n\nlet CssSyntaxError = require('./css-syntax-error')\nlet Declaration = require('./declaration')\nlet LazyResult = require('./lazy-result')\nlet Container = require('./container')\nlet Processor = require('./processor')\nlet stringify = require('./stringify')\nlet fromJSON = require('./fromJSON')\nlet Document = require('./document')\nlet Warning = require('./warning')\nlet Comment = require('./comment')\nlet AtRule = require('./at-rule')\nlet Result = require('./result.js')\nlet Input = require('./input')\nlet parse = require('./parse')\nlet list = require('./list')\nlet Rule = require('./rule')\nlet Root = require('./root')\nlet Node = require('./node')\n\nfunction postcss(...plugins) {\n if (plugins.length === 1 && Array.isArray(plugins[0])) {\n plugins = plugins[0]\n }\n return new Processor(plugins)\n}\n\npostcss.plugin = function plugin(name, initializer) {\n let warningPrinted = false\n function creator(...args) {\n // eslint-disable-next-line no-console\n if (console && console.warn && !warningPrinted) {\n warningPrinted = true\n // eslint-disable-next-line no-console\n console.warn(\n name +\n ': postcss.plugin was deprecated. Migration guide:\\n' +\n 'https://evilmartians.com/chronicles/postcss-8-plugin-migration'\n )\n if (process.env.LANG && process.env.LANG.startsWith('cn')) {\n /* c8 ignore next 7 */\n // eslint-disable-next-line no-console\n console.warn(\n name +\n ': 里面 postcss.plugin 被弃用. 迁移指南:\\n' +\n 'https://www.w3ctech.com/topic/2226'\n )\n }\n }\n let transformer = initializer(...args)\n transformer.postcssPlugin = name\n transformer.postcssVersion = new Processor().version\n return transformer\n }\n\n let cache\n Object.defineProperty(creator, 'postcss', {\n get() {\n if (!cache) cache = creator()\n return cache\n }\n })\n\n creator.process = function (css, processOpts, pluginOpts) {\n return postcss([creator(pluginOpts)]).process(css, processOpts)\n }\n\n return creator\n}\n\npostcss.stringify = stringify\npostcss.parse = parse\npostcss.fromJSON = fromJSON\npostcss.list = list\n\npostcss.comment = defaults => new Comment(defaults)\npostcss.atRule = defaults => new AtRule(defaults)\npostcss.decl = defaults => new Declaration(defaults)\npostcss.rule = defaults => new Rule(defaults)\npostcss.root = defaults => new Root(defaults)\npostcss.document = defaults => new Document(defaults)\n\npostcss.CssSyntaxError = CssSyntaxError\npostcss.Declaration = Declaration\npostcss.Container = Container\npostcss.Processor = Processor\npostcss.Document = Document\npostcss.Comment = Comment\npostcss.Warning = Warning\npostcss.AtRule = AtRule\npostcss.Result = Result\npostcss.Input = Input\npostcss.Rule = Rule\npostcss.Root = Root\npostcss.Node = Node\n\nLazyResult.registerPostcss(postcss)\n\nmodule.exports = postcss\npostcss.default = postcss\n","var openParentheses = \"(\".charCodeAt(0);\nvar closeParentheses = \")\".charCodeAt(0);\nvar singleQuote = \"'\".charCodeAt(0);\nvar doubleQuote = '\"'.charCodeAt(0);\nvar backslash = \"\\\\\".charCodeAt(0);\nvar slash = \"/\".charCodeAt(0);\nvar comma = \",\".charCodeAt(0);\nvar colon = \":\".charCodeAt(0);\nvar star = \"*\".charCodeAt(0);\nvar uLower = \"u\".charCodeAt(0);\nvar uUpper = \"U\".charCodeAt(0);\nvar plus = \"+\".charCodeAt(0);\nvar isUnicodeRange = /^[a-f0-9?-]+$/i;\n\nmodule.exports = function(input) {\n var tokens = [];\n var value = input;\n\n var next,\n quote,\n prev,\n token,\n escape,\n escapePos,\n whitespacePos,\n parenthesesOpenPos;\n var pos = 0;\n var code = value.charCodeAt(pos);\n var max = value.length;\n var stack = [{ nodes: tokens }];\n var balanced = 0;\n var parent;\n\n var name = \"\";\n var before = \"\";\n var after = \"\";\n\n while (pos < max) {\n // Whitespaces\n if (code <= 32) {\n next = pos;\n do {\n next += 1;\n code = value.charCodeAt(next);\n } while (code <= 32);\n token = value.slice(pos, next);\n\n prev = tokens[tokens.length - 1];\n if (code === closeParentheses && balanced) {\n after = token;\n } else if (prev && prev.type === \"div\") {\n prev.after = token;\n prev.sourceEndIndex += token.length;\n } else if (\n code === comma ||\n code === colon ||\n (code === slash &&\n value.charCodeAt(next + 1) !== star &&\n (!parent ||\n (parent && parent.type === \"function\" && parent.value !== \"calc\")))\n ) {\n before = token;\n } else {\n tokens.push({\n type: \"space\",\n sourceIndex: pos,\n sourceEndIndex: next,\n value: token\n });\n }\n\n pos = next;\n\n // Quotes\n } else if (code === singleQuote || code === doubleQuote) {\n next = pos;\n quote = code === singleQuote ? \"'\" : '\"';\n token = {\n type: \"string\",\n sourceIndex: pos,\n quote: quote\n };\n do {\n escape = false;\n next = value.indexOf(quote, next + 1);\n if (~next) {\n escapePos = next;\n while (value.charCodeAt(escapePos - 1) === backslash) {\n escapePos -= 1;\n escape = !escape;\n }\n } else {\n value += quote;\n next = value.length - 1;\n token.unclosed = true;\n }\n } while (escape);\n token.value = value.slice(pos + 1, next);\n token.sourceEndIndex = token.unclosed ? next : next + 1;\n tokens.push(token);\n pos = next + 1;\n code = value.charCodeAt(pos);\n\n // Comments\n } else if (code === slash && value.charCodeAt(pos + 1) === star) {\n next = value.indexOf(\"*/\", pos);\n\n token = {\n type: \"comment\",\n sourceIndex: pos,\n sourceEndIndex: next + 2\n };\n\n if (next === -1) {\n token.unclosed = true;\n next = value.length;\n token.sourceEndIndex = next;\n }\n\n token.value = value.slice(pos + 2, next);\n tokens.push(token);\n\n pos = next + 2;\n code = value.charCodeAt(pos);\n\n // Operation within calc\n } else if (\n (code === slash || code === star) &&\n parent &&\n parent.type === \"function\" &&\n parent.value === \"calc\"\n ) {\n token = value[pos];\n tokens.push({\n type: \"word\",\n sourceIndex: pos - before.length,\n sourceEndIndex: pos + token.length,\n value: token\n });\n pos += 1;\n code = value.charCodeAt(pos);\n\n // Dividers\n } else if (code === slash || code === comma || code === colon) {\n token = value[pos];\n\n tokens.push({\n type: \"div\",\n sourceIndex: pos - before.length,\n sourceEndIndex: pos + token.length,\n value: token,\n before: before,\n after: \"\"\n });\n before = \"\";\n\n pos += 1;\n code = value.charCodeAt(pos);\n\n // Open parentheses\n } else if (openParentheses === code) {\n // Whitespaces after open parentheses\n next = pos;\n do {\n next += 1;\n code = value.charCodeAt(next);\n } while (code <= 32);\n parenthesesOpenPos = pos;\n token = {\n type: \"function\",\n sourceIndex: pos - name.length,\n value: name,\n before: value.slice(parenthesesOpenPos + 1, next)\n };\n pos = next;\n\n if (name === \"url\" && code !== singleQuote && code !== doubleQuote) {\n next -= 1;\n do {\n escape = false;\n next = value.indexOf(\")\", next + 1);\n if (~next) {\n escapePos = next;\n while (value.charCodeAt(escapePos - 1) === backslash) {\n escapePos -= 1;\n escape = !escape;\n }\n } else {\n value += \")\";\n next = value.length - 1;\n token.unclosed = true;\n }\n } while (escape);\n // Whitespaces before closed\n whitespacePos = next;\n do {\n whitespacePos -= 1;\n code = value.charCodeAt(whitespacePos);\n } while (code <= 32);\n if (parenthesesOpenPos < whitespacePos) {\n if (pos !== whitespacePos + 1) {\n token.nodes = [\n {\n type: \"word\",\n sourceIndex: pos,\n sourceEndIndex: whitespacePos + 1,\n value: value.slice(pos, whitespacePos + 1)\n }\n ];\n } else {\n token.nodes = [];\n }\n if (token.unclosed && whitespacePos + 1 !== next) {\n token.after = \"\";\n token.nodes.push({\n type: \"space\",\n sourceIndex: whitespacePos + 1,\n sourceEndIndex: next,\n value: value.slice(whitespacePos + 1, next)\n });\n } else {\n token.after = value.slice(whitespacePos + 1, next);\n token.sourceEndIndex = next;\n }\n } else {\n token.after = \"\";\n token.nodes = [];\n }\n pos = next + 1;\n token.sourceEndIndex = token.unclosed ? next : pos;\n code = value.charCodeAt(pos);\n tokens.push(token);\n } else {\n balanced += 1;\n token.after = \"\";\n token.sourceEndIndex = pos + 1;\n tokens.push(token);\n stack.push(token);\n tokens = token.nodes = [];\n parent = token;\n }\n name = \"\";\n\n // Close parentheses\n } else if (closeParentheses === code && balanced) {\n pos += 1;\n code = value.charCodeAt(pos);\n\n parent.after = after;\n parent.sourceEndIndex += after.length;\n after = \"\";\n balanced -= 1;\n stack[stack.length - 1].sourceEndIndex = pos;\n stack.pop();\n parent = stack[balanced];\n tokens = parent.nodes;\n\n // Words\n } else {\n next = pos;\n do {\n if (code === backslash) {\n next += 1;\n }\n next += 1;\n code = value.charCodeAt(next);\n } while (\n next < max &&\n !(\n code <= 32 ||\n code === singleQuote ||\n code === doubleQuote ||\n code === comma ||\n code === colon ||\n code === slash ||\n code === openParentheses ||\n (code === star &&\n parent &&\n parent.type === \"function\" &&\n parent.value === \"calc\") ||\n (code === slash &&\n parent.type === \"function\" &&\n parent.value === \"calc\") ||\n (code === closeParentheses && balanced)\n )\n );\n token = value.slice(pos, next);\n\n if (openParentheses === code) {\n name = token;\n } else if (\n (uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) &&\n plus === token.charCodeAt(1) &&\n isUnicodeRange.test(token.slice(2))\n ) {\n tokens.push({\n type: \"unicode-range\",\n sourceIndex: pos,\n sourceEndIndex: next,\n value: token\n });\n } else {\n tokens.push({\n type: \"word\",\n sourceIndex: pos,\n sourceEndIndex: next,\n value: token\n });\n }\n\n pos = next;\n }\n }\n\n for (pos = stack.length - 1; pos; pos -= 1) {\n stack[pos].unclosed = true;\n stack[pos].sourceEndIndex = value.length;\n }\n\n return stack[0].nodes;\n};\n","module.exports = function walk(nodes, cb, bubble) {\n var i, max, node, result;\n\n for (i = 0, max = nodes.length; i < max; i += 1) {\n node = nodes[i];\n if (!bubble) {\n result = cb(node, i, nodes);\n }\n\n if (\n result !== false &&\n node.type === \"function\" &&\n Array.isArray(node.nodes)\n ) {\n walk(node.nodes, cb, bubble);\n }\n\n if (bubble) {\n cb(node, i, nodes);\n }\n }\n};\n","function stringifyNode(node, custom) {\n var type = node.type;\n var value = node.value;\n var buf;\n var customResult;\n\n if (custom && (customResult = custom(node)) !== undefined) {\n return customResult;\n } else if (type === \"word\" || type === \"space\") {\n return value;\n } else if (type === \"string\") {\n buf = node.quote || \"\";\n return buf + value + (node.unclosed ? \"\" : buf);\n } else if (type === \"comment\") {\n return \"/*\" + value + (node.unclosed ? \"\" : \"*/\");\n } else if (type === \"div\") {\n return (node.before || \"\") + value + (node.after || \"\");\n } else if (Array.isArray(node.nodes)) {\n buf = stringify(node.nodes, custom);\n if (type !== \"function\") {\n return buf;\n }\n return (\n value +\n \"(\" +\n (node.before || \"\") +\n buf +\n (node.after || \"\") +\n (node.unclosed ? \"\" : \")\")\n );\n }\n return value;\n}\n\nfunction stringify(nodes, custom) {\n var result, i;\n\n if (Array.isArray(nodes)) {\n result = \"\";\n for (i = nodes.length - 1; ~i; i -= 1) {\n result = stringifyNode(nodes[i], custom) + result;\n }\n return result;\n }\n return stringifyNode(nodes, custom);\n}\n\nmodule.exports = stringify;\n","var minus = \"-\".charCodeAt(0);\nvar plus = \"+\".charCodeAt(0);\nvar dot = \".\".charCodeAt(0);\nvar exp = \"e\".charCodeAt(0);\nvar EXP = \"E\".charCodeAt(0);\n\n// Check if three code points would start a number\n// https://www.w3.org/TR/css-syntax-3/#starts-with-a-number\nfunction likeNumber(value) {\n var code = value.charCodeAt(0);\n var nextCode;\n\n if (code === plus || code === minus) {\n nextCode = value.charCodeAt(1);\n\n if (nextCode >= 48 && nextCode <= 57) {\n return true;\n }\n\n var nextNextCode = value.charCodeAt(2);\n\n if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) {\n return true;\n }\n\n return false;\n }\n\n if (code === dot) {\n nextCode = value.charCodeAt(1);\n\n if (nextCode >= 48 && nextCode <= 57) {\n return true;\n }\n\n return false;\n }\n\n if (code >= 48 && code <= 57) {\n return true;\n }\n\n return false;\n}\n\n// Consume a number\n// https://www.w3.org/TR/css-syntax-3/#consume-number\nmodule.exports = function(value) {\n var pos = 0;\n var length = value.length;\n var code;\n var nextCode;\n var nextNextCode;\n\n if (length === 0 || !likeNumber(value)) {\n return false;\n }\n\n code = value.charCodeAt(pos);\n\n if (code === plus || code === minus) {\n pos++;\n }\n\n while (pos < length) {\n code = value.charCodeAt(pos);\n\n if (code < 48 || code > 57) {\n break;\n }\n\n pos += 1;\n }\n\n code = value.charCodeAt(pos);\n nextCode = value.charCodeAt(pos + 1);\n\n if (code === dot && nextCode >= 48 && nextCode <= 57) {\n pos += 2;\n\n while (pos < length) {\n code = value.charCodeAt(pos);\n\n if (code < 48 || code > 57) {\n break;\n }\n\n pos += 1;\n }\n }\n\n code = value.charCodeAt(pos);\n nextCode = value.charCodeAt(pos + 1);\n nextNextCode = value.charCodeAt(pos + 2);\n\n if (\n (code === exp || code === EXP) &&\n ((nextCode >= 48 && nextCode <= 57) ||\n ((nextCode === plus || nextCode === minus) &&\n nextNextCode >= 48 &&\n nextNextCode <= 57))\n ) {\n pos += nextCode === plus || nextCode === minus ? 3 : 2;\n\n while (pos < length) {\n code = value.charCodeAt(pos);\n\n if (code < 48 || code > 57) {\n break;\n }\n\n pos += 1;\n }\n }\n\n return {\n number: value.slice(0, pos),\n unit: value.slice(pos)\n };\n};\n","var parse = require(\"./parse\");\nvar walk = require(\"./walk\");\nvar stringify = require(\"./stringify\");\n\nfunction ValueParser(value) {\n if (this instanceof ValueParser) {\n this.nodes = parse(value);\n return this;\n }\n return new ValueParser(value);\n}\n\nValueParser.prototype.toString = function() {\n return Array.isArray(this.nodes) ? stringify(this.nodes) : \"\";\n};\n\nValueParser.prototype.walk = function(cb, bubble) {\n walk(this.nodes, cb, bubble);\n return this;\n};\n\nValueParser.unit = require(\"./unit\");\n\nValueParser.walk = walk;\n\nValueParser.stringify = stringify;\n\nmodule.exports = ValueParser;\n","// Copyright (c) 2014 Rafael Caricio. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nvar GradientParser = (GradientParser || {});\n\nGradientParser.stringify = (function() {\n\n var visitor = {\n\n 'visit_linear-gradient': function(node) {\n return visitor.visit_gradient(node);\n },\n\n 'visit_repeating-linear-gradient': function(node) {\n return visitor.visit_gradient(node);\n },\n\n 'visit_radial-gradient': function(node) {\n return visitor.visit_gradient(node);\n },\n\n 'visit_repeating-radial-gradient': function(node) {\n return visitor.visit_gradient(node);\n },\n\n 'visit_gradient': function(node) {\n var orientation = visitor.visit(node.orientation);\n if (orientation) {\n orientation += ', ';\n }\n\n return node.type + '(' + orientation + visitor.visit(node.colorStops) + ')';\n },\n\n 'visit_shape': function(node) {\n var result = node.value,\n at = visitor.visit(node.at),\n style = visitor.visit(node.style);\n\n if (style) {\n result += ' ' + style;\n }\n\n if (at) {\n result += ' at ' + at;\n }\n\n return result;\n },\n\n 'visit_default-radial': function(node) {\n var result = '',\n at = visitor.visit(node.at);\n\n if (at) {\n result += at;\n }\n return result;\n },\n\n 'visit_extent-keyword': function(node) {\n var result = node.value,\n at = visitor.visit(node.at);\n\n if (at) {\n result += ' at ' + at;\n }\n\n return result;\n },\n\n 'visit_position-keyword': function(node) {\n return node.value;\n },\n\n 'visit_position': function(node) {\n return visitor.visit(node.value.x) + ' ' + visitor.visit(node.value.y);\n },\n\n 'visit_%': function(node) {\n return node.value + '%';\n },\n\n 'visit_em': function(node) {\n return node.value + 'em';\n },\n\n 'visit_px': function(node) {\n return node.value + 'px';\n },\n\n 'visit_literal': function(node) {\n return visitor.visit_color(node.value, node);\n },\n\n 'visit_hex': function(node) {\n return visitor.visit_color('#' + node.value, node);\n },\n\n 'visit_rgb': function(node) {\n return visitor.visit_color('rgb(' + node.value.join(', ') + ')', node);\n },\n\n 'visit_rgba': function(node) {\n return visitor.visit_color('rgba(' + node.value.join(', ') + ')', node);\n },\n\n 'visit_color': function(resultColor, node) {\n var result = resultColor,\n length = visitor.visit(node.length);\n\n if (length) {\n result += ' ' + length;\n }\n return result;\n },\n\n 'visit_angular': function(node) {\n return node.value + 'deg';\n },\n\n 'visit_directional': function(node) {\n return 'to ' + node.value;\n },\n\n 'visit_array': function(elements) {\n var result = '',\n size = elements.length;\n\n elements.forEach(function(element, i) {\n result += visitor.visit(element);\n if (i < size - 1) {\n result += ', ';\n }\n });\n\n return result;\n },\n\n 'visit': function(element) {\n if (!element) {\n return '';\n }\n var result = '';\n\n if (element instanceof Array) {\n return visitor.visit_array(element, result);\n } else if (element.type) {\n var nodeVisitor = visitor['visit_' + element.type];\n if (nodeVisitor) {\n return nodeVisitor(element);\n } else {\n throw Error('Missing visitor visit_' + element.type);\n }\n } else {\n throw Error('Invalid node.');\n }\n }\n\n };\n\n return function(root) {\n return visitor.visit(root);\n };\n})();\n\n// Copyright (c) 2014 Rafael Caricio. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nvar GradientParser = (GradientParser || {});\n\nGradientParser.parse = (function() {\n\n var tokens = {\n linearGradient: /^(\\-(webkit|o|ms|moz)\\-)?(linear\\-gradient)/i,\n repeatingLinearGradient: /^(\\-(webkit|o|ms|moz)\\-)?(repeating\\-linear\\-gradient)/i,\n radialGradient: /^(\\-(webkit|o|ms|moz)\\-)?(radial\\-gradient)/i,\n repeatingRadialGradient: /^(\\-(webkit|o|ms|moz)\\-)?(repeating\\-radial\\-gradient)/i,\n sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,\n extentKeywords: /^(closest\\-side|closest\\-corner|farthest\\-side|farthest\\-corner|contain|cover)/,\n positionKeywords: /^(left|center|right|top|bottom)/i,\n pixelValue: /^(-?(([0-9]*\\.[0-9]+)|([0-9]+\\.?)))px/,\n percentageValue: /^(-?(([0-9]*\\.[0-9]+)|([0-9]+\\.?)))\\%/,\n emValue: /^(-?(([0-9]*\\.[0-9]+)|([0-9]+\\.?)))em/,\n angleValue: /^(-?(([0-9]*\\.[0-9]+)|([0-9]+\\.?)))deg/,\n startCall: /^\\(/,\n endCall: /^\\)/,\n comma: /^,/,\n hexColor: /^\\#([0-9a-fA-F]+)/,\n literalColor: /^([a-zA-Z]+)/,\n rgbColor: /^rgb/i,\n rgbaColor: /^rgba/i,\n number: /^(([0-9]*\\.[0-9]+)|([0-9]+\\.?))/\n };\n\n var input = '';\n\n function error(msg) {\n var err = new Error(input + ': ' + msg);\n err.source = input;\n throw err;\n }\n\n function getAST() {\n var ast = matchListDefinitions();\n\n if (input.length > 0) {\n error('Invalid input not EOF');\n }\n\n return ast;\n }\n\n function matchListDefinitions() {\n return matchListing(matchDefinition);\n }\n\n function matchDefinition() {\n return matchGradient(\n 'linear-gradient',\n tokens.linearGradient,\n matchLinearOrientation) ||\n\n matchGradient(\n 'repeating-linear-gradient',\n tokens.repeatingLinearGradient,\n matchLinearOrientation) ||\n\n matchGradient(\n 'radial-gradient',\n tokens.radialGradient,\n matchListRadialOrientations) ||\n\n matchGradient(\n 'repeating-radial-gradient',\n tokens.repeatingRadialGradient,\n matchListRadialOrientations);\n }\n\n function matchGradient(gradientType, pattern, orientationMatcher) {\n return matchCall(pattern, function(captures) {\n\n var orientation = orientationMatcher();\n if (orientation) {\n if (!scan(tokens.comma)) {\n error('Missing comma before color stops');\n }\n }\n\n return {\n type: gradientType,\n orientation: orientation,\n colorStops: matchListing(matchColorStop)\n };\n });\n }\n\n function matchCall(pattern, callback) {\n var captures = scan(pattern);\n\n if (captures) {\n if (!scan(tokens.startCall)) {\n error('Missing (');\n }\n\n var result = callback(captures);\n\n if (!scan(tokens.endCall)) {\n error('Missing )');\n }\n\n return result;\n }\n }\n\n function matchLinearOrientation() {\n return matchSideOrCorner() ||\n matchAngle();\n }\n\n function matchSideOrCorner() {\n return match('directional', tokens.sideOrCorner, 1);\n }\n\n function matchAngle() {\n return match('angular', tokens.angleValue, 1);\n }\n\n function matchListRadialOrientations() {\n var radialOrientations,\n radialOrientation = matchRadialOrientation(),\n lookaheadCache;\n\n if (radialOrientation) {\n radialOrientations = [];\n radialOrientations.push(radialOrientation);\n\n lookaheadCache = input;\n if (scan(tokens.comma)) {\n radialOrientation = matchRadialOrientation();\n if (radialOrientation) {\n radialOrientations.push(radialOrientation);\n } else {\n input = lookaheadCache;\n }\n }\n }\n\n return radialOrientations;\n }\n\n function matchRadialOrientation() {\n var radialType = matchCircle() ||\n matchEllipse();\n\n if (radialType) {\n radialType.at = matchAtPosition();\n } else {\n var extent = matchExtentKeyword();\n if (extent) {\n radialType = extent;\n var positionAt = matchAtPosition();\n if (positionAt) {\n radialType.at = positionAt;\n }\n } else {\n var defaultPosition = matchPositioning();\n if (defaultPosition) {\n radialType = {\n type: 'default-radial',\n at: defaultPosition\n };\n }\n }\n }\n\n return radialType;\n }\n\n function matchCircle() {\n var circle = match('shape', /^(circle)/i, 0);\n\n if (circle) {\n circle.style = matchLength() || matchExtentKeyword();\n }\n\n return circle;\n }\n\n function matchEllipse() {\n var ellipse = match('shape', /^(ellipse)/i, 0);\n\n if (ellipse) {\n ellipse.style = matchDistance() || matchExtentKeyword();\n }\n\n return ellipse;\n }\n\n function matchExtentKeyword() {\n return match('extent-keyword', tokens.extentKeywords, 1);\n }\n\n function matchAtPosition() {\n if (match('position', /^at/, 0)) {\n var positioning = matchPositioning();\n\n if (!positioning) {\n error('Missing positioning value');\n }\n\n return positioning;\n }\n }\n\n function matchPositioning() {\n var location = matchCoordinates();\n\n if (location.x || location.y) {\n return {\n type: 'position',\n value: location\n };\n }\n }\n\n function matchCoordinates() {\n return {\n x: matchDistance(),\n y: matchDistance()\n };\n }\n\n function matchListing(matcher) {\n var captures = matcher(),\n result = [];\n\n if (captures) {\n result.push(captures);\n while (scan(tokens.comma)) {\n captures = matcher();\n if (captures) {\n result.push(captures);\n } else {\n error('One extra comma');\n }\n }\n }\n\n return result;\n }\n\n function matchColorStop() {\n var color = matchColor();\n\n if (!color) {\n error('Expected color definition');\n }\n\n color.length = matchDistance();\n return color;\n }\n\n function matchColor() {\n return matchHexColor() ||\n matchRGBAColor() ||\n matchRGBColor() ||\n matchLiteralColor();\n }\n\n function matchLiteralColor() {\n return match('literal', tokens.literalColor, 0);\n }\n\n function matchHexColor() {\n return match('hex', tokens.hexColor, 1);\n }\n\n function matchRGBColor() {\n return matchCall(tokens.rgbColor, function() {\n return {\n type: 'rgb',\n value: matchListing(matchNumber)\n };\n });\n }\n\n function matchRGBAColor() {\n return matchCall(tokens.rgbaColor, function() {\n return {\n type: 'rgba',\n value: matchListing(matchNumber)\n };\n });\n }\n\n function matchNumber() {\n return scan(tokens.number)[1];\n }\n\n function matchDistance() {\n return match('%', tokens.percentageValue, 1) ||\n matchPositionKeyword() ||\n matchLength();\n }\n\n function matchPositionKeyword() {\n return match('position-keyword', tokens.positionKeywords, 1);\n }\n\n function matchLength() {\n return match('px', tokens.pixelValue, 1) ||\n match('em', tokens.emValue, 1);\n }\n\n function match(type, pattern, captureIndex) {\n var captures = scan(pattern);\n if (captures) {\n return {\n type: type,\n value: captures[captureIndex]\n };\n }\n }\n\n function scan(regexp) {\n var captures,\n blankCaptures;\n\n blankCaptures = /^[\\n\\r\\t\\s]+/.exec(input);\n if (blankCaptures) {\n consume(blankCaptures[0].length);\n }\n\n captures = regexp.exec(input);\n if (captures) {\n consume(captures[0].length);\n }\n\n return captures;\n }\n\n function consume(size) {\n input = input.substr(size);\n }\n\n return function(code) {\n input = code.toString();\n return getAST();\n };\n})();\n\nexports.parse = GradientParser.parse;\nexports.stringify = GradientParser.stringify;\n","/*\nLanguage: 1C:Enterprise\nAuthor: Stanislav Belov \nDescription: built-in language 1C:Enterprise (v7, v8)\nCategory: enterprise\n*/\n\nfunction _1c(hljs) {\n // общий паттерн для определения идентификаторов\n const UNDERSCORE_IDENT_RE = '[A-Za-zА-Яа-яёЁ_][A-Za-zА-Яа-яёЁ_0-9]+';\n\n // v7 уникальные ключевые слова, отсутствующие в v8 ==> keyword\n const v7_keywords =\n 'далее ';\n\n // v8 ключевые слова ==> keyword\n const v8_keywords =\n 'возврат вызватьисключение выполнить для если и из или иначе иначеесли исключение каждого конецесли '\n + 'конецпопытки конеццикла не новый перейти перем по пока попытка прервать продолжить тогда цикл экспорт ';\n\n // keyword : ключевые слова\n const KEYWORD = v7_keywords + v8_keywords;\n\n // v7 уникальные директивы, отсутствующие в v8 ==> meta-keyword\n const v7_meta_keywords =\n 'загрузитьизфайла ';\n\n // v8 ключевые слова в инструкциях препроцессора, директивах компиляции, аннотациях ==> meta-keyword\n const v8_meta_keywords =\n 'вебклиент вместо внешнеесоединение клиент конецобласти мобильноеприложениеклиент мобильноеприложениесервер '\n + 'наклиенте наклиентенасервере наклиентенасерверебезконтекста насервере насерверебезконтекста область перед '\n + 'после сервер толстыйклиентобычноеприложение толстыйклиентуправляемоеприложение тонкийклиент ';\n\n // meta-keyword : ключевые слова в инструкциях препроцессора, директивах компиляции, аннотациях\n const METAKEYWORD = v7_meta_keywords + v8_meta_keywords;\n\n // v7 системные константы ==> built_in\n const v7_system_constants =\n 'разделительстраниц разделительстрок символтабуляции ';\n\n // v7 уникальные методы глобального контекста, отсутствующие в v8 ==> built_in\n const v7_global_context_methods =\n 'ansitooem oemtoansi ввестивидсубконто ввестиперечисление ввестипериод ввестиплансчетов выбранныйплансчетов '\n + 'датагод датамесяц датачисло заголовоксистемы значениевстроку значениеизстроки каталогиб каталогпользователя '\n + 'кодсимв конгода конецпериодаби конецрассчитанногопериодаби конецстандартногоинтервала конквартала конмесяца '\n + 'коннедели лог лог10 максимальноеколичествосубконто названиеинтерфейса названиенабораправ назначитьвид '\n + 'назначитьсчет найтиссылки началопериодаби началостандартногоинтервала начгода начквартала начмесяца '\n + 'начнедели номерднягода номерднянедели номернеделигода обработкаожидания основнойжурналрасчетов '\n + 'основнойплансчетов основнойязык очиститьокносообщений периодстр получитьвремята получитьдатута '\n + 'получитьдокументта получитьзначенияотбора получитьпозициюта получитьпустоезначение получитьта '\n + 'префиксавтонумерации пропись пустоезначение разм разобратьпозициюдокумента рассчитатьрегистрына '\n + 'рассчитатьрегистрыпо симв создатьобъект статусвозврата стрколичествострок сформироватьпозициюдокумента '\n + 'счетпокоду текущеевремя типзначения типзначениястр установитьтана установитьтапо фиксшаблон шаблон ';\n\n // v8 методы глобального контекста ==> built_in\n const v8_global_context_methods =\n 'acos asin atan base64значение base64строка cos exp log log10 pow sin sqrt tan xmlзначение xmlстрока '\n + 'xmlтип xmlтипзнч активноеокно безопасныйрежим безопасныйрежимразделенияданных булево ввестидату ввестизначение '\n + 'ввестистроку ввестичисло возможностьчтенияxml вопрос восстановитьзначение врег выгрузитьжурналрегистрации '\n + 'выполнитьобработкуоповещения выполнитьпроверкуправдоступа вычислить год данныеформывзначение дата день деньгода '\n + 'деньнедели добавитьмесяц заблокироватьданныедляредактирования заблокироватьработупользователя завершитьработусистемы '\n + 'загрузитьвнешнююкомпоненту закрытьсправку записатьjson записатьxml записатьдатуjson записьжурналарегистрации '\n + 'заполнитьзначениясвойств запроситьразрешениепользователя запуститьприложение запуститьсистему зафиксироватьтранзакцию '\n + 'значениевданныеформы значениевстрокувнутр значениевфайл значениезаполнено значениеизстрокивнутр значениеизфайла '\n + 'изxmlтипа импортмоделиxdto имякомпьютера имяпользователя инициализироватьпредопределенныеданные информацияобошибке '\n + 'каталогбиблиотекимобильногоустройства каталогвременныхфайлов каталогдокументов каталогпрограммы кодироватьстроку '\n + 'кодлокализацииинформационнойбазы кодсимвола командасистемы конецгода конецдня конецквартала конецмесяца конецминуты '\n + 'конецнедели конецчаса конфигурациябазыданныхизмененадинамически конфигурацияизменена копироватьданныеформы '\n + 'копироватьфайл краткоепредставлениеошибки лев макс местноевремя месяц мин минута монопольныйрежим найти '\n + 'найтинедопустимыесимволыxml найтиокнопонавигационнойссылке найтипомеченныенаудаление найтипоссылкам найтифайлы '\n + 'началогода началодня началоквартала началомесяца началоминуты началонедели началочаса начатьзапросразрешенияпользователя '\n + 'начатьзапускприложения начатькопированиефайла начатьперемещениефайла начатьподключениевнешнейкомпоненты '\n + 'начатьподключениерасширенияработыскриптографией начатьподключениерасширенияработысфайлами начатьпоискфайлов '\n + 'начатьполучениекаталогавременныхфайлов начатьполучениекаталогадокументов начатьполучениерабочегокаталогаданныхпользователя '\n + 'начатьполучениефайлов начатьпомещениефайла начатьпомещениефайлов начатьсозданиедвоичныхданныхизфайла начатьсозданиекаталога '\n + 'начатьтранзакцию начатьудалениефайлов начатьустановкувнешнейкомпоненты начатьустановкурасширенияработыскриптографией '\n + 'начатьустановкурасширенияработысфайлами неделягода необходимостьзавершениясоединения номерсеансаинформационнойбазы '\n + 'номерсоединенияинформационнойбазы нрег нстр обновитьинтерфейс обновитьнумерациюобъектов обновитьповторноиспользуемыезначения '\n + 'обработкапрерыванияпользователя объединитьфайлы окр описаниеошибки оповестить оповеститьобизменении '\n + 'отключитьобработчикзапросанастроекклиенталицензирования отключитьобработчикожидания отключитьобработчикоповещения '\n + 'открытьзначение открытьиндекссправки открытьсодержаниесправки открытьсправку открытьформу открытьформумодально '\n + 'отменитьтранзакцию очиститьжурналрегистрации очиститьнастройкипользователя очиститьсообщения параметрыдоступа '\n + 'перейтипонавигационнойссылке переместитьфайл подключитьвнешнююкомпоненту '\n + 'подключитьобработчикзапросанастроекклиенталицензирования подключитьобработчикожидания подключитьобработчикоповещения '\n + 'подключитьрасширениеработыскриптографией подключитьрасширениеработысфайлами подробноепредставлениеошибки '\n + 'показатьвводдаты показатьвводзначения показатьвводстроки показатьвводчисла показатьвопрос показатьзначение '\n + 'показатьинформациюобошибке показатьнакарте показатьоповещениепользователя показатьпредупреждение полноеимяпользователя '\n + 'получитьcomобъект получитьxmlтип получитьадреспоместоположению получитьблокировкусеансов получитьвремязавершенияспящегосеанса '\n + 'получитьвремязасыпанияпассивногосеанса получитьвремяожиданияблокировкиданных получитьданныевыбора '\n + 'получитьдополнительныйпараметрклиенталицензирования получитьдопустимыекодылокализации получитьдопустимыечасовыепояса '\n + 'получитьзаголовокклиентскогоприложения получитьзаголовоксистемы получитьзначенияотборажурналарегистрации '\n + 'получитьидентификаторконфигурации получитьизвременногохранилища получитьимявременногофайла '\n + 'получитьимяклиенталицензирования получитьинформациюэкрановклиента получитьиспользованиежурналарегистрации '\n + 'получитьиспользованиесобытияжурналарегистрации получитькраткийзаголовокприложения получитьмакетоформления '\n + 'получитьмаскувсефайлы получитьмаскувсефайлыклиента получитьмаскувсефайлысервера получитьместоположениепоадресу '\n + 'получитьминимальнуюдлинупаролейпользователей получитьнавигационнуюссылку получитьнавигационнуюссылкуинформационнойбазы '\n + 'получитьобновлениеконфигурациибазыданных получитьобновлениепредопределенныхданныхинформационнойбазы получитьобщиймакет '\n + 'получитьобщуюформу получитьокна получитьоперативнуюотметкувремени получитьотключениебезопасногорежима '\n + 'получитьпараметрыфункциональныхопцийинтерфейса получитьполноеимяпредопределенногозначения '\n + 'получитьпредставлениянавигационныхссылок получитьпроверкусложностипаролейпользователей получитьразделительпути '\n + 'получитьразделительпутиклиента получитьразделительпутисервера получитьсеансыинформационнойбазы '\n + 'получитьскоростьклиентскогосоединения получитьсоединенияинформационнойбазы получитьсообщенияпользователю '\n + 'получитьсоответствиеобъектаиформы получитьсоставстандартногоинтерфейсаodata получитьструктурухранениябазыданных '\n + 'получитьтекущийсеансинформационнойбазы получитьфайл получитьфайлы получитьформу получитьфункциональнуюопцию '\n + 'получитьфункциональнуюопциюинтерфейса получитьчасовойпоясинформационнойбазы пользователиос поместитьвовременноехранилище '\n + 'поместитьфайл поместитьфайлы прав праводоступа предопределенноезначение представлениекодалокализации представлениепериода '\n + 'представлениеправа представлениеприложения представлениесобытияжурналарегистрации представлениечасовогопояса предупреждение '\n + 'прекратитьработусистемы привилегированныйрежим продолжитьвызов прочитатьjson прочитатьxml прочитатьдатуjson пустаястрока '\n + 'рабочийкаталогданныхпользователя разблокироватьданныедляредактирования разделитьфайл разорватьсоединениесвнешнимисточникомданных '\n + 'раскодироватьстроку рольдоступна секунда сигнал символ скопироватьжурналрегистрации смещениелетнеговремени '\n + 'смещениестандартноговремени соединитьбуферыдвоичныхданных создатькаталог создатьфабрикуxdto сокрл сокрлп сокрп сообщить '\n + 'состояние сохранитьзначение сохранитьнастройкипользователя сред стрдлина стрзаканчиваетсяна стрзаменить стрнайти стрначинаетсяс '\n + 'строка строкасоединенияинформационнойбазы стрполучитьстроку стрразделить стрсоединить стрсравнить стрчисловхождений '\n + 'стрчислострок стршаблон текущаядата текущаядатасеанса текущаяуниверсальнаядата текущаяуниверсальнаядатавмиллисекундах '\n + 'текущийвариантинтерфейсаклиентскогоприложения текущийвариантосновногошрифтаклиентскогоприложения текущийкодлокализации '\n + 'текущийрежимзапуска текущийязык текущийязыксистемы тип типзнч транзакцияактивна трег удалитьданныеинформационнойбазы '\n + 'удалитьизвременногохранилища удалитьобъекты удалитьфайлы универсальноевремя установитьбезопасныйрежим '\n + 'установитьбезопасныйрежимразделенияданных установитьблокировкусеансов установитьвнешнююкомпоненту '\n + 'установитьвремязавершенияспящегосеанса установитьвремязасыпанияпассивногосеанса установитьвремяожиданияблокировкиданных '\n + 'установитьзаголовокклиентскогоприложения установитьзаголовоксистемы установитьиспользованиежурналарегистрации '\n + 'установитьиспользованиесобытияжурналарегистрации установитькраткийзаголовокприложения '\n + 'установитьминимальнуюдлинупаролейпользователей установитьмонопольныйрежим установитьнастройкиклиенталицензирования '\n + 'установитьобновлениепредопределенныхданныхинформационнойбазы установитьотключениебезопасногорежима '\n + 'установитьпараметрыфункциональныхопцийинтерфейса установитьпривилегированныйрежим '\n + 'установитьпроверкусложностипаролейпользователей установитьрасширениеработыскриптографией '\n + 'установитьрасширениеработысфайлами установитьсоединениесвнешнимисточникомданных установитьсоответствиеобъектаиформы '\n + 'установитьсоставстандартногоинтерфейсаodata установитьчасовойпоясинформационнойбазы установитьчасовойпояссеанса '\n + 'формат цел час часовойпояс часовойпояссеанса число числопрописью этоадресвременногохранилища ';\n\n // v8 свойства глобального контекста ==> built_in\n const v8_global_context_property =\n 'wsссылки библиотекакартинок библиотекамакетовоформлениякомпоновкиданных библиотекастилей бизнеспроцессы '\n + 'внешниеисточникиданных внешниеобработки внешниеотчеты встроенныепокупки главныйинтерфейс главныйстиль '\n + 'документы доставляемыеуведомления журналыдокументов задачи информацияобинтернетсоединении использованиерабочейдаты '\n + 'историяработыпользователя константы критерииотбора метаданные обработки отображениерекламы отправкадоставляемыхуведомлений '\n + 'отчеты панельзадачос параметрзапуска параметрысеанса перечисления планывидоврасчета планывидовхарактеристик '\n + 'планыобмена планысчетов полнотекстовыйпоиск пользователиинформационнойбазы последовательности проверкавстроенныхпокупок '\n + 'рабочаядата расширенияконфигурации регистрыбухгалтерии регистрынакопления регистрырасчета регистрысведений '\n + 'регламентныезадания сериализаторxdto справочники средствагеопозиционирования средствакриптографии средствамультимедиа '\n + 'средстваотображениярекламы средствапочты средствателефонии фабрикаxdto файловыепотоки фоновыезадания хранилищанастроек '\n + 'хранилищевариантовотчетов хранилищенастроекданныхформ хранилищеобщихнастроек хранилищепользовательскихнастроекдинамическихсписков '\n + 'хранилищепользовательскихнастроекотчетов хранилищесистемныхнастроек ';\n\n // built_in : встроенные или библиотечные объекты (константы, классы, функции)\n const BUILTIN =\n v7_system_constants\n + v7_global_context_methods + v8_global_context_methods\n + v8_global_context_property;\n\n // v8 системные наборы значений ==> class\n const v8_system_sets_of_values =\n 'webцвета windowsцвета windowsшрифты библиотекакартинок рамкистиля символы цветастиля шрифтыстиля ';\n\n // v8 системные перечисления - интерфейсные ==> class\n const v8_system_enums_interface =\n 'автоматическоесохранениеданныхформывнастройках автонумерациявформе автораздвижениесерий '\n + 'анимациядиаграммы вариантвыравниванияэлементовизаголовков вариантуправлениявысотойтаблицы '\n + 'вертикальнаяпрокруткаформы вертикальноеположение вертикальноеположениеэлемента видгруппыформы '\n + 'виддекорацииформы виддополненияэлементаформы видизмененияданных видкнопкиформы видпереключателя '\n + 'видподписейкдиаграмме видполяформы видфлажка влияниеразмеранапузырекдиаграммы горизонтальноеположение '\n + 'горизонтальноеположениеэлемента группировкаколонок группировкаподчиненныхэлементовформы '\n + 'группыиэлементы действиеперетаскивания дополнительныйрежимотображения допустимыедействияперетаскивания '\n + 'интервалмеждуэлементамиформы использованиевывода использованиеполосыпрокрутки '\n + 'используемоезначениеточкибиржевойдиаграммы историявыборапривводе источникзначенийоситочекдиаграммы '\n + 'источникзначенияразмерапузырькадиаграммы категориягруппыкоманд максимумсерий начальноеотображениедерева '\n + 'начальноеотображениесписка обновлениетекстаредактирования ориентациядендрограммы ориентациядиаграммы '\n + 'ориентацияметокдиаграммы ориентацияметоксводнойдиаграммы ориентацияэлементаформы отображениевдиаграмме '\n + 'отображениевлегендедиаграммы отображениегруппыкнопок отображениезаголовкашкалыдиаграммы '\n + 'отображениезначенийсводнойдиаграммы отображениезначенияизмерительнойдиаграммы '\n + 'отображениеинтерваладиаграммыганта отображениекнопки отображениекнопкивыбора отображениеобсужденийформы '\n + 'отображениеобычнойгруппы отображениеотрицательныхзначенийпузырьковойдиаграммы отображениепанелипоиска '\n + 'отображениеподсказки отображениепредупрежденияприредактировании отображениеразметкиполосырегулирования '\n + 'отображениестраницформы отображениетаблицы отображениетекстазначениядиаграммыганта '\n + 'отображениеуправленияобычнойгруппы отображениефигурыкнопки палитрацветовдиаграммы поведениеобычнойгруппы '\n + 'поддержкамасштабадендрограммы поддержкамасштабадиаграммыганта поддержкамасштабасводнойдиаграммы '\n + 'поисквтаблицепривводе положениезаголовкаэлементаформы положениекартинкикнопкиформы '\n + 'положениекартинкиэлементаграфическойсхемы положениекоманднойпанелиформы положениекоманднойпанелиэлементаформы '\n + 'положениеопорнойточкиотрисовки положениеподписейкдиаграмме положениеподписейшкалызначенийизмерительнойдиаграммы '\n + 'положениесостоянияпросмотра положениестрокипоиска положениетекстасоединительнойлинии положениеуправленияпоиском '\n + 'положениешкалывремени порядокотображенияточекгоризонтальнойгистограммы порядоксерийвлегендедиаграммы '\n + 'размеркартинки расположениезаголовкашкалыдиаграммы растягиваниеповертикалидиаграммыганта '\n + 'режимавтоотображениясостояния режимвводастроктаблицы режимвыборанезаполненного режимвыделениядаты '\n + 'режимвыделениястрокитаблицы режимвыделениятаблицы режимизмененияразмера режимизменениясвязанногозначения '\n + 'режимиспользованиядиалогапечати режимиспользованияпараметракоманды режиммасштабированияпросмотра '\n + 'режимосновногоокнаклиентскогоприложения режимоткрытияокнаформы режимотображениявыделения '\n + 'режимотображениягеографическойсхемы режимотображениязначенийсерии режимотрисовкисеткиграфическойсхемы '\n + 'режимполупрозрачностидиаграммы режимпробеловдиаграммы режимразмещениянастранице режимредактированияколонки '\n + 'режимсглаживаниядиаграммы режимсглаживанияиндикатора режимсписказадач сквозноевыравнивание '\n + 'сохранениеданныхформывнастройках способзаполнениятекстазаголовкашкалыдиаграммы '\n + 'способопределенияограничивающегозначениядиаграммы стандартнаягруппакоманд стандартноеоформление '\n + 'статусоповещенияпользователя стильстрелки типаппроксимациилиниитрендадиаграммы типдиаграммы '\n + 'типединицышкалывремени типимпортасерийслоягеографическойсхемы типлиниигеографическойсхемы типлиниидиаграммы '\n + 'типмаркерагеографическойсхемы типмаркерадиаграммы типобластиоформления '\n + 'типорганизацииисточникаданныхгеографическойсхемы типотображениясериислоягеографическойсхемы '\n + 'типотображенияточечногообъектагеографическойсхемы типотображенияшкалыэлементалегендыгеографическойсхемы '\n + 'типпоискаобъектовгеографическойсхемы типпроекциигеографическойсхемы типразмещенияизмерений '\n + 'типразмещенияреквизитовизмерений типрамкиэлементауправления типсводнойдиаграммы '\n + 'типсвязидиаграммыганта типсоединениязначенийпосериямдиаграммы типсоединенияточекдиаграммы '\n + 'типсоединительнойлинии типстороныэлементаграфическойсхемы типформыотчета типшкалырадарнойдиаграммы '\n + 'факторлиниитрендадиаграммы фигуракнопки фигурыграфическойсхемы фиксациявтаблице форматдняшкалывремени '\n + 'форматкартинки ширинаподчиненныхэлементовформы ';\n\n // v8 системные перечисления - свойства прикладных объектов ==> class\n const v8_system_enums_objects_properties =\n 'виддвижениябухгалтерии виддвижениянакопления видпериодарегистрарасчета видсчета видточкимаршрутабизнеспроцесса '\n + 'использованиеагрегатарегистранакопления использованиегруппиэлементов использованиережимапроведения '\n + 'использованиесреза периодичностьагрегатарегистранакопления режимавтовремя режимзаписидокумента режимпроведениядокумента ';\n\n // v8 системные перечисления - планы обмена ==> class\n const v8_system_enums_exchange_plans =\n 'авторегистрацияизменений допустимыйномерсообщения отправкаэлементаданных получениеэлементаданных ';\n\n // v8 системные перечисления - табличный документ ==> class\n const v8_system_enums_tabular_document =\n 'использованиерасшифровкитабличногодокумента ориентациястраницы положениеитоговколоноксводнойтаблицы '\n + 'положениеитоговстроксводнойтаблицы положениетекстаотносительнокартинки расположениезаголовкагруппировкитабличногодокумента '\n + 'способчтениязначенийтабличногодокумента типдвустороннейпечати типзаполненияобластитабличногодокумента '\n + 'типкурсоровтабличногодокумента типлиниирисункатабличногодокумента типлинииячейкитабличногодокумента '\n + 'типнаправленияпереходатабличногодокумента типотображениявыделениятабличногодокумента типотображениялинийсводнойтаблицы '\n + 'типразмещениятекстатабличногодокумента типрисункатабличногодокумента типсмещениятабличногодокумента '\n + 'типузоратабличногодокумента типфайлатабличногодокумента точностьпечати чередованиерасположениястраниц ';\n\n // v8 системные перечисления - планировщик ==> class\n const v8_system_enums_sheduler =\n 'отображениевремениэлементовпланировщика ';\n\n // v8 системные перечисления - форматированный документ ==> class\n const v8_system_enums_formatted_document =\n 'типфайлаформатированногодокумента ';\n\n // v8 системные перечисления - запрос ==> class\n const v8_system_enums_query =\n 'обходрезультатазапроса типзаписизапроса ';\n\n // v8 системные перечисления - построитель отчета ==> class\n const v8_system_enums_report_builder =\n 'видзаполнениярасшифровкипостроителяотчета типдобавленияпредставлений типизмеренияпостроителяотчета типразмещенияитогов ';\n\n // v8 системные перечисления - работа с файлами ==> class\n const v8_system_enums_files =\n 'доступкфайлу режимдиалогавыборафайла режимоткрытияфайла ';\n\n // v8 системные перечисления - построитель запроса ==> class\n const v8_system_enums_query_builder =\n 'типизмеренияпостроителязапроса ';\n\n // v8 системные перечисления - анализ данных ==> class\n const v8_system_enums_data_analysis =\n 'видданныханализа методкластеризации типединицыинтервалавременианализаданных типзаполнениятаблицырезультатаанализаданных '\n + 'типиспользованиячисловыхзначенийанализаданных типисточникаданныхпоискаассоциаций типколонкианализаданныхдереворешений '\n + 'типколонкианализаданныхкластеризация типколонкианализаданныхобщаястатистика типколонкианализаданныхпоискассоциаций '\n + 'типколонкианализаданныхпоискпоследовательностей типколонкимоделипрогноза типмерырасстоянияанализаданных '\n + 'типотсеченияправилассоциации типполяанализаданных типстандартизациианализаданных типупорядочиванияправилассоциациианализаданных '\n + 'типупорядочиванияшаблоновпоследовательностейанализаданных типупрощениядереварешений ';\n\n // v8 системные перечисления - xml, json, xs, dom, xdto, web-сервисы ==> class\n const v8_system_enums_xml_json_xs_dom_xdto_ws =\n 'wsнаправлениепараметра вариантxpathxs вариантзаписидатыjson вариантпростоготипаxs видгруппымоделиxs видфасетаxdto '\n + 'действиепостроителяdom завершенностьпростоготипаxs завершенностьсоставноготипаxs завершенностьсхемыxs запрещенныеподстановкиxs '\n + 'исключениягруппподстановкиxs категорияиспользованияатрибутаxs категорияограниченияидентичностиxs категорияограниченияпространствименxs '\n + 'методнаследованияxs модельсодержимогоxs назначениетипаxml недопустимыеподстановкиxs обработкапробельныхсимволовxs обработкасодержимогоxs '\n + 'ограничениезначенияxs параметрыотбораузловdom переносстрокjson позициявдокументеdom пробельныесимволыxml типатрибутаxml типзначенияjson '\n + 'типканоническогоxml типкомпонентыxs типпроверкиxml типрезультатаdomxpath типузлаdom типузлаxml формаxml формапредставленияxs '\n + 'форматдатыjson экранированиесимволовjson ';\n\n // v8 системные перечисления - система компоновки данных ==> class\n const v8_system_enums_data_composition_system =\n 'видсравнениякомпоновкиданных действиеобработкирасшифровкикомпоновкиданных направлениесортировкикомпоновкиданных '\n + 'расположениевложенныхэлементоврезультатакомпоновкиданных расположениеитоговкомпоновкиданных расположениегруппировкикомпоновкиданных '\n + 'расположениеполейгруппировкикомпоновкиданных расположениеполякомпоновкиданных расположениереквизитовкомпоновкиданных '\n + 'расположениересурсовкомпоновкиданных типбухгалтерскогоостаткакомпоновкиданных типвыводатекстакомпоновкиданных '\n + 'типгруппировкикомпоновкиданных типгруппыэлементовотборакомпоновкиданных типдополненияпериодакомпоновкиданных '\n + 'типзаголовкаполейкомпоновкиданных типмакетагруппировкикомпоновкиданных типмакетаобластикомпоновкиданных типостаткакомпоновкиданных '\n + 'типпериодакомпоновкиданных типразмещениятекстакомпоновкиданных типсвязинаборовданныхкомпоновкиданных типэлементарезультатакомпоновкиданных '\n + 'расположениелегендыдиаграммыкомпоновкиданных типпримененияотборакомпоновкиданных режимотображенияэлементанастройкикомпоновкиданных '\n + 'режимотображениянастроеккомпоновкиданных состояниеэлементанастройкикомпоновкиданных способвосстановлениянастроеккомпоновкиданных '\n + 'режимкомпоновкирезультата использованиепараметракомпоновкиданных автопозицияресурсовкомпоновкиданных '\n + 'вариантиспользованиягруппировкикомпоновкиданных расположениересурсоввдиаграммекомпоновкиданных фиксациякомпоновкиданных '\n + 'использованиеусловногооформлениякомпоновкиданных ';\n\n // v8 системные перечисления - почта ==> class\n const v8_system_enums_email =\n 'важностьинтернетпочтовогосообщения обработкатекстаинтернетпочтовогосообщения способкодированияинтернетпочтовоговложения '\n + 'способкодированиянеasciiсимволовинтернетпочтовогосообщения типтекстапочтовогосообщения протоколинтернетпочты '\n + 'статусразборапочтовогосообщения ';\n\n // v8 системные перечисления - журнал регистрации ==> class\n const v8_system_enums_logbook =\n 'режимтранзакциизаписижурналарегистрации статустранзакциизаписижурналарегистрации уровеньжурналарегистрации ';\n\n // v8 системные перечисления - криптография ==> class\n const v8_system_enums_cryptography =\n 'расположениехранилищасертификатовкриптографии режимвключениясертификатовкриптографии режимпроверкисертификатакриптографии '\n + 'типхранилищасертификатовкриптографии ';\n\n // v8 системные перечисления - ZIP ==> class\n const v8_system_enums_zip =\n 'кодировкаименфайловвzipфайле методсжатияzip методшифрованияzip режимвосстановленияпутейфайловzip режимобработкиподкаталоговzip '\n + 'режимсохраненияпутейzip уровеньсжатияzip ';\n\n // v8 системные перечисления -\n // Блокировка данных, Фоновые задания, Автоматизированное тестирование,\n // Доставляемые уведомления, Встроенные покупки, Интернет, Работа с двоичными данными ==> class\n const v8_system_enums_other =\n 'звуковоеоповещение направлениепереходакстроке позициявпотоке порядокбайтов режимблокировкиданных режимуправленияблокировкойданных '\n + 'сервисвстроенныхпокупок состояниефоновогозадания типподписчикадоставляемыхуведомлений уровеньиспользованиязащищенногосоединенияftp ';\n\n // v8 системные перечисления - схема запроса ==> class\n const v8_system_enums_request_schema =\n 'направлениепорядкасхемызапроса типдополненияпериодамисхемызапроса типконтрольнойточкисхемызапроса типобъединениясхемызапроса '\n + 'типпараметрадоступнойтаблицысхемызапроса типсоединениясхемызапроса ';\n\n // v8 системные перечисления - свойства объектов метаданных ==> class\n const v8_system_enums_properties_of_metadata_objects =\n 'httpметод автоиспользованиеобщегореквизита автопрефиксномеразадачи вариантвстроенногоязыка видиерархии видрегистранакопления '\n + 'видтаблицывнешнегоисточникаданных записьдвиженийприпроведении заполнениепоследовательностей индексирование '\n + 'использованиебазыпланавидоврасчета использованиебыстроговыбора использованиеобщегореквизита использованиеподчинения '\n + 'использованиеполнотекстовогопоиска использованиеразделяемыхданныхобщегореквизита использованиереквизита '\n + 'назначениеиспользованияприложения назначениерасширенияконфигурации направлениепередачи обновлениепредопределенныхданных '\n + 'оперативноепроведение основноепредставлениевидарасчета основноепредставлениевидахарактеристики основноепредставлениезадачи '\n + 'основноепредставлениепланаобмена основноепредставлениесправочника основноепредставлениесчета перемещениеграницыприпроведении '\n + 'периодичностьномерабизнеспроцесса периодичностьномерадокумента периодичностьрегистрарасчета периодичностьрегистрасведений '\n + 'повторноеиспользованиевозвращаемыхзначений полнотекстовыйпоискпривводепостроке принадлежностьобъекта проведение '\n + 'разделениеаутентификацииобщегореквизита разделениеданныхобщегореквизита разделениерасширенийконфигурацииобщегореквизита '\n + 'режимавтонумерацииобъектов режимзаписирегистра режимиспользованиямодальности '\n + 'режимиспользованиясинхронныхвызововрасширенийплатформыивнешнихкомпонент режимповторногоиспользованиясеансов '\n + 'режимполученияданныхвыборапривводепостроке режимсовместимости режимсовместимостиинтерфейса '\n + 'режимуправленияблокировкойданныхпоумолчанию сериикодовпланавидовхарактеристик сериикодовпланасчетов '\n + 'сериикодовсправочника созданиепривводе способвыбора способпоискастрокипривводепостроке способредактирования '\n + 'типданныхтаблицывнешнегоисточникаданных типкодапланавидоврасчета типкодасправочника типмакета типномерабизнеспроцесса '\n + 'типномерадокумента типномеразадачи типформы удалениедвижений ';\n\n // v8 системные перечисления - разные ==> class\n const v8_system_enums_differents =\n 'важностьпроблемыприменениярасширенияконфигурации вариантинтерфейсаклиентскогоприложения вариантмасштабаформклиентскогоприложения '\n + 'вариантосновногошрифтаклиентскогоприложения вариантстандартногопериода вариантстандартнойдатыначала видграницы видкартинки '\n + 'видотображенияполнотекстовогопоиска видрамки видсравнения видцвета видчисловогозначения видшрифта допустимаядлина допустимыйзнак '\n + 'использованиеbyteordermark использованиеметаданныхполнотекстовогопоиска источникрасширенийконфигурации клавиша кодвозвратадиалога '\n + 'кодировкаxbase кодировкатекста направлениепоиска направлениесортировки обновлениепредопределенныхданных обновлениеприизмененииданных '\n + 'отображениепанелиразделов проверказаполнения режимдиалогавопрос режимзапускаклиентскогоприложения режимокругления режимоткрытияформприложения '\n + 'режимполнотекстовогопоиска скоростьклиентскогосоединения состояниевнешнегоисточникаданных состояниеобновленияконфигурациибазыданных '\n + 'способвыборасертификатаwindows способкодированиястроки статуссообщения типвнешнейкомпоненты типплатформы типповеденияклавишиenter '\n + 'типэлементаинформацииовыполненииобновленияконфигурациибазыданных уровеньизоляциитранзакций хешфункция частидаты';\n\n // class: встроенные наборы значений, системные перечисления (содержат дочерние значения, обращения к которым через разыменование)\n const CLASS =\n v8_system_sets_of_values\n + v8_system_enums_interface\n + v8_system_enums_objects_properties\n + v8_system_enums_exchange_plans\n + v8_system_enums_tabular_document\n + v8_system_enums_sheduler\n + v8_system_enums_formatted_document\n + v8_system_enums_query\n + v8_system_enums_report_builder\n + v8_system_enums_files\n + v8_system_enums_query_builder\n + v8_system_enums_data_analysis\n + v8_system_enums_xml_json_xs_dom_xdto_ws\n + v8_system_enums_data_composition_system\n + v8_system_enums_email\n + v8_system_enums_logbook\n + v8_system_enums_cryptography\n + v8_system_enums_zip\n + v8_system_enums_other\n + v8_system_enums_request_schema\n + v8_system_enums_properties_of_metadata_objects\n + v8_system_enums_differents;\n\n // v8 общие объекты (у объектов есть конструктор, экземпляры создаются методом НОВЫЙ) ==> type\n const v8_shared_object =\n 'comобъект ftpсоединение httpзапрос httpсервисответ httpсоединение wsопределения wsпрокси xbase анализданных аннотацияxs '\n + 'блокировкаданных буфердвоичныхданных включениеxs выражениекомпоновкиданных генераторслучайныхчисел географическаясхема '\n + 'географическиекоординаты графическаясхема группамоделиxs данныерасшифровкикомпоновкиданных двоичныеданные дендрограмма '\n + 'диаграмма диаграммаганта диалогвыборафайла диалогвыборацвета диалогвыборашрифта диалограсписаниярегламентногозадания '\n + 'диалогредактированиястандартногопериода диапазон документdom документhtml документацияxs доставляемоеуведомление '\n + 'записьdom записьfastinfoset записьhtml записьjson записьxml записьzipфайла записьданных записьтекста записьузловdom '\n + 'запрос защищенноесоединениеopenssl значенияполейрасшифровкикомпоновкиданных извлечениетекста импортxs интернетпочта '\n + 'интернетпочтовоесообщение интернетпочтовыйпрофиль интернетпрокси интернетсоединение информациядляприложенияxs '\n + 'использованиеатрибутаxs использованиесобытияжурналарегистрации источникдоступныхнастроеккомпоновкиданных '\n + 'итераторузловdom картинка квалификаторыдаты квалификаторыдвоичныхданных квалификаторыстроки квалификаторычисла '\n + 'компоновщикмакетакомпоновкиданных компоновщикнастроеккомпоновкиданных конструктормакетаоформлениякомпоновкиданных '\n + 'конструкторнастроеккомпоновкиданных конструкторформатнойстроки линия макеткомпоновкиданных макетобластикомпоновкиданных '\n + 'макетоформлениякомпоновкиданных маскаxs менеджеркриптографии наборсхемxml настройкикомпоновкиданных настройкисериализацииjson '\n + 'обработкакартинок обработкарасшифровкикомпоновкиданных обходдереваdom объявлениеатрибутаxs объявлениенотацииxs '\n + 'объявлениеэлементаxs описаниеиспользованиясобытиядоступжурналарегистрации '\n + 'описаниеиспользованиясобытияотказвдоступежурналарегистрации описаниеобработкирасшифровкикомпоновкиданных '\n + 'описаниепередаваемогофайла описаниетипов определениегруппыатрибутовxs определениегруппымоделиxs '\n + 'определениеограниченияидентичностиxs определениепростоготипаxs определениесоставноготипаxs определениетипадокументаdom '\n + 'определенияxpathxs отборкомпоновкиданных пакетотображаемыхдокументов параметрвыбора параметркомпоновкиданных '\n + 'параметрызаписиjson параметрызаписиxml параметрычтенияxml переопределениеxs планировщик полеанализаданных '\n + 'полекомпоновкиданных построительdom построительзапроса построительотчета построительотчетаанализаданных '\n + 'построительсхемxml поток потоквпамяти почта почтовоесообщение преобразованиеxsl преобразованиекканоническомуxml '\n + 'процессорвыводарезультатакомпоновкиданныхвколлекциюзначений процессорвыводарезультатакомпоновкиданныхвтабличныйдокумент '\n + 'процессоркомпоновкиданных разыменовательпространствименdom рамка расписаниерегламентногозадания расширенноеимяxml '\n + 'результатчтенияданных своднаядиаграмма связьпараметравыбора связьпотипу связьпотипукомпоновкиданных сериализаторxdto '\n + 'сертификатклиентаwindows сертификатклиентафайл сертификаткриптографии сертификатыудостоверяющихцентровwindows '\n + 'сертификатыудостоверяющихцентровфайл сжатиеданных системнаяинформация сообщениепользователю сочетаниеклавиш '\n + 'сравнениезначений стандартнаядатаначала стандартныйпериод схемаxml схемакомпоновкиданных табличныйдокумент '\n + 'текстовыйдокумент тестируемоеприложение типданныхxml уникальныйидентификатор фабрикаxdto файл файловыйпоток '\n + 'фасетдлиныxs фасетколичестваразрядовдробнойчастиxs фасетмаксимальноговключающегозначенияxs '\n + 'фасетмаксимальногоисключающегозначенияxs фасетмаксимальнойдлиныxs фасетминимальноговключающегозначенияxs '\n + 'фасетминимальногоисключающегозначенияxs фасетминимальнойдлиныxs фасетобразцаxs фасетобщегоколичестваразрядовxs '\n + 'фасетперечисленияxs фасетпробельныхсимволовxs фильтрузловdom форматированнаястрока форматированныйдокумент '\n + 'фрагментxs хешированиеданных хранилищезначения цвет чтениеfastinfoset чтениеhtml чтениеjson чтениеxml чтениеzipфайла '\n + 'чтениеданных чтениетекста чтениеузловdom шрифт элементрезультатакомпоновкиданных ';\n\n // v8 универсальные коллекции значений ==> type\n const v8_universal_collection =\n 'comsafearray деревозначений массив соответствие списокзначений структура таблицазначений фиксированнаяструктура '\n + 'фиксированноесоответствие фиксированныймассив ';\n\n // type : встроенные типы\n const TYPE =\n v8_shared_object\n + v8_universal_collection;\n\n // literal : примитивные типы\n const LITERAL = 'null истина ложь неопределено';\n\n // number : числа\n const NUMBERS = hljs.inherit(hljs.NUMBER_MODE);\n\n // string : строки\n const STRINGS = {\n className: 'string',\n begin: '\"|\\\\|',\n end: '\"|$',\n contains: [ { begin: '\"\"' } ]\n };\n\n // number : даты\n const DATE = {\n begin: \"'\",\n end: \"'\",\n excludeBegin: true,\n excludeEnd: true,\n contains: [\n {\n className: 'number',\n begin: '\\\\d{4}([\\\\.\\\\\\\\/:-]?\\\\d{2}){0,5}'\n }\n ]\n };\n\n // comment : комментарии\n const COMMENTS = hljs.inherit(hljs.C_LINE_COMMENT_MODE);\n\n // meta : инструкции препроцессора, директивы компиляции\n const META = {\n className: 'meta',\n\n begin: '#|&',\n end: '$',\n keywords: {\n $pattern: UNDERSCORE_IDENT_RE,\n keyword: KEYWORD + METAKEYWORD\n },\n contains: [ COMMENTS ]\n };\n\n // symbol : метка goto\n const SYMBOL = {\n className: 'symbol',\n begin: '~',\n end: ';|:',\n excludeEnd: true\n };\n\n // function : объявление процедур и функций\n const FUNCTION = {\n className: 'function',\n variants: [\n {\n begin: 'процедура|функция',\n end: '\\\\)',\n keywords: 'процедура функция'\n },\n {\n begin: 'конецпроцедуры|конецфункции',\n keywords: 'конецпроцедуры конецфункции'\n }\n ],\n contains: [\n {\n begin: '\\\\(',\n end: '\\\\)',\n endsParent: true,\n contains: [\n {\n className: 'params',\n begin: UNDERSCORE_IDENT_RE,\n end: ',',\n excludeEnd: true,\n endsWithParent: true,\n keywords: {\n $pattern: UNDERSCORE_IDENT_RE,\n keyword: 'знач',\n literal: LITERAL\n },\n contains: [\n NUMBERS,\n STRINGS,\n DATE\n ]\n },\n COMMENTS\n ]\n },\n hljs.inherit(hljs.TITLE_MODE, { begin: UNDERSCORE_IDENT_RE })\n ]\n };\n\n return {\n name: '1C:Enterprise',\n case_insensitive: true,\n keywords: {\n $pattern: UNDERSCORE_IDENT_RE,\n keyword: KEYWORD,\n built_in: BUILTIN,\n class: CLASS,\n type: TYPE,\n literal: LITERAL\n },\n contains: [\n META,\n FUNCTION,\n COMMENTS,\n SYMBOL,\n NUMBERS,\n STRINGS,\n DATE\n ]\n };\n}\n\nmodule.exports = _1c;\n","/*\nLanguage: Augmented Backus-Naur Form\nAuthor: Alex McKibben \nWebsite: https://tools.ietf.org/html/rfc5234\nAudit: 2020\n*/\n\n/** @type LanguageFn */\nfunction abnf(hljs) {\n const regex = hljs.regex;\n const IDENT = /^[a-zA-Z][a-zA-Z0-9-]*/;\n\n const KEYWORDS = [\n \"ALPHA\",\n \"BIT\",\n \"CHAR\",\n \"CR\",\n \"CRLF\",\n \"CTL\",\n \"DIGIT\",\n \"DQUOTE\",\n \"HEXDIG\",\n \"HTAB\",\n \"LF\",\n \"LWSP\",\n \"OCTET\",\n \"SP\",\n \"VCHAR\",\n \"WSP\"\n ];\n\n const COMMENT = hljs.COMMENT(/;/, /$/);\n\n const TERMINAL_BINARY = {\n scope: \"symbol\",\n match: /%b[0-1]+(-[0-1]+|(\\.[0-1]+)+)?/\n };\n\n const TERMINAL_DECIMAL = {\n scope: \"symbol\",\n match: /%d[0-9]+(-[0-9]+|(\\.[0-9]+)+)?/\n };\n\n const TERMINAL_HEXADECIMAL = {\n scope: \"symbol\",\n match: /%x[0-9A-F]+(-[0-9A-F]+|(\\.[0-9A-F]+)+)?/\n };\n\n const CASE_SENSITIVITY = {\n scope: \"symbol\",\n match: /%[si](?=\".*\")/\n };\n\n const RULE_DECLARATION = {\n scope: \"attribute\",\n match: regex.concat(IDENT, /(?=\\s*=)/)\n };\n\n const ASSIGNMENT = {\n scope: \"operator\",\n match: /=\\/?/\n };\n\n return {\n name: 'Augmented Backus-Naur Form',\n illegal: /[!@#$^&',?+~`|:]/,\n keywords: KEYWORDS,\n contains: [\n ASSIGNMENT,\n RULE_DECLARATION,\n COMMENT,\n TERMINAL_BINARY,\n TERMINAL_DECIMAL,\n TERMINAL_HEXADECIMAL,\n CASE_SENSITIVITY,\n hljs.QUOTE_STRING_MODE,\n hljs.NUMBER_MODE\n ]\n };\n}\n\nmodule.exports = abnf;\n","/*\n Language: Apache Access Log\n Author: Oleg Efimov \n Description: Apache/Nginx Access Logs\n Website: https://httpd.apache.org/docs/2.4/logs.html#accesslog\n Category: web, logs\n Audit: 2020\n */\n\n/** @type LanguageFn */\nfunction accesslog(hljs) {\n const regex = hljs.regex;\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods\n const HTTP_VERBS = [\n \"GET\",\n \"POST\",\n \"HEAD\",\n \"PUT\",\n \"DELETE\",\n \"CONNECT\",\n \"OPTIONS\",\n \"PATCH\",\n \"TRACE\"\n ];\n return {\n name: 'Apache Access Log',\n contains: [\n // IP\n {\n className: 'number',\n begin: /^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b/,\n relevance: 5\n },\n // Other numbers\n {\n className: 'number',\n begin: /\\b\\d+\\b/,\n relevance: 0\n },\n // Requests\n {\n className: 'string',\n begin: regex.concat(/\"/, regex.either(...HTTP_VERBS)),\n end: /\"/,\n keywords: HTTP_VERBS,\n illegal: /\\n/,\n relevance: 5,\n contains: [\n {\n begin: /HTTP\\/[12]\\.\\d'/,\n relevance: 5\n }\n ]\n },\n // Dates\n {\n className: 'string',\n // dates must have a certain length, this prevents matching\n // simple array accesses a[123] and [] and other common patterns\n // found in other languages\n begin: /\\[\\d[^\\]\\n]{8,}\\]/,\n illegal: /\\n/,\n relevance: 1\n },\n {\n className: 'string',\n begin: /\\[/,\n end: /\\]/,\n illegal: /\\n/,\n relevance: 0\n },\n // User agent / relevance boost\n {\n className: 'string',\n begin: /\"Mozilla\\/\\d\\.\\d \\(/,\n end: /\"/,\n illegal: /\\n/,\n relevance: 3\n },\n // Strings\n {\n className: 'string',\n begin: /\"/,\n end: /\"/,\n illegal: /\\n/,\n relevance: 0\n }\n ]\n };\n}\n\nmodule.exports = accesslog;\n","/*\nLanguage: ActionScript\nAuthor: Alexander Myadzel \nCategory: scripting\nAudit: 2020\n*/\n\n/** @type LanguageFn */\nfunction actionscript(hljs) {\n const regex = hljs.regex;\n const IDENT_RE = /[a-zA-Z_$][a-zA-Z0-9_$]*/;\n const PKG_NAME_RE = regex.concat(\n IDENT_RE,\n regex.concat(\"(\\\\.\", IDENT_RE, \")*\")\n );\n const IDENT_FUNC_RETURN_TYPE_RE = /([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)/;\n\n const AS3_REST_ARG_MODE = {\n className: 'rest_arg',\n begin: /[.]{3}/,\n end: IDENT_RE,\n relevance: 10\n };\n\n const KEYWORDS = [\n \"as\",\n \"break\",\n \"case\",\n \"catch\",\n \"class\",\n \"const\",\n \"continue\",\n \"default\",\n \"delete\",\n \"do\",\n \"dynamic\",\n \"each\",\n \"else\",\n \"extends\",\n \"final\",\n \"finally\",\n \"for\",\n \"function\",\n \"get\",\n \"if\",\n \"implements\",\n \"import\",\n \"in\",\n \"include\",\n \"instanceof\",\n \"interface\",\n \"internal\",\n \"is\",\n \"namespace\",\n \"native\",\n \"new\",\n \"override\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"return\",\n \"set\",\n \"static\",\n \"super\",\n \"switch\",\n \"this\",\n \"throw\",\n \"try\",\n \"typeof\",\n \"use\",\n \"var\",\n \"void\",\n \"while\",\n \"with\"\n ];\n const LITERALS = [\n \"true\",\n \"false\",\n \"null\",\n \"undefined\"\n ];\n\n return {\n name: 'ActionScript',\n aliases: [ 'as' ],\n keywords: {\n keyword: KEYWORDS,\n literal: LITERALS\n },\n contains: [\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.C_NUMBER_MODE,\n {\n match: [\n /\\bpackage/,\n /\\s+/,\n PKG_NAME_RE\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.class\"\n }\n },\n {\n match: [\n /\\b(?:class|interface|extends|implements)/,\n /\\s+/,\n IDENT_RE\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.class\"\n }\n },\n {\n className: 'meta',\n beginKeywords: 'import include',\n end: /;/,\n keywords: { keyword: 'import include' }\n },\n {\n beginKeywords: 'function',\n end: /[{;]/,\n excludeEnd: true,\n illegal: /\\S/,\n contains: [\n hljs.inherit(hljs.TITLE_MODE, { className: \"title.function\" }),\n {\n className: 'params',\n begin: /\\(/,\n end: /\\)/,\n contains: [\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n AS3_REST_ARG_MODE\n ]\n },\n { begin: regex.concat(/:\\s*/, IDENT_FUNC_RETURN_TYPE_RE) }\n ]\n },\n hljs.METHOD_GUARD\n ],\n illegal: /#/\n };\n}\n\nmodule.exports = actionscript;\n","/*\nLanguage: Ada\nAuthor: Lars Schulna \nDescription: Ada is a general-purpose programming language that has great support for saftey critical and real-time applications.\n It has been developed by the DoD and thus has been used in military and safety-critical applications (like civil aviation).\n The first version appeared in the 80s, but it's still actively developed today with\n the newest standard being Ada2012.\n*/\n\n// We try to support full Ada2012\n//\n// We highlight all appearances of types, keywords, literals (string, char, number, bool)\n// and titles (user defined function/procedure/package)\n// CSS classes are set accordingly\n//\n// Languages causing problems for language detection:\n// xml (broken by Foo : Bar type), elm (broken by Foo : Bar type), vbscript-html (broken by body keyword)\n// sql (ada default.txt has a lot of sql keywords)\n\n/** @type LanguageFn */\nfunction ada(hljs) {\n // Regular expression for Ada numeric literals.\n // stolen form the VHDL highlighter\n\n // Decimal literal:\n const INTEGER_RE = '\\\\d(_|\\\\d)*';\n const EXPONENT_RE = '[eE][-+]?' + INTEGER_RE;\n const DECIMAL_LITERAL_RE = INTEGER_RE + '(\\\\.' + INTEGER_RE + ')?' + '(' + EXPONENT_RE + ')?';\n\n // Based literal:\n const BASED_INTEGER_RE = '\\\\w+';\n const BASED_LITERAL_RE = INTEGER_RE + '#' + BASED_INTEGER_RE + '(\\\\.' + BASED_INTEGER_RE + ')?' + '#' + '(' + EXPONENT_RE + ')?';\n\n const NUMBER_RE = '\\\\b(' + BASED_LITERAL_RE + '|' + DECIMAL_LITERAL_RE + ')';\n\n // Identifier regex\n const ID_REGEX = '[A-Za-z](_?[A-Za-z0-9.])*';\n\n // bad chars, only allowed in literals\n const BAD_CHARS = `[]\\\\{\\\\}%#'\"`;\n\n // Ada doesn't have block comments, only line comments\n const COMMENTS = hljs.COMMENT('--', '$');\n\n // variable declarations of the form\n // Foo : Bar := Baz;\n // where only Bar will be highlighted\n const VAR_DECLS = {\n // TODO: These spaces are not required by the Ada syntax\n // however, I have yet to see handwritten Ada code where\n // someone does not put spaces around :\n begin: '\\\\s+:\\\\s+',\n end: '\\\\s*(:=|;|\\\\)|=>|$)',\n // endsWithParent: true,\n // returnBegin: true,\n illegal: BAD_CHARS,\n contains: [\n {\n // workaround to avoid highlighting\n // named loops and declare blocks\n beginKeywords: 'loop for declare others',\n endsParent: true\n },\n {\n // properly highlight all modifiers\n className: 'keyword',\n beginKeywords: 'not null constant access function procedure in out aliased exception'\n },\n {\n className: 'type',\n begin: ID_REGEX,\n endsParent: true,\n relevance: 0\n }\n ]\n };\n\n const KEYWORDS = [\n \"abort\",\n \"else\",\n \"new\",\n \"return\",\n \"abs\",\n \"elsif\",\n \"not\",\n \"reverse\",\n \"abstract\",\n \"end\",\n \"accept\",\n \"entry\",\n \"select\",\n \"access\",\n \"exception\",\n \"of\",\n \"separate\",\n \"aliased\",\n \"exit\",\n \"or\",\n \"some\",\n \"all\",\n \"others\",\n \"subtype\",\n \"and\",\n \"for\",\n \"out\",\n \"synchronized\",\n \"array\",\n \"function\",\n \"overriding\",\n \"at\",\n \"tagged\",\n \"generic\",\n \"package\",\n \"task\",\n \"begin\",\n \"goto\",\n \"pragma\",\n \"terminate\",\n \"body\",\n \"private\",\n \"then\",\n \"if\",\n \"procedure\",\n \"type\",\n \"case\",\n \"in\",\n \"protected\",\n \"constant\",\n \"interface\",\n \"is\",\n \"raise\",\n \"use\",\n \"declare\",\n \"range\",\n \"delay\",\n \"limited\",\n \"record\",\n \"when\",\n \"delta\",\n \"loop\",\n \"rem\",\n \"while\",\n \"digits\",\n \"renames\",\n \"with\",\n \"do\",\n \"mod\",\n \"requeue\",\n \"xor\"\n ];\n\n return {\n name: 'Ada',\n case_insensitive: true,\n keywords: {\n keyword: KEYWORDS,\n literal: [\n \"True\",\n \"False\"\n ]\n },\n contains: [\n COMMENTS,\n // strings \"foobar\"\n {\n className: 'string',\n begin: /\"/,\n end: /\"/,\n contains: [\n {\n begin: /\"\"/,\n relevance: 0\n }\n ]\n },\n // characters ''\n {\n // character literals always contain one char\n className: 'string',\n begin: /'.'/\n },\n {\n // number literals\n className: 'number',\n begin: NUMBER_RE,\n relevance: 0\n },\n {\n // Attributes\n className: 'symbol',\n begin: \"'\" + ID_REGEX\n },\n {\n // package definition, maybe inside generic\n className: 'title',\n begin: '(\\\\bwith\\\\s+)?(\\\\bprivate\\\\s+)?\\\\bpackage\\\\s+(\\\\bbody\\\\s+)?',\n end: '(is|$)',\n keywords: 'package body',\n excludeBegin: true,\n excludeEnd: true,\n illegal: BAD_CHARS\n },\n {\n // function/procedure declaration/definition\n // maybe inside generic\n begin: '(\\\\b(with|overriding)\\\\s+)?\\\\b(function|procedure)\\\\s+',\n end: '(\\\\bis|\\\\bwith|\\\\brenames|\\\\)\\\\s*;)',\n keywords: 'overriding function procedure with is renames return',\n // we need to re-match the 'function' keyword, so that\n // the title mode below matches only exactly once\n returnBegin: true,\n contains:\n [\n COMMENTS,\n {\n // name of the function/procedure\n className: 'title',\n begin: '(\\\\bwith\\\\s+)?\\\\b(function|procedure)\\\\s+',\n end: '(\\\\(|\\\\s+|$)',\n excludeBegin: true,\n excludeEnd: true,\n illegal: BAD_CHARS\n },\n // 'self'\n // // parameter types\n VAR_DECLS,\n {\n // return type\n className: 'type',\n begin: '\\\\breturn\\\\s+',\n end: '(\\\\s+|;|$)',\n keywords: 'return',\n excludeBegin: true,\n excludeEnd: true,\n // we are done with functions\n endsParent: true,\n illegal: BAD_CHARS\n\n }\n ]\n },\n {\n // new type declarations\n // maybe inside generic\n className: 'type',\n begin: '\\\\b(sub)?type\\\\s+',\n end: '\\\\s+',\n keywords: 'type',\n excludeBegin: true,\n illegal: BAD_CHARS\n },\n\n // see comment above the definition\n VAR_DECLS\n\n // no markup\n // relevance boosters for small snippets\n // {begin: '\\\\s*=>\\\\s*'},\n // {begin: '\\\\s*:=\\\\s*'},\n // {begin: '\\\\s+:=\\\\s+'},\n ]\n };\n}\n\nmodule.exports = ada;\n","/*\nLanguage: AngelScript\nAuthor: Melissa Geels \nCategory: scripting\nWebsite: https://www.angelcode.com/angelscript/\n*/\n\n/** @type LanguageFn */\nfunction angelscript(hljs) {\n const builtInTypeMode = {\n className: 'built_in',\n begin: '\\\\b(void|bool|int8|int16|int32|int64|int|uint8|uint16|uint32|uint64|uint|string|ref|array|double|float|auto|dictionary)'\n };\n\n const objectHandleMode = {\n className: 'symbol',\n begin: '[a-zA-Z0-9_]+@'\n };\n\n const genericMode = {\n className: 'keyword',\n begin: '<',\n end: '>',\n contains: [\n builtInTypeMode,\n objectHandleMode\n ]\n };\n\n builtInTypeMode.contains = [ genericMode ];\n objectHandleMode.contains = [ genericMode ];\n\n const KEYWORDS = [\n \"for\",\n \"in|0\",\n \"break\",\n \"continue\",\n \"while\",\n \"do|0\",\n \"return\",\n \"if\",\n \"else\",\n \"case\",\n \"switch\",\n \"namespace\",\n \"is\",\n \"cast\",\n \"or\",\n \"and\",\n \"xor\",\n \"not\",\n \"get|0\",\n \"in\",\n \"inout|10\",\n \"out\",\n \"override\",\n \"set|0\",\n \"private\",\n \"public\",\n \"const\",\n \"default|0\",\n \"final\",\n \"shared\",\n \"external\",\n \"mixin|10\",\n \"enum\",\n \"typedef\",\n \"funcdef\",\n \"this\",\n \"super\",\n \"import\",\n \"from\",\n \"interface\",\n \"abstract|0\",\n \"try\",\n \"catch\",\n \"protected\",\n \"explicit\",\n \"property\"\n ];\n\n return {\n name: 'AngelScript',\n aliases: [ 'asc' ],\n\n keywords: KEYWORDS,\n\n // avoid close detection with C# and JS\n illegal: '(^using\\\\s+[A-Za-z0-9_\\\\.]+;$|\\\\bfunction\\\\s*[^\\\\(])',\n\n contains: [\n { // 'strings'\n className: 'string',\n begin: '\\'',\n end: '\\'',\n illegal: '\\\\n',\n contains: [ hljs.BACKSLASH_ESCAPE ],\n relevance: 0\n },\n\n // \"\"\"heredoc strings\"\"\"\n {\n className: 'string',\n begin: '\"\"\"',\n end: '\"\"\"'\n },\n\n { // \"strings\"\n className: 'string',\n begin: '\"',\n end: '\"',\n illegal: '\\\\n',\n contains: [ hljs.BACKSLASH_ESCAPE ],\n relevance: 0\n },\n\n hljs.C_LINE_COMMENT_MODE, // single-line comments\n hljs.C_BLOCK_COMMENT_MODE, // comment blocks\n\n { // metadata\n className: 'string',\n begin: '^\\\\s*\\\\[',\n end: '\\\\]'\n },\n\n { // interface or namespace declaration\n beginKeywords: 'interface namespace',\n end: /\\{/,\n illegal: '[;.\\\\-]',\n contains: [\n { // interface or namespace name\n className: 'symbol',\n begin: '[a-zA-Z0-9_]+'\n }\n ]\n },\n\n { // class declaration\n beginKeywords: 'class',\n end: /\\{/,\n illegal: '[;.\\\\-]',\n contains: [\n { // class name\n className: 'symbol',\n begin: '[a-zA-Z0-9_]+',\n contains: [\n {\n begin: '[:,]\\\\s*',\n contains: [\n {\n className: 'symbol',\n begin: '[a-zA-Z0-9_]+'\n }\n ]\n }\n ]\n }\n ]\n },\n\n builtInTypeMode, // built-in types\n objectHandleMode, // object handles\n\n { // literals\n className: 'literal',\n begin: '\\\\b(null|true|false)'\n },\n\n { // numbers\n className: 'number',\n relevance: 0,\n begin: '(-?)(\\\\b0[xXbBoOdD][a-fA-F0-9]+|(\\\\b\\\\d+(\\\\.\\\\d*)?f?|\\\\.\\\\d+f?)([eE][-+]?\\\\d+f?)?)'\n }\n ]\n };\n}\n\nmodule.exports = angelscript;\n","/*\nLanguage: Apache config\nAuthor: Ruslan Keba \nContributors: Ivan Sagalaev \nWebsite: https://httpd.apache.org\nDescription: language definition for Apache configuration files (httpd.conf & .htaccess)\nCategory: config, web\nAudit: 2020\n*/\n\n/** @type LanguageFn */\nfunction apache(hljs) {\n const NUMBER_REF = {\n className: 'number',\n begin: /[$%]\\d+/\n };\n const NUMBER = {\n className: 'number',\n begin: /\\b\\d+/\n };\n const IP_ADDRESS = {\n className: \"number\",\n begin: /\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?/\n };\n const PORT_NUMBER = {\n className: \"number\",\n begin: /:\\d{1,5}/\n };\n return {\n name: 'Apache config',\n aliases: [ 'apacheconf' ],\n case_insensitive: true,\n contains: [\n hljs.HASH_COMMENT_MODE,\n {\n className: 'section',\n begin: /<\\/?/,\n end: />/,\n contains: [\n IP_ADDRESS,\n PORT_NUMBER,\n // low relevance prevents us from claming XML/HTML where this rule would\n // match strings inside of XML tags\n hljs.inherit(hljs.QUOTE_STRING_MODE, { relevance: 0 })\n ]\n },\n {\n className: 'attribute',\n begin: /\\w+/,\n relevance: 0,\n // keywords aren’t needed for highlighting per se, they only boost relevance\n // for a very generally defined mode (starts with a word, ends with line-end\n keywords: { _: [\n \"order\",\n \"deny\",\n \"allow\",\n \"setenv\",\n \"rewriterule\",\n \"rewriteengine\",\n \"rewritecond\",\n \"documentroot\",\n \"sethandler\",\n \"errordocument\",\n \"loadmodule\",\n \"options\",\n \"header\",\n \"listen\",\n \"serverroot\",\n \"servername\"\n ] },\n starts: {\n end: /$/,\n relevance: 0,\n keywords: { literal: 'on off all deny allow' },\n contains: [\n {\n className: 'meta',\n begin: /\\s\\[/,\n end: /\\]$/\n },\n {\n className: 'variable',\n begin: /[\\$%]\\{/,\n end: /\\}/,\n contains: [\n 'self',\n NUMBER_REF\n ]\n },\n IP_ADDRESS,\n NUMBER,\n hljs.QUOTE_STRING_MODE\n ]\n }\n }\n ],\n illegal: /\\S/\n };\n}\n\nmodule.exports = apache;\n","/*\nLanguage: AppleScript\nAuthors: Nathan Grigg , Dr. Drang \nCategory: scripting\nWebsite: https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html\nAudit: 2020\n*/\n\n/** @type LanguageFn */\nfunction applescript(hljs) {\n const regex = hljs.regex;\n const STRING = hljs.inherit(\n hljs.QUOTE_STRING_MODE, { illegal: null });\n const PARAMS = {\n className: 'params',\n begin: /\\(/,\n end: /\\)/,\n contains: [\n 'self',\n hljs.C_NUMBER_MODE,\n STRING\n ]\n };\n const COMMENT_MODE_1 = hljs.COMMENT(/--/, /$/);\n const COMMENT_MODE_2 = hljs.COMMENT(\n /\\(\\*/,\n /\\*\\)/,\n { contains: [\n 'self', // allow nesting\n COMMENT_MODE_1\n ] }\n );\n const COMMENTS = [\n COMMENT_MODE_1,\n COMMENT_MODE_2,\n hljs.HASH_COMMENT_MODE\n ];\n\n const KEYWORD_PATTERNS = [\n /apart from/,\n /aside from/,\n /instead of/,\n /out of/,\n /greater than/,\n /isn't|(doesn't|does not) (equal|come before|come after|contain)/,\n /(greater|less) than( or equal)?/,\n /(starts?|ends|begins?) with/,\n /contained by/,\n /comes (before|after)/,\n /a (ref|reference)/,\n /POSIX (file|path)/,\n /(date|time) string/,\n /quoted form/\n ];\n\n const BUILT_IN_PATTERNS = [\n /clipboard info/,\n /the clipboard/,\n /info for/,\n /list (disks|folder)/,\n /mount volume/,\n /path to/,\n /(close|open for) access/,\n /(get|set) eof/,\n /current date/,\n /do shell script/,\n /get volume settings/,\n /random number/,\n /set volume/,\n /system attribute/,\n /system info/,\n /time to GMT/,\n /(load|run|store) script/,\n /scripting components/,\n /ASCII (character|number)/,\n /localized string/,\n /choose (application|color|file|file name|folder|from list|remote application|URL)/,\n /display (alert|dialog)/\n ];\n\n return {\n name: 'AppleScript',\n aliases: [ 'osascript' ],\n keywords: {\n keyword:\n 'about above after against and around as at back before beginning '\n + 'behind below beneath beside between but by considering '\n + 'contain contains continue copy div does eighth else end equal '\n + 'equals error every exit fifth first for fourth from front '\n + 'get given global if ignoring in into is it its last local me '\n + 'middle mod my ninth not of on onto or over prop property put ref '\n + 'reference repeat returning script second set seventh since '\n + 'sixth some tell tenth that the|0 then third through thru '\n + 'timeout times to transaction try until where while whose with '\n + 'without',\n literal:\n 'AppleScript false linefeed return pi quote result space tab true',\n built_in:\n 'alias application boolean class constant date file integer list '\n + 'number real record string text '\n + 'activate beep count delay launch log offset read round '\n + 'run say summarize write '\n + 'character characters contents day frontmost id item length '\n + 'month name|0 paragraph paragraphs rest reverse running time version '\n + 'weekday word words year'\n },\n contains: [\n STRING,\n hljs.C_NUMBER_MODE,\n {\n className: 'built_in',\n begin: regex.concat(\n /\\b/,\n regex.either(...BUILT_IN_PATTERNS),\n /\\b/\n )\n },\n {\n className: 'built_in',\n begin: /^\\s*return\\b/\n },\n {\n className: 'literal',\n begin:\n /\\b(text item delimiters|current application|missing value)\\b/\n },\n {\n className: 'keyword',\n begin: regex.concat(\n /\\b/,\n regex.either(...KEYWORD_PATTERNS),\n /\\b/\n )\n },\n {\n beginKeywords: 'on',\n illegal: /[${=;\\n]/,\n contains: [\n hljs.UNDERSCORE_TITLE_MODE,\n PARAMS\n ]\n },\n ...COMMENTS\n ],\n illegal: /\\/\\/|->|=>|\\[\\[/\n };\n}\n\nmodule.exports = applescript;\n","/*\n Language: ArcGIS Arcade\n Category: scripting\n Author: John Foster \n Website: https://developers.arcgis.com/arcade/\n Description: ArcGIS Arcade is an expression language used in many Esri ArcGIS products such as Pro, Online, Server, Runtime, JavaScript, and Python\n*/\n\n/** @type LanguageFn */\nfunction arcade(hljs) {\n const IDENT_RE = '[A-Za-z_][0-9A-Za-z_]*';\n const KEYWORDS = {\n keyword: [\n \"if\",\n \"for\",\n \"while\",\n \"var\",\n \"new\",\n \"function\",\n \"do\",\n \"return\",\n \"void\",\n \"else\",\n \"break\"\n ],\n literal: [\n \"BackSlash\",\n \"DoubleQuote\",\n \"false\",\n \"ForwardSlash\",\n \"Infinity\",\n \"NaN\",\n \"NewLine\",\n \"null\",\n \"PI\",\n \"SingleQuote\",\n \"Tab\",\n \"TextFormatting\",\n \"true\",\n \"undefined\"\n ],\n built_in: [\n \"Abs\",\n \"Acos\",\n \"All\",\n \"Angle\",\n \"Any\",\n \"Area\",\n \"AreaGeodetic\",\n \"Array\",\n \"Asin\",\n \"Atan\",\n \"Atan2\",\n \"Attachments\",\n \"Average\",\n \"Back\",\n \"Bearing\",\n \"Boolean\",\n \"Buffer\",\n \"BufferGeodetic\",\n \"Ceil\",\n \"Centroid\",\n \"Clip\",\n \"Concatenate\",\n \"Console\",\n \"Constrain\",\n \"Contains\",\n \"ConvertDirection\",\n \"Cos\",\n \"Count\",\n \"Crosses\",\n \"Cut\",\n \"Date\",\n \"DateAdd\",\n \"DateDiff\",\n \"Day\",\n \"Decode\",\n \"DefaultValue\",\n \"Densify\",\n \"DensifyGeodetic\",\n \"Dictionary\",\n \"Difference\",\n \"Disjoint\",\n \"Distance\",\n \"DistanceGeodetic\",\n \"Distinct\",\n \"Domain\",\n \"DomainCode\",\n \"DomainName\",\n \"EnvelopeIntersects\",\n \"Equals\",\n \"Erase\",\n \"Exp\",\n \"Expects\",\n \"Extent\",\n \"Feature\",\n \"FeatureSet\",\n \"FeatureSetByAssociation\",\n \"FeatureSetById\",\n \"FeatureSetByName\",\n \"FeatureSetByPortalItem\",\n \"FeatureSetByRelationshipName\",\n \"Filter\",\n \"Find\",\n \"First\",\n \"Floor\",\n \"FromCharCode\",\n \"FromCodePoint\",\n \"FromJSON\",\n \"GdbVersion\",\n \"Generalize\",\n \"Geometry\",\n \"GetFeatureSet\",\n \"GetUser\",\n \"GroupBy\",\n \"Guid\",\n \"Hash\",\n \"HasKey\",\n \"Hour\",\n \"IIf\",\n \"Includes\",\n \"IndexOf\",\n \"Insert\",\n \"Intersection\",\n \"Intersects\",\n \"IsEmpty\",\n \"IsNan\",\n \"ISOMonth\",\n \"ISOWeek\",\n \"ISOWeekday\",\n \"ISOYear\",\n \"IsSelfIntersecting\",\n \"IsSimple\",\n \"Left|0\",\n \"Length\",\n \"Length3D\",\n \"LengthGeodetic\",\n \"Log\",\n \"Lower\",\n \"Map\",\n \"Max\",\n \"Mean\",\n \"Mid\",\n \"Millisecond\",\n \"Min\",\n \"Minute\",\n \"Month\",\n \"MultiPartToSinglePart\",\n \"Multipoint\",\n \"NextSequenceValue\",\n \"None\",\n \"Now\",\n \"Number\",\n \"Offset|0\",\n \"OrderBy\",\n \"Overlaps\",\n \"Point\",\n \"Polygon\",\n \"Polyline\",\n \"Pop\",\n \"Portal\",\n \"Pow\",\n \"Proper\",\n \"Push\",\n \"Random\",\n \"Reduce\",\n \"Relate\",\n \"Replace\",\n \"Resize\",\n \"Reverse\",\n \"Right|0\",\n \"RingIsClockwise\",\n \"Rotate\",\n \"Round\",\n \"Schema\",\n \"Second\",\n \"SetGeometry\",\n \"Simplify\",\n \"Sin\",\n \"Slice\",\n \"Sort\",\n \"Splice\",\n \"Split\",\n \"Sqrt\",\n \"Stdev\",\n \"SubtypeCode\",\n \"SubtypeName\",\n \"Subtypes\",\n \"Sum\",\n \"SymmetricDifference\",\n \"Tan\",\n \"Text\",\n \"Timestamp\",\n \"ToCharCode\",\n \"ToCodePoint\",\n \"Today\",\n \"ToHex\",\n \"ToLocal\",\n \"Top|0\",\n \"Touches\",\n \"ToUTC\",\n \"TrackAccelerationAt\",\n \"TrackAccelerationWindow\",\n \"TrackCurrentAcceleration\",\n \"TrackCurrentDistance\",\n \"TrackCurrentSpeed\",\n \"TrackCurrentTime\",\n \"TrackDistanceAt\",\n \"TrackDistanceWindow\",\n \"TrackDuration\",\n \"TrackFieldWindow\",\n \"TrackGeometryWindow\",\n \"TrackIndex\",\n \"TrackSpeedAt\",\n \"TrackSpeedWindow\",\n \"TrackStartTime\",\n \"TrackWindow\",\n \"Trim\",\n \"TypeOf\",\n \"Union\",\n \"Upper\",\n \"UrlEncode\",\n \"Variance\",\n \"Week\",\n \"Weekday\",\n \"When\",\n \"Within\",\n \"Year\"\n ]\n };\n const SYMBOL = {\n className: 'symbol',\n begin: '\\\\$[datastore|feature|layer|map|measure|sourcefeature|sourcelayer|targetfeature|targetlayer|value|view]+'\n };\n const NUMBER = {\n className: 'number',\n variants: [\n { begin: '\\\\b(0[bB][01]+)' },\n { begin: '\\\\b(0[oO][0-7]+)' },\n { begin: hljs.C_NUMBER_RE }\n ],\n relevance: 0\n };\n const SUBST = {\n className: 'subst',\n begin: '\\\\$\\\\{',\n end: '\\\\}',\n keywords: KEYWORDS,\n contains: [] // defined later\n };\n const TEMPLATE_STRING = {\n className: 'string',\n begin: '`',\n end: '`',\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ]\n };\n SUBST.contains = [\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n TEMPLATE_STRING,\n NUMBER,\n hljs.REGEXP_MODE\n ];\n const PARAMS_CONTAINS = SUBST.contains.concat([\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.C_LINE_COMMENT_MODE\n ]);\n\n return {\n name: 'ArcGIS Arcade',\n case_insensitive: true,\n keywords: KEYWORDS,\n contains: [\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n TEMPLATE_STRING,\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n SYMBOL,\n NUMBER,\n { // object attr container\n begin: /[{,]\\s*/,\n relevance: 0,\n contains: [\n {\n begin: IDENT_RE + '\\\\s*:',\n returnBegin: true,\n relevance: 0,\n contains: [\n {\n className: 'attr',\n begin: IDENT_RE,\n relevance: 0\n }\n ]\n }\n ]\n },\n { // \"value\" container\n begin: '(' + hljs.RE_STARTERS_RE + '|\\\\b(return)\\\\b)\\\\s*',\n keywords: 'return',\n contains: [\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.REGEXP_MODE,\n {\n className: 'function',\n begin: '(\\\\(.*?\\\\)|' + IDENT_RE + ')\\\\s*=>',\n returnBegin: true,\n end: '\\\\s*=>',\n contains: [\n {\n className: 'params',\n variants: [\n { begin: IDENT_RE },\n { begin: /\\(\\s*\\)/ },\n {\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS,\n contains: PARAMS_CONTAINS\n }\n ]\n }\n ]\n }\n ],\n relevance: 0\n },\n {\n beginKeywords: 'function',\n end: /\\{/,\n excludeEnd: true,\n contains: [\n hljs.inherit(hljs.TITLE_MODE, {\n className: \"title.function\",\n begin: IDENT_RE\n }),\n {\n className: 'params',\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n contains: PARAMS_CONTAINS\n }\n ],\n illegal: /\\[|%/\n },\n { begin: /\\$[(.]/ }\n ],\n illegal: /#(?!!)/\n };\n}\n\nmodule.exports = arcade;\n","/*\nLanguage: C++\nCategory: common, system\nWebsite: https://isocpp.org\n*/\n\n/** @type LanguageFn */\nfunction cPlusPlus(hljs) {\n const regex = hljs.regex;\n // added for historic reasons because `hljs.C_LINE_COMMENT_MODE` does\n // not include such support nor can we be sure all the grammars depending\n // on it would desire this behavior\n const C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$', { contains: [ { begin: /\\\\\\n/ } ] });\n const DECLTYPE_AUTO_RE = 'decltype\\\\(auto\\\\)';\n const NAMESPACE_RE = '[a-zA-Z_]\\\\w*::';\n const TEMPLATE_ARGUMENT_RE = '<[^<>]+>';\n const FUNCTION_TYPE_RE = '(?!struct)('\n + DECLTYPE_AUTO_RE + '|'\n + regex.optional(NAMESPACE_RE)\n + '[a-zA-Z_]\\\\w*' + regex.optional(TEMPLATE_ARGUMENT_RE)\n + ')';\n\n const CPP_PRIMITIVE_TYPES = {\n className: 'type',\n begin: '\\\\b[a-z\\\\d_]*_t\\\\b'\n };\n\n // https://en.cppreference.com/w/cpp/language/escape\n // \\\\ \\x \\xFF \\u2837 \\u00323747 \\374\n const CHARACTER_ESCAPES = '\\\\\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\\\S)';\n const STRINGS = {\n className: 'string',\n variants: [\n {\n begin: '(u8?|U|L)?\"',\n end: '\"',\n illegal: '\\\\n',\n contains: [ hljs.BACKSLASH_ESCAPE ]\n },\n {\n begin: '(u8?|U|L)?\\'(' + CHARACTER_ESCAPES + '|.)',\n end: '\\'',\n illegal: '.'\n },\n hljs.END_SAME_AS_BEGIN({\n begin: /(?:u8?|U|L)?R\"([^()\\\\ ]{0,16})\\(/,\n end: /\\)([^()\\\\ ]{0,16})\"/\n })\n ]\n };\n\n const NUMBERS = {\n className: 'number',\n variants: [\n { begin: '\\\\b(0b[01\\']+)' },\n { begin: '(-?)\\\\b([\\\\d\\']+(\\\\.[\\\\d\\']*)?|\\\\.[\\\\d\\']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)' },\n { begin: '(-?)(\\\\b0[xX][a-fA-F0-9\\']+|(\\\\b[\\\\d\\']+(\\\\.[\\\\d\\']*)?|\\\\.[\\\\d\\']+)([eE][-+]?[\\\\d\\']+)?)' }\n ],\n relevance: 0\n };\n\n const PREPROCESSOR = {\n className: 'meta',\n begin: /#\\s*[a-z]+\\b/,\n end: /$/,\n keywords: { keyword:\n 'if else elif endif define undef warning error line '\n + 'pragma _Pragma ifdef ifndef include' },\n contains: [\n {\n begin: /\\\\\\n/,\n relevance: 0\n },\n hljs.inherit(STRINGS, { className: 'string' }),\n {\n className: 'string',\n begin: /<.*?>/\n },\n C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE\n ]\n };\n\n const TITLE_MODE = {\n className: 'title',\n begin: regex.optional(NAMESPACE_RE) + hljs.IDENT_RE,\n relevance: 0\n };\n\n const FUNCTION_TITLE = regex.optional(NAMESPACE_RE) + hljs.IDENT_RE + '\\\\s*\\\\(';\n\n // https://en.cppreference.com/w/cpp/keyword\n const RESERVED_KEYWORDS = [\n 'alignas',\n 'alignof',\n 'and',\n 'and_eq',\n 'asm',\n 'atomic_cancel',\n 'atomic_commit',\n 'atomic_noexcept',\n 'auto',\n 'bitand',\n 'bitor',\n 'break',\n 'case',\n 'catch',\n 'class',\n 'co_await',\n 'co_return',\n 'co_yield',\n 'compl',\n 'concept',\n 'const_cast|10',\n 'consteval',\n 'constexpr',\n 'constinit',\n 'continue',\n 'decltype',\n 'default',\n 'delete',\n 'do',\n 'dynamic_cast|10',\n 'else',\n 'enum',\n 'explicit',\n 'export',\n 'extern',\n 'false',\n 'final',\n 'for',\n 'friend',\n 'goto',\n 'if',\n 'import',\n 'inline',\n 'module',\n 'mutable',\n 'namespace',\n 'new',\n 'noexcept',\n 'not',\n 'not_eq',\n 'nullptr',\n 'operator',\n 'or',\n 'or_eq',\n 'override',\n 'private',\n 'protected',\n 'public',\n 'reflexpr',\n 'register',\n 'reinterpret_cast|10',\n 'requires',\n 'return',\n 'sizeof',\n 'static_assert',\n 'static_cast|10',\n 'struct',\n 'switch',\n 'synchronized',\n 'template',\n 'this',\n 'thread_local',\n 'throw',\n 'transaction_safe',\n 'transaction_safe_dynamic',\n 'true',\n 'try',\n 'typedef',\n 'typeid',\n 'typename',\n 'union',\n 'using',\n 'virtual',\n 'volatile',\n 'while',\n 'xor',\n 'xor_eq'\n ];\n\n // https://en.cppreference.com/w/cpp/keyword\n const RESERVED_TYPES = [\n 'bool',\n 'char',\n 'char16_t',\n 'char32_t',\n 'char8_t',\n 'double',\n 'float',\n 'int',\n 'long',\n 'short',\n 'void',\n 'wchar_t',\n 'unsigned',\n 'signed',\n 'const',\n 'static'\n ];\n\n const TYPE_HINTS = [\n 'any',\n 'auto_ptr',\n 'barrier',\n 'binary_semaphore',\n 'bitset',\n 'complex',\n 'condition_variable',\n 'condition_variable_any',\n 'counting_semaphore',\n 'deque',\n 'false_type',\n 'future',\n 'imaginary',\n 'initializer_list',\n 'istringstream',\n 'jthread',\n 'latch',\n 'lock_guard',\n 'multimap',\n 'multiset',\n 'mutex',\n 'optional',\n 'ostringstream',\n 'packaged_task',\n 'pair',\n 'promise',\n 'priority_queue',\n 'queue',\n 'recursive_mutex',\n 'recursive_timed_mutex',\n 'scoped_lock',\n 'set',\n 'shared_future',\n 'shared_lock',\n 'shared_mutex',\n 'shared_timed_mutex',\n 'shared_ptr',\n 'stack',\n 'string_view',\n 'stringstream',\n 'timed_mutex',\n 'thread',\n 'true_type',\n 'tuple',\n 'unique_lock',\n 'unique_ptr',\n 'unordered_map',\n 'unordered_multimap',\n 'unordered_multiset',\n 'unordered_set',\n 'variant',\n 'vector',\n 'weak_ptr',\n 'wstring',\n 'wstring_view'\n ];\n\n const FUNCTION_HINTS = [\n 'abort',\n 'abs',\n 'acos',\n 'apply',\n 'as_const',\n 'asin',\n 'atan',\n 'atan2',\n 'calloc',\n 'ceil',\n 'cerr',\n 'cin',\n 'clog',\n 'cos',\n 'cosh',\n 'cout',\n 'declval',\n 'endl',\n 'exchange',\n 'exit',\n 'exp',\n 'fabs',\n 'floor',\n 'fmod',\n 'forward',\n 'fprintf',\n 'fputs',\n 'free',\n 'frexp',\n 'fscanf',\n 'future',\n 'invoke',\n 'isalnum',\n 'isalpha',\n 'iscntrl',\n 'isdigit',\n 'isgraph',\n 'islower',\n 'isprint',\n 'ispunct',\n 'isspace',\n 'isupper',\n 'isxdigit',\n 'labs',\n 'launder',\n 'ldexp',\n 'log',\n 'log10',\n 'make_pair',\n 'make_shared',\n 'make_shared_for_overwrite',\n 'make_tuple',\n 'make_unique',\n 'malloc',\n 'memchr',\n 'memcmp',\n 'memcpy',\n 'memset',\n 'modf',\n 'move',\n 'pow',\n 'printf',\n 'putchar',\n 'puts',\n 'realloc',\n 'scanf',\n 'sin',\n 'sinh',\n 'snprintf',\n 'sprintf',\n 'sqrt',\n 'sscanf',\n 'std',\n 'stderr',\n 'stdin',\n 'stdout',\n 'strcat',\n 'strchr',\n 'strcmp',\n 'strcpy',\n 'strcspn',\n 'strlen',\n 'strncat',\n 'strncmp',\n 'strncpy',\n 'strpbrk',\n 'strrchr',\n 'strspn',\n 'strstr',\n 'swap',\n 'tan',\n 'tanh',\n 'terminate',\n 'to_underlying',\n 'tolower',\n 'toupper',\n 'vfprintf',\n 'visit',\n 'vprintf',\n 'vsprintf'\n ];\n\n const LITERALS = [\n 'NULL',\n 'false',\n 'nullopt',\n 'nullptr',\n 'true'\n ];\n\n // https://en.cppreference.com/w/cpp/keyword\n const BUILT_IN = [ '_Pragma' ];\n\n const CPP_KEYWORDS = {\n type: RESERVED_TYPES,\n keyword: RESERVED_KEYWORDS,\n literal: LITERALS,\n built_in: BUILT_IN,\n _type_hints: TYPE_HINTS\n };\n\n const FUNCTION_DISPATCH = {\n className: 'function.dispatch',\n relevance: 0,\n keywords: {\n // Only for relevance, not highlighting.\n _hint: FUNCTION_HINTS },\n begin: regex.concat(\n /\\b/,\n /(?!decltype)/,\n /(?!if)/,\n /(?!for)/,\n /(?!switch)/,\n /(?!while)/,\n hljs.IDENT_RE,\n regex.lookahead(/(<[^<>]+>|)\\s*\\(/))\n };\n\n const EXPRESSION_CONTAINS = [\n FUNCTION_DISPATCH,\n PREPROCESSOR,\n CPP_PRIMITIVE_TYPES,\n C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n NUMBERS,\n STRINGS\n ];\n\n const EXPRESSION_CONTEXT = {\n // This mode covers expression context where we can't expect a function\n // definition and shouldn't highlight anything that looks like one:\n // `return some()`, `else if()`, `(x*sum(1, 2))`\n variants: [\n {\n begin: /=/,\n end: /;/\n },\n {\n begin: /\\(/,\n end: /\\)/\n },\n {\n beginKeywords: 'new throw return else',\n end: /;/\n }\n ],\n keywords: CPP_KEYWORDS,\n contains: EXPRESSION_CONTAINS.concat([\n {\n begin: /\\(/,\n end: /\\)/,\n keywords: CPP_KEYWORDS,\n contains: EXPRESSION_CONTAINS.concat([ 'self' ]),\n relevance: 0\n }\n ]),\n relevance: 0\n };\n\n const FUNCTION_DECLARATION = {\n className: 'function',\n begin: '(' + FUNCTION_TYPE_RE + '[\\\\*&\\\\s]+)+' + FUNCTION_TITLE,\n returnBegin: true,\n end: /[{;=]/,\n excludeEnd: true,\n keywords: CPP_KEYWORDS,\n illegal: /[^\\w\\s\\*&:<>.]/,\n contains: [\n { // to prevent it from being confused as the function title\n begin: DECLTYPE_AUTO_RE,\n keywords: CPP_KEYWORDS,\n relevance: 0\n },\n {\n begin: FUNCTION_TITLE,\n returnBegin: true,\n contains: [ TITLE_MODE ],\n relevance: 0\n },\n // needed because we do not have look-behind on the below rule\n // to prevent it from grabbing the final : in a :: pair\n {\n begin: /::/,\n relevance: 0\n },\n // initializers\n {\n begin: /:/,\n endsWithParent: true,\n contains: [\n STRINGS,\n NUMBERS\n ]\n },\n // allow for multiple declarations, e.g.:\n // extern void f(int), g(char);\n {\n relevance: 0,\n match: /,/\n },\n {\n className: 'params',\n begin: /\\(/,\n end: /\\)/,\n keywords: CPP_KEYWORDS,\n relevance: 0,\n contains: [\n C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n STRINGS,\n NUMBERS,\n CPP_PRIMITIVE_TYPES,\n // Count matching parentheses.\n {\n begin: /\\(/,\n end: /\\)/,\n keywords: CPP_KEYWORDS,\n relevance: 0,\n contains: [\n 'self',\n C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n STRINGS,\n NUMBERS,\n CPP_PRIMITIVE_TYPES\n ]\n }\n ]\n },\n CPP_PRIMITIVE_TYPES,\n C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n PREPROCESSOR\n ]\n };\n\n return {\n name: 'C++',\n aliases: [\n 'cc',\n 'c++',\n 'h++',\n 'hpp',\n 'hh',\n 'hxx',\n 'cxx'\n ],\n keywords: CPP_KEYWORDS,\n illegal: ' rooms (9);`\n begin: '\\\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function)\\\\s*<(?!<)',\n end: '>',\n keywords: CPP_KEYWORDS,\n contains: [\n 'self',\n CPP_PRIMITIVE_TYPES\n ]\n },\n {\n begin: hljs.IDENT_RE + '::',\n keywords: CPP_KEYWORDS\n },\n {\n match: [\n // extra complexity to deal with `enum class` and `enum struct`\n /\\b(?:enum(?:\\s+(?:class|struct))?|class|struct|union)/,\n /\\s+/,\n /\\w+/\n ],\n className: {\n 1: 'keyword',\n 3: 'title.class'\n }\n }\n ])\n };\n}\n\n/*\nLanguage: Arduino\nAuthor: Stefania Mellai \nDescription: The Arduino® Language is a superset of C++. This rules are designed to highlight the Arduino® source code. For info about language see http://www.arduino.cc.\nWebsite: https://www.arduino.cc\n*/\n\n\n/** @type LanguageFn */\nfunction arduino(hljs) {\n const ARDUINO_KW = {\n type: [\n \"boolean\",\n \"byte\",\n \"word\",\n \"String\"\n ],\n built_in: [\n \"KeyboardController\",\n \"MouseController\",\n \"SoftwareSerial\",\n \"EthernetServer\",\n \"EthernetClient\",\n \"LiquidCrystal\",\n \"RobotControl\",\n \"GSMVoiceCall\",\n \"EthernetUDP\",\n \"EsploraTFT\",\n \"HttpClient\",\n \"RobotMotor\",\n \"WiFiClient\",\n \"GSMScanner\",\n \"FileSystem\",\n \"Scheduler\",\n \"GSMServer\",\n \"YunClient\",\n \"YunServer\",\n \"IPAddress\",\n \"GSMClient\",\n \"GSMModem\",\n \"Keyboard\",\n \"Ethernet\",\n \"Console\",\n \"GSMBand\",\n \"Esplora\",\n \"Stepper\",\n \"Process\",\n \"WiFiUDP\",\n \"GSM_SMS\",\n \"Mailbox\",\n \"USBHost\",\n \"Firmata\",\n \"PImage\",\n \"Client\",\n \"Server\",\n \"GSMPIN\",\n \"FileIO\",\n \"Bridge\",\n \"Serial\",\n \"EEPROM\",\n \"Stream\",\n \"Mouse\",\n \"Audio\",\n \"Servo\",\n \"File\",\n \"Task\",\n \"GPRS\",\n \"WiFi\",\n \"Wire\",\n \"TFT\",\n \"GSM\",\n \"SPI\",\n \"SD\"\n ],\n _hints: [\n \"setup\",\n \"loop\",\n \"runShellCommandAsynchronously\",\n \"analogWriteResolution\",\n \"retrieveCallingNumber\",\n \"printFirmwareVersion\",\n \"analogReadResolution\",\n \"sendDigitalPortPair\",\n \"noListenOnLocalhost\",\n \"readJoystickButton\",\n \"setFirmwareVersion\",\n \"readJoystickSwitch\",\n \"scrollDisplayRight\",\n \"getVoiceCallStatus\",\n \"scrollDisplayLeft\",\n \"writeMicroseconds\",\n \"delayMicroseconds\",\n \"beginTransmission\",\n \"getSignalStrength\",\n \"runAsynchronously\",\n \"getAsynchronously\",\n \"listenOnLocalhost\",\n \"getCurrentCarrier\",\n \"readAccelerometer\",\n \"messageAvailable\",\n \"sendDigitalPorts\",\n \"lineFollowConfig\",\n \"countryNameWrite\",\n \"runShellCommand\",\n \"readStringUntil\",\n \"rewindDirectory\",\n \"readTemperature\",\n \"setClockDivider\",\n \"readLightSensor\",\n \"endTransmission\",\n \"analogReference\",\n \"detachInterrupt\",\n \"countryNameRead\",\n \"attachInterrupt\",\n \"encryptionType\",\n \"readBytesUntil\",\n \"robotNameWrite\",\n \"readMicrophone\",\n \"robotNameRead\",\n \"cityNameWrite\",\n \"userNameWrite\",\n \"readJoystickY\",\n \"readJoystickX\",\n \"mouseReleased\",\n \"openNextFile\",\n \"scanNetworks\",\n \"noInterrupts\",\n \"digitalWrite\",\n \"beginSpeaker\",\n \"mousePressed\",\n \"isActionDone\",\n \"mouseDragged\",\n \"displayLogos\",\n \"noAutoscroll\",\n \"addParameter\",\n \"remoteNumber\",\n \"getModifiers\",\n \"keyboardRead\",\n \"userNameRead\",\n \"waitContinue\",\n \"processInput\",\n \"parseCommand\",\n \"printVersion\",\n \"readNetworks\",\n \"writeMessage\",\n \"blinkVersion\",\n \"cityNameRead\",\n \"readMessage\",\n \"setDataMode\",\n \"parsePacket\",\n \"isListening\",\n \"setBitOrder\",\n \"beginPacket\",\n \"isDirectory\",\n \"motorsWrite\",\n \"drawCompass\",\n \"digitalRead\",\n \"clearScreen\",\n \"serialEvent\",\n \"rightToLeft\",\n \"setTextSize\",\n \"leftToRight\",\n \"requestFrom\",\n \"keyReleased\",\n \"compassRead\",\n \"analogWrite\",\n \"interrupts\",\n \"WiFiServer\",\n \"disconnect\",\n \"playMelody\",\n \"parseFloat\",\n \"autoscroll\",\n \"getPINUsed\",\n \"setPINUsed\",\n \"setTimeout\",\n \"sendAnalog\",\n \"readSlider\",\n \"analogRead\",\n \"beginWrite\",\n \"createChar\",\n \"motorsStop\",\n \"keyPressed\",\n \"tempoWrite\",\n \"readButton\",\n \"subnetMask\",\n \"debugPrint\",\n \"macAddress\",\n \"writeGreen\",\n \"randomSeed\",\n \"attachGPRS\",\n \"readString\",\n \"sendString\",\n \"remotePort\",\n \"releaseAll\",\n \"mouseMoved\",\n \"background\",\n \"getXChange\",\n \"getYChange\",\n \"answerCall\",\n \"getResult\",\n \"voiceCall\",\n \"endPacket\",\n \"constrain\",\n \"getSocket\",\n \"writeJSON\",\n \"getButton\",\n \"available\",\n \"connected\",\n \"findUntil\",\n \"readBytes\",\n \"exitValue\",\n \"readGreen\",\n \"writeBlue\",\n \"startLoop\",\n \"IPAddress\",\n \"isPressed\",\n \"sendSysex\",\n \"pauseMode\",\n \"gatewayIP\",\n \"setCursor\",\n \"getOemKey\",\n \"tuneWrite\",\n \"noDisplay\",\n \"loadImage\",\n \"switchPIN\",\n \"onRequest\",\n \"onReceive\",\n \"changePIN\",\n \"playFile\",\n \"noBuffer\",\n \"parseInt\",\n \"overflow\",\n \"checkPIN\",\n \"knobRead\",\n \"beginTFT\",\n \"bitClear\",\n \"updateIR\",\n \"bitWrite\",\n \"position\",\n \"writeRGB\",\n \"highByte\",\n \"writeRed\",\n \"setSpeed\",\n \"readBlue\",\n \"noStroke\",\n \"remoteIP\",\n \"transfer\",\n \"shutdown\",\n \"hangCall\",\n \"beginSMS\",\n \"endWrite\",\n \"attached\",\n \"maintain\",\n \"noCursor\",\n \"checkReg\",\n \"checkPUK\",\n \"shiftOut\",\n \"isValid\",\n \"shiftIn\",\n \"pulseIn\",\n \"connect\",\n \"println\",\n \"localIP\",\n \"pinMode\",\n \"getIMEI\",\n \"display\",\n \"noBlink\",\n \"process\",\n \"getBand\",\n \"running\",\n \"beginSD\",\n \"drawBMP\",\n \"lowByte\",\n \"setBand\",\n \"release\",\n \"bitRead\",\n \"prepare\",\n \"pointTo\",\n \"readRed\",\n \"setMode\",\n \"noFill\",\n \"remove\",\n \"listen\",\n \"stroke\",\n \"detach\",\n \"attach\",\n \"noTone\",\n \"exists\",\n \"buffer\",\n \"height\",\n \"bitSet\",\n \"circle\",\n \"config\",\n \"cursor\",\n \"random\",\n \"IRread\",\n \"setDNS\",\n \"endSMS\",\n \"getKey\",\n \"micros\",\n \"millis\",\n \"begin\",\n \"print\",\n \"write\",\n \"ready\",\n \"flush\",\n \"width\",\n \"isPIN\",\n \"blink\",\n \"clear\",\n \"press\",\n \"mkdir\",\n \"rmdir\",\n \"close\",\n \"point\",\n \"yield\",\n \"image\",\n \"BSSID\",\n \"click\",\n \"delay\",\n \"read\",\n \"text\",\n \"move\",\n \"peek\",\n \"beep\",\n \"rect\",\n \"line\",\n \"open\",\n \"seek\",\n \"fill\",\n \"size\",\n \"turn\",\n \"stop\",\n \"home\",\n \"find\",\n \"step\",\n \"tone\",\n \"sqrt\",\n \"RSSI\",\n \"SSID\",\n \"end\",\n \"bit\",\n \"tan\",\n \"cos\",\n \"sin\",\n \"pow\",\n \"map\",\n \"abs\",\n \"max\",\n \"min\",\n \"get\",\n \"run\",\n \"put\"\n ],\n literal: [\n \"DIGITAL_MESSAGE\",\n \"FIRMATA_STRING\",\n \"ANALOG_MESSAGE\",\n \"REPORT_DIGITAL\",\n \"REPORT_ANALOG\",\n \"INPUT_PULLUP\",\n \"SET_PIN_MODE\",\n \"INTERNAL2V56\",\n \"SYSTEM_RESET\",\n \"LED_BUILTIN\",\n \"INTERNAL1V1\",\n \"SYSEX_START\",\n \"INTERNAL\",\n \"EXTERNAL\",\n \"DEFAULT\",\n \"OUTPUT\",\n \"INPUT\",\n \"HIGH\",\n \"LOW\"\n ]\n };\n\n const ARDUINO = cPlusPlus(hljs);\n\n const kws = /** @type {Record} */ (ARDUINO.keywords);\n\n kws.type = [\n ...kws.type,\n ...ARDUINO_KW.type\n ];\n kws.literal = [\n ...kws.literal,\n ...ARDUINO_KW.literal\n ];\n kws.built_in = [\n ...kws.built_in,\n ...ARDUINO_KW.built_in\n ];\n kws._hints = ARDUINO_KW._hints;\n\n ARDUINO.name = 'Arduino';\n ARDUINO.aliases = [ 'ino' ];\n ARDUINO.supersetOf = \"cpp\";\n\n return ARDUINO;\n}\n\nmodule.exports = arduino;\n","/*\nLanguage: ARM Assembly\nAuthor: Dan Panzarella \nDescription: ARM Assembly including Thumb and Thumb2 instructions\nCategory: assembler\n*/\n\n/** @type LanguageFn */\nfunction armasm(hljs) {\n // local labels: %?[FB]?[AT]?\\d{1,2}\\w+\n\n const COMMENT = { variants: [\n hljs.COMMENT('^[ \\\\t]*(?=#)', '$', {\n relevance: 0,\n excludeBegin: true\n }),\n hljs.COMMENT('[;@]', '$', { relevance: 0 }),\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE\n ] };\n\n return {\n name: 'ARM Assembly',\n case_insensitive: true,\n aliases: [ 'arm' ],\n keywords: {\n $pattern: '\\\\.?' + hljs.IDENT_RE,\n meta:\n // GNU preprocs\n '.2byte .4byte .align .ascii .asciz .balign .byte .code .data .else .end .endif .endm .endr .equ .err .exitm .extern .global .hword .if .ifdef .ifndef .include .irp .long .macro .rept .req .section .set .skip .space .text .word .arm .thumb .code16 .code32 .force_thumb .thumb_func .ltorg '\n // ARM directives\n + 'ALIAS ALIGN ARM AREA ASSERT ATTR CN CODE CODE16 CODE32 COMMON CP DATA DCB DCD DCDU DCDO DCFD DCFDU DCI DCQ DCQU DCW DCWU DN ELIF ELSE END ENDFUNC ENDIF ENDP ENTRY EQU EXPORT EXPORTAS EXTERN FIELD FILL FUNCTION GBLA GBLL GBLS GET GLOBAL IF IMPORT INCBIN INCLUDE INFO KEEP LCLA LCLL LCLS LTORG MACRO MAP MEND MEXIT NOFP OPT PRESERVE8 PROC QN READONLY RELOC REQUIRE REQUIRE8 RLIST FN ROUT SETA SETL SETS SN SPACE SUBT THUMB THUMBX TTL WHILE WEND ',\n built_in:\n 'r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 ' // standard registers\n + 'w0 w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 w14 w15 ' // 32 bit ARMv8 registers\n + 'w16 w17 w18 w19 w20 w21 w22 w23 w24 w25 w26 w27 w28 w29 w30 '\n + 'x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 ' // 64 bit ARMv8 registers\n + 'x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 '\n + 'pc lr sp ip sl sb fp ' // typical regs plus backward compatibility\n + 'a1 a2 a3 a4 v1 v2 v3 v4 v5 v6 v7 v8 f0 f1 f2 f3 f4 f5 f6 f7 ' // more regs and fp\n + 'p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 ' // coprocessor regs\n + 'c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 ' // more coproc\n + 'q0 q1 q2 q3 q4 q5 q6 q7 q8 q9 q10 q11 q12 q13 q14 q15 ' // advanced SIMD NEON regs\n\n // program status registers\n + 'cpsr_c cpsr_x cpsr_s cpsr_f cpsr_cx cpsr_cxs cpsr_xs cpsr_xsf cpsr_sf cpsr_cxsf '\n + 'spsr_c spsr_x spsr_s spsr_f spsr_cx spsr_cxs spsr_xs spsr_xsf spsr_sf spsr_cxsf '\n\n // NEON and VFP registers\n + 's0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12 s13 s14 s15 '\n + 's16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 '\n + 'd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 '\n + 'd16 d17 d18 d19 d20 d21 d22 d23 d24 d25 d26 d27 d28 d29 d30 d31 '\n\n + '{PC} {VAR} {TRUE} {FALSE} {OPT} {CONFIG} {ENDIAN} {CODESIZE} {CPU} {FPU} {ARCHITECTURE} {PCSTOREOFFSET} {ARMASM_VERSION} {INTER} {ROPI} {RWPI} {SWST} {NOSWST} . @'\n },\n contains: [\n {\n className: 'keyword',\n begin: '\\\\b(' // mnemonics\n + 'adc|'\n + '(qd?|sh?|u[qh]?)?add(8|16)?|usada?8|(q|sh?|u[qh]?)?(as|sa)x|'\n + 'and|adrl?|sbc|rs[bc]|asr|b[lx]?|blx|bxj|cbn?z|tb[bh]|bic|'\n + 'bfc|bfi|[su]bfx|bkpt|cdp2?|clz|clrex|cmp|cmn|cpsi[ed]|cps|'\n + 'setend|dbg|dmb|dsb|eor|isb|it[te]{0,3}|lsl|lsr|ror|rrx|'\n + 'ldm(([id][ab])|f[ds])?|ldr((s|ex)?[bhd])?|movt?|mvn|mra|mar|'\n + 'mul|[us]mull|smul[bwt][bt]|smu[as]d|smmul|smmla|'\n + 'mla|umlaal|smlal?([wbt][bt]|d)|mls|smlsl?[ds]|smc|svc|sev|'\n + 'mia([bt]{2}|ph)?|mrr?c2?|mcrr2?|mrs|msr|orr|orn|pkh(tb|bt)|rbit|'\n + 'rev(16|sh)?|sel|[su]sat(16)?|nop|pop|push|rfe([id][ab])?|'\n + 'stm([id][ab])?|str(ex)?[bhd]?|(qd?)?sub|(sh?|q|u[qh]?)?sub(8|16)|'\n + '[su]xt(a?h|a?b(16)?)|srs([id][ab])?|swpb?|swi|smi|tst|teq|'\n + 'wfe|wfi|yield'\n + ')'\n + '(eq|ne|cs|cc|mi|pl|vs|vc|hi|ls|ge|lt|gt|le|al|hs|lo)?' // condition codes\n + '[sptrx]?' // legal postfixes\n + '(?=\\\\s)' // followed by space\n },\n COMMENT,\n hljs.QUOTE_STRING_MODE,\n {\n className: 'string',\n begin: '\\'',\n end: '[^\\\\\\\\]\\'',\n relevance: 0\n },\n {\n className: 'title',\n begin: '\\\\|',\n end: '\\\\|',\n illegal: '\\\\n',\n relevance: 0\n },\n {\n className: 'number',\n variants: [\n { // hex\n begin: '[#$=]?0x[0-9a-f]+' },\n { // bin\n begin: '[#$=]?0b[01]+' },\n { // literal\n begin: '[#$=]\\\\d+' },\n { // bare number\n begin: '\\\\b\\\\d+' }\n ],\n relevance: 0\n },\n {\n className: 'symbol',\n variants: [\n { // GNU ARM syntax\n begin: '^[ \\\\t]*[a-z_\\\\.\\\\$][a-z0-9_\\\\.\\\\$]+:' },\n { // ARM syntax\n begin: '^[a-z_\\\\.\\\\$][a-z0-9_\\\\.\\\\$]+' },\n { // label reference\n begin: '[=#]\\\\w+' }\n ],\n relevance: 0\n }\n ]\n };\n}\n\nmodule.exports = armasm;\n","/*\nLanguage: HTML, XML\nWebsite: https://www.w3.org/XML/\nCategory: common, web\nAudit: 2020\n*/\n\n/** @type LanguageFn */\nfunction xml(hljs) {\n const regex = hljs.regex;\n // XML names can have the following additional letters: https://www.w3.org/TR/xml/#NT-NameChar\n // OTHER_NAME_CHARS = /[:\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]/;\n // Element names start with NAME_START_CHAR followed by optional other Unicode letters, ASCII digits, hyphens, underscores, and periods\n // const TAG_NAME_RE = regex.concat(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/, regex.optional(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*:/), /[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*/);;\n // const XML_IDENT_RE = /[A-Z_a-z:\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]+/;\n // const TAG_NAME_RE = regex.concat(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/, regex.optional(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*:/), /[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*/);\n // however, to cater for performance and more Unicode support rely simply on the Unicode letter class\n const TAG_NAME_RE = regex.concat(/[\\p{L}_]/u, regex.optional(/[\\p{L}0-9_.-]*:/u), /[\\p{L}0-9_.-]*/u);\n const XML_IDENT_RE = /[\\p{L}0-9._:-]+/u;\n const XML_ENTITIES = {\n className: 'symbol',\n begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/\n };\n const XML_META_KEYWORDS = {\n begin: /\\s/,\n contains: [\n {\n className: 'keyword',\n begin: /#?[a-z_][a-z1-9_-]+/,\n illegal: /\\n/\n }\n ]\n };\n const XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, {\n begin: /\\(/,\n end: /\\)/\n });\n const APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, { className: 'string' });\n const QUOTE_META_STRING_MODE = hljs.inherit(hljs.QUOTE_STRING_MODE, { className: 'string' });\n const TAG_INTERNALS = {\n endsWithParent: true,\n illegal: /`]+/ }\n ]\n }\n ]\n }\n ]\n };\n return {\n name: 'HTML, XML',\n aliases: [\n 'html',\n 'xhtml',\n 'rss',\n 'atom',\n 'xjb',\n 'xsd',\n 'xsl',\n 'plist',\n 'wsf',\n 'svg'\n ],\n case_insensitive: true,\n unicodeRegex: true,\n contains: [\n {\n className: 'meta',\n begin: //,\n relevance: 10,\n contains: [\n XML_META_KEYWORDS,\n QUOTE_META_STRING_MODE,\n APOS_META_STRING_MODE,\n XML_META_PAR_KEYWORDS,\n {\n begin: /\\[/,\n end: /\\]/,\n contains: [\n {\n className: 'meta',\n begin: //,\n contains: [\n XML_META_KEYWORDS,\n XML_META_PAR_KEYWORDS,\n QUOTE_META_STRING_MODE,\n APOS_META_STRING_MODE\n ]\n }\n ]\n }\n ]\n },\n hljs.COMMENT(\n //,\n { relevance: 10 }\n ),\n {\n begin: //,\n relevance: 10\n },\n XML_ENTITIES,\n // xml processing instructions\n {\n className: 'meta',\n end: /\\?>/,\n variants: [\n {\n begin: /<\\?xml/,\n relevance: 10,\n contains: [\n QUOTE_META_STRING_MODE\n ]\n },\n {\n begin: /<\\?[a-z][a-z0-9]+/,\n }\n ]\n\n },\n {\n className: 'tag',\n /*\n The lookahead pattern (?=...) ensures that 'begin' only matches\n ')/,\n end: />/,\n keywords: { name: 'style' },\n contains: [ TAG_INTERNALS ],\n starts: {\n end: /<\\/style>/,\n returnEnd: true,\n subLanguage: [\n 'css',\n 'xml'\n ]\n }\n },\n {\n className: 'tag',\n // See the comment in the - - -
- - - + [data-cy="chat-input"] { + padding-top: 0.9rem !important; + } + + [data-cy="llm-modal-option"][data-option="copilot"] { + display: none !important; + } + + + + +
+ + + + \ No newline at end of file diff --git a/appland-navie/package.json b/appland-navie/package.json index 5ce491d2..30852092 100644 --- a/appland-navie/package.json +++ b/appland-navie/package.json @@ -6,15 +6,15 @@ "bundle": "tsup --env.NODE_ENV production" }, "devDependencies": { - "buffer": "^6.0.3", "browserify-fs": "^1.0.0", + "buffer": "^6.0.3", "node-libs-browser": "^2.2.1", "process": "^0.11.10", "tsup": "^8.2.4", "typescript": "^5.6.2" }, "dependencies": { - "@appland/components": "^4.37.3", + "@appland/components": "^4.39.0", "highlight.js": "^11.9.0", "url": "^0.11", "vue": "^2.7", diff --git a/appland-navie/webview.js b/appland-navie/webview.js index 95d7f1c6..4253d0a8 100644 --- a/appland-navie/webview.js +++ b/appland-navie/webview.js @@ -25,6 +25,8 @@ export function mountWebview() { appmapYmlPresent: this.appmapYmlPresent, targetAppmapData: initialData.targetAppmapData, targetAppmapFsPath: initialData.targetAppmapFsPath, + editorType: 'intellij', + useAnimation: initialData.useAnimation, openNewChat() { vscode.postMessage({ command: "open-new-chat" }); }, @@ -59,6 +61,11 @@ export function mountWebview() { handleAppMapMessages(app, vscode, messages); + messages.on('pin-files', (props) => { + const { requests } = props; + app.$root.$emit('pin-files', requests); + }); + messages.on('update', (props) => { Object.entries(props) .filter(([key]) => key !== 'type') @@ -69,6 +76,7 @@ export function mountWebview() { }); }); + app.$on('choose-files-to-pin', () => vscode.postMessage({ command: 'choose-files-to-pin' })); app.$on('open-install-instructions', () => vscode.postMessage({command: 'open-install-instructions'})) app.$on('open-record-instructions', () => vscode.postMessage({command: 'open-record-instructions'})) app.$on('open-appmap', (path) => vscode.postMessage({command: 'open-appmap', path})) diff --git a/appland-navie/yarn.lock b/appland-navie/yarn.lock index ffc7856c..f966d6cf 100644 --- a/appland-navie/yarn.lock +++ b/appland-navie/yarn.lock @@ -3,9 +3,9 @@ "@appland/client@^1.12.0": - version "1.18.0" - resolved "https://registry.yarnpkg.com/@appland/client/-/client-1.18.0.tgz#cf518de34e95b3e4de3b53d4f54bf480a197258c" - integrity sha512-UVJ1eAD/JfnCQqIoiTBqSFbDIxujHarxfDBARk9mSdpenAcwmA7bR+GW7dsYTM9kwJ0nwLfhl/vGqzX2uIjkkQ== + version "1.23.0" + resolved "https://registry.yarnpkg.com/@appland/client/-/client-1.23.0.tgz#9861ad35117b8601cd5bda66d3a5f7b273449208" + integrity sha512-GZ4oJZAvPih3I4AB8z9istdUKZ03IeR4o/lvesvSdsW4s7/Bg0ggOhQ3UI+HQWz2jE9XYirbod0iLclMhk/+ww== dependencies: "@appland/models" "^2.10.0" "@types/form-data" "^2.5.0" @@ -14,10 +14,10 @@ rxjs "^7.8.1" socket.io-client "^4.7.2" -"@appland/components@^4.37.3": - version "4.37.3" - resolved "https://registry.yarnpkg.com/@appland/components/-/components-4.37.3.tgz#da1f95e1d9159a4b1528b40e0db38f118d98a8b3" - integrity sha512-7gT2zGnXs56gXXCkol6hLcckJZErGofwTrrUpZj4k/bHkj9QkGovD6fK/o02LgF/0/yLsBpegTwEanVXpEjUhA== +"@appland/components@^4.39.0": + version "4.39.0" + resolved "https://registry.yarnpkg.com/@appland/components/-/components-4.39.0.tgz#ae0dfae7ddfdf498830a674e1c57f6dab418a51b" + integrity sha512-+zf/ueYFSkysgkOEpiZqSIEALXGttwi+mDqF/FY5zoMi77jIVoG9bzGTf2QtckFTUGiTI4yFvCWj17CtSw/jfg== dependencies: "@appland/client" "^1.12.0" "@appland/diagrams" "^1.7.0" @@ -58,9 +58,9 @@ deepmerge "^4.2.2" "@appland/models@^2.10.0", "@appland/models@^2.10.2": - version "2.10.2" - resolved "https://registry.yarnpkg.com/@appland/models/-/models-2.10.2.tgz#5229824262633cd6b24379f469f5e3600c03d7c3" - integrity sha512-LBJXbu9sUW7I/vrxmuhXjPeWrCMrheewlzE1XMaLedGmsZvbPRHR/MqzOf1WkTlEYoHIhnkSrqkI3AaWWjXI3w== + version "2.10.3" + resolved "https://registry.yarnpkg.com/@appland/models/-/models-2.10.3.tgz#2f1c07ca12e3c497391ac459e3dd22f8a40a8271" + integrity sha512-Sl/YeGX5dQSzueT+MERpvSTU+mKHf8l1XmqnnngtFCaO2Wr048pgDDNUPDrYLE0AIAeYAfgs+arbNeAxwgBVCw== dependencies: "@appland/sql-parser" "^1.5.0" crypto-js "^4.0.0" @@ -95,10 +95,31 @@ resolved "https://registry.yarnpkg.com/@appland/sql-parser/-/sql-parser-1.5.1.tgz#331d644364899858ba7aa6e884e2492596990626" integrity sha512-R2FBHUOdzdBPUCCiL6WvXT9Fu+Xaj89exa1g+wMlatIe5z6vqitzLkY5a9zGDL3IByTiwbR0jiYuvFMfhp1Q+Q== +"@babel/helper-string-parser@^7.25.7": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.7.tgz#d50e8d37b1176207b4fe9acedec386c565a44a54" + integrity sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g== + +"@babel/helper-validator-identifier@^7.25.7": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.7.tgz#77b7f60c40b15c97df735b38a66ba1d7c3e93da5" + integrity sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg== + "@babel/parser@^7.23.5": - version "7.24.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.5.tgz#4a4d5ab4315579e5398a82dcf636ca80c3392790" - integrity sha512-EOv5IK8arwh3LI47dz1b0tKUb/1uhHAnHJOrjgtQMIpu1uXd9mlFrJg9IUgGUgZ41Ch0K8REPTYpO7B76b4vJg== + version "7.25.8" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.25.8.tgz#f6aaf38e80c36129460c1657c0762db584c9d5e2" + integrity sha512-HcttkxzdPucv3nNFmfOOMfFf64KgdJVqm1KaCm25dPGMLElo9nsLvXeJECQg8UzPuBGLyTSA0ZzqCtDSzKTEoQ== + dependencies: + "@babel/types" "^7.25.8" + +"@babel/types@^7.25.8": + version "7.25.8" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.25.8.tgz#5cf6037258e8a9bcad533f4979025140cb9993e1" + integrity sha512-JWtuCu8VQsMladxVz/P4HzHUGCAwpuqacmowgXFs5XjxIgKuNjnLokQzuVjlTvIzODaDmpjT3oxcC48vyk9EWg== + dependencies: + "@babel/helper-string-parser" "^7.25.7" + "@babel/helper-validator-identifier" "^7.25.7" + to-fast-properties "^2.0.0" "@braintree/sanitize-url@^6.0.1": version "6.0.4" @@ -269,9 +290,9 @@ integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== "@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": - version "1.4.15" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" - integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + version "1.5.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== "@jridgewell/trace-mapping@^0.3.24": version "0.3.25" @@ -281,111 +302,90 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@nodelib/fs.scandir@2.1.5": - version "2.1.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" - integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== - dependencies: - "@nodelib/fs.stat" "2.0.5" - run-parallel "^1.1.9" - -"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": - version "2.0.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" - integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== - -"@nodelib/fs.walk@^1.2.3": - version "1.2.8" - resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" - integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== - dependencies: - "@nodelib/fs.scandir" "2.1.5" - fastq "^1.6.0" - "@pkgjs/parseargs@^0.11.0": version "0.11.0" resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== -"@rollup/rollup-android-arm-eabi@4.21.3": - version "4.21.3" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.21.3.tgz#155c7d82c1b36c3ad84d9adf9b3cd520cba81a0f" - integrity sha512-MmKSfaB9GX+zXl6E8z4koOr/xU63AMVleLEa64v7R0QF/ZloMs5vcD1sHgM64GXXS1csaJutG+ddtzcueI/BLg== - -"@rollup/rollup-android-arm64@4.21.3": - version "4.21.3" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.21.3.tgz#b94b6fa002bd94a9cbd8f9e47e23b25e5bd113ba" - integrity sha512-zrt8ecH07PE3sB4jPOggweBjJMzI1JG5xI2DIsUbkA+7K+Gkjys6eV7i9pOenNSDJH3eOr/jLb/PzqtmdwDq5g== - -"@rollup/rollup-darwin-arm64@4.21.3": - version "4.21.3" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.21.3.tgz#0934126cf9cbeadfe0eb7471ab5d1517e8cd8dcc" - integrity sha512-P0UxIOrKNBFTQaXTxOH4RxuEBVCgEA5UTNV6Yz7z9QHnUJ7eLX9reOd/NYMO3+XZO2cco19mXTxDMXxit4R/eQ== - -"@rollup/rollup-darwin-x64@4.21.3": - version "4.21.3" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.21.3.tgz#0ce8e1e0f349778938c7c90e4bdc730640e0a13e" - integrity sha512-L1M0vKGO5ASKntqtsFEjTq/fD91vAqnzeaF6sfNAy55aD+Hi2pBI5DKwCO+UNDQHWsDViJLqshxOahXyLSh3EA== - -"@rollup/rollup-linux-arm-gnueabihf@4.21.3": - version "4.21.3" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.21.3.tgz#5669d34775ad5d71e4f29ade99d0ff4df523afb6" - integrity sha512-btVgIsCjuYFKUjopPoWiDqmoUXQDiW2A4C3Mtmp5vACm7/GnyuprqIDPNczeyR5W8rTXEbkmrJux7cJmD99D2g== - -"@rollup/rollup-linux-arm-musleabihf@4.21.3": - version "4.21.3" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.21.3.tgz#f6d1a0e1da4061370cb2f4244fbdd727c806dd88" - integrity sha512-zmjbSphplZlau6ZTkxd3+NMtE4UKVy7U4aVFMmHcgO5CUbw17ZP6QCgyxhzGaU/wFFdTfiojjbLG3/0p9HhAqA== - -"@rollup/rollup-linux-arm64-gnu@4.21.3": - version "4.21.3" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.21.3.tgz#ed96a05e99743dee4d23cc4913fc6e01a0089c88" - integrity sha512-nSZfcZtAnQPRZmUkUQwZq2OjQciR6tEoJaZVFvLHsj0MF6QhNMg0fQ6mUOsiCUpTqxTx0/O6gX0V/nYc7LrgPw== - -"@rollup/rollup-linux-arm64-musl@4.21.3": - version "4.21.3" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.21.3.tgz#057ea26eaa7e537a06ded617d23d57eab3cecb58" - integrity sha512-MnvSPGO8KJXIMGlQDYfvYS3IosFN2rKsvxRpPO2l2cum+Z3exiExLwVU+GExL96pn8IP+GdH8Tz70EpBhO0sIQ== - -"@rollup/rollup-linux-powerpc64le-gnu@4.21.3": - version "4.21.3" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.21.3.tgz#6e6e1f9404c9bf3fbd7d51cd11cd288a9a2843aa" - integrity sha512-+W+p/9QNDr2vE2AXU0qIy0qQE75E8RTwTwgqS2G5CRQ11vzq0tbnfBd6brWhS9bCRjAjepJe2fvvkvS3dno+iw== - -"@rollup/rollup-linux-riscv64-gnu@4.21.3": - version "4.21.3" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.21.3.tgz#eef1536a53f6e6658a2a778130e6b1a4a41cb439" - integrity sha512-yXH6K6KfqGXaxHrtr+Uoy+JpNlUlI46BKVyonGiaD74ravdnF9BUNC+vV+SIuB96hUMGShhKV693rF9QDfO6nQ== - -"@rollup/rollup-linux-s390x-gnu@4.21.3": - version "4.21.3" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.21.3.tgz#2b28fb89ca084efaf8086f435025d96b4a966957" - integrity sha512-R8cwY9wcnApN/KDYWTH4gV/ypvy9yZUHlbJvfaiXSB48JO3KpwSpjOGqO4jnGkLDSk1hgjYkTbTt6Q7uvPf8eg== - -"@rollup/rollup-linux-x64-gnu@4.21.3": - version "4.21.3" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.21.3.tgz#5226cde6c6b495b04a3392c1d2c572844e42f06b" - integrity sha512-kZPbX/NOPh0vhS5sI+dR8L1bU2cSO9FgxwM8r7wHzGydzfSjLRCFAT87GR5U9scj2rhzN3JPYVC7NoBbl4FZ0g== - -"@rollup/rollup-linux-x64-musl@4.21.3": - version "4.21.3" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.21.3.tgz#2c2412982e6c2a00a2ecac6d548ebb02f0aa6ca4" - integrity sha512-S0Yq+xA1VEH66uiMNhijsWAafffydd2X5b77eLHfRmfLsRSpbiAWiRHV6DEpz6aOToPsgid7TI9rGd6zB1rhbg== - -"@rollup/rollup-win32-arm64-msvc@4.21.3": - version "4.21.3" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.21.3.tgz#fbb6ef5379199e2ec0103ef32877b0985c773a55" - integrity sha512-9isNzeL34yquCPyerog+IMCNxKR8XYmGd0tHSV+OVx0TmE0aJOo9uw4fZfUuk2qxobP5sug6vNdZR6u7Mw7Q+Q== - -"@rollup/rollup-win32-ia32-msvc@4.21.3": - version "4.21.3" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.21.3.tgz#d50e2082e147e24d87fe34abbf6246525ec3845a" - integrity sha512-nMIdKnfZfzn1Vsk+RuOvl43ONTZXoAPUUxgcU0tXooqg4YrAqzfKzVenqqk2g5efWh46/D28cKFrOzDSW28gTA== - -"@rollup/rollup-win32-x64-msvc@4.21.3": - version "4.21.3" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.21.3.tgz#4115233aa1bd5a2060214f96d8511f6247093212" - integrity sha512-fOvu7PCQjAj4eWDEuD8Xz5gpzFqXzGlxHZozHP4b9Jxv9APtdxL6STqztDzMLuRXEc4UpXGGhx029Xgm91QBeA== +"@rollup/rollup-android-arm-eabi@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.24.0.tgz#1661ff5ea9beb362795304cb916049aba7ac9c54" + integrity sha512-Q6HJd7Y6xdB48x8ZNVDOqsbh2uByBhgK8PiQgPhwkIw/HC/YX5Ghq2mQY5sRMZWHb3VsFkWooUVOZHKr7DmDIA== + +"@rollup/rollup-android-arm64@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.24.0.tgz#2ffaa91f1b55a0082b8a722525741aadcbd3971e" + integrity sha512-ijLnS1qFId8xhKjT81uBHuuJp2lU4x2yxa4ctFPtG+MqEE6+C5f/+X/bStmxapgmwLwiL3ih122xv8kVARNAZA== + +"@rollup/rollup-darwin-arm64@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.24.0.tgz#627007221b24b8cc3063703eee0b9177edf49c1f" + integrity sha512-bIv+X9xeSs1XCk6DVvkO+S/z8/2AMt/2lMqdQbMrmVpgFvXlmde9mLcbQpztXm1tajC3raFDqegsH18HQPMYtA== + +"@rollup/rollup-darwin-x64@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.24.0.tgz#0605506142b9e796c370d59c5984ae95b9758724" + integrity sha512-X6/nOwoFN7RT2svEQWUsW/5C/fYMBe4fnLK9DQk4SX4mgVBiTA9h64kjUYPvGQ0F/9xwJ5U5UfTbl6BEjaQdBQ== + +"@rollup/rollup-linux-arm-gnueabihf@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.24.0.tgz#62dfd196d4b10c0c2db833897164d2d319ee0cbb" + integrity sha512-0KXvIJQMOImLCVCz9uvvdPgfyWo93aHHp8ui3FrtOP57svqrF/roSSR5pjqL2hcMp0ljeGlU4q9o/rQaAQ3AYA== + +"@rollup/rollup-linux-arm-musleabihf@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.24.0.tgz#53ce72aeb982f1f34b58b380baafaf6a240fddb3" + integrity sha512-it2BW6kKFVh8xk/BnHfakEeoLPv8STIISekpoF+nBgWM4d55CZKc7T4Dx1pEbTnYm/xEKMgy1MNtYuoA8RFIWw== + +"@rollup/rollup-linux-arm64-gnu@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.24.0.tgz#1632990f62a75c74f43e4b14ab3597d7ed416496" + integrity sha512-i0xTLXjqap2eRfulFVlSnM5dEbTVque/3Pi4g2y7cxrs7+a9De42z4XxKLYJ7+OhE3IgxvfQM7vQc43bwTgPwA== + +"@rollup/rollup-linux-arm64-musl@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.24.0.tgz#8c03a996efb41e257b414b2e0560b7a21f2d9065" + integrity sha512-9E6MKUJhDuDh604Qco5yP/3qn3y7SLXYuiC0Rpr89aMScS2UAmK1wHP2b7KAa1nSjWJc/f/Lc0Wl1L47qjiyQw== + +"@rollup/rollup-linux-powerpc64le-gnu@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.24.0.tgz#5b98729628d5bcc8f7f37b58b04d6845f85c7b5d" + integrity sha512-2XFFPJ2XMEiF5Zi2EBf4h73oR1V/lycirxZxHZNc93SqDN/IWhYYSYj8I9381ikUFXZrz2v7r2tOVk2NBwxrWw== + +"@rollup/rollup-linux-riscv64-gnu@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.24.0.tgz#48e42e41f4cabf3573cfefcb448599c512e22983" + integrity sha512-M3Dg4hlwuntUCdzU7KjYqbbd+BLq3JMAOhCKdBE3TcMGMZbKkDdJ5ivNdehOssMCIokNHFOsv7DO4rlEOfyKpg== + +"@rollup/rollup-linux-s390x-gnu@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.24.0.tgz#e0b4f9a966872cb7d3e21b9e412a4b7efd7f0b58" + integrity sha512-mjBaoo4ocxJppTorZVKWFpy1bfFj9FeCMJqzlMQGjpNPY9JwQi7OuS1axzNIk0nMX6jSgy6ZURDZ2w0QW6D56g== + +"@rollup/rollup-linux-x64-gnu@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.24.0.tgz#78144741993100f47bd3da72fce215e077ae036b" + integrity sha512-ZXFk7M72R0YYFN5q13niV0B7G8/5dcQ9JDp8keJSfr3GoZeXEoMHP/HlvqROA3OMbMdfr19IjCeNAnPUG93b6A== + +"@rollup/rollup-linux-x64-musl@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.24.0.tgz#d9fe32971883cd1bd858336bd33a1c3ca6146127" + integrity sha512-w1i+L7kAXZNdYl+vFvzSZy8Y1arS7vMgIy8wusXJzRrPyof5LAb02KGr1PD2EkRcl73kHulIID0M501lN+vobQ== + +"@rollup/rollup-win32-arm64-msvc@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.24.0.tgz#71fa3ea369316db703a909c790743972e98afae5" + integrity sha512-VXBrnPWgBpVDCVY6XF3LEW0pOU51KbaHhccHw6AS6vBWIC60eqsH19DAeeObl+g8nKAz04QFdl/Cefta0xQtUQ== + +"@rollup/rollup-win32-ia32-msvc@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.24.0.tgz#653f5989a60658e17d7576a3996deb3902e342e2" + integrity sha512-xrNcGDU0OxVcPTH/8n/ShH4UevZxKIO6HJFK0e15XItZP2UcaiLFd5kiX7hJnqCbSztUF8Qot+JWBC/QXRPYWQ== + +"@rollup/rollup-win32-x64-msvc@4.24.0": + version "4.24.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.24.0.tgz#0574d7e87b44ee8511d08cc7f914bcb802b70818" + integrity sha512-fbMkAF7fufku0N2dE5TBXcNlg0pt0cJue4xBRE2Qc5Vqikxr4VCgKj/ht6SMdFcOacVA9rqF70APJ8RN/4vMJw== "@socket.io/component-emitter@~3.1.0": version "3.1.2" @@ -423,10 +423,10 @@ dependencies: "@types/ms" "*" -"@types/estree@1.0.5": - version "1.0.5" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" - integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== +"@types/estree@1.0.6": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50" + integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw== "@types/form-data@^2.5.0": version "2.5.0" @@ -448,11 +448,11 @@ integrity sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g== "@types/node@*": - version "20.12.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.12.tgz#7cbecdf902085cec634fdb362172dfe12b8f2050" - integrity sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw== + version "22.7.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.6.tgz#3ec3e2b071e136cd11093c19128405e1d1f92f33" + integrity sha512-/d7Rnj0/ExXDMcioS78/kf1lMzYk4BZV8MZGTBKzTGZ6/406ukkbYlIsZmMPhcR5KlkunDHQLrtAVmSq7r+mSw== dependencies: - undici-types "~5.26.4" + undici-types "~6.19.2" "@types/node@^12.12.54": version "12.20.55" @@ -467,9 +467,9 @@ "@types/node" "*" "@types/unist@^2", "@types/unist@^2.0.0": - version "2.0.10" - resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.10.tgz#04ffa7f406ab628f7f7e97ca23e290cd8ab15efc" - integrity sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA== + version "2.0.11" + resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.11.tgz#11af57b127e32487774841f7a4e54eab166d03c4" + integrity sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA== "@types/ws@^7.4.4": version "7.4.7" @@ -544,11 +544,6 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -array-union@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" - integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== - asn1.js@^4.10.1: version "4.10.1" resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0" @@ -598,7 +593,7 @@ bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9: resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== -bn.js@^5.0.0, bn.js@^5.2.1: +bn.js@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== @@ -610,7 +605,7 @@ brace-expansion@^2.0.1: dependencies: balanced-match "^1.0.0" -braces@^3.0.3, braces@~3.0.2: +braces@~3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== @@ -663,12 +658,13 @@ browserify-fs@^1.0.0: levelup "^0.18.2" browserify-rsa@^4.0.0, browserify-rsa@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.1.0.tgz#b2fd06b5b75ae297f7ce2dc651f918f5be158c8d" - integrity sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog== + version "4.1.1" + resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.1.1.tgz#06e530907fe2949dc21fc3c2e2302e10b1437238" + integrity sha512-YBjSAiTqM04ZVei6sXighu679a3SqWORA3qZTEqZImnlkDIFtKc6pNutpjyZ8RJTjQtuYfeetkxM11GwoYXMIQ== dependencies: - bn.js "^5.0.0" - randombytes "^2.0.1" + bn.js "^5.2.1" + randombytes "^2.1.0" + safe-buffer "^5.2.1" browserify-sign@^4.0.0: version "4.2.3" @@ -932,9 +928,9 @@ cytoscape-cose-bilkent@^4.1.0: cose-base "^1.0.0" cytoscape@^3.28.1: - version "3.30.0" - resolved "https://registry.yarnpkg.com/cytoscape/-/cytoscape-3.30.0.tgz#5b0c13f7bb305481e2c70414d4c5f149d92eda82" - integrity sha512-l590mjTHT6/Cbxp13dGPC2Y7VXdgc+rUeF8AnF/JPzhjNevbDJfObnJgaSjlldOgBQZbue+X6IUZ7r5GAgvauQ== + version "3.30.2" + resolved "https://registry.yarnpkg.com/cytoscape/-/cytoscape-3.30.2.tgz#94149707fb6547a55e3b44f03ffe232706212161" + integrity sha512-oICxQsjW8uSaRmn4UK/jkczKOqTrVqt5/1WL0POiJUT2EKNc9STM4hYFHv917yu55aTBMFNRzymlJhVAiWPCxw== "d3-array@1 - 2": version "2.12.1" @@ -1238,36 +1234,22 @@ dagre@^0.8.5: lodash "^4.17.15" dayjs@^1.11.7: - version "1.11.11" - resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.11.tgz#dfe0e9d54c5f8b68ccf8ca5f72ac603e7e5ed59e" - integrity sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg== + version "1.11.13" + resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.13.tgz#92430b0139055c3ebb60150aa13e860a4b5a366c" + integrity sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg== de-indent@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d" integrity sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg== -debug@^4.0.0: - version "4.3.5" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.5.tgz#e83444eceb9fedd4a1da56d671ae2446a01a6e1e" - integrity sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg== - dependencies: - ms "2.1.2" - -debug@^4.3.5: +debug@^4.0.0, debug@^4.3.5, debug@~4.3.1, debug@~4.3.2: version "4.3.7" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== dependencies: ms "^2.1.3" -debug@~4.3.1, debug@~4.3.2: - version "4.3.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - decode-named-character-reference@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz#daabac9690874c394c81e4162a0304b35d824f0e" @@ -1349,13 +1331,6 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" -dir-glob@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" - integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== - dependencies: - path-type "^4.0.0" - dom-to-svg@^0.12.2: version "0.12.2" resolved "https://registry.yarnpkg.com/dom-to-svg/-/dom-to-svg-0.12.2.tgz#0c943fc883703452e33f13631b630b79508d064a" @@ -1370,15 +1345,15 @@ domain-browser@^1.1.1: resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA== -dompurify@^3.0.5: +"dompurify@^3.0.5 <3.1.7": version "3.1.6" resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.1.6.tgz#43c714a94c6a7b8801850f82e756685300a027e2" integrity sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ== dompurify@^3.0.6: - version "3.1.3" - resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.1.3.tgz#cfe3ce4232c216d923832f68f2aa18b2fb9bd223" - integrity sha512-5sOWYSNPaxz6o2MUPvtyxTTqR4D3L77pr5rUQoWgD5ROQtVIZQgJkXbo1DLlK3vj11YGw5+LnF4SYti4gZmwng== + version "3.1.7" + resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.1.7.tgz#711a8c96479fb6ced93453732c160c3c72418a6a" + integrity sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ== eastasianwidth@^0.2.0: version "0.2.0" @@ -1413,21 +1388,21 @@ emoji-regex@^9.2.2: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== -engine.io-client@~6.5.2: - version "6.5.3" - resolved "https://registry.yarnpkg.com/engine.io-client/-/engine.io-client-6.5.3.tgz#4cf6fa24845029b238f83c628916d9149c399bc5" - integrity sha512-9Z0qLB0NIisTRt1DZ/8U2k12RJn8yls/nXMZLn+/N8hANT3TcYjKFKcwbw5zFQiN4NTde3TSY9zb79e1ij6j9Q== +engine.io-client@~6.6.1: + version "6.6.1" + resolved "https://registry.yarnpkg.com/engine.io-client/-/engine.io-client-6.6.1.tgz#28a9cc4e90d448e1d0ba9369ad08a7af82f9956a" + integrity sha512-aYuoak7I+R83M/BBPIOs2to51BmFIpC1wZe6zZzMrT2llVsHy5cvcmdsJgP2Qz6smHu+sD9oexiSUAVd8OfBPw== dependencies: "@socket.io/component-emitter" "~3.1.0" debug "~4.3.1" engine.io-parser "~5.2.1" - ws "~8.11.0" - xmlhttprequest-ssl "~2.0.0" + ws "~8.17.1" + xmlhttprequest-ssl "~2.1.1" engine.io-parser@~5.2.1: - version "5.2.2" - resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-5.2.2.tgz#37b48e2d23116919a3453738c5720455e64e1c49" - integrity sha512-RcyUFKA93/CXH20l4SoVvzZfrSDMOTUS3bWVpTt2FuFP+XYrL8i8oonHP7WInRyVHXh0n/ORtoeiE1os+8qkSw== + version "5.2.3" + resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-5.2.3.tgz#00dc5b97b1f233a23c9398d0209504cf5f94d92f" + integrity sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q== errno@^0.1.1, errno@~0.1.1: version "0.1.8" @@ -1523,23 +1498,10 @@ eyes@^0.1.8: resolved "https://registry.yarnpkg.com/eyes/-/eyes-0.1.8.tgz#62cf120234c683785d902348a800ef3e0cc20bc0" integrity sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ== -fast-glob@^3.2.9: - version "3.3.2" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" - integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== - dependencies: - "@nodelib/fs.stat" "^2.0.2" - "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.2" - merge2 "^1.3.0" - micromatch "^4.0.4" - -fastq@^1.6.0: - version "1.17.1" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47" - integrity sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w== - dependencies: - reusify "^1.0.4" +fdir@^6.4.0: + version "6.4.2" + resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.4.2.tgz#ddaa7ce1831b161bc3657bb99cb36e1622702689" + integrity sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ== fill-range@^7.1.1: version "7.1.1" @@ -1562,9 +1524,9 @@ foreground-child@^3.1.0: signal-exit "^4.0.1" form-data@*, form-data@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" - integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== + version "4.0.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.1.tgz#ba1076daaaa5bfd7e99c1a6cb02aa0a5cff90d48" + integrity sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw== dependencies: asynckit "^0.4.0" combined-stream "^1.0.8" @@ -1603,7 +1565,7 @@ get-stream@^6.0.0: resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== -glob-parent@^5.1.2, glob-parent@~5.1.2: +glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== @@ -1622,18 +1584,6 @@ glob@^10.3.10: package-json-from-dist "^1.0.0" path-scurry "^1.11.1" -globby@^11.1.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" - integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== - dependencies: - array-union "^2.1.0" - dir-glob "^3.0.1" - fast-glob "^3.2.9" - ignore "^5.2.0" - merge2 "^1.4.1" - slash "^3.0.0" - gopd@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" @@ -1708,9 +1658,9 @@ he@^1.2.0: integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== highlight.js@^11.9.0: - version "11.9.0" - resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-11.9.0.tgz#04ab9ee43b52a41a047432c8103e2158a1b8b5b0" - integrity sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw== + version "11.10.0" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-11.10.0.tgz#6e3600dc4b33d6dc23d5bd94fbf72405f5892b92" + integrity sha512-SYVnVFswQER+zu1laSya563s+F8VDGt7o35d4utbamowvUNLLMovFqwCLSocpZTz3MgaSRA1IbqRWZv97dtErQ== hmac-drbg@^1.0.1: version "1.0.1" @@ -1748,11 +1698,6 @@ ieee754@^1.1.4, ieee754@^1.2.1: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== -ignore@^5.2.0: - version "5.3.2" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" - integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== - indexof@~0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d" @@ -1857,9 +1802,9 @@ jackspeak@^3.1.2: "@pkgjs/parseargs" "^0.11.0" jayson@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/jayson/-/jayson-4.1.0.tgz#60dc946a85197317f2b1439d672a8b0a99cea2f9" - integrity sha512-R6JlbyLN53Mjku329XoRT2zJAE6ZgOQ8f91ucYdMCD4nkGCF9kZSrcGXpHIU4jeKj58zUZke2p+cdQchU7Ly7A== + version "4.1.2" + resolved "https://registry.yarnpkg.com/jayson/-/jayson-4.1.2.tgz#443c26a8658703e0b2e881117b09395d88b6982e" + integrity sha512-5nzMWDHy6f+koZOuYsArh2AXs73NfWYVlFyJJuCedr93GpY+Ku8qq10ropSXVfHK+H0T6paA88ww+/dV+1fBNA== dependencies: "@types/connect" "^3.4.33" "@types/node" "^12.12.54" @@ -1872,7 +1817,7 @@ jayson@^4.1.0: isomorphic-ws "^4.0.1" json-stringify-safe "^5.0.1" uuid "^8.3.2" - ws "^7.4.5" + ws "^7.5.10" joycon@^3.1.1: version "3.1.1" @@ -2056,9 +2001,9 @@ ltgt@^2.1.2: integrity sha512-AI2r85+4MquTw9ZYqabu4nMwy9Oftlfa/e/52t9IjtfG+mGBbTNdAoZ3RQKLHR6r0wQnwZnPIEh/Ya6XTWAKNA== marked-highlight@^2.0.7: - version "2.1.1" - resolved "https://registry.yarnpkg.com/marked-highlight/-/marked-highlight-2.1.1.tgz#144120e32363f042b420276a9c7b8dab748f630f" - integrity sha512-ktdqwtBne8rim5mb+vvZ9FzElGFb+CHCgkx/g6DSzTjaSrVnxsJdSzB5YgCkknFrcOW+viocM1lGyIjC0oa3fg== + version "2.2.0" + resolved "https://registry.yarnpkg.com/marked-highlight/-/marked-highlight-2.2.0.tgz#94d04da1a03abc36afbe4021294de0e4d4907636" + integrity sha512-36LzwtVf7HEbbMITKU4j+iZuyWKgdXJfgYr4F5j27vs79oRPyApuBF3WkS5OsqO1+1lypWxztad7zNRM4qgXFw== marked@^10.0.0: version "10.0.0" @@ -2104,15 +2049,10 @@ merge-stream@^2.0.0: resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -merge2@^1.3.0, merge2@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" - integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== - mermaid@^10.9.1: - version "10.9.1" - resolved "https://registry.yarnpkg.com/mermaid/-/mermaid-10.9.1.tgz#5f582c23f3186c46c6aa673e59eeb46d741b2ea6" - integrity sha512-Mx45Obds5W1UkW1nv/7dHRsbfMM1aOKA2+Pxs/IGHNonygDHwmng8xTHyS9z4KWVi0rbko8gjiBmuwwXQ7tiNA== + version "10.9.2" + resolved "https://registry.yarnpkg.com/mermaid/-/mermaid-10.9.2.tgz#108fe98060e6fba6bc826e5b454674aa2d32b817" + integrity sha512-UkZyMSuIYcI1Q0H+2pv/5CiY84sOwQ2XlKoDZMl9Y/MtrLEtxQtyA6LWGkMxnZxj0dJqI+7nw51bYjNnrbdFsQ== dependencies: "@braintree/sanitize-url" "^6.0.1" "@types/d3-scale" "^4.0.3" @@ -2123,7 +2063,7 @@ mermaid@^10.9.1: d3-sankey "^0.12.3" dagre-d3-es "7.0.10" dayjs "^1.11.7" - dompurify "^3.0.5" + dompurify "^3.0.5 <3.1.7" elkjs "^0.9.0" katex "^0.16.9" khroma "^2.0.0" @@ -2329,14 +2269,6 @@ micromark@^3.0.0: micromark-util-types "^1.0.1" uvu "^0.5.0" -micromatch@^4.0.4: - version "4.0.8" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" - integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== - dependencies: - braces "^3.0.3" - picomatch "^2.3.1" - miller-rabin@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" @@ -2389,11 +2321,6 @@ mri@^1.1.0: resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA== -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" @@ -2465,9 +2392,9 @@ object-assign@^4.0.1: integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== object-inspect@^1.13.1: - version "1.13.1" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" - integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== + version "1.13.2" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.2.tgz#dea0088467fb991e67af4058147a24824a3043ff" + integrity sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g== object-keys@^1.1.1: version "1.1.1" @@ -2523,9 +2450,9 @@ os-browserify@^0.3.0: integrity sha512-gjcpUc3clBf9+210TRaDWbf+rZZZEshZ+DlXMRCeAjp0xhTrnQsKHypIy1J3d5hKdUzj69t708EHtU8P6bUn0A== package-json-from-dist@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz#e501cd3094b278495eb4258d4c9f6d5ac3019f00" - integrity sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw== + version "1.0.1" + resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505" + integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw== pako@^2.1.0: version "2.1.0" @@ -2567,11 +2494,6 @@ path-scurry@^1.11.1: lru-cache "^10.2.0" minipass "^5.0.0 || ^6.0.2 || ^7.0.0" -path-type@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" - integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== - pbkdf2@^3.0.3, pbkdf2@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075" @@ -2583,16 +2505,21 @@ pbkdf2@^3.0.3, pbkdf2@^3.1.2: safe-buffer "^5.0.1" sha.js "^2.4.8" -picocolors@^1.0.0, picocolors@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" - integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== +picocolors@^1.0.1, picocolors@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" + integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== -picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1: +picomatch@^2.0.4, picomatch@^2.2.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== +picomatch@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.2.tgz#77c742931e8f3b8820946c76cd0c1f13730d1dab" + integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg== + pirates@^4.0.1: version "4.0.6" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.6.tgz#3018ae32ecfcff6c29ba2267cbf21166ac1f36b9" @@ -2611,13 +2538,13 @@ postcss-value-parser@^4.1.0: integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== postcss@^8.2.9, postcss@^8.4.14: - version "8.4.38" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.38.tgz#b387d533baf2054288e337066d81c6bee9db9e0e" - integrity sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A== + version "8.4.47" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.47.tgz#5bf6c9a010f3e724c503bf03ef7947dcb0fea365" + integrity sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ== dependencies: nanoid "^3.3.7" - picocolors "^1.0.0" - source-map-js "^1.2.0" + picocolors "^1.1.0" + source-map-js "^1.2.1" "prettier@^1.18.2 || ^2.0.0": version "2.8.8" @@ -2666,13 +2593,6 @@ punycode@^2.1.0: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== -qs@^6.11.2: - version "6.12.1" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.12.1.tgz#39422111ca7cbdb70425541cba20c7d7b216599a" - integrity sha512-zWmv4RSuB9r2mYQw3zxQuHWeU+42aKi1wWig/j4ele4ygELZ7PEO6MM7rim9oAQH2A5MWfsAVf/jPvTPgCbvUQ== - dependencies: - side-channel "^1.0.6" - qs@^6.12.3: version "6.13.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.13.0.tgz#6ca3bd58439f7e245655798997787b0d88a51906" @@ -2685,12 +2605,7 @@ querystring-es3@^0.2.0: resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" integrity sha512-773xhDQnZBMFobEiztv8LIl70ch5MSF/jUQVlhwFyBILqq96anmoctVIYz+ZRp0qbCKATTn6ev02M3r7Ga5vqA== -queue-microtask@^1.2.2: - version "1.2.3" - resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" - integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== - -randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: +randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== @@ -2759,11 +2674,6 @@ resolve-from@^5.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== -reusify@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" - integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== - ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" @@ -2778,37 +2688,30 @@ robust-predicates@^3.0.2: integrity sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg== rollup@^4.19.0: - version "4.21.3" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.21.3.tgz#c64ba119e6aeb913798a6f7eef2780a0df5a0821" - integrity sha512-7sqRtBNnEbcBtMeRVc6VRsJMmpI+JU1z9VTvW8D4gXIYQFz0aLcsE6rRkyghZkLfEgUZgVvOG7A5CVz/VW5GIA== + version "4.24.0" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.24.0.tgz#c14a3576f20622ea6a5c9cad7caca5e6e9555d05" + integrity sha512-DOmrlGSXNk1DM0ljiQA+i+o0rSLhtii1je5wgk60j49d1jHT5YYttBv1iWOnYSTG+fZZESUOSNiAl89SIet+Cg== dependencies: - "@types/estree" "1.0.5" + "@types/estree" "1.0.6" optionalDependencies: - "@rollup/rollup-android-arm-eabi" "4.21.3" - "@rollup/rollup-android-arm64" "4.21.3" - "@rollup/rollup-darwin-arm64" "4.21.3" - "@rollup/rollup-darwin-x64" "4.21.3" - "@rollup/rollup-linux-arm-gnueabihf" "4.21.3" - "@rollup/rollup-linux-arm-musleabihf" "4.21.3" - "@rollup/rollup-linux-arm64-gnu" "4.21.3" - "@rollup/rollup-linux-arm64-musl" "4.21.3" - "@rollup/rollup-linux-powerpc64le-gnu" "4.21.3" - "@rollup/rollup-linux-riscv64-gnu" "4.21.3" - "@rollup/rollup-linux-s390x-gnu" "4.21.3" - "@rollup/rollup-linux-x64-gnu" "4.21.3" - "@rollup/rollup-linux-x64-musl" "4.21.3" - "@rollup/rollup-win32-arm64-msvc" "4.21.3" - "@rollup/rollup-win32-ia32-msvc" "4.21.3" - "@rollup/rollup-win32-x64-msvc" "4.21.3" + "@rollup/rollup-android-arm-eabi" "4.24.0" + "@rollup/rollup-android-arm64" "4.24.0" + "@rollup/rollup-darwin-arm64" "4.24.0" + "@rollup/rollup-darwin-x64" "4.24.0" + "@rollup/rollup-linux-arm-gnueabihf" "4.24.0" + "@rollup/rollup-linux-arm-musleabihf" "4.24.0" + "@rollup/rollup-linux-arm64-gnu" "4.24.0" + "@rollup/rollup-linux-arm64-musl" "4.24.0" + "@rollup/rollup-linux-powerpc64le-gnu" "4.24.0" + "@rollup/rollup-linux-riscv64-gnu" "4.24.0" + "@rollup/rollup-linux-s390x-gnu" "4.24.0" + "@rollup/rollup-linux-x64-gnu" "4.24.0" + "@rollup/rollup-linux-x64-musl" "4.24.0" + "@rollup/rollup-win32-arm64-msvc" "4.24.0" + "@rollup/rollup-win32-ia32-msvc" "4.24.0" + "@rollup/rollup-win32-x64-msvc" "4.24.0" fsevents "~2.3.2" -run-parallel@^1.1.9: - version "1.2.0" - resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" - integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== - dependencies: - queue-microtask "^1.2.2" - rw@1: version "1.3.3" resolved "https://registry.yarnpkg.com/rw/-/rw-1.3.3.tgz#3f862dfa91ab766b14885ef4d01124bfda074fb4" @@ -2910,19 +2813,14 @@ signal-exit@^4.0.1: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== -slash@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" - integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== - socket.io-client@^4.7.2: - version "4.7.5" - resolved "https://registry.yarnpkg.com/socket.io-client/-/socket.io-client-4.7.5.tgz#919be76916989758bdc20eec63f7ee0ae45c05b7" - integrity sha512-sJ/tqHOCe7Z50JCBCXrsY3I2k03iOiUe+tj1OmKeD2lXPiGH/RUCdTZFoqVyN7l1MnpIzPrGtLcijffmeouNlQ== + version "4.8.0" + resolved "https://registry.yarnpkg.com/socket.io-client/-/socket.io-client-4.8.0.tgz#2ea0302d0032d23422bd2860f78127a800cad6a2" + integrity sha512-C0jdhD5yQahMws9alf/yvtsMGTaIDBnZ8Rb5HU56svyq0l5LIrGzIDZZD5pHQlmzxLuU91Gz+VpQMKgCTNYtkw== dependencies: "@socket.io/component-emitter" "~3.1.0" debug "~4.3.2" - engine.io-client "~6.5.2" + engine.io-client "~6.6.1" socket.io-parser "~4.2.4" socket.io-parser@~4.2.4: @@ -2933,10 +2831,10 @@ socket.io-parser@~4.2.4: "@socket.io/component-emitter" "~3.1.0" debug "~4.3.1" -source-map-js@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af" - integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg== +source-map-js@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46" + integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA== source-map@0.8.0-beta.0: version "0.8.0-beta.0" @@ -3054,9 +2952,9 @@ strip-final-newline@^2.0.0: integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== stylis@^4.1.3: - version "4.3.2" - resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.3.2.tgz#8f76b70777dd53eb669c6f58c997bf0a9972e444" - integrity sha512-bhtUjWd/z6ltJiQwg0dUfxEJ+W+jdqQd8TbWLWyeIJHlnsqmGLRFFd8e5mA0AZi/zx90smXRlN66YMTcaSFifg== + version "4.3.4" + resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.3.4.tgz#ca5c6c4a35c4784e4e93a2a24dc4e9fa075250a4" + integrity sha512-osIBl6BGUmSfDkyH2mB7EFvCJntXDrLhKjHTRj/rK6xLH0yuPrHULDRQzKokSOD4VoorhtKpfcfW1GAntu8now== sucrase@^3.35.0: version "3.35.0" @@ -3097,11 +2995,24 @@ timers-browserify@^2.0.4: dependencies: setimmediate "^1.0.4" +tinyglobby@^0.2.1: + version "0.2.9" + resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.9.tgz#6baddd1b0fe416403efb0dd40442c7d7c03c1c66" + integrity sha512-8or1+BGEdk1Zkkw2ii16qSS7uVrQJPre5A9o/XkWPATkk23FZh/15BKFxPnlTy6vkljZxLqYCzzBMj30ZrSvjw== + dependencies: + fdir "^6.4.0" + picomatch "^4.0.2" + to-arraybuffer@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" integrity sha512-okFlQcoGTi4LQBG/PgSYblw9VOyptsz2KJZqc6qtgGdes8VktzUQkj4BI2blit072iS8VODNcMA+tvnS9dnuMA== +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== + to-regex-range@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" @@ -3132,14 +3043,14 @@ ts-interface-checker@^0.1.9: integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA== tslib@^2.1.0: - version "2.6.2" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" - integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== + version "2.8.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.0.tgz#d124c86c3c05a40a91e6fdea4021bd31d377971b" + integrity sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA== tsup@^8.2.4: - version "8.2.4" - resolved "https://registry.yarnpkg.com/tsup/-/tsup-8.2.4.tgz#5e31790c1e66392cee384ad746ed51c106614beb" - integrity sha512-akpCPePnBnC/CXgRrcy72ZSntgIEUa1jN0oJbbvpALWKNOz1B7aM+UVDWGRGIO/T/PZugAESWDJUAb5FD48o8Q== + version "8.3.0" + resolved "https://registry.yarnpkg.com/tsup/-/tsup-8.3.0.tgz#c7dae40b13d11d81fb144c0f90077a99102a572a" + integrity sha512-ALscEeyS03IomcuNdFdc0YWGVIkwH1Ws7nfTbAPuoILvEV2hpGQAY72LIOjglGo4ShWpZfpBqP/jpQVCzqYQag== dependencies: bundle-require "^5.0.0" cac "^6.7.14" @@ -3148,7 +3059,6 @@ tsup@^8.2.4: debug "^4.3.5" esbuild "^0.23.0" execa "^5.1.1" - globby "^11.1.0" joycon "^3.1.1" picocolors "^1.0.1" postcss-load-config "^6.0.1" @@ -3156,6 +3066,7 @@ tsup@^8.2.4: rollup "^4.19.0" source-map "0.8.0-beta.0" sucrase "^3.35.0" + tinyglobby "^0.2.1" tree-kill "^1.2.2" tty-browserify@0.0.0: @@ -3174,14 +3085,14 @@ typedarray@^0.0.6: integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== typescript@^5.6.2: - version "5.6.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.2.tgz#d1de67b6bef77c41823f822df8f0b3bcff60a5a0" - integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw== + version "5.6.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b" + integrity sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw== -undici-types@~5.26.4: - version "5.26.5" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" - integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== +undici-types@~6.19.2: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== unist-util-stringify-position@^3.0.0: version "3.0.3" @@ -3190,15 +3101,7 @@ unist-util-stringify-position@^3.0.0: dependencies: "@types/unist" "^2.0.0" -url@^0.11: - version "0.11.3" - resolved "https://registry.yarnpkg.com/url/-/url-0.11.3.tgz#6f495f4b935de40ce4a0a52faee8954244f3d3ad" - integrity sha512-6hxOLGfZASQK/cijlZnZJTq8OXAkt/3YGfQX45vvMYXpZoo8NdWZcY73K108Jf759lS1Bv/8wXnHDTSz17dSRw== - dependencies: - punycode "^1.4.1" - qs "^6.11.2" - -url@^0.11.0: +url@^0.11, url@^0.11.0: version "0.11.4" resolved "https://registry.yarnpkg.com/url/-/url-0.11.4.tgz#adca77b3562d56b72746e76b330b7f27b6721f3c" integrity sha512-oCwdVC7mTuWiPyjLUz/COz5TLk6wgp0RCsN+wHZ2Ekneac9w8uuV0njcbbie2ME+Vs+d6duwmYuR3HgQXs1fOg== @@ -3320,20 +3223,20 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -ws@^7.4.5: - version "7.5.9" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" - integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== +ws@^7.5.10: + version "7.5.10" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9" + integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ== -ws@~8.11.0: - version "8.11.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.11.0.tgz#6a0d36b8edfd9f96d8b25683db2f8d7de6e8e143" - integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg== +ws@~8.17.1: + version "8.17.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b" + integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ== -xmlhttprequest-ssl@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz#91360c86b914e67f44dce769180027c0da618c67" - integrity sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A== +xmlhttprequest-ssl@~2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.1.1.tgz#0d045c3b2babad8e7db1af5af093f5d0d60df99a" + integrity sha512-ptjR8YSJIXoA3Mbv5po7RtSYHO6mZr8s7i5VGmEk7QY2pQWyT1o0N+W1gKbOyJPUCGXGnuw0wqe8f0L6Y0ny7g== xtend@^2.2.0: version "2.2.0" diff --git a/build.gradle.kts b/build.gradle.kts index cd174a07..560b9381 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,7 +24,7 @@ buildscript { plugins { idea id("org.jetbrains.kotlin.jvm") version "1.9.24" - id("org.jetbrains.intellij.platform") version "2.0.0" + id("org.jetbrains.intellij.platform") version "2.1.0" id("org.jetbrains.changelog") version "1.3.1" id("com.adarshr.test-logger") version "3.2.0" id("de.undercouch.download") version "5.6.0" @@ -39,6 +39,13 @@ val ideVersion = prop("ideVersion") group = "appland.appmap" version = pluginVersionString +val platformVersion = when { + // e.g. '2024.1' + ideVersion.length == 6 -> ideVersion.replace(".", "").substring(2).toInt() + // e.g. '243.16718.32' + else -> ideVersion.substringBefore(".").toInt() +} + val isCI = System.getenv("CI") == "true" val agentOutputPath = rootProject.layout.buildDirectory.asFile.get() .resolve("appmap-java-agent") @@ -68,6 +75,16 @@ allprojects { intellijIdeaCommunity(ideVersion) // using "Bundled" to gain access to the Java plugin's test classes testFramework(TestFrameworkType.Bundled) + + // org.jetbrains.intellij.platform requires to bundledModules for 2024.2+ + if (platformVersion >= 242) { + bundledModule("intellij.platform.collaborationTools") + bundledModule("intellij.platform.vcs.impl") + } + // 2024.3 extracted JSON support into a plugin + if (platformVersion >= 243) { + bundledPlugin("com.intellij.modules.json") + } } // added because org.jetbrains.intellij.platform resolves to an older version bundled with the SDK @@ -96,13 +113,16 @@ allprojects { testImplementation(project(":plugin-core", "testOutput")) } - // https://mvnrepository.com/artifact/org.mock-server/mockserver-netty - testImplementation("org.mock-server:mockserver-netty:5.15.0") - // https://mvnrepository.com/artifact/org.mock-server/mockserver-junit-rule - testImplementation("org.mock-server:mockserver-junit-rule:5.15.0") - // workaround for https://github.com/JetBrains/intellij-platform-gradle-plugin/issues/1663 testImplementation("org.opentest4j:opentest4j:1.3.0") + + // Subproject test-integration must not get our additional test dependencies + // because mockserver is conflicting with the SDK's bundled library versions. + // See https://github.com/getappmap/appmap-intellij-plugin/pull/794. + if (!project.name.startsWith("tests-")) { + // https://mvnrepository.com/artifact/org.mock-server/mockserver-junit-rule + testImplementation("org.mock-server:mockserver-junit-rule:5.15.0") + } } intellijPlatform { @@ -222,16 +242,10 @@ project(":") { dependencies { intellijPlatform { - // fixme use when https://github.com/JetBrains/intellij-platform-gradle-plugin/issues/1673 is resolved - // pluginModule(implementation(project(":plugin-core"))) - // pluginModule(implementation(project(":plugin-gradle"))) - // pluginModule(implementation(project(":plugin-java"))) - // pluginModule(implementation(project(":plugin-maven"))) - - implementation(project(":plugin-core")) - implementation(project(":plugin-gradle")) - implementation(project(":plugin-java")) - implementation(project(":plugin-maven")) + pluginModule(implementation(project(":plugin-core"))) + pluginModule(implementation(project(":plugin-gradle"))) + pluginModule(implementation(project(":plugin-java"))) + pluginModule(implementation(project(":plugin-maven"))) pluginVerifier() zipSigner() @@ -420,6 +434,12 @@ project(":plugin-maven") { } } +project(":tests-integration") { + dependencies { + implementation(project(":plugin-core")) + } +} + // https://github.com/commonmark/commonmark-java fun String.renderMarkdown(): String { val parser = Parser.builder().build() diff --git a/description.md b/description.md index 23dd425b..9cd293e2 100644 --- a/description.md +++ b/description.md @@ -1,10 +1,10 @@ -AppMap is a free developer tools platform powered by runtime analysis and AI. It's composed of three components: +AppMap is a developer tools platform powered by runtime analysis and AI. It's composed of three components: * Navie - AI code architect. * AppMap data - Runtime traces of your application runtime. * AppMap diagrams - Interactive visualizations of AppMap data. -By using AppMap data, Navie is the first AI code architect with the context to understand how your app works when it runs, like a principal engineer or software architect. AppMap data provides Navie with accurate information about application behavior, APIs, database queries, and more, providing valuable context so you can ask more challenging questions and get better answers. +Navie is the first AI code architect with the context to understand how your app works when it runs, like a principal engineer or software architect. AppMap data provides Navie with accurate information about application behavior, APIs, database queries, and more, providing valuable context so you can ask more challenging questions and get better answers. ![image](https://appmap.io/assets/img/appmap-navie-intellij-screenshot.png) @@ -25,14 +25,7 @@ Supported programming languages: Java, Python, Ruby, TypeScript/JavaScript (for ## Examples -Here are some examples of Navie making context-aware suggestions, providing tactical solutions, and reasoning about the larger context of the specific code being worked on. - -1. [Understand complex data flows and add a new feature in Java Spring](https://appmap.io/navie/how-to/understand-complex-data-flows-and-add-new-features-in-java-spring/) -2. [Find and fix slow API endpoints in a FastAPI app](https://appmap.io/navie/how-to/fix-slow-api-endpoints-in-a-fastapi-app-with-navie/) -3. [Find and fix a database performance issue in Ruby on Rails](https://appmap.io/navie/how-to/find-and-fix-a-database-performance-issue-in-ruby-on-rails/) -4. [Quickly add a new feature to a complex Python app](https://appmap.io/navie/how-to/adding-a-new-feature-to-a-complex-python-application/) -5. [Fixing performance issues with MongoDB in a MERN app](https://appmap.io/navie/how-to/fixing-performance-issues-with-mongodb-in-a-mern-app/) - +[Here are some examples](https://appmap.io/product/examples/navie) of Navie making context-aware suggestions, providing tactical solutions, and reasoning about the larger context of the specific code being worked on. ## Chat Modes @@ -40,10 +33,16 @@ Navie provides different modes of interaction to assist you with your code and p - **`@explain` (default)**: Navie makes context-aware suggestions, provides specific solutions, and reasons about the larger context of the specific code being worked on. -- **`@help`**: Activate help mode by beginning any question with the prefix "@help". This mode offers assistance with using AppMap, including guidance for generating and leveraging AppMap data effectively. +- **`@plan`**: Navie focuses the AI response on building a detailed implementation plan for the relevant query. This will focus Navie on only understanding the problem and the application to generate a step-by-step plan. - **`@generate`**: Activate code generation mode by beginning any question with the prefix "@generate". In this mode Navie's response are optimized to include code snippets you can use directly in the files are working on. +- **`@test`**: Navie's responses are optimized for test case creation, such as unit testing or integration testing. This prefix will understand how your tests are currently written and provide updated tests based on features or code that is provided. + +- **`@diagram`**: Navie will create and render a Mermaid compatible diagram within the Navie chat window. You can open this diagram in the [Mermaid Live Editor](https://mermaid.live), copy the Mermaid Definitions to your clipboard, save to disk, or expand a full window view. + +- **`@help`**: Activate help mode by beginning any question with the prefix "@help". This mode offers assistance with using AppMap, including guidance for generating and leveraging AppMap data effectively. + **Via the JetBrains Tools menu option** You can open Navie by clicking on the JetBrains menu option *Tools -> AppMap*. From there you can select *Explain with AppMap Navie*. @@ -53,6 +52,15 @@ You can open Navie by clicking on the JetBrains menu option *Tools -> AppMap*. F ![image](https://appmap.io/assets/img/product/ask-navie-about-a-map.webp) +## Pin files to Navie's context + +Pin specific data files to your conversation with Navie to include data sources you know are relevant to the issue. This includes pinning the text of the issue itself. + +![image](https://appmap.io/assets/img/pinned-context.webp) + +Pin code from Navie responses to your conversation when a Navie response contains code that you want to reference in subsequent prompts. + +![image](https://appmap.io/assets/img/pin-from-response.webp ## Bring your own key or model for Navie @@ -99,4 +107,4 @@ Make AppMap data by running your app—either by [running test cases](https://ap To learn more about security of AppMap, or the use of data with AI when using Navie, see the AppMap [security disclosure](https://appmap.io/security) for more detailed information and discussion. -There is [no fee](https://appmap.io/pricing) for personal use of AppMap for graphing and limited Navie use. Pricing for premium features and integrations are listed on [AppMap’s Pricing Page](https://appmap.io/pricing). +There is [no fee](https://appmap.io/pricing) for personal use of AppMap for graphing and limited Navie use. Pricing for premium features and integrations are listed on [AppMap’s Pricing Page](https://appmap.io/pricing). \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 85df98ff..e8fb5d66 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,10 @@ pluginVersion=0.67.0 sinceBuild=231.0 -untilBuild=242.* +untilBuild=243.* # run plugin verifier for the earliest and latest supported versions -ideVersionVerifier=IC-2023.1,IC-2024.2 +ideVersionVerifier=IC-2023.1,IC-243.16718.32 lombokVersion=1.18.32 @@ -14,6 +14,7 @@ ideVersion=2023.1 #ideVersion=2023.3.2 #ideVersion=2024.1 #ideVersion=2024.2 +#ideVersion=243.16718.32 kotlin.stdlib.default.dependency=false diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index afba1092..a4b76b95 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 20db9ad5..df97d72b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68d..f5feea6d 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -83,10 +85,9 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +134,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +148,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,11 +201,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 93e3f59f..9d21a218 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/plugin-core/src/main/java/appland/actions/AddNavieContextFilesAction.java b/plugin-core/src/main/java/appland/actions/AddNavieContextFilesAction.java new file mode 100644 index 00000000..76b165e2 --- /dev/null +++ b/plugin-core/src/main/java/appland/actions/AddNavieContextFilesAction.java @@ -0,0 +1,83 @@ +package appland.actions; + +import appland.webviews.navie.NavieEditor; +import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.fileEditor.FileEditorManager; +import com.intellij.openapi.vfs.VirtualFile; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +/** + * Action to add VirtualFiles available in the action context as pinned files to the currently active Navie editor. + */ +public class AddNavieContextFilesAction extends AnAction { + @Override + public @NotNull ActionUpdateThread getActionUpdateThread() { + return ActionUpdateThread.BGT; + } + + @Override + public void update(@NotNull AnActionEvent e) { + e.getPresentation().setEnabledAndVisible(findActiveNavieEditor(e) != null && hasSelectedFiles(e)); + } + + @Override + public void actionPerformed(@NotNull AnActionEvent e) { + var editor = findActiveNavieEditor(e); + if (editor != null) { + editor.addPinnedFiles(findSelectedFiles(e)); + } + } + + private boolean hasSelectedFiles(@NotNull AnActionEvent e) { + var files = PlatformDataKeys.VIRTUAL_FILE_ARRAY.getData(e.getDataContext()); + if (files != null) { + for (var file : files) { + if (!file.isDirectory() && file.isInLocalFileSystem()) { + return true; + } + } + } + + return false; + } + + private @NotNull List findSelectedFiles(@NotNull AnActionEvent e) { + var files = PlatformDataKeys.VIRTUAL_FILE_ARRAY.getData(e.getDataContext()); + if (files == null || files.length == 0) { + return Collections.emptyList(); + } + + // we're only accepting files on the local filesystem, the file size is validated by NavieEditor + var localFiles = new ArrayList(); + for (var file : files) { + if (!file.isDirectory() && file.isInLocalFileSystem()) { + localFiles.add(file); + } + } + return localFiles; + } + + private @Nullable NavieEditor findActiveNavieEditor(@NotNull AnActionEvent e) { + var editorManager = FileEditorManager.getInstance(Objects.requireNonNull(e.getProject())); + var editor = editorManager.getSelectedEditor(); + + // If invoked with the context menu of an editor tab, then "editor" equals the clicked tab's editor and not the + // visible Navie editor tab. We're attempting a fallback in such a case. + if (ActionPlaces.EDITOR_TAB_POPUP.equals(e.getPlace()) && !(editor instanceof NavieEditor)) { + for (var candidate : editorManager.getAllEditors()) { + if (candidate instanceof NavieEditor) { + editor = candidate; + break; + } + } + } + + return editor instanceof NavieEditor ? (NavieEditor) editor : null; + } +} diff --git a/plugin-core/src/main/java/appland/actions/ChooseAndAddNavieContextFilesAction.java b/plugin-core/src/main/java/appland/actions/ChooseAndAddNavieContextFilesAction.java new file mode 100644 index 00000000..509ed401 --- /dev/null +++ b/plugin-core/src/main/java/appland/actions/ChooseAndAddNavieContextFilesAction.java @@ -0,0 +1,52 @@ +package appland.actions; + +import appland.webviews.navie.NavieEditor; +import com.intellij.openapi.project.Project; + +import com.intellij.openapi.actionSystem.ActionUpdateThread; +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.fileChooser.FileChooser; +import com.intellij.openapi.fileChooser.FileChooserDescriptor; +import com.intellij.openapi.fileEditor.FileEditorManager; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +/** + * Action to let the user choose the files to add as pinned files to the active Navie editor. + */ +public class ChooseAndAddNavieContextFilesAction extends AnAction { + @Override + public @NotNull ActionUpdateThread getActionUpdateThread() { + return ActionUpdateThread.BGT; + } + + @Override + public void update(@NotNull AnActionEvent e) { + e.getPresentation().setEnabled(findActiveNavieEditor(e) != null); + } + + public static void chooseAndAddPinnedFiles(Project project, NavieEditor editor) { + var descriptor = new FileChooserDescriptor(true, false, false, false, false, true); + var chosenFiles = FileChooser.chooseFiles(descriptor, project, null); + if (chosenFiles.length > 0) { + editor.addPinnedFiles(List.of(chosenFiles)); + } + } + + @Override + public void actionPerformed(@NotNull AnActionEvent e) { + var editor = findActiveNavieEditor(e); + if (editor != null) { + chooseAndAddPinnedFiles(e.getProject(), editor); + } + } + + private @Nullable NavieEditor findActiveNavieEditor(@NotNull AnActionEvent e) { + var project = e.getProject(); + var editor = project != null ? FileEditorManager.getInstance(project).getSelectedEditor() : null; + return editor instanceof NavieEditor ? (NavieEditor) editor : null; + } +} diff --git a/plugin-core/src/main/java/appland/notifications/AppMapNotifications.java b/plugin-core/src/main/java/appland/notifications/AppMapNotifications.java index 233e44b2..e62e2a6f 100644 --- a/plugin-core/src/main/java/appland/notifications/AppMapNotifications.java +++ b/plugin-core/src/main/java/appland/notifications/AppMapNotifications.java @@ -4,24 +4,25 @@ import appland.AppMapPlugin; import appland.actions.StopAppMapRecordingAction; import appland.settings.AppMapApplicationSettingsService; +import appland.settings.AppMapProjectConfigurable; import appland.startup.FirstAppMapLaunchStartupActivity; import appland.webviews.navie.NavieEditorProvider; import com.intellij.ide.BrowserUtil; import com.intellij.ide.util.PropertiesComponent; import com.intellij.notification.*; +import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.application.ApplicationInfo; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; +import com.intellij.openapi.options.ShowSettingsUtil; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.net.HttpConfigurable; -import com.intellij.util.ui.EDT; import com.intellij.util.ui.EdtInvocationManager; -import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -254,6 +255,11 @@ public static boolean isWebviewTextInputBroken() { */ @SuppressWarnings("removal") public static void showWebviewTextInputBrokenMessage(@NotNull Project project, boolean forNavie) { + // don't show in our unit tests because there's no user interaction + if (ApplicationManager.getApplication().isUnitTestMode()) { + return; + } + var properties = PropertiesComponent.getInstance(); var hideMessagePropertyKey = forNavie ? "appmap.navie.hideIsBrokenMessage" : "appmap.signin.hideIsBrokenMessage"; if (properties.getBoolean(hideMessagePropertyKey, false)) { @@ -284,4 +290,28 @@ public void rememberChoice(boolean isSelected, int exitCode) { }); }, ModalityState.defaultModalityState()); } + + public static void showNaviePinnedFileTooLargeNotification(@NotNull Project project, + int skippedFiles, + int fileSizeLimitKB) { + EdtInvocationManager.invokeLaterIfNeeded(() -> { + var notification = new AppMapFullContentNotification( + GENERIC_NOTIFICATIONS_ID, null, + AppMapBundle.get("notification.naviePinnedFileTooLarge.title"), + null, + AppMapBundle.get("notification.naviePinnedFileTooLarge.content", skippedFiles, fileSizeLimitKB), + NotificationType.INFORMATION, null + ); + + var action = AppMapBundle.get("notification.naviePinnedFileTooLarge.showSettings"); + notification.addAction(new NotificationAction(action) { + @Override + public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification notification) { + notification.expire(); + ShowSettingsUtil.getInstance().showSettingsDialog(project, AppMapProjectConfigurable.class); + } + }); + notification.notify(project); + }); + } } diff --git a/plugin-core/src/main/java/appland/settings/AppMapApplicationSettings.java b/plugin-core/src/main/java/appland/settings/AppMapApplicationSettings.java index 2880abfd..bcfa76d1 100644 --- a/plugin-core/src/main/java/appland/settings/AppMapApplicationSettings.java +++ b/plugin-core/src/main/java/appland/settings/AppMapApplicationSettings.java @@ -24,6 +24,7 @@ public class AppMapApplicationSettings { private volatile boolean enableTelemetry = true; private volatile boolean enableScanner = false; private volatile @Nullable String apiKey = null; + private volatile boolean useAnimation = true; /** * {@code true} if page "Install AppMap Agent" of the installation guide webview was at least shown once. */ @@ -48,6 +49,11 @@ public class AppMapApplicationSettings { private volatile HashMap cliEnvironment = new HashMap<>(); private volatile boolean cliPassParentEnv = true; + /** + * Maximum accepted file size in kilobytes for files pinned inside a Navie webview editor. + */ + private volatile int maxPinnedFileSizeKB = 20; + public AppMapApplicationSettings() { } @@ -60,6 +66,8 @@ public AppMapApplicationSettings(@NotNull AppMapApplicationSettings settings) { this.showFirstAppMapNotification = settings.showFirstAppMapNotification; this.cliEnvironment.putAll(settings.cliEnvironment); this.cliPassParentEnv = settings.cliPassParentEnv; + this.maxPinnedFileSizeKB = settings.maxPinnedFileSizeKB; + this.useAnimation = settings.useAnimation; } public @NotNull Map getCliEnvironment() { diff --git a/plugin-core/src/main/java/appland/toolwindow/appmap/DeleteAllMapsAction.java b/plugin-core/src/main/java/appland/toolwindow/appmap/DeleteAllMapsAction.java index 423c05ae..e5ab0893 100644 --- a/plugin-core/src/main/java/appland/toolwindow/appmap/DeleteAllMapsAction.java +++ b/plugin-core/src/main/java/appland/toolwindow/appmap/DeleteAllMapsAction.java @@ -41,7 +41,7 @@ public void actionPerformed(@NotNull AnActionEvent e) { if (CommonDataKeys.VIRTUAL_FILE_ARRAY.is(dataId)) { return parentContext.getData(AppMapWindowPanel.KEY_ALL_APPMAPS); } - return parentContext.getData(dataId); + return null; }); } } diff --git a/plugin-core/src/main/java/appland/utils/DataContexts.java b/plugin-core/src/main/java/appland/utils/DataContexts.java index cef84166..f7109d2e 100644 --- a/plugin-core/src/main/java/appland/utils/DataContexts.java +++ b/plugin-core/src/main/java/appland/utils/DataContexts.java @@ -9,7 +9,7 @@ /** * Provides factory methods to create customized {@link DataContext} implementations, which are compatible with all our supported IDEs. *

- * 2024.2 is rejecting custom implementations and is only accepting DataContext implementations provides by the SDK itself. + * 2024.2 is rejecting custom implementations and is only accepting DataContext implementations provided by the SDK itself. */ @SuppressWarnings("removal") public final class DataContexts { diff --git a/plugin-core/src/main/java/appland/webviews/WebviewEditorProvider.java b/plugin-core/src/main/java/appland/webviews/WebviewEditorProvider.java index fd82b9b5..53bbcad9 100644 --- a/plugin-core/src/main/java/appland/webviews/WebviewEditorProvider.java +++ b/plugin-core/src/main/java/appland/webviews/WebviewEditorProvider.java @@ -1,6 +1,7 @@ package appland.webviews; import com.google.common.base.Predicates; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.fileEditor.FileEditor; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.fileEditor.FileEditorPolicy; @@ -106,6 +107,10 @@ public boolean isWebViewFile(@NotNull VirtualFile file) { public LightVirtualFile createVirtualFile(@NotNull String title) { var file = new LightVirtualFile(title); WEBVIEW_EDITOR_KEY.set(file, webviewTypeId); + // TestEditorManagerImpl is used in tests and only uses custom editor provider is set via KEY :( + if (ApplicationManager.getApplication().isUnitTestMode()) { + FileEditorProvider.KEY.set(file, this); + } return file; } diff --git a/plugin-core/src/main/java/appland/webviews/navie/NavieEditor.java b/plugin-core/src/main/java/appland/webviews/navie/NavieEditor.java index be7f04df..3f4f87ab 100644 --- a/plugin-core/src/main/java/appland/webviews/navie/NavieEditor.java +++ b/plugin-core/src/main/java/appland/webviews/navie/NavieEditor.java @@ -1,6 +1,7 @@ package appland.webviews.navie; import appland.AppMapBundle; +import appland.actions.ChooseAndAddNavieContextFilesAction; import appland.actions.SetNavieOpenAiKeyAction; import appland.config.AppMapConfigFileListener; import appland.files.AppMapFiles; @@ -11,7 +12,9 @@ import appland.index.IndexedFileListenerUtil; import appland.installGuide.InstallGuideEditorProvider; import appland.installGuide.InstallGuideViewPage; +import appland.notifications.AppMapNotifications; import appland.rpcService.AppLandJsonRpcService; +import appland.settings.AppMapApplicationSettings; import appland.settings.AppMapApplicationSettingsService; import appland.settings.AppMapProjectSettingsService; import appland.settings.AppMapSecureApplicationSettingsService; @@ -25,11 +28,16 @@ import appland.webviews.webserver.AppMapWebview; import com.google.gson.JsonObject; import com.google.gson.annotations.SerializedName; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataContext; +import com.intellij.openapi.actionSystem.Presentation; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.fileEditor.FileDocumentManager; +import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.Task; @@ -44,6 +52,7 @@ import com.intellij.util.Alarm; import com.intellij.util.SingleAlarm; import com.intellij.util.concurrency.AppExecutorUtil; +import com.intellij.util.concurrency.annotations.RequiresEdt; import com.intellij.util.concurrency.annotations.RequiresReadLock; import lombok.Value; import org.jetbrains.annotations.Nls; @@ -55,6 +64,7 @@ import java.time.Instant; import java.time.ZoneId; import java.time.format.DateTimeFormatter; +import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.List; @@ -75,6 +85,7 @@ public class NavieEditor extends WebviewEditor { public NavieEditor(@NotNull Project project, @NotNull VirtualFile file) { super(project, AppMapWebview.Navie, file, SharedAppMapWebViewMessages.withBaseMessages( + "choose-files-to-pin", "open-appmap", "open-install-instructions", "open-location", @@ -91,7 +102,9 @@ public NavieEditor(@NotNull Project project, @NotNull VirtualFile file) { @Override protected void setupInitMessage(@Nullable Void initData, @NotNull JsonObject payload) { - var apiKey = AppMapApplicationSettingsService.getInstance().getApiKey(); + AppMapApplicationSettings settings = AppMapApplicationSettingsService.getInstance(); + var apiKey = settings.getApiKey(); + var useAnimation = settings.isUseAnimation(); var filters = AppMapProjectSettingsService.getState(project).getAppMapFilters().values(); var codeSelection = NavieEditorProvider.KEY_CODE_SELECTION.get(file); var promptSuggestion = NavieEditorProvider.KEY_PROMPT_SUGGESTION.get(file); @@ -124,6 +137,7 @@ protected void setupInitMessage(@Nullable Void initData, @NotNull JsonObject pay if (promptSuggestion != null) { payload.add("suggestion", gson.toJsonTree(promptSuggestion)); } + payload.addProperty("useAnimation", useAnimation); } @Override @@ -148,6 +162,9 @@ protected void handleMessage(@NotNull String messageId, @Nullable JsonObject mes } switch (messageId) { + case "choose-files-to-pin": + handleChooseFilesToPin(); + break; case "open-appmap": { var path = message != null ? message.getAsJsonPrimitive("path") : null; if (path != null) { @@ -239,6 +256,12 @@ public void run(@NotNull ProgressIndicator indicator) { }.queue(); } + private void handleChooseFilesToPin() { + ApplicationManager.getApplication().invokeLater(() -> { + ChooseAndAddNavieContextFilesAction.chooseAndAddPinnedFiles(project, this); + }); + } + private void handleOpenLocation(@NotNull String pathWithLineRange, @Nullable String directory) { var colonIndex = pathWithLineRange.lastIndexOf(':'); var filePath = colonIndex > 0 ? pathWithLineRange.substring(0, colonIndex) : pathWithLineRange; @@ -382,6 +405,52 @@ private void handleSelectLlmOption(@NotNull String choice) { return new UpdatableNavieData(isAppMapYamlPresent, mostRecentAppMaps); } + /** + * Adds the given files as pinned files to the Navie webview. + *

+ * If a file is larger than the configured max file size, then it's excluded and a notification is shown to the user. + * + * @param contextFiles Files to pin in the webview + */ + @RequiresEdt + public void addPinnedFiles(@NotNull List contextFiles) { + if (contextFiles.isEmpty()) { + return; + } + + var maxPinnedFileSizeKB = AppMapApplicationSettingsService.getInstance().getMaxPinnedFileSizeKB(); + + var validFileRequests = ReadAction.compute(() -> { + var validRequests = new ArrayList(); + for (var file : contextFiles) { + var isValid = file.isValid() + && file.isInLocalFileSystem() + && !file.isDirectory() + && file.getLength() <= 1024L * maxPinnedFileSizeKB; + + if (isValid) { + var document = FileDocumentManager.getInstance().getDocument(file); + if (document != null) { + var url = file.getUrl(); + validRequests.add(new NaviePinFileRequest(file.getPresentableName(), url, document.getText())); + } + } + } + return validRequests; + }); + + if (!validFileRequests.isEmpty()) { + var pinFiles = createMessageObject("pin-files"); + pinFiles.add("requests", gson.toJsonTree(validFileRequests)); + postMessage(pinFiles); + } + + var tooLargeFilesCount = contextFiles.size() - validFileRequests.size(); + if (tooLargeFilesCount > 0) { + AppMapNotifications.showNaviePinnedFileTooLargeNotification(project, tooLargeFilesCount, maxPinnedFileSizeKB); + } + } + /** * JSON used by the Navie webview to take the most recent AppMaps. */ diff --git a/plugin-core/src/main/java/appland/webviews/navie/NaviePinFileRequest.java b/plugin-core/src/main/java/appland/webviews/navie/NaviePinFileRequest.java new file mode 100644 index 00000000..7721dc33 --- /dev/null +++ b/plugin-core/src/main/java/appland/webviews/navie/NaviePinFileRequest.java @@ -0,0 +1,15 @@ +package appland.webviews.navie; + +import com.google.gson.annotations.SerializedName; +import org.jetbrains.annotations.NotNull; + +/** + * @param name The name of the file being pinned + * @param uri URI of the file to add + * @param content The content for the file + */ +public record NaviePinFileRequest(@SerializedName("name") @NotNull String name, + @SerializedName("uri") @NotNull String uri, + @SerializedName("content") @NotNull String content) { + +} diff --git a/plugin-core/src/main/kotlin/appland/settings/AppMapProjectSettingsPanel.kt b/plugin-core/src/main/kotlin/appland/settings/AppMapProjectSettingsPanel.kt index 10ab18b2..2e699cdd 100644 --- a/plugin-core/src/main/kotlin/appland/settings/AppMapProjectSettingsPanel.kt +++ b/plugin-core/src/main/kotlin/appland/settings/AppMapProjectSettingsPanel.kt @@ -3,8 +3,10 @@ package appland.settings import appland.AppMapBundle import com.intellij.execution.configuration.EnvironmentVariablesComponent import com.intellij.openapi.util.text.Strings +import com.intellij.ui.JBIntSpinner import com.intellij.ui.components.JBTextField import com.intellij.ui.dsl.builder.AlignX +import com.intellij.ui.dsl.builder.RightGap import com.intellij.ui.dsl.builder.RowLayout import com.intellij.ui.dsl.builder.panel import java.awt.BorderLayout @@ -15,7 +17,9 @@ class AppMapProjectSettingsPanel { private lateinit var enableTelemetry: JCheckBox private lateinit var enableScanner: JCheckBox private lateinit var cliEnvironment: EnvironmentVariablesComponent + private lateinit var maxPinnedFileSizeKB: JBIntSpinner private lateinit var openAIKey: JBTextField + private lateinit var useAnimation: JCheckBox fun loadSettingsFrom( applicationSettings: AppMapApplicationSettings, @@ -25,8 +29,11 @@ class AppMapProjectSettingsPanel { enableScanner.isSelected = applicationSettings.isEnableScanner cliEnvironment.envs = applicationSettings.cliEnvironment cliEnvironment.isPassParentEnvs = applicationSettings.isCliPassParentEnv + maxPinnedFileSizeKB.number = applicationSettings.maxPinnedFileSizeKB openAIKey.text = Strings.notNullize(secureApplicationSettings.openAIKey) + useAnimation.isSelected = applicationSettings.isUseAnimation + } fun applySettingsTo( @@ -46,8 +53,10 @@ class AppMapProjectSettingsPanel { } else { applicationSettings.cliEnvironment = cliEnvironment.envs } + applicationSettings.maxPinnedFileSizeKB = maxPinnedFileSizeKB.number secureApplicationSettings.openAIKey = Strings.nullize(openAIKey.text) + applicationSettings.isUseAnimation = useAnimation.isSelected } fun getMainPanel(): JPanel { @@ -58,6 +67,14 @@ class AppMapProjectSettingsPanel { row { enableTelemetry = checkBox(AppMapBundle.get("projectSettings.enableTelemetry.title")).component } + row(AppMapBundle.get("projectSettings.maxPinnedFileSize.label")) { + maxPinnedFileSizeKB = spinner(0..4096).gap(RightGap.SMALL).component + label(AppMapBundle.get("projectSettings.maxPinnedFileSize.unit")) + rowComment(AppMapBundle.get("projectSettings.maxPinnedFileSize.comment")) + } + row { + useAnimation = checkBox(AppMapBundle.get("projectSettings.useAnimation.title")).component + } group(AppMapBundle.get("projectSettings.appMapServices")) { row { enableScanner = checkBox(AppMapBundle.get("projectSettings.enableScanner.title")).component diff --git a/plugin-core/src/main/resources/META-INF/appmap-core.xml b/plugin-core/src/main/resources/META-INF/appmap-core.xml index e1de8246..7ec6cc6e 100644 --- a/plugin-core/src/main/resources/META-INF/appmap-core.xml +++ b/plugin-core/src/main/resources/META-INF/appmap-core.xml @@ -165,15 +165,25 @@ icon="AllIcons.General.ContextHelp" class="appland.actions.OpenInstallGuideAction"/> + + + + + + + + + - + diff --git a/plugin-core/src/main/resources/messages/appland.properties b/plugin-core/src/main/resources/messages/appland.properties index 8f4123df..858807f3 100644 --- a/plugin-core/src/main/resources/messages/appland.properties +++ b/plugin-core/src/main/resources/messages/appland.properties @@ -59,6 +59,11 @@ action.appmap.generateOpenAPI.noRootMessage.text=No directory containing AppMaps action.appmap.generateOpenAPI.task.title=Generating OpenAPI File... action.appmap.generateOpenAPI.rootChooser.title=Choose AppMap Directory +action.appmap.navie.pinContextFile.text=AppMap: Add Files to Navie Context + +action.appmap.navie.chooseAndPinContextFile.text=AppMap: Add Files to Navie Context +action.appmap.navie.chooseAndPinContextFile.MainMenu.text=Add Files to Navie Context + group.appmapToolsMenu.text=AppMap group.appmapToolsMenu.title=AppMap Tools @@ -144,6 +149,10 @@ notification.appMapSignIn.content=Logged into AppMap notification.navieUnavailable.content=AppMap Explain is not ready yet. Please try again in a few seconds. +notification.naviePinnedFileTooLarge.title=AppMap +notification.naviePinnedFileTooLarge.content={0,choice,1#One pinned file exceeds|1<{0,number,integer} pinned files exceed} the maximum file size of {1,number,integer} KB. +notification.naviePinnedFileTooLarge.showSettings=Show settings + notification.brokenProxySupport.title=AppMap notification.brokenProxySupport.content=The version of your IDE has a bug which breaks proxy support in webflows.
AppMap uses webviews for most of its features including signup and Navie.
Please downgrade to 2023.3 or upgrade to the next updates of 2024.1 to use AppMaps features with proxy support when JetBrains resolves this issue. notification.brokenProxySupport.showLinkAction=Open AppMap status @@ -176,6 +185,10 @@ projectSettings.enableTelemetry.title=Enable telemetry projectSettings.enableScanner.title=Enable AppMap scanner projectSettings.appMapServices=AppMap Services projectSettings.openAIKey.title=OpenAI key: +projectSettings.maxPinnedFileSize.label=Max Pinned File Size: +projectSettings.maxPinnedFileSize.comment=Maximum size of a file (in KB) that can be pinned to the Navie context. +projectSettings.maxPinnedFileSize.unit=KB +projectSettings.useAnimation.title=Use animation installGuide.editor.title=Using AppMap installGuide.pageInstallAgent.title=Add AppMap to your project diff --git a/plugin-core/src/test/java/appland/AppMapBaseTest.java b/plugin-core/src/test/java/appland/AppMapBaseTest.java index 42f5f4d7..3bd3a70a 100644 --- a/plugin-core/src/test/java/appland/AppMapBaseTest.java +++ b/plugin-core/src/test/java/appland/AppMapBaseTest.java @@ -5,6 +5,8 @@ import appland.config.AppMapConfigFile; import appland.files.AppMapFiles; import appland.problemsView.TestFindingsManager; +import appland.rpcService.AppLandJsonRpcListener; +import appland.rpcService.AppLandJsonRpcListenerAdapter; import appland.rpcService.AppLandJsonRpcService; import appland.settings.AppMapApplicationSettings; import appland.settings.AppMapApplicationSettingsService; @@ -33,6 +35,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; public abstract class AppMapBaseTest extends LightPlatformCodeInsightFixture4TestCase { @@ -186,6 +189,72 @@ protected void waitUntilIndexesAreReady() { IndexTestUtils.waitUntilIndexesAreReady(getProject()); } + protected void waitForJsonRpcServer() { + var service = AppLandJsonRpcService.getInstance(getProject()); + if (service.isServerRunning()) { + return; + } + + var latch = createWaitForJsonRpcServerRestartCondition(true); + ApplicationManager.getApplication().executeOnPooledThread(service::startServer); + try { + assertTrue("The AppMap JSON-RPC server must launch", latch.await(30, TimeUnit.SECONDS)); + } catch (InterruptedException e) { + addSuppressedException(e); + } + } + + protected void waitForJsonRpcServerPort() { + var service = AppLandJsonRpcService.getInstance(getProject()); + if (service.isServerRunning()) { + return; + } + + var latch = createWaitForJsonRpcServerPortCondition(); + ApplicationManager.getApplication().executeOnPooledThread(service::startServer); + try { + assertTrue("The AppMap JSON-RPC server must launch", latch.await(30, TimeUnit.SECONDS)); + } catch (InterruptedException e) { + addSuppressedException(e); + } + } + + protected @NotNull CountDownLatch createWaitForJsonRpcServerRestartCondition(boolean allowStart) { + var latch = new CountDownLatch(1); + getProject().getMessageBus() + .connect(getTestRootDisposable()) + .subscribe(AppLandJsonRpcListener.TOPIC, new AppLandJsonRpcListenerAdapter() { + @Override + public void serverStarted() { + if (allowStart) { + latch.countDown(); + } + } + + @Override + public void serverRestarted() { + latch.countDown(); + } + }); + return latch; + } + + protected @NotNull CountDownLatch createWaitForJsonRpcServerPortCondition() { + var latch = new CountDownLatch(1); + getProject().getMessageBus() + .connect(getTestRootDisposable()) + .subscribe(AppLandJsonRpcListener.TOPIC, new AppLandJsonRpcListenerAdapter() { + @Override + public void serverConfigurationUpdated(@NotNull Collection contentRoots, + @NotNull Collection appMapConfigFiles) { + if (AppLandJsonRpcService.getInstance(getProject()).getServerPort() != null) { + latch.countDown(); + } + } + }); + return latch; + } + private String createAppMapEvents(int requestCount, int queryCount) { var json = new StringBuilder(); json.append("["); diff --git a/plugin-core/src/test/java/appland/actions/AddNavieContextFilesActionTest.java b/plugin-core/src/test/java/appland/actions/AddNavieContextFilesActionTest.java new file mode 100644 index 00000000..e8852298 --- /dev/null +++ b/plugin-core/src/test/java/appland/actions/AddNavieContextFilesActionTest.java @@ -0,0 +1,119 @@ +package appland.actions; + +import appland.AppMapBaseTest; +import appland.cli.TestAppLandDownloadService; +import appland.utils.DataContexts; +import appland.webviews.navie.NavieEditor; +import appland.webviews.navie.NavieEditorProvider; +import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.actionSystem.ex.ActionUtil; +import com.intellij.openapi.fileEditor.FileEditorManager; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.testFramework.EdtTestUtil; +import com.intellij.testFramework.TestActionEvent; +import com.intellij.testFramework.fixtures.TempDirTestFixture; +import com.intellij.testFramework.fixtures.impl.TempDirTestFixtureImpl; +import com.intellij.ui.jcef.JBCefApp; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Test; + +import java.nio.file.Path; +import java.util.concurrent.TimeUnit; + +public class AddNavieContextFilesActionTest extends AppMapBaseTest { + @Override + protected TempDirTestFixture createTempDirTestFixture() { + return new TempDirTestFixtureImpl(); + } + + @Before + public void ensureToolsDownloaded() { + TestAppLandDownloadService.ensureDownloaded(); + + // Unfortunately, JCEF is unsupported on headless systems, which includes CI. + Assume.assumeTrue("JCEF must be supported to run tests of this class", JBCefApp.isSupported()); + } + + @Test + public void enabledForNavieEditorAndContextFile() throws Exception { + // must be created first because the Navie editor must be the selected editor + var contextFile = myFixture.configureByText("test.txt", ""); + + var tempDir = myFixture.createFile("test.txt", "").getParent(); + withContentRoot(tempDir, () -> { + openNavieEditor(tempDir); + + var presentation = updateAction(createActionContext(contextFile.getVirtualFile())); + Assert.assertTrue("Action must be enabled for a file", presentation.isEnabledAndVisible()); + }); + } + + @Test + public void disabledWithoutNavieEditor() throws Exception { + var contextFile = myFixture.configureByText("test.txt", ""); + + var tempDir = myFixture.createFile("test.txt", "").getParent(); + withContentRoot(tempDir, () -> { + var presentation = updateAction(createActionContext(contextFile.getVirtualFile())); + Assert.assertFalse("Action must be unavailable without selected Navie editor", presentation.isEnabledAndVisible()); + }); + } + + @Test + public void disabledWithoutContextFile() throws Exception { + var contextDir = myFixture.configureByText("test.txt", "").getVirtualFile().getParent(); + + var tempDir = myFixture.createFile("test.txt", "").getParent(); + withContentRoot(tempDir, () -> { + openNavieEditor(tempDir); + + var presentation = updateAction(createActionContext(contextDir)); + Assert.assertFalse("Action must be unavailable for a selected directory", presentation.isEnabledAndVisible()); + }); + } + + private void openNavieEditor(@NotNull VirtualFile tempDir) throws Exception { + createAppMapConfig(tempDir, Path.of("tmp", "appmap")); + waitForJsonRpcServerPort(); + + edt(() -> NavieEditorProvider.openEditor(getProject(), DataContext.EMPTY_CONTEXT)); + + // wait until the Navie editor is the selected editor + var deadline = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(30); + while (System.currentTimeMillis() <= deadline) { + var editor = EdtTestUtil.runInEdtAndGet(() -> FileEditorManager.getInstance(getProject()).getSelectedEditor()); + if (editor instanceof NavieEditor) { + break; + } + Thread.sleep(500); + } + + var editor = EdtTestUtil.runInEdtAndGet(() -> FileEditorManager.getInstance(getProject()).getSelectedEditor()); + assertTrue("Navie editor must be open", editor instanceof NavieEditor); + } + + private @NotNull DataContext createActionContext(@Nullable VirtualFile contextFile) { + return DataContexts.createCustomContext(dataId -> { + if (contextFile != null && PlatformDataKeys.VIRTUAL_FILE_ARRAY.is(dataId)) { + return new VirtualFile[]{contextFile}; + } + if (PlatformDataKeys.PROJECT.is(dataId)) { + return myFixture.getProject(); + } + return null; + }); + } + + private static @NotNull Presentation updateAction(@NotNull DataContext context) { + var action = ActionManager.getInstance().getAction("appmap.navie.pinContextFile"); + assertNotNull(action); + + var e = TestActionEvent.createFromAnAction(action, null, ActionPlaces.MAIN_MENU, context); + ActionUtil.performDumbAwareUpdate(action, e, false); + return e.getPresentation(); + } +} \ No newline at end of file diff --git a/plugin-core/src/test/java/appland/rpcService/DefaultAppLandJsonRpcServiceTest.java b/plugin-core/src/test/java/appland/rpcService/DefaultAppLandJsonRpcServiceTest.java index fc6e826e..4411d6f6 100644 --- a/plugin-core/src/test/java/appland/rpcService/DefaultAppLandJsonRpcServiceTest.java +++ b/plugin-core/src/test/java/appland/rpcService/DefaultAppLandJsonRpcServiceTest.java @@ -2,12 +2,13 @@ import appland.AppMapBaseTest; import appland.cli.AppLandCommandLineService; +import appland.cli.TestAppLandDownloadService; import appland.settings.AppMapApplicationSettingsService; import com.intellij.openapi.application.ApplicationInfo; -import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; import org.junit.Assume; +import org.junit.Before; import org.junit.Test; import java.util.Collection; @@ -27,6 +28,11 @@ protected boolean runInDispatchThread() { return false; } + @Before + public void ensureToolsDownloaded() { + TestAppLandDownloadService.ensureDownloaded(); + } + @Test public void launchedWithProject() { waitForJsonRpcServer(); @@ -65,7 +71,7 @@ public void serverConfigurationUpdated(@NotNull Collection contentR public void serverRestartAfterTermination() throws Exception { waitForJsonRpcServer(); - var latch = createWaitForRestartCondition(false); + var latch = createWaitForJsonRpcServerRestartCondition(false); // kill and wait for restart TestAppLandJsonRpcService.killJsonRpcProcess(getProject()); @@ -97,7 +103,7 @@ public void restartAfterApiKeyChange() throws Exception { var appMapSettings = AppMapApplicationSettingsService.getInstance(); appMapSettings.setApiKey("dummy"); try { - var latch = createWaitForRestartCondition(false); + var latch = createWaitForJsonRpcServerRestartCondition(false); // change API key and wait for restart appMapSettings.setApiKeyNotifying("new-api-key"); @@ -116,42 +122,8 @@ public void codeEditorInfo() { // For example: // IntelliJ IDEA 2023.2 by JetBrains s.r.o. - var matches = editorInfo.matches("IntelliJ IDEA [0-9.]+( EAP | Beta)? by JetBrains s\\.r\\.o\\."); + // IntelliJ IDEA 2024.3 EAP by JetBrains s.r.o. + var matches = editorInfo.matches("IntelliJ IDEA [0-9.]+( EAP| Beta)? by JetBrains s\\.r\\.o\\."); assertTrue("Code editor info must match: " + editorInfo, matches); } - - private void waitForJsonRpcServer() { - var service = AppLandJsonRpcService.getInstance(getProject()); - if (service.isServerRunning()) { - return; - } - - var latch = createWaitForRestartCondition(true); - ApplicationManager.getApplication().executeOnPooledThread(service::startServer); - try { - assertTrue("The AppMap JSON-RPC server must launch", latch.await(30, TimeUnit.SECONDS)); - } catch (InterruptedException e) { - addSuppressedException(e); - } - } - - private @NotNull CountDownLatch createWaitForRestartCondition(boolean allowStart) { - var latch = new CountDownLatch(1); - getProject().getMessageBus() - .connect(getTestRootDisposable()) - .subscribe(AppLandJsonRpcListener.TOPIC, new AppLandJsonRpcListenerAdapter() { - @Override - public void serverStarted() { - if (allowStart) { - latch.countDown(); - } - } - - @Override - public void serverRestarted() { - latch.countDown(); - } - }); - return latch; - } } \ No newline at end of file diff --git a/plugin-core/src/test/java/appland/settings/AppMapApplicationSettingsTest.java b/plugin-core/src/test/java/appland/settings/AppMapApplicationSettingsTest.java index e79e20e1..daa7b874 100644 --- a/plugin-core/src/test/java/appland/settings/AppMapApplicationSettingsTest.java +++ b/plugin-core/src/test/java/appland/settings/AppMapApplicationSettingsTest.java @@ -3,6 +3,7 @@ import appland.AppMapBaseTest; import com.intellij.configurationStore.XmlSerializer; import com.intellij.openapi.util.JDOMUtil; +import org.jetbrains.annotations.NotNull; import org.junit.Assert; import org.junit.Test; @@ -11,12 +12,7 @@ public class AppMapApplicationSettingsTest extends AppMapBaseTest { @Test public void xmlSerialization() { - var settings = new AppMapApplicationSettings(); - settings.setCliEnvironmentNotifying(Map.of("name1", "value1", "name2", "value2")); - settings.setApiKey("my-appmap-api-key"); - settings.setInstallInstructionsViewed(true); - settings.setFirstStart(true); - settings.setCliPassParentEnv(true); + var settings = createSettings(); var serialized = XmlSerializer.serialize(settings); Assert.assertNotNull(serialized); @@ -24,16 +20,37 @@ public void xmlSerialization() { var deserialized = XmlSerializer.deserialize(serialized, AppMapApplicationSettings.class); Assert.assertEquals(settings, deserialized); - var expectedXML = "\n" + - " \n" + - " "; + var expectedXML = """ + + + """; Assert.assertEquals(expectedXML, JDOMUtil.write(serialized)); } + + @Test + public void copy() { + var settings = createSettings(); + var copiedSettings = new AppMapApplicationSettings(settings); + Assert.assertEquals("Copy constructor must copy all settings", settings, copiedSettings); + } + + @NotNull + private static AppMapApplicationSettings createSettings() { + var settings = new AppMapApplicationSettings(); + settings.setCliEnvironmentNotifying(Map.of("name1", "value1", "name2", "value2")); + settings.setApiKey("my-appmap-api-key"); + settings.setInstallInstructionsViewed(true); + settings.setFirstStart(true); + settings.setCliPassParentEnv(true); + settings.setMaxPinnedFileSizeKB(40); + return settings; + } } \ No newline at end of file diff --git a/plugin-core/src/test/java/appland/webviews/navie/NaviePinFileRequestTest.java b/plugin-core/src/test/java/appland/webviews/navie/NaviePinFileRequestTest.java new file mode 100644 index 00000000..b8b362a4 --- /dev/null +++ b/plugin-core/src/test/java/appland/webviews/navie/NaviePinFileRequestTest.java @@ -0,0 +1,15 @@ +package appland.webviews.navie; + +import appland.AppMapBaseTest; +import appland.utils.GsonUtils; +import org.junit.Test; + +public class NaviePinFileRequestTest extends AppMapBaseTest { + @Test + public void jsonSerialization() { + // language=JSON + var expected = "{\"name\":\"request-name\",\"uri\":\"file:///dir/subdir/file.txt\",\"content\":\"my content\"}"; + var request = new NaviePinFileRequest("request-name", "file:///dir/subdir/file.txt", "my content"); + assertEquals(expected, GsonUtils.GSON.toJson(request)); + } +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index d24b8d59..5c594eb0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -10,4 +10,7 @@ rootProject.name = "intellij-appmap" include("plugin-core") include("plugin-gradle") include("plugin-java") -include("plugin-maven") \ No newline at end of file +include("plugin-maven") + +// module to tests without additional test dependencies +include("tests-integration") \ No newline at end of file diff --git a/plugin-core/src/test/java/appland/webviews/webserver/AppMapWebviewTest.java b/tests-integration/src/test/java/appland/webviews/webserver/AppMapWebviewTest.java similarity index 100% rename from plugin-core/src/test/java/appland/webviews/webserver/AppMapWebviewTest.java rename to tests-integration/src/test/java/appland/webviews/webserver/AppMapWebviewTest.java