diff --git a/.github/workflows/binance-orderbook-ui.yml b/.github/workflows/binance-orderbook-ui.yml index 593d1a0..ce4410d 100644 --- a/.github/workflows/binance-orderbook-ui.yml +++ b/.github/workflows/binance-orderbook-ui.yml @@ -54,7 +54,8 @@ permissions: jobs: ui: runs-on: ubuntu-latest - timeout-minutes: 10 + # Include setup and report upload around the complete browser suite. + timeout-minutes: 15 steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 diff --git a/docs/binance-order-notifications.md b/docs/binance-order-notifications.md index d7a5d6f..709fe1b 100644 --- a/docs/binance-order-notifications.md +++ b/docs/binance-order-notifications.md @@ -19,8 +19,8 @@ The public factories captured on 2026-10-07 show two independent paths: cancellation, partial-fill and fill events into toasts through a 30 ms debounce, without checking the page symbol. -`order-notifications/native-modules.js` pins complete source for `39116`, `55401` -and all six observed `30877` variants. Changes are limited to those notification +`order-notifications/native-modules.js` contains three verified structural +templates for `39116`, `55401` and `30877`. Changes are limited to those notification consumers. Ordinary events are checked before debounce and immediately before presentation. Queued tokens contain only a symbol, or null for native handling; order IDs, client order IDs, prices and quantities are not retained in tokens. @@ -28,6 +28,35 @@ Both audio calls check the same selected token. The sound queue is pruned only when native playback can start, never while its current cooldown still owns the queue head. +The `39116` factories in `3314.51597d7f.js` and `3314.86064918.js` have the +same syntax tree apart from consistently renamed local identifiers. Both were +observed in concurrently open tabs on 2026-10-07: the latter left OUSDT and +encoded 龙虾USDT on native sound while USUSDT used the earlier matched source. +AINUSDT also had active sound filtering, confirming that the failure followed +the loaded source rather than the asset name. Runtime matching now uses lexical +binding equivalence rather than source text or a Binance bundle version. +Fixtures identify these variants by source SHA-256 because their module and +chunk IDs are identical. The manifest also associates replacements by source +hash, and browser fixtures require exactly one selected source per module ID. + +Acorn parses each targeted factory and eslint-scope resolves its declarations +and references. The structural signature normalizes those local binding names +and removes source positions and ordinary literal formatting. It preserves +global names, object and member keys, import IDs, constants, operators, regular +expressions, template raw values, strict directives and binding relationships. +Shadowing a global or changing an event field therefore changes the signature. +The pure numeric boolean spellings `!0`/`!1` normalize to `true`/`false` because +repackers expand them while formatting. Other truthiness expressions, calls and +side effects remain structurally exact. +An equivalent factory selects a precompiled replacement; host source is never +executed or dynamically compiled by the matcher. The nine captured notification +sources reduce to three structures, including both sound producer variants. + +Parsing happens only when a targeted module is captured, not on each order. +Invalid syntax, dynamic scope and sources over 64 KiB are rejected by the +existing capture-failure boundary. This accepts formatting and local renaming; +it does not attempt arbitrary program equivalence or guess changed module IDs. + The page symbol is read on each check, including after a debounce or pending audio Promise. Each matching tab may notify, even if two tabs show the same symbol. A symbol with no matching tab produces no ordinary notification in the @@ -57,13 +86,14 @@ and failure outcomes; stopping mirror writes does not stop notification scope. No second queue accessor, global Audio override, WebSocket replacement, new account subscription or DOM notification removal is installed by this feature. -Both sound factories must execute their pinned replacements before either -changes the native string queue to classified tokens. If either source mismatches, +Both sound factories must execute their verified replacements before either +changes the native string queue to classified tokens. If either structure mismatches, both sides retain the original string contract. Pending native strings are also preserved during activation. Toast capture is independent. Late injection, -unknown source or the original 30-second capture deadline leaves the affected +unknown behavior or the original 30-second capture deadline leaves the affected path native and reports its reason; native reminders may therefore still repeat -after an upstream change. +after a substantive upstream change. Local variable renaming alone does not +require a new userscript release. `self.__BINANCE_ORDER_NOTIFICATIONS__.snapshot()` exposes only capture status and aggregate scope-check counts. `suppressedChecks` is a check count, not a unique @@ -91,5 +121,7 @@ fill on a BTC page produced the native toast and load/play/play calls. Isolated tests run the captured adapters, event cache, listeners, React 18.2 hooks and native debounce with controlled clocks. Only preferences, account stream and presentation I/O are replaced. Real orders are never required to validate this -feature. Installed-source and live notification behavior remain separate from -these deterministic checks. +feature. An independent esbuild repack also renames and reformats all eight +browser-host modules before exercising foreign-symbol silence and matching +sound through the actual generated userscript. Installed-source and live +notification behavior remain separate from these deterministic checks. diff --git a/docs/binance-orderbook-trade-development.md b/docs/binance-orderbook-trade-development.md index 94cbb5f..01dcccd 100644 --- a/docs/binance-orderbook-trade-development.md +++ b/docs/binance-orderbook-trade-development.md @@ -24,7 +24,7 @@ scripts/binance-orderbook-trade.user.js `order-notifications/` scopes native ordinary order toasts and sound to the current futures symbol. The storage installer shares its single early queue -observer with these independently pinned targets; no separate userscript is +observer with these independently verified structural targets; no separate userscript is installed. Risk and unknown events retain native handling. The native account data flow and trading feedback readers remain unchanged. See [notification scope](binance-order-notifications.md) for source pins, delayed diff --git a/docs/licenses/binance-notification-parser.txt b/docs/licenses/binance-notification-parser.txt new file mode 100644 index 0000000..3eab7ee --- /dev/null +++ b/docs/licenses/binance-notification-parser.txt @@ -0,0 +1,93 @@ +Acorn +MIT License + +Copyright (C) 2012-2022 by various contributors (see AUTHORS) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +eslint-scope +Copyright JS Foundation and other contributors, https://js.foundation +Copyright (C) 2012-2013 Yusuke Suzuki (twitter: @Constellation) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +estraverse +Copyright (C) 2012-2013 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +esrecurse +Copyright (C) 2014 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/e2e/binance-orderbook/helpers/order-notifications-host.js b/e2e/binance-orderbook/helpers/order-notifications-host.js index 885ee1d..d8de3e4 100644 --- a/e2e/binance-orderbook/helpers/order-notifications-host.js +++ b/e2e/binance-orderbook/helpers/order-notifications-host.js @@ -1,5 +1,7 @@ import { readFile } from 'node:fs/promises'; -import { build } from 'esbuild'; +import assert from 'node:assert/strict'; +import { parse } from 'acorn'; +import { build, transform } from 'esbuild'; import { nativeOrderNotificationSources } from '../../../test/fixtures/binance-order-notifications/original-factories.js'; import { openUserscriptScenario } from './userscript-page.js'; @@ -7,7 +9,7 @@ import { createCancelScenario } from '../scenarios/cancel-current-symbol.js'; let dependenciesSource; -/** Bundle only library dependencies; captured native factories retain their exact source. */ +/** Bundle React dependencies separately from the native factories under test. */ async function readReactDependencies() { if (!dependenciesSource) { const result = await build({ @@ -166,7 +168,10 @@ function installNotificationHost(nativeFactories) { } /** Install the built artifact at document-start, then enter through the real Rspack queue. */ -export async function openNotificationScenario(page, symbol) { +export async function openNotificationScenario(page, symbol, { + soundSourceSha256 = '5362a54e61f022714e673e166b62e3c22997084ca7a9f4e676475ec91cfcfaa8', + repackNativeFactories = false, +} = {}) { await page.route('**/*', (route) => route.abort('blockedbyclient')); const [artifact, runtime, react] = await Promise.all([ readFile(new URL('../../../scripts/binance-orderbook-trade.user.js', import.meta.url), 'utf8'), @@ -175,10 +180,40 @@ export async function openNotificationScenario(page, symbol) { ]); await page.addInitScript({ content: `self.__NOTIFICATION_EARLY_ROOT__=Boolean(document.documentElement);\n${artifact}` }); const ids = new Set(['30877', '39116', '55401', '40477', '70020', '22584', '34122', '4189']); - const factories = nativeOrderNotificationSources.filter((entry) => ids.has(entry.id) - && (entry.id !== '30877' || entry.chunks.includes('37511'))).map((entry) => entry.source).join(',\n'); + const selectedSources = nativeOrderNotificationSources.filter((entry) => ids.has(entry.id) + && (entry.id !== '30877' || entry.chunks.includes('37511')) + && (entry.id !== '39116' || entry.sha256 === soundSourceSha256)); + const factories = Array.from(ids, (id) => { + const matches = selectedSources.filter((entry) => entry.id === id); + assert.equal(matches.length, 1, `Notification host requires exactly one native factory for ${id}`); + return matches[0].source; + }).join(',\n'); + let factoryObject = `{${factories}}`; + if (repackNativeFactories) { + // An independent compiler supplies unseen bindings without using the production matcher. + const capturedFactories = parse(`(${factoryObject});`, { ecmaVersion: 'latest' }).body[0].expression; + const { code } = await transform(`(${factoryObject});`, { + minifyIdentifiers: true, + minifySyntax: false, + minifyWhitespace: false, + }); + const program = parse(code, { ecmaVersion: 'latest' }); + assert.equal(program.body.length, 1, 'Repacked factories must remain one expression'); + const expression = program.body[0].expression; + assert.equal(expression.type, 'ObjectExpression', 'Repacked factories must remain an object'); + assert.deepEqual(expression.properties.map((property) => String(property.key.value)), [...ids]); + for (const [index, property] of expression.properties.entries()) { + const captured = selectedSources.find((entry) => entry.id === String(property.key.value)); + assert.notEqual(code.slice(property.start, property.end), captured.source, + `Repacking must change the captured source for ${captured.id}`); + assert.notDeepEqual(property.value.params.map((parameter) => parameter.name), + capturedFactories.properties[index].value.params.map((parameter) => parameter.name), + `Repacking must rename factory parameters for ${captured.id}`); + } + factoryObject = code.slice(expression.start, expression.end); + } const host = await openUserscriptScenario(page, createCancelScenario({ currentSymbol: symbol }), { - beforeOrderbook: `${react}\n${runtime}\n(${installNotificationHost.toString()})({${factories}});\nif(false){`, + beforeOrderbook: `${react}\n${runtime}\n(${installNotificationHost.toString()})(${factoryObject});\nif(false){`, afterOrderbook: '}', }); await page.waitForFunction(() => self.__NOTIFICATION_HOST__?.ready() === true); diff --git a/e2e/binance-orderbook/specs/order-notifications.pw.js b/e2e/binance-orderbook/specs/order-notifications.pw.js index 885bc79..a2cadcc 100644 --- a/e2e/binance-orderbook/specs/order-notifications.pw.js +++ b/e2e/binance-orderbook/specs/order-notifications.pw.js @@ -3,6 +3,106 @@ import { openNotificationScenario, readNotificationEffects } from '../helpers/or import { readFixtureState } from '../helpers/userscript-page.js'; const panel = '#jh-binance-close-qty-multiplier-panel'; +const currentSoundSourceSha256 = '0e53de2a0de8073e445688bdf6b858b9f0eb3c20b49ecda9f230418a7c85a2f8'; + +test('user keeps symbol-scoped reminders after native factories are independently renamed and formatted', async ({ page }, testInfo) => { + // Given OUSDT loads the built userscript with independently repacked native modules + const host = await openNotificationScenario(page, 'OUSDT', { + soundSourceSha256: currentSoundSourceSha256, + repackNativeFactories: true, + }); + + // When the native account consumers receive an unrelated USUSDT fill + await page.evaluate(() => self.__NOTIFICATION_HOST__.notify('USUSDT', 42)); + await page.clock.runFor(500); + + // Then all three renamed consumers are active and produce no foreign reminder + expect(await page.evaluate(() => self.__BINANCE_ORDER_NOTIFICATIONS__.snapshot())).toMatchObject({ + toastActive: true, + soundActive: true, + modules: { + 30877: { status: 'active' }, + 39116: { status: 'active' }, + 55401: { status: 'active' }, + }, + }); + await expect(page.getByRole('alert')).toHaveCount(0); + expect(await readNotificationEffects(page)).toEqual({ audio: [], toasts: [] }); + + // When the same renamed consumers receive an OUSDT fill on the matching route + await page.evaluate(() => self.__NOTIFICATION_HOST__.notify('OUSDT', 43)); + await page.clock.runFor(500); + + // Then the native toast and both audio calls remain available without financial actions + await expect(page.getByRole('alert')).toHaveText('LIMIT BUY Order Filled'); + expect((await readNotificationEffects(page)).audio).toEqual([ + { kind: 'load', pathname: '/zh-CN/futures/OUSDT' }, + { kind: 'play', pathname: '/zh-CN/futures/OUSDT' }, + { kind: 'play', pathname: '/zh-CN/futures/OUSDT' }, + ]); + await expect(page.locator(panel)).toBeVisible(); + expect(host.errors).toEqual([]); + expect((await readFixtureState(page)).events.filter((event) => ['order-submitted', 'cancel-requested'].includes(event.type))).toEqual([]); + await page.screenshot({ path: testInfo.outputPath('repacked-ousdt-native-reminder.png'), fullPage: true }); +}); + +for (const foreignSymbol of ['OUSDT', '龙虾USDT']) { + test(`user hears the current native sound variant only for the matching USUSDT or ${foreignSymbol} tab`, async ({ page, browser }) => { + // Given USUSDT and a different futures symbol load the current native sound source in isolated pages + const otherContext = await browser.newContext({ viewport: { width: 1440, height: 1000 } }); + const foreignPage = await otherContext.newPage(); + try { + const soundOptions = { soundSourceSha256: currentSoundSourceSha256 }; + const usHost = await openNotificationScenario(page, 'USUSDT', soundOptions); + const foreignHost = await openNotificationScenario(foreignPage, foreignSymbol, soundOptions); + expect(await foreignPage.evaluate(() => location.pathname)).toBe(`/zh-CN/futures/${encodeURIComponent(foreignSymbol)}`); + + // When both tabs receive the same USUSDT account fill through the real native consumers + await page.evaluate(() => self.__NOTIFICATION_HOST__.notify('USUSDT', 42)); + await foreignPage.evaluate(() => self.__NOTIFICATION_HOST__.notify('USUSDT', 42)); + await page.clock.runFor(500); + await foreignPage.clock.runFor(500); + + // Then only USUSDT presents its original native toast and load/play/play sound sequence + await expect(page.getByRole('alert')).toHaveText('LIMIT BUY Order Filled'); + await expect(foreignPage.getByRole('alert')).toHaveCount(0); + expect((await readNotificationEffects(page)).audio).toEqual([ + { kind: 'load', pathname: '/zh-CN/futures/USUSDT' }, + { kind: 'play', pathname: '/zh-CN/futures/USUSDT' }, + { kind: 'play', pathname: '/zh-CN/futures/USUSDT' }, + ]); + expect(await readNotificationEffects(foreignPage)).toEqual({ audio: [], toasts: [] }); + expect(await page.evaluate(() => self.__BINANCE_ORDER_NOTIFICATIONS__.snapshot())).toMatchObject({ toastActive: true, soundActive: true }); + expect(await foreignPage.evaluate(() => self.__BINANCE_ORDER_NOTIFICATIONS__.snapshot())).toMatchObject({ toastActive: true, soundActive: true }); + + // When both tabs receive a fill matching the other page after the native cooldown + await page.clock.runFor(2000); + await foreignPage.clock.runFor(2000); + await page.evaluate((symbol) => self.__NOTIFICATION_HOST__.notify(symbol, 43), foreignSymbol); + await foreignPage.evaluate((symbol) => self.__NOTIFICATION_HOST__.notify(symbol, 43), foreignSymbol); + await page.clock.runFor(500); + await foreignPage.clock.runFor(500); + + // Then that page retains its native reminder while USUSDT gains no presentation or financial actions + await expect(page.getByRole('alert')).toHaveCount(1); + await expect(foreignPage.getByRole('alert')).toHaveText('LIMIT BUY Order Filled'); + expect((await readNotificationEffects(page)).audio.map((event) => event.kind)).toEqual(['load', 'play', 'play']); + expect((await readNotificationEffects(foreignPage)).audio).toEqual([ + { kind: 'load', pathname: `/zh-CN/futures/${encodeURIComponent(foreignSymbol)}` }, + { kind: 'play', pathname: `/zh-CN/futures/${encodeURIComponent(foreignSymbol)}` }, + { kind: 'play', pathname: `/zh-CN/futures/${encodeURIComponent(foreignSymbol)}` }, + ]); + await expect(page.locator(panel)).toBeVisible(); + await expect(foreignPage.locator(panel)).toBeVisible(); + expect(usHost.errors).toEqual([]); + expect(foreignHost.errors).toEqual([]); + expect((await readFixtureState(page)).events.filter((event) => ['order-submitted', 'cancel-requested'].includes(event.type))).toEqual([]); + expect((await readFixtureState(foreignPage)).events.filter((event) => ['order-submitted', 'cancel-requested'].includes(event.type))).toEqual([]); + } finally { + await otherContext.close(); + } + }); +} test('user sees and hears each ordinary fill only in the matching isolated futures tab', async ({ page, browser }, testInfo) => { // Given two isolated Chromium pages load the real generated userscript before their native runtime diff --git a/package-lock.json b/package-lock.json index 31d5983..0243993 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "acorn": "8.18.0", "esbuild": "^0.25.0", "eslint": "10.10.0", + "eslint-scope": "9.1.2", "jsdom": "^29.1.1", "monocart-coverage-reports": "2.13.0", "react": "18.2.0", diff --git a/package.json b/package.json index 18d82c7..68f5ce6 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "acorn": "8.18.0", "esbuild": "^0.25.0", "eslint": "10.10.0", + "eslint-scope": "9.1.2", "jsdom": "^29.1.1", "monocart-coverage-reports": "2.13.0", "react": "18.2.0", diff --git a/scripts/binance-orderbook-trade.user.js b/scripts/binance-orderbook-trade.user.js index 5f7dafe..5fadf0d 100644 --- a/scripts/binance-orderbook-trade.user.js +++ b/scripts/binance-orderbook-trade.user.js @@ -3,7 +3,7 @@ // @namespace binance.orderbook.trade // @icon data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2214%22%20fill%3D%22%23f0b90b%22%2F%3E%3Ctext%20x%3D%2232%22%20y%3D%2249%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-size%3D%2242%22%20font-weight%3D%22800%22%20fill%3D%22%23111827%22%3EJ%3C%2Ftext%3E%3C%2Fsvg%3E // @icon64 data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2214%22%20fill%3D%22%23f0b90b%22%2F%3E%3Ctext%20x%3D%2232%22%20y%3D%2249%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-size%3D%2242%22%20font-weight%3D%22800%22%20fill%3D%22%23111827%22%3EJ%3C%2Ftext%3E%3C%2Fsvg%3E -// @version 2.7.221 +// @version 2.7.222 // @author jackhai9 // @description 单击订单簿价格,按当前开仓/平仓 tab 自动填数量并执行下单,内置数量倍率面板 // @match https://www.binance.com/*/futures/* @@ -16,7 +16,881 @@ // @sandbox raw // @grant none // ==/UserScript== +/* +Acorn +MIT License + +Copyright (C) 2012-2022 by various contributors (see AUTHORS) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +eslint-scope +Copyright JS Foundation and other contributors, https://js.foundation +Copyright (C) 2012-2013 Yusuke Suzuki (twitter: @Constellation) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +estraverse +Copyright (C) 2012-2013 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +esrecurse +Copyright (C) 2014 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ (() => { + var __create = Object.create; + var __defProp = Object.defineProperty; + var __getOwnPropDesc = Object.getOwnPropertyDescriptor; + var __getOwnPropNames = Object.getOwnPropertyNames; + var __getProtoOf = Object.getPrototypeOf; + var __hasOwnProp = Object.prototype.hasOwnProperty; + var __commonJS = (cb, mod) => function __require() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; + }; + var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; + }; + var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + + // node_modules/estraverse/estraverse.js + var require_estraverse = __commonJS({ + "node_modules/estraverse/estraverse.js"(exports) { + (function clone(exports2) { + "use strict"; + var Syntax4, VisitorOption, VisitorKeys, BREAK, SKIP, REMOVE; + function deepCopy(obj) { + var ret = {}, key, val; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + val = obj[key]; + if (typeof val === "object" && val !== null) { + ret[key] = deepCopy(val); + } else { + ret[key] = val; + } + } + } + return ret; + } + function upperBound(array, func) { + var diff, len, i, current2; + len = array.length; + i = 0; + while (len) { + diff = len >>> 1; + current2 = i + diff; + if (func(array[current2])) { + len = diff; + } else { + i = current2 + 1; + len -= diff + 1; + } + } + return i; + } + Syntax4 = { + AssignmentExpression: "AssignmentExpression", + AssignmentPattern: "AssignmentPattern", + ArrayExpression: "ArrayExpression", + ArrayPattern: "ArrayPattern", + ArrowFunctionExpression: "ArrowFunctionExpression", + AwaitExpression: "AwaitExpression", + // CAUTION: It's deferred to ES7. + BlockStatement: "BlockStatement", + BinaryExpression: "BinaryExpression", + BreakStatement: "BreakStatement", + CallExpression: "CallExpression", + CatchClause: "CatchClause", + ChainExpression: "ChainExpression", + ClassBody: "ClassBody", + ClassDeclaration: "ClassDeclaration", + ClassExpression: "ClassExpression", + ComprehensionBlock: "ComprehensionBlock", + // CAUTION: It's deferred to ES7. + ComprehensionExpression: "ComprehensionExpression", + // CAUTION: It's deferred to ES7. + ConditionalExpression: "ConditionalExpression", + ContinueStatement: "ContinueStatement", + DebuggerStatement: "DebuggerStatement", + DirectiveStatement: "DirectiveStatement", + DoWhileStatement: "DoWhileStatement", + EmptyStatement: "EmptyStatement", + ExportAllDeclaration: "ExportAllDeclaration", + ExportDefaultDeclaration: "ExportDefaultDeclaration", + ExportNamedDeclaration: "ExportNamedDeclaration", + ExportSpecifier: "ExportSpecifier", + ExpressionStatement: "ExpressionStatement", + ForStatement: "ForStatement", + ForInStatement: "ForInStatement", + ForOfStatement: "ForOfStatement", + FunctionDeclaration: "FunctionDeclaration", + FunctionExpression: "FunctionExpression", + GeneratorExpression: "GeneratorExpression", + // CAUTION: It's deferred to ES7. + Identifier: "Identifier", + IfStatement: "IfStatement", + ImportExpression: "ImportExpression", + ImportDeclaration: "ImportDeclaration", + ImportDefaultSpecifier: "ImportDefaultSpecifier", + ImportNamespaceSpecifier: "ImportNamespaceSpecifier", + ImportSpecifier: "ImportSpecifier", + Literal: "Literal", + LabeledStatement: "LabeledStatement", + LogicalExpression: "LogicalExpression", + MemberExpression: "MemberExpression", + MetaProperty: "MetaProperty", + MethodDefinition: "MethodDefinition", + ModuleSpecifier: "ModuleSpecifier", + NewExpression: "NewExpression", + ObjectExpression: "ObjectExpression", + ObjectPattern: "ObjectPattern", + PrivateIdentifier: "PrivateIdentifier", + Program: "Program", + Property: "Property", + PropertyDefinition: "PropertyDefinition", + RestElement: "RestElement", + ReturnStatement: "ReturnStatement", + SequenceExpression: "SequenceExpression", + SpreadElement: "SpreadElement", + Super: "Super", + SwitchStatement: "SwitchStatement", + SwitchCase: "SwitchCase", + TaggedTemplateExpression: "TaggedTemplateExpression", + TemplateElement: "TemplateElement", + TemplateLiteral: "TemplateLiteral", + ThisExpression: "ThisExpression", + ThrowStatement: "ThrowStatement", + TryStatement: "TryStatement", + UnaryExpression: "UnaryExpression", + UpdateExpression: "UpdateExpression", + VariableDeclaration: "VariableDeclaration", + VariableDeclarator: "VariableDeclarator", + WhileStatement: "WhileStatement", + WithStatement: "WithStatement", + YieldExpression: "YieldExpression" + }; + VisitorKeys = { + AssignmentExpression: ["left", "right"], + AssignmentPattern: ["left", "right"], + ArrayExpression: ["elements"], + ArrayPattern: ["elements"], + ArrowFunctionExpression: ["params", "body"], + AwaitExpression: ["argument"], + // CAUTION: It's deferred to ES7. + BlockStatement: ["body"], + BinaryExpression: ["left", "right"], + BreakStatement: ["label"], + CallExpression: ["callee", "arguments"], + CatchClause: ["param", "body"], + ChainExpression: ["expression"], + ClassBody: ["body"], + ClassDeclaration: ["id", "superClass", "body"], + ClassExpression: ["id", "superClass", "body"], + ComprehensionBlock: ["left", "right"], + // CAUTION: It's deferred to ES7. + ComprehensionExpression: ["blocks", "filter", "body"], + // CAUTION: It's deferred to ES7. + ConditionalExpression: ["test", "consequent", "alternate"], + ContinueStatement: ["label"], + DebuggerStatement: [], + DirectiveStatement: [], + DoWhileStatement: ["body", "test"], + EmptyStatement: [], + ExportAllDeclaration: ["source"], + ExportDefaultDeclaration: ["declaration"], + ExportNamedDeclaration: ["declaration", "specifiers", "source"], + ExportSpecifier: ["exported", "local"], + ExpressionStatement: ["expression"], + ForStatement: ["init", "test", "update", "body"], + ForInStatement: ["left", "right", "body"], + ForOfStatement: ["left", "right", "body"], + FunctionDeclaration: ["id", "params", "body"], + FunctionExpression: ["id", "params", "body"], + GeneratorExpression: ["blocks", "filter", "body"], + // CAUTION: It's deferred to ES7. + Identifier: [], + IfStatement: ["test", "consequent", "alternate"], + ImportExpression: ["source"], + ImportDeclaration: ["specifiers", "source"], + ImportDefaultSpecifier: ["local"], + ImportNamespaceSpecifier: ["local"], + ImportSpecifier: ["imported", "local"], + Literal: [], + LabeledStatement: ["label", "body"], + LogicalExpression: ["left", "right"], + MemberExpression: ["object", "property"], + MetaProperty: ["meta", "property"], + MethodDefinition: ["key", "value"], + ModuleSpecifier: [], + NewExpression: ["callee", "arguments"], + ObjectExpression: ["properties"], + ObjectPattern: ["properties"], + PrivateIdentifier: [], + Program: ["body"], + Property: ["key", "value"], + PropertyDefinition: ["key", "value"], + RestElement: ["argument"], + ReturnStatement: ["argument"], + SequenceExpression: ["expressions"], + SpreadElement: ["argument"], + Super: [], + SwitchStatement: ["discriminant", "cases"], + SwitchCase: ["test", "consequent"], + TaggedTemplateExpression: ["tag", "quasi"], + TemplateElement: [], + TemplateLiteral: ["quasis", "expressions"], + ThisExpression: [], + ThrowStatement: ["argument"], + TryStatement: ["block", "handler", "finalizer"], + UnaryExpression: ["argument"], + UpdateExpression: ["argument"], + VariableDeclaration: ["declarations"], + VariableDeclarator: ["id", "init"], + WhileStatement: ["test", "body"], + WithStatement: ["object", "body"], + YieldExpression: ["argument"] + }; + BREAK = {}; + SKIP = {}; + REMOVE = {}; + VisitorOption = { + Break: BREAK, + Skip: SKIP, + Remove: REMOVE + }; + function Reference2(parent, key) { + this.parent = parent; + this.key = key; + } + Reference2.prototype.replace = function replace2(node) { + this.parent[this.key] = node; + }; + Reference2.prototype.remove = function remove() { + if (Array.isArray(this.parent)) { + this.parent.splice(this.key, 1); + return true; + } else { + this.replace(null); + return false; + } + }; + function Element2(node, path, wrap, ref2) { + this.node = node; + this.path = path; + this.wrap = wrap; + this.ref = ref2; + } + function Controller() { + } + Controller.prototype.path = function path() { + var i, iz, j, jz, result, element; + function addToPath(result2, path2) { + if (Array.isArray(path2)) { + for (j = 0, jz = path2.length; j < jz; ++j) { + result2.push(path2[j]); + } + } else { + result2.push(path2); + } + } + if (!this.__current.path) { + return null; + } + result = []; + for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { + element = this.__leavelist[i]; + addToPath(result, element.path); + } + addToPath(result, this.__current.path); + return result; + }; + Controller.prototype.type = function() { + var node = this.current(); + return node.type || this.__current.wrap; + }; + Controller.prototype.parents = function parents() { + var i, iz, result; + result = []; + for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { + result.push(this.__leavelist[i].node); + } + return result; + }; + Controller.prototype.current = function current2() { + return this.__current.node; + }; + Controller.prototype.__execute = function __execute(callback, element) { + var previous, result; + result = void 0; + previous = this.__current; + this.__current = element; + this.__state = null; + if (callback) { + result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); + } + this.__current = previous; + return result; + }; + Controller.prototype.notify = function notify(flag) { + this.__state = flag; + }; + Controller.prototype.skip = function() { + this.notify(SKIP); + }; + Controller.prototype["break"] = function() { + this.notify(BREAK); + }; + Controller.prototype.remove = function() { + this.notify(REMOVE); + }; + Controller.prototype.__initialize = function(root, visitor) { + this.visitor = visitor; + this.root = root; + this.__worklist = []; + this.__leavelist = []; + this.__current = null; + this.__state = null; + this.__fallback = null; + if (visitor.fallback === "iteration") { + this.__fallback = Object.keys; + } else if (typeof visitor.fallback === "function") { + this.__fallback = visitor.fallback; + } + this.__keys = VisitorKeys; + if (visitor.keys) { + this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); + } + }; + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === "object" && typeof node.type === "string"; + } + function isProperty(nodeType, key) { + return (nodeType === Syntax4.ObjectExpression || nodeType === Syntax4.ObjectPattern) && "properties" === key; + } + function candidateExistsInLeaveList(leavelist, candidate) { + for (var i = leavelist.length - 1; i >= 0; --i) { + if (leavelist[i].node === candidate) { + return true; + } + } + return false; + } + Controller.prototype.traverse = function traverse2(root, visitor) { + var worklist, leavelist, element, node, nodeType, ret, key, current2, current22, candidates, candidate, sentinel; + this.__initialize(root, visitor); + sentinel = {}; + worklist = this.__worklist; + leavelist = this.__leavelist; + worklist.push(new Element2(root, null, null, null)); + leavelist.push(new Element2(null, null, null, null)); + while (worklist.length) { + element = worklist.pop(); + if (element === sentinel) { + element = leavelist.pop(); + ret = this.__execute(visitor.leave, element); + if (this.__state === BREAK || ret === BREAK) { + return; + } + continue; + } + if (element.node) { + ret = this.__execute(visitor.enter, element); + if (this.__state === BREAK || ret === BREAK) { + return; + } + worklist.push(sentinel); + leavelist.push(element); + if (this.__state === SKIP || ret === SKIP) { + continue; + } + node = element.node; + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error("Unknown node type " + nodeType + "."); + } + } + current2 = candidates.length; + while ((current2 -= 1) >= 0) { + key = candidates[current2]; + candidate = node[key]; + if (!candidate) { + continue; + } + if (Array.isArray(candidate)) { + current22 = candidate.length; + while ((current22 -= 1) >= 0) { + if (!candidate[current22]) { + continue; + } + if (candidateExistsInLeaveList(leavelist, candidate[current22])) { + continue; + } + if (isProperty(nodeType, candidates[current2])) { + element = new Element2(candidate[current22], [key, current22], "Property", null); + } else if (isNode(candidate[current22])) { + element = new Element2(candidate[current22], [key, current22], null, null); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + if (candidateExistsInLeaveList(leavelist, candidate)) { + continue; + } + worklist.push(new Element2(candidate, key, null, null)); + } + } + } + } + }; + Controller.prototype.replace = function replace2(root, visitor) { + var worklist, leavelist, node, nodeType, target, element, current2, current22, candidates, candidate, sentinel, outer, key; + function removeElem(element2) { + var i, key2, nextElem, parent; + if (element2.ref.remove()) { + key2 = element2.ref.key; + parent = element2.ref.parent; + i = worklist.length; + while (i--) { + nextElem = worklist[i]; + if (nextElem.ref && nextElem.ref.parent === parent) { + if (nextElem.ref.key < key2) { + break; + } + --nextElem.ref.key; + } + } + } + } + this.__initialize(root, visitor); + sentinel = {}; + worklist = this.__worklist; + leavelist = this.__leavelist; + outer = { + root + }; + element = new Element2(root, null, null, new Reference2(outer, "root")); + worklist.push(element); + leavelist.push(element); + while (worklist.length) { + element = worklist.pop(); + if (element === sentinel) { + element = leavelist.pop(); + target = this.__execute(visitor.leave, element); + if (target !== void 0 && target !== BREAK && target !== SKIP && target !== REMOVE) { + element.ref.replace(target); + } + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + } + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + continue; + } + target = this.__execute(visitor.enter, element); + if (target !== void 0 && target !== BREAK && target !== SKIP && target !== REMOVE) { + element.ref.replace(target); + element.node = target; + } + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + element.node = null; + } + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + node = element.node; + if (!node) { + continue; + } + worklist.push(sentinel); + leavelist.push(element); + if (this.__state === SKIP || target === SKIP) { + continue; + } + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error("Unknown node type " + nodeType + "."); + } + } + current2 = candidates.length; + while ((current2 -= 1) >= 0) { + key = candidates[current2]; + candidate = node[key]; + if (!candidate) { + continue; + } + if (Array.isArray(candidate)) { + current22 = candidate.length; + while ((current22 -= 1) >= 0) { + if (!candidate[current22]) { + continue; + } + if (isProperty(nodeType, candidates[current2])) { + element = new Element2(candidate[current22], [key, current22], "Property", new Reference2(candidate, current22)); + } else if (isNode(candidate[current22])) { + element = new Element2(candidate[current22], [key, current22], null, new Reference2(candidate, current22)); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element2(candidate, key, null, new Reference2(node, key))); + } + } + } + return outer.root; + }; + function traverse(root, visitor) { + var controller = new Controller(); + return controller.traverse(root, visitor); + } + function replace(root, visitor) { + var controller = new Controller(); + return controller.replace(root, visitor); + } + function extendCommentRange(comment, tokens) { + var target; + target = upperBound(tokens, function search(token) { + return token.range[0] > comment.range[0]; + }); + comment.extendedRange = [comment.range[0], comment.range[1]]; + if (target !== tokens.length) { + comment.extendedRange[1] = tokens[target].range[0]; + } + target -= 1; + if (target >= 0) { + comment.extendedRange[0] = tokens[target].range[1]; + } + return comment; + } + function attachComments(tree, providedComments, tokens) { + var comments = [], comment, len, i, cursor; + if (!tree.range) { + throw new Error("attachComments needs range information"); + } + if (!tokens.length) { + if (providedComments.length) { + for (i = 0, len = providedComments.length; i < len; i += 1) { + comment = deepCopy(providedComments[i]); + comment.extendedRange = [0, tree.range[0]]; + comments.push(comment); + } + tree.leadingComments = comments; + } + return tree; + } + for (i = 0, len = providedComments.length; i < len; i += 1) { + comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); + } + cursor = 0; + traverse(tree, { + enter: function(node) { + var comment2; + while (cursor < comments.length) { + comment2 = comments[cursor]; + if (comment2.extendedRange[1] > node.range[0]) { + break; + } + if (comment2.extendedRange[1] === node.range[0]) { + if (!node.leadingComments) { + node.leadingComments = []; + } + node.leadingComments.push(comment2); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } + if (cursor === comments.length) { + return VisitorOption.Break; + } + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + cursor = 0; + traverse(tree, { + leave: function(node) { + var comment2; + while (cursor < comments.length) { + comment2 = comments[cursor]; + if (node.range[1] < comment2.extendedRange[0]) { + break; + } + if (node.range[1] === comment2.extendedRange[0]) { + if (!node.trailingComments) { + node.trailingComments = []; + } + node.trailingComments.push(comment2); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } + if (cursor === comments.length) { + return VisitorOption.Break; + } + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + return tree; + } + exports2.Syntax = Syntax4; + exports2.traverse = traverse; + exports2.replace = replace; + exports2.attachComments = attachComments; + exports2.VisitorKeys = VisitorKeys; + exports2.VisitorOption = VisitorOption; + exports2.Controller = Controller; + exports2.cloneEnvironment = function() { + return clone({}); + }; + return exports2; + })(exports); + } + }); + + // node_modules/esrecurse/package.json + var require_package = __commonJS({ + "node_modules/esrecurse/package.json"(exports, module) { + module.exports = { + name: "esrecurse", + description: "ECMAScript AST recursive visitor", + homepage: "https://github.com/estools/esrecurse", + main: "esrecurse.js", + version: "4.3.0", + engines: { + node: ">=4.0" + }, + maintainers: [ + { + name: "Yusuke Suzuki", + email: "utatane.tea@gmail.com", + web: "https://github.com/Constellation" + } + ], + repository: { + type: "git", + url: "https://github.com/estools/esrecurse.git" + }, + dependencies: { + estraverse: "^5.2.0" + }, + devDependencies: { + "babel-cli": "^6.24.1", + "babel-eslint": "^7.2.3", + "babel-preset-es2015": "^6.24.1", + "babel-register": "^6.24.1", + chai: "^4.0.2", + esprima: "^4.0.0", + gulp: "^3.9.0", + "gulp-bump": "^2.7.0", + "gulp-eslint": "^4.0.0", + "gulp-filter": "^5.0.0", + "gulp-git": "^2.4.1", + "gulp-mocha": "^4.3.1", + "gulp-tag-version": "^1.2.1", + jsdoc: "^3.3.0-alpha10", + minimist: "^1.1.0" + }, + license: "BSD-2-Clause", + scripts: { + test: "gulp travis", + "unit-test": "gulp test", + lint: "gulp lint" + }, + babel: { + presets: [ + "es2015" + ] + } + }; + } + }); + + // node_modules/esrecurse/esrecurse.js + var require_esrecurse = __commonJS({ + "node_modules/esrecurse/esrecurse.js"(exports) { + (function() { + "use strict"; + var estraverse4 = require_estraverse(); + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === "object" && typeof node.type === "string"; + } + function isProperty(nodeType, key) { + return (nodeType === estraverse4.Syntax.ObjectExpression || nodeType === estraverse4.Syntax.ObjectPattern) && key === "properties"; + } + function Visitor(visitor, options) { + options = options || {}; + this.__visitor = visitor || this; + this.__childVisitorKeys = options.childVisitorKeys ? Object.assign({}, estraverse4.VisitorKeys, options.childVisitorKeys) : estraverse4.VisitorKeys; + if (options.fallback === "iteration") { + this.__fallback = Object.keys; + } else if (typeof options.fallback === "function") { + this.__fallback = options.fallback; + } + } + Visitor.prototype.visitChildren = function(node) { + var type, children, i, iz, j, jz, child; + if (node == null) { + return; + } + type = node.type || estraverse4.Syntax.Property; + children = this.__childVisitorKeys[type]; + if (!children) { + if (this.__fallback) { + children = this.__fallback(node); + } else { + throw new Error("Unknown node type " + type + "."); + } + } + for (i = 0, iz = children.length; i < iz; ++i) { + child = node[children[i]]; + if (child) { + if (Array.isArray(child)) { + for (j = 0, jz = child.length; j < jz; ++j) { + if (child[j]) { + if (isNode(child[j]) || isProperty(type, children[i])) { + this.visit(child[j]); + } + } + } + } else if (isNode(child)) { + this.visit(child); + } + } + } + }; + Visitor.prototype.visit = function(node) { + var type; + if (node == null) { + return; + } + type = node.type || estraverse4.Syntax.Property; + if (this.__visitor[type]) { + this.__visitor[type].call(this, node); + return; + } + this.visitChildren(node); + }; + exports.version = require_package().version; + exports.Visitor = Visitor; + exports.visit = function(node, visitor, options) { + var v = new Visitor(visitor, options); + v.visit(node); + }; + })(); + } + }); + // src/binance-orderbook-trade/contracts/binance-page-text.js var freezeLabels = (labels) => Object.freeze(labels); var BINANCE_PAGE_TEXT = Object.freeze({ @@ -954,14 +1828,14 @@ const moves = []; let previous = null; for (const price of prices) { - const current = normalizeDecimalString(price); - if (!current) continue; + const current2 = normalizeDecimalString(price); + if (!current2) continue; if (previous) { - const diff = subtractDecimalStrings(current, previous) || subtractDecimalStrings(previous, current); + const diff = subtractDecimalStrings(current2, previous) || subtractDecimalStrings(previous, current2); const normalizedDiff = normalizeDecimalString(diff); if (normalizedDiff && isPositiveDecimalString(normalizedDiff)) moves.push(normalizedDiff); } - previous = current; + previous = current2; } return moves; } @@ -1972,11 +2846,11 @@ message: null }; } - const data = payload.data; + const data2 = payload.data; return { payloadType, payloadKeys: Object.keys(payload).sort(), - dataKeys: data && typeof data === "object" && !Array.isArray(data) ? Object.keys(data).sort() : [], + dataKeys: data2 && typeof data2 === "object" && !Array.isArray(data2) ? Object.keys(data2).sort() : [], success: readDiagnosticScalar(payload.success), code: readDiagnosticScalar(payload.code), message: readDiagnosticMessage(payload.message ?? payload.msg) @@ -2062,11 +2936,11 @@ }); } function patchHistoryMethod(view, methodName) { - const current = view.history[methodName]; - if (current[ROUTE_PATCH_MARKER]) return; + const current2 = view.history[methodName]; + if (current2[ROUTE_PATCH_MARKER]) return; function routeAwareHistoryMethod(...args) { const previousHref = view.location.href; - const result = Reflect.apply(current, this, args); + const result = Reflect.apply(current2, this, args); if (view.location.href !== previousHref) dispatchRouteChange(view); return result; } @@ -2103,10 +2977,10 @@ function createAccountOrdersMutationSignal(observationRoot) { const MutationObserverClass = observationRoot?.ownerDocument?.defaultView?.MutationObserver; if (!observationRoot || !MutationObserverClass) return null; - let version = 0; + let version2 = 0; let pendingFinish = null; const notify = () => { - version += 1; + version2 += 1; pendingFinish?.("changed"); }; const observer = new MutationObserverClass(notify); @@ -2119,10 +2993,10 @@ }); return { get version() { - return version; + return version2; }, waitForChange(afterVersion, timeoutMs) { - if (version !== afterVersion) return Promise.resolve("changed"); + if (version2 !== afterVersion) return Promise.resolve("changed"); return new Promise((resolve) => { let timer = null; const finish = (result) => { @@ -2151,13 +3025,13 @@ try { while (true) { throwIfAborted(abortSignal); - const version = signal.version; + const version2 = signal.version; const state = readState(); if (state) return state; const remainingMs = deadline - Date.now(); if (remainingMs <= 0) return readState(); await waitForPromiseOrAbort( - signal.waitForChange(version, remainingMs), + signal.waitForChange(version2, remainingMs), abortSignal ); } @@ -2938,8 +3812,8 @@ let displayStep = null; for (let i = 1; i < prices.length; i += 1) { const prev = prices[i - 1]; - const current = prices[i]; - let diff = subtractDecimalStrings(current, prev) || subtractDecimalStrings(prev, current); + const current2 = prices[i]; + let diff = subtractDecimalStrings(current2, prev) || subtractDecimalStrings(prev, current2); diff = normalizeDecimalString(diff); if (!diff || !isPositiveDecimalString(diff)) continue; if (!displayStep || compareDecimalStrings(diff, displayStep) < 0) displayStep = diff; @@ -4533,17 +5407,17 @@ const coordinate = geometry.priceToCoordinate(level.price); if (!Number.isFinite(coordinate)) continue; const y = Math.max(0, Math.min(lastRow, Math.round(coordinate))); - const current = buckets.get(y); - if (!current) { + const current2 = buckets.get(y); + if (!current2) { buckets.set(y, { ...level, y, minPrice: level.price, maxPrice: level.price }); continue; } - current.quantity += level.quantity; - current.minPrice = Math.min(current.minPrice, level.price); - current.maxPrice = Math.max(current.maxPrice, level.price); - if (level.cumulative > current.cumulative) { - current.price = level.price; - current.cumulative = level.cumulative; + current2.quantity += level.quantity; + current2.minPrice = Math.min(current2.minPrice, level.price); + current2.maxPrice = Math.max(current2.maxPrice, level.price); + if (level.cumulative > current2.cumulative) { + current2.price = level.price; + current2.cumulative = level.cumulative; } } return [...buckets.values()].sort((left, right) => left.y - right.y); @@ -4762,10 +5636,10 @@ function createDialogMutationSignal(document2) { const MutationObserverClass = document2?.defaultView?.MutationObserver; if (!document2?.body || !MutationObserverClass) return null; - let version = 0; + let version2 = 0; let pendingFinish = null; const notify = () => { - version += 1; + version2 += 1; pendingFinish?.("changed"); }; const observer = new MutationObserverClass((mutations) => { @@ -4779,11 +5653,11 @@ }); return { get version() { - return version; + return version2; }, notify, waitForChange(afterVersion, timeoutMs = null) { - if (version !== afterVersion) return Promise.resolve("changed"); + if (version2 !== afterVersion) return Promise.resolve("changed"); return new Promise((resolve) => { let timer = null; const finish = (result) => { @@ -4812,13 +5686,13 @@ try { while (true) { throwIfAborted(abortSignal); - const version = signal.version; + const version2 = signal.version; const state = readState(); if (state) return state; const remainingMs = deadline - Date.now(); if (remainingMs <= 0) return readState(); await waitForPromiseOrAbort( - signal.waitForChange(version, remainingMs), + signal.waitForChange(version2, remainingMs), abortSignal ); } @@ -5654,7 +6528,7 @@ }); }, [n]); return { executionOrders: a }; - }, at = function(t) { + }, at2 = function(t) { var n = t.namespace, a = t.symbol, u = (0, Br.j)({ namespace: n, symbol: a }); return (0, r.useMemo)(function() { return u.map(function(s) { @@ -5681,7 +6555,7 @@ }); }, [a]); }, pt = function(t) { - var n = t.namespace, a = t.symbol, u = at({ namespace: n, symbol: a }), s = ot({ symbol: a }), g = Rr({ symbol: a }); + var n = t.namespace, a = t.symbol, u = at2({ namespace: n, symbol: a }), s = ot({ symbol: a }), g = Rr({ symbol: a }); return (0, r.useMemo)(function() { return (0, d._)(u).concat((0, d._)(s), (0, d._)(g)); }, [u, s, g]); @@ -6259,7 +7133,7 @@ return "en"; } }; - var x = r(46108), ot = r.n(x), Z = r(75857), rt = r.n(Z), at = r(87809), j = r.n(at), X = r(34789), Q = r.n(X), ct = r(19953), it = r.n(ct), lt = r(82438), ut = r.n(lt), a = r(87835), E = r.n(a), O = r(75257); + var x = r(46108), ot = r.n(x), Z = r(75857), rt = r.n(Z), at2 = r(87809), j = r.n(at2), X = r(34789), Q = r.n(X), ct = r(19953), it = r.n(ct), lt = r(82438), ut = r.n(lt), a = r(87835), E = r.n(a), O = r(75257); const W = (t) => /^(LineTool)/g.test(t), _t = (t) => `${t}.customSettings`, ft = (t) => `${t}.layout`, J = (t) => t.chartId, kt = ({ save: t }) => { const n = {}, s = [], i = t.charts.reduce((I, N) => { const _ = N.panes.reduce((m, y) => { @@ -6709,12 +7583,12 @@ } } let store; - function advance() { + function advance2() { if (index === entries.length) return; const [key, value] = entries[index]; function next() { index += 1; - advance(); + advance2(); } function put() { const request = store.put(value === null ? void 0 : value, key); @@ -6727,16 +7601,16 @@ } const read = store.get(key); read.onsuccess = () => guard(() => { - let current; + let current2; try { - current = snapshotJson(read.result === void 0 ? null : read.result, budget); + current2 = snapshotJson(read.result === void 0 ? null : read.result, budget); } catch { budget.remaining = 0; put(); return; } function writeIfChanged(present) { - if (present && equalJson(current, value)) { + if (present && equalJson(current2, value)) { skipped += 1; next(); } else put(); @@ -6749,7 +7623,7 @@ } guard(() => { store = transaction.objectStore("keyvaluepairs"); - advance(); + advance2(); }); }); } @@ -6948,82 +7822,7384 @@ return Object.freeze({ snapshot, stop }); } - // src/binance-orderbook-trade/order-notifications/native-modules.js - var pinnedFactories = [ - { - id: "39116", - original: '39116(D,l,t){"use strict";t.d(l,{QZ:()=>p.Q,$$:()=>n,E$:()=>S});var e=t(41594),a=2e3,r=2,n=function(){var E=(0,e.useRef)(null),A=function(O){E.current=setTimeout(function(){O(),E.current&&clearTimeout(E.current),E.current=null},a)};return(0,e.useMemo)(function(){return{interval:E,intervalFunc:A}},[])},i=t(75510),s=t(16921),c=t(72363),d=t(79515),y=t(40477),p=t(70020),T=function(E,A){var O=(0,d.nH)(),m=(0,d.Py)().isExistFutureAccount,g=(0,y.A)(A,500),u=g.run,o=(0,d.ON)().isPM2,f=(0,s.Gw)();(0,e.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!0});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(P){(P.status==="FILLED"||P.status==="PARTIALLY_FILLED"||P.status==="EXPIRED")&&u(String(P.orderId))})})},[u,E,m,O,o,f]),(0,e.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!1});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(P){(P.status==="FILLED"||P.status==="PARTIALLY_FILLED"||P.status==="EXPIRED")&&u(String(P.orderId))})})},[u,E,m,O,o,f])},S=function(){var E=(0,e.useState)(new Date),A=E[0],O=E[1],m=(0,e.useRef)([]),g=(0,p.Q)(),u=g.showNotification,o=g.enableNotification,f=(0,e.useCallback)(function(){var v;(v=m)===null||v===void 0||v.current.shift(),O(new Date)},[]),_=(0,e.useCallback)(function(v){var L;if(u&&((L=m)===null||L===void 0?void 0:L.current.length) p.Q, $$: () => n, E$: () => S }); - var e = t(41594), a = 2e3, r = 2, n = function() { - var E = (0, e.useRef)(null), A = function(O) { - E.current = setTimeout(function() { - O(), E.current && clearTimeout(E.current), E.current = null; - }, a); - }; - return (0, e.useMemo)(function() { - return { interval: E, intervalFunc: A }; - }, []); - }, i = t(75510), s = t(16921), c = t(72363), d = t(79515), y = t(40477), p = t(70020), T = function(E, A) { - var O = (0, d.nH)(), m = (0, d.Py)().isExistFutureAccount, g = (0, y.A)(function(__event) { - if (__notify.allowSoundInput(__event)) return Reflect.apply(A, this, [__event]); - }, 500), u = g.run, o = (0, d.ON)().isPM2, f = (0, s.Gw)(); - (0, e.useEffect)(function() { - if (!O || !m || !E) return function() { - return null; - }; - var _ = (0, c.Ri)({ isCM: true }); - return _.getUserOrderStream({ isPM2: o, params: f }).subscribe(function(v) { - var L = Array.isArray(v) ? (0, i._)(v) : [v]; - L.forEach(function(P) { - (P.status === "FILLED" || P.status === "PARTIALLY_FILLED" || P.status === "EXPIRED") && ((!__notify.soundReady() || __notify.allowOrder(P)) && u(__notify.soundInput(P))); - }); - }); - }, [u, E, m, O, o, f]), (0, e.useEffect)(function() { - if (!O || !m || !E) return function() { - return null; - }; - var _ = (0, c.Ri)({ isCM: false }); - return _.getUserOrderStream({ isPM2: o, params: f }).subscribe(function(v) { - var L = Array.isArray(v) ? (0, i._)(v) : [v]; - L.forEach(function(P) { - (P.status === "FILLED" || P.status === "PARTIALLY_FILLED" || P.status === "EXPIRED") && ((!__notify.soundReady() || __notify.allowOrder(P)) && u(__notify.soundInput(P))); - }); - }); - }, [u, E, m, O, o, f]); - }, S = function() { - var E = (0, e.useState)(/* @__PURE__ */ new Date()), A = E[0], O = E[1], m = (0, e.useRef)([]), g = (0, p.Q)(), u = g.showNotification, o = g.enableNotification, f = (0, e.useCallback)(function() { - var v; - (v = m) === null || v === void 0 || v.current.shift(), O(/* @__PURE__ */ new Date()); - }, []), _ = (0, e.useCallback)(function(v) { - var L; - if (u && ((L = m) === null || L === void 0 ? void 0 : L.current.length) < r && o && v) { - var P; - (P = m) === null || P === void 0 || P.current.push(v), O(/* @__PURE__ */ new Date()); - } - }, [o, u]); - return T(u && o, _), (0, e.useMemo)(function() { - return { notifications: m, lastNotifyTime: A, popNotification: f }; - }, [A, f]); - }; - } }[39116]; + // node_modules/acorn/dist/acorn.mjs + var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 78, 5, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 199, 7, 137, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 55, 9, 266, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; + var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 7, 25, 39, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 5, 57, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 24, 43, 261, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 33, 24, 3, 24, 45, 74, 6, 0, 67, 12, 65, 1, 2, 0, 15, 4, 10, 7381, 42, 31, 98, 114, 8702, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 208, 30, 2, 2, 2, 1, 2, 6, 3, 4, 10, 1, 225, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4381, 3, 5773, 3, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 8489]; + var nonASCIIidentifierChars = "‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-᫝᫠-᫫ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・"; + var nonASCIIidentifierStartChars = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-࢏ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚ౜ౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ೜-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ƛ꟱-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ"; + var reservedWords = { + 3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile", + 5: "class enum extends super const export import", + 6: "enum", + strict: "implements interface let package private protected public static yield", + strictBind: "eval arguments" + }; + var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this"; + var keywords$1 = { + 5: ecma5AndLessKeywords, + "5module": ecma5AndLessKeywords + " export import", + 6: ecma5AndLessKeywords + " const class extends export import super" + }; + var keywordRelationalOperator = /^in(stanceof)?$/; + var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); + var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); + function isInAstralSet(code, set) { + var pos = 65536; + for (var i = 0; i < set.length; i += 2) { + pos += set[i]; + if (pos > code) { + return false; } - }, - { - id: "30877", - original: '30877(be,W,e){e.d(W,{F:()=>N,z:()=>o});var r=e(41594),a=e.n(r),T=e(61523),p=e(92873),P=e(64041),b=e(17409),S=e(51471),E=e(40477),$="trd-openOrder",G=function(c){return(0,p.o)($,c)},o=function(){var c=(0,S.zr)("open_order_status_toast",!0),h=c.data,R=c.setData,K=c.hasInitialized,x=(0,r.useCallback)(function(){R(!h)},[h,R]);return{enableToast:K?h:!1,toggleToast:x}},N=function(){var c=G().getI18n,h=(0,P.h)().enqueueNotification,R=o().enableToast,K=(0,E.A)(h,30),x=K.run,i=(0,T.d4)(function(l){return l.setting.layout}),d=(0,r.useMemo)(function(){return i===b.a0},[i]),A=(0,r.useCallback)(function(l){var D=l.side.toUpperCase(),Y=l.type.replace(/[-_]/g,"");return"".concat(D).concat(Y)},[]),g=(0,r.useCallback)(function(l){if(!(l.type==="LIQUIDATION"||!R)){var D=A(l),Y=c("".concat(D,"CancelTitle"),{defaultValue:"".concat(l.type," ").concat(l.side," Order Canceled")});x(Y)}},[A,c,x,R]),C=(0,r.useCallback)(function(l){if(!(l.type==="LIQUIDATION"||!R)){var D=A(l),Y=c("".concat(D,"FillTitle"),{defaultValue:"".concat(l.type," ").concat(l.side," Order Filled")});x(Y,{variant:"success"})}},[A,c,x,R]),I=(0,r.useCallback)(function(l){if(!(l.type==="LIQUIDATION"||!R)){var D=A(l),Y=c("".concat(D,"PFTitle"),{defaultValue:"".concat(l.type," ").concat(l.side," Order Partially Filled")});x(Y,{variant:"success"})}},[A,c,x,R]);return(0,r.useMemo)(function(){return{cancelOrderNotify:g,fillOrderNotify:C,fillOrderPartNotify:I}},[g,C,I])}}', - create(__notify) { - return { 30877(be, W, e) { - e.d(W, { F: () => N, z: () => o }); - var r = e(41594), a = e.n(r), T = e(61523), p = e(92873), P = e(64041), b = e(17409), S = e(51471), E = e(40477), $ = "trd-openOrder", G = function(c) { - return (0, p.o)($, c); - }, o = function() { - var c = (0, S.zr)("open_order_status_toast", true), h = c.data, R = c.setData, K = c.hasInitialized, x = (0, r.useCallback)(function() { - R(!h); - }, [h, R]); - return { enableToast: K ? h : false, toggleToast: x }; + pos += set[i + 1]; + if (pos >= code) { + return true; + } + } + return false; + } + function isIdentifierStart(code, astral) { + if (code < 65) { + return code === 36; + } + if (code < 91) { + return true; + } + if (code < 97) { + return code === 95; + } + if (code < 123) { + return true; + } + if (code <= 65535) { + return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code)); + } + if (astral === false) { + return false; + } + return isInAstralSet(code, astralIdentifierStartCodes); + } + function isIdentifierChar(code, astral) { + if (code < 48) { + return code === 36; + } + if (code < 58) { + return true; + } + if (code < 65) { + return false; + } + if (code < 91) { + return true; + } + if (code < 97) { + return code === 95; + } + if (code < 123) { + return true; + } + if (code <= 65535) { + return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code)); + } + if (astral === false) { + return false; + } + return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); + } + var TokenType = function TokenType2(label, conf) { + if (conf === void 0) conf = {}; + this.label = label; + this.keyword = conf.keyword; + this.beforeExpr = !!conf.beforeExpr; + this.startsExpr = !!conf.startsExpr; + this.isLoop = !!conf.isLoop; + this.isAssign = !!conf.isAssign; + this.prefix = !!conf.prefix; + this.postfix = !!conf.postfix; + this.binop = conf.binop || null; + this.updateContext = null; + }; + function binop(name, prec) { + return new TokenType(name, { beforeExpr: true, binop: prec }); + } + var beforeExpr = { beforeExpr: true }; + var startsExpr = { startsExpr: true }; + var keywords = {}; + function kw(name, options) { + if (options === void 0) options = {}; + options.keyword = name; + return keywords[name] = new TokenType(name, options); + } + var types$1 = { + num: new TokenType("num", startsExpr), + regexp: new TokenType("regexp", startsExpr), + string: new TokenType("string", startsExpr), + name: new TokenType("name", startsExpr), + privateId: new TokenType("privateId", startsExpr), + eof: new TokenType("eof"), + // Punctuation token types. + bracketL: new TokenType("[", { beforeExpr: true, startsExpr: true }), + bracketR: new TokenType("]"), + braceL: new TokenType("{", { beforeExpr: true, startsExpr: true }), + braceR: new TokenType("}"), + parenL: new TokenType("(", { beforeExpr: true, startsExpr: true }), + parenR: new TokenType(")"), + comma: new TokenType(",", beforeExpr), + semi: new TokenType(";", beforeExpr), + colon: new TokenType(":", beforeExpr), + dot: new TokenType("."), + question: new TokenType("?", beforeExpr), + questionDot: new TokenType("?."), + arrow: new TokenType("=>", beforeExpr), + template: new TokenType("template"), + invalidTemplate: new TokenType("invalidTemplate"), + ellipsis: new TokenType("...", beforeExpr), + backQuote: new TokenType("`", startsExpr), + dollarBraceL: new TokenType("${", { beforeExpr: true, startsExpr: true }), + // Operators. These carry several kinds of properties to help the + // parser use them properly (the presence of these properties is + // what categorizes them as operators). + // + // `binop`, when present, specifies that this operator is a binary + // operator, and will refer to its precedence. + // + // `prefix` and `postfix` mark the operator as a prefix or postfix + // unary operator. + // + // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as + // binary operators with a very low precedence, that should result + // in AssignmentExpression nodes. + eq: new TokenType("=", { beforeExpr: true, isAssign: true }), + assign: new TokenType("_=", { beforeExpr: true, isAssign: true }), + incDec: new TokenType("++/--", { prefix: true, postfix: true, startsExpr: true }), + prefix: new TokenType("!/~", { beforeExpr: true, prefix: true, startsExpr: true }), + logicalOR: binop("||", 1), + logicalAND: binop("&&", 2), + bitwiseOR: binop("|", 3), + bitwiseXOR: binop("^", 4), + bitwiseAND: binop("&", 5), + equality: binop("==/!=/===/!==", 6), + relational: binop("/<=/>=", 7), + bitShift: binop("<>/>>>", 8), + plusMin: new TokenType("+/-", { beforeExpr: true, binop: 9, prefix: true, startsExpr: true }), + modulo: binop("%", 10), + star: binop("*", 10), + slash: binop("/", 10), + starstar: new TokenType("**", { beforeExpr: true }), + coalesce: binop("??", 1), + // Keyword token types. + _break: kw("break"), + _case: kw("case", beforeExpr), + _catch: kw("catch"), + _continue: kw("continue"), + _debugger: kw("debugger"), + _default: kw("default", beforeExpr), + _do: kw("do", { isLoop: true, beforeExpr: true }), + _else: kw("else", beforeExpr), + _finally: kw("finally"), + _for: kw("for", { isLoop: true }), + _function: kw("function", startsExpr), + _if: kw("if"), + _return: kw("return", beforeExpr), + _switch: kw("switch"), + _throw: kw("throw", beforeExpr), + _try: kw("try"), + _var: kw("var"), + _const: kw("const"), + _while: kw("while", { isLoop: true }), + _with: kw("with"), + _new: kw("new", { beforeExpr: true, startsExpr: true }), + _this: kw("this", startsExpr), + _super: kw("super", startsExpr), + _class: kw("class", startsExpr), + _extends: kw("extends", beforeExpr), + _export: kw("export"), + _import: kw("import", startsExpr), + _null: kw("null", startsExpr), + _true: kw("true", startsExpr), + _false: kw("false", startsExpr), + _in: kw("in", { beforeExpr: true, binop: 7 }), + _instanceof: kw("instanceof", { beforeExpr: true, binop: 7 }), + _typeof: kw("typeof", { beforeExpr: true, prefix: true, startsExpr: true }), + _void: kw("void", { beforeExpr: true, prefix: true, startsExpr: true }), + _delete: kw("delete", { beforeExpr: true, prefix: true, startsExpr: true }) + }; + var lineBreak = /\r\n?|\n|\u2028|\u2029/; + var lineBreakG = new RegExp(lineBreak.source, "g"); + function isNewLine(code) { + return code === 10 || code === 13 || code === 8232 || code === 8233; + } + function nextLineBreak(code, from, end) { + if (end === void 0) end = code.length; + for (var i = from; i < end; i++) { + var next = code.charCodeAt(i); + if (isNewLine(next)) { + return i < end - 1 && next === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1; + } + } + return -1; + } + var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/; + var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g; + var ref = Object.prototype; + var hasOwnProperty = ref.hasOwnProperty; + var toString = ref.toString; + var hasOwn = Object.hasOwn || (function(obj, propName) { + return hasOwnProperty.call(obj, propName); + }); + var isArray = Array.isArray || (function(obj) { + return toString.call(obj) === "[object Array]"; + }); + var regexpCache = /* @__PURE__ */ Object.create(null); + function wordsRegexp(words) { + return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$")); + } + function codePointToString(code) { + if (code <= 65535) { + return String.fromCharCode(code); + } + code -= 65536; + return String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320); + } + var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/; + var Position = function Position2(line, col) { + this.line = line; + this.column = col; + }; + Position.prototype.offset = function offset(n) { + return new Position(this.line, this.column + n); + }; + var SourceLocation = function SourceLocation2(p, start, end) { + this.start = start; + this.end = end; + if (p.sourceFile !== null) { + this.source = p.sourceFile; + } + }; + function getLineInfo(input, offset2) { + for (var line = 1, cur = 0; ; ) { + var nextBreak = nextLineBreak(input, cur, offset2); + if (nextBreak < 0) { + return new Position(line, offset2 - cur); + } + ++line; + cur = nextBreak; + } + } + var defaultOptions = { + // `ecmaVersion` indicates the ECMAScript version to parse. Must be + // either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 + // (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"` + // (the latest version the library supports). This influences + // support for strict mode, the set of reserved words, and support + // for new syntax features. + ecmaVersion: null, + // `sourceType` indicates the mode the code should be parsed in. + // Can be either `"script"`, `"module"` or `"commonjs"`. This influences global + // strict mode and parsing of `import` and `export` declarations. + sourceType: "script", + // When set to true, enable strict parsing mode even if `sourceType` + // is `"script"`. + strict: false, + // `onInsertedSemicolon` can be a callback that will be called when + // a semicolon is automatically inserted. It will be passed the + // position of the inserted semicolon as an offset, and if + // `locations` is enabled, it is given the location as a `{line, + // column}` object as second argument. + onInsertedSemicolon: null, + // `onTrailingComma` is similar to `onInsertedSemicolon`, but for + // trailing commas. + onTrailingComma: null, + // By default, reserved words are only enforced if ecmaVersion >= 5. + // Set `allowReserved` to a boolean value to explicitly turn this on + // an off. When this option has the value "never", reserved words + // and keywords can also not be used as property names. + allowReserved: null, + // When enabled, a return at the top level is not considered an + // error. + allowReturnOutsideFunction: false, + // When enabled, import/export statements are not constrained to + // appearing at the top of the program, and an import.meta expression + // in a script isn't considered an error. + allowImportExportEverywhere: false, + // By default, await identifiers are allowed to appear at the top-level scope only if ecmaVersion >= 2022. + // When enabled, await identifiers are allowed to appear at the top-level scope, + // but they are still not allowed in non-async functions. + allowAwaitOutsideFunction: null, + // When enabled, super identifiers are not constrained to + // appearing in methods and do not raise an error when they appear elsewhere. + allowSuperOutsideMethod: null, + // When enabled, hashbang directive in the beginning of file is + // allowed and treated as a line comment. Enabled by default when + // `ecmaVersion` >= 2023. + allowHashBang: false, + // By default, the parser will verify that private properties are + // only used in places where they are valid and have been declared. + // Set this to false to turn such checks off. + checkPrivateFields: true, + // When `locations` is on, `loc` properties holding objects with + // `start` and `end` properties in `{line, column}` form (with + // line being 1-based and column 0-based) will be attached to the + // nodes. + locations: false, + // Pass an optional `{line, column}` object to use for the start of + // the parse. This is mostly useful when using `parseExpressionAt` + // with `locations: true`, to prevent the parser from having to + // determine the line position at the start position. + startLocation: null, + // A function can be passed as `onToken` option, which will + // cause Acorn to call that function with object in the same + // format as tokens returned from `tokenizer().getToken()`. Note + // that you are not allowed to call the parser from the + // callback—that will corrupt its internal state. + onToken: null, + // A function can be passed as `onComment` option, which will + // cause Acorn to call that function with `(block, text, start, + // end)` parameters whenever a comment is skipped. `block` is a + // boolean indicating whether this is a block (`/* */`) comment, + // `text` is the content of the comment, and `start` and `end` are + // character offsets that denote the start and end of the comment. + // When the `locations` option is on, two more parameters are + // passed, the full `{line, column}` locations of the start and + // end of the comments. Note that you are not allowed to call the + // parser from the callback—that will corrupt its internal state. + // When this option has an array as value, objects representing the + // comments are pushed to it. + onComment: null, + // Nodes have their start and end characters offsets recorded in + // `start` and `end` properties (directly on the node, rather than + // the `loc` object, which holds line/column data. To also add a + // [semi-standardized][range] `range` property holding a `[start, + // end]` array with the same numbers, set the `ranges` option to + // `true`. + // + // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678 + ranges: false, + // It is possible to parse multiple files into a single AST by + // passing the tree produced by parsing the first file as + // `program` option in subsequent parses. This will add the + // toplevel forms of the parsed file to the `Program` (top) node + // of an existing parse tree. + program: null, + // When `locations` is on, you can pass this to record the source + // file in every node's `loc` object. + sourceFile: null, + // This value, if given, is stored in every node, whether + // `locations` is on or off. + directSourceFile: null, + // When enabled, parenthesized expressions are represented by + // (non-standard) ParenthesizedExpression nodes + preserveParens: false + }; + var warnedAboutEcmaVersion = false; + function getOptions(opts) { + var options = {}; + for (var opt in defaultOptions) { + options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt]; + } + if (options.ecmaVersion === "latest") { + options.ecmaVersion = 1e8; + } else if (options.ecmaVersion == null) { + if (!warnedAboutEcmaVersion && typeof console === "object" && console.warn) { + warnedAboutEcmaVersion = true; + console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future."); + } + options.ecmaVersion = 11; + } else if (options.ecmaVersion >= 2015) { + options.ecmaVersion -= 2009; + } + if (options.allowReserved == null) { + options.allowReserved = options.ecmaVersion < 5; + } + if (!opts || opts.allowHashBang == null) { + options.allowHashBang = options.ecmaVersion >= 14; + } + if (isArray(options.onToken)) { + var tokens = options.onToken; + options.onToken = function(token) { + return tokens.push(token); + }; + } + if (isArray(options.onComment)) { + options.onComment = pushComment(options, options.onComment); + } + if (options.sourceType === "commonjs" && options.allowAwaitOutsideFunction) { + throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs"); + } + return options; + } + function pushComment(options, array) { + return function(block, text, start, end, startLoc, endLoc) { + var comment = { + type: block ? "Block" : "Line", + value: text, + start, + end + }; + if (options.locations) { + comment.loc = new SourceLocation(this, startLoc, endLoc); + } + if (options.ranges) { + comment.range = [start, end]; + } + array.push(comment); + }; + } + var SCOPE_TOP = 1; + var SCOPE_FUNCTION = 2; + var SCOPE_ASYNC = 4; + var SCOPE_GENERATOR = 8; + var SCOPE_ARROW = 16; + var SCOPE_SIMPLE_CATCH = 32; + var SCOPE_SUPER = 64; + var SCOPE_DIRECT_SUPER = 128; + var SCOPE_CLASS_STATIC_BLOCK = 256; + var SCOPE_CLASS_FIELD_INIT = 512; + var SCOPE_SWITCH = 1024; + var SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK; + function functionFlags(async, generator) { + return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0); + } + var BIND_NONE = 0; + var BIND_VAR = 1; + var BIND_LEXICAL = 2; + var BIND_FUNCTION = 3; + var BIND_SIMPLE_CATCH = 4; + var BIND_OUTSIDE = 5; + var Parser = function Parser2(options, input, startPos) { + this.options = options = getOptions(options); + this.sourceFile = options.sourceFile; + this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]); + var reserved = ""; + if (options.allowReserved !== true) { + reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3]; + if (options.sourceType === "module") { + reserved += " await"; + } + } + this.reservedWords = wordsRegexp(reserved); + var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict; + this.reservedWordsStrict = wordsRegexp(reservedStrict); + this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind); + this.input = String(input); + this.containsEsc = false; + this.pos = startPos || 0; + this.curLine = 1; + if (options.startLocation) { + this.lineStart = this.pos - options.startLocation.column; + this.curLine = options.startLocation.line; + } else if (startPos) { + this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1; + if (this.options.locations) { + this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length; + } + } else { + this.lineStart = 0; + } + this.type = types$1.eof; + this.value = null; + this.start = this.end = this.pos; + this.startLoc = this.endLoc = this.curPosition(); + this.lastTokEndLoc = this.lastTokStartLoc = null; + this.lastTokStart = this.lastTokEnd = this.pos; + this.context = this.initialContext(); + this.exprAllowed = true; + this.inModule = options.sourceType === "module"; + this.strict = this.inModule || options.strict === true || this.strictDirective(this.pos); + this.potentialArrowAt = -1; + this.potentialArrowInForAwait = false; + this.yieldPos = this.awaitPos = this.awaitIdentPos = 0; + this.labels = []; + this.undefinedExports = /* @__PURE__ */ Object.create(null); + if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!") { + this.skipLineComment(2); + } + this.scopeStack = []; + this.enterScope( + this.options.sourceType === "commonjs" ? SCOPE_FUNCTION : SCOPE_TOP + ); + this.regexpState = null; + this.privateNameStack = []; + }; + var prototypeAccessors = { inFunction: { configurable: true }, inGenerator: { configurable: true }, inAsync: { configurable: true }, canAwait: { configurable: true }, allowReturn: { configurable: true }, allowSuper: { configurable: true }, allowDirectSuper: { configurable: true }, treatFunctionsAsVar: { configurable: true }, allowNewDotTarget: { configurable: true }, allowUsing: { configurable: true }, inClassStaticBlock: { configurable: true } }; + Parser.prototype.parse = function parse() { + var this$1$1 = this; + var node = this.options.program || this.startNode(); + this.nextToken(); + return this.catchStackOverflow(function() { + return this$1$1.parseTopLevel(node); + }); + }; + prototypeAccessors.inFunction.get = function() { + return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0; + }; + prototypeAccessors.inGenerator.get = function() { + return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0; + }; + prototypeAccessors.inAsync.get = function() { + return (this.currentVarScope().flags & SCOPE_ASYNC) > 0; + }; + prototypeAccessors.canAwait.get = function() { + for (var i = this.scopeStack.length - 1; i >= 0; i--) { + var ref2 = this.scopeStack[i]; + var flags = ref2.flags; + if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT)) { + return false; + } + if (flags & SCOPE_FUNCTION) { + return (flags & SCOPE_ASYNC) > 0; + } + } + return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction; + }; + prototypeAccessors.allowReturn.get = function() { + if (this.inFunction) { + return true; + } + if (this.options.allowReturnOutsideFunction && this.currentVarScope().flags & SCOPE_TOP) { + return true; + } + return false; + }; + prototypeAccessors.allowSuper.get = function() { + var ref2 = this.currentThisScope(); + var flags = ref2.flags; + return (flags & SCOPE_SUPER) > 0 || this.options.allowSuperOutsideMethod; + }; + prototypeAccessors.allowDirectSuper.get = function() { + return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0; + }; + prototypeAccessors.treatFunctionsAsVar.get = function() { + return this.treatFunctionsAsVarInScope(this.currentScope()); + }; + prototypeAccessors.allowNewDotTarget.get = function() { + for (var i = this.scopeStack.length - 1; i >= 0; i--) { + var ref2 = this.scopeStack[i]; + var flags = ref2.flags; + if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT) || flags & SCOPE_FUNCTION && !(flags & SCOPE_ARROW)) { + return true; + } + } + return false; + }; + prototypeAccessors.allowUsing.get = function() { + var ref2 = this.currentScope(); + var flags = ref2.flags; + if (flags & SCOPE_SWITCH) { + return false; + } + if (!this.inModule && flags & SCOPE_TOP) { + return false; + } + return true; + }; + prototypeAccessors.inClassStaticBlock.get = function() { + return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0; + }; + Parser.extend = function extend() { + var plugins = [], len = arguments.length; + while (len--) plugins[len] = arguments[len]; + var cls = this; + for (var i = 0; i < plugins.length; i++) { + cls = plugins[i](cls); + } + return cls; + }; + Parser.parse = function parse2(input, options) { + return new this(options, input).parse(); + }; + Parser.parseExpressionAt = function parseExpressionAt(input, pos, options) { + var parser = new this(options, input, pos); + parser.nextToken(); + return parser.parseExpression(); + }; + Parser.tokenizer = function tokenizer(input, options) { + return new this(options, input); + }; + Object.defineProperties(Parser.prototype, prototypeAccessors); + var pp$9 = Parser.prototype; + var literal = /^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/; + pp$9.strictDirective = function(start) { + if (this.options.ecmaVersion < 5) { + return false; + } + for (; ; ) { + skipWhiteSpace.lastIndex = start; + start += skipWhiteSpace.exec(this.input)[0].length; + var match = literal.exec(this.input.slice(start)); + if (!match) { + return false; + } + if ((match[1] || match[2]) === "use strict") { + skipWhiteSpace.lastIndex = start + match[0].length; + var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length; + var next = this.input.charAt(end); + return next === ";" || next === "}" || lineBreak.test(spaceAfter[0]) && !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "="); + } + start += match[0].length; + skipWhiteSpace.lastIndex = start; + start += skipWhiteSpace.exec(this.input)[0].length; + if (this.input[start] === ";") { + start++; + } + } + }; + pp$9.eat = function(type) { + if (this.type === type) { + this.next(); + return true; + } else { + return false; + } + }; + pp$9.isContextual = function(name) { + return this.type === types$1.name && this.value === name && !this.containsEsc; + }; + pp$9.eatContextual = function(name) { + if (!this.isContextual(name)) { + return false; + } + this.next(); + return true; + }; + pp$9.catchStackOverflow = function(f) { + try { + return f(); + } catch (e) { + if (e instanceof Error && (/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message) || /\btoo much recursion\b/i.test(e.message))) { + this.raise(this.start, "Not enough stack space to parse input"); + } else { + throw e; + } + } + }; + pp$9.expectContextual = function(name) { + if (!this.eatContextual(name)) { + this.unexpected(); + } + }; + pp$9.canInsertSemicolon = function() { + return this.type === types$1.eof || this.type === types$1.braceR || lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); + }; + pp$9.insertSemicolon = function() { + if (this.canInsertSemicolon()) { + if (this.options.onInsertedSemicolon) { + this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); + } + return true; + } + }; + pp$9.semicolon = function() { + if (!this.eat(types$1.semi) && !this.insertSemicolon()) { + this.unexpected(); + } + }; + pp$9.afterTrailingComma = function(tokType, notNext) { + if (this.type === tokType) { + if (this.options.onTrailingComma) { + this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); + } + if (!notNext) { + this.next(); + } + return true; + } + }; + pp$9.expect = function(type) { + this.eat(type) || this.unexpected(); + }; + pp$9.unexpected = function(pos) { + this.raise(pos != null ? pos : this.start, "Unexpected token"); + }; + var DestructuringErrors = function DestructuringErrors2() { + this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1; + }; + pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) { + if (!refDestructuringErrors) { + return; + } + if (refDestructuringErrors.trailingComma > -1) { + this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); + } + var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind; + if (parens > -1) { + this.raiseRecoverable(parens, isAssign ? "Assigning to rvalue" : "Parenthesized pattern"); + } + }; + pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) { + if (!refDestructuringErrors) { + return false; + } + var shorthandAssign = refDestructuringErrors.shorthandAssign; + var doubleProto = refDestructuringErrors.doubleProto; + if (!andThrow) { + return shorthandAssign >= 0 || doubleProto >= 0; + } + if (shorthandAssign >= 0) { + this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns"); + } + if (doubleProto >= 0) { + this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); + } + }; + pp$9.checkYieldAwaitInDefaultParams = function() { + if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos)) { + this.raise(this.yieldPos, "Yield expression cannot be a default value"); + } + if (this.awaitPos) { + this.raise(this.awaitPos, "Await expression cannot be a default value"); + } + }; + pp$9.isSimpleAssignTarget = function(expr) { + if (expr.type === "ParenthesizedExpression") { + return this.isSimpleAssignTarget(expr.expression); + } + return expr.type === "Identifier" || expr.type === "MemberExpression"; + }; + var pp$8 = Parser.prototype; + pp$8.parseTopLevel = function(node) { + var exports$1 = /* @__PURE__ */ Object.create(null); + if (!node.body) { + node.body = []; + } + while (this.type !== types$1.eof) { + var stmt = this.parseStatement(null, true, exports$1); + node.body.push(stmt); + } + if (this.inModule) { + for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1) { + var name = list[i]; + this.raiseRecoverable(this.undefinedExports[name].start, "Export '" + name + "' is not defined"); + } + } + this.adaptDirectivePrologue(node.body); + this.next(); + node.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType; + return this.finishNode(node, "Program"); + }; + var loopLabel = { kind: "loop" }; + var switchLabel = { kind: "switch" }; + pp$8.isLet = function(context) { + if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { + return false; + } + skipWhiteSpace.lastIndex = this.pos; + var skip = skipWhiteSpace.exec(this.input); + var next = this.pos + skip[0].length, nextCh = this.fullCharCodeAt(next); + if (nextCh === 91 || nextCh === 92) { + return true; + } + if (context) { + return false; + } + if (nextCh === 123) { + return true; + } + if (isIdentifierStart(nextCh)) { + var start = next; + do { + next += nextCh <= 65535 ? 1 : 2; + } while (isIdentifierChar(nextCh = this.fullCharCodeAt(next))); + if (nextCh === 92) { + return true; + } + var ident = this.input.slice(start, next); + if (!keywordRelationalOperator.test(ident)) { + return true; + } + } + return false; + }; + pp$8.isAsyncFunction = function() { + if (this.options.ecmaVersion < 8 || !this.isContextual("async")) { + return false; + } + skipWhiteSpace.lastIndex = this.pos; + var skip = skipWhiteSpace.exec(this.input); + var next = this.pos + skip[0].length, after; + return !lineBreak.test(this.input.slice(this.pos, next)) && this.input.slice(next, next + 8) === "function" && (next + 8 === this.input.length || !(isIdentifierChar(after = this.fullCharCodeAt(next + 8)) || after === 92)); + }; + pp$8.isUsingKeyword = function(isAwaitUsing, isFor) { + if (this.options.ecmaVersion < 17 || !this.isContextual(isAwaitUsing ? "await" : "using")) { + return false; + } + skipWhiteSpace.lastIndex = this.pos; + var skip = skipWhiteSpace.exec(this.input); + var next = this.pos + skip[0].length; + if (lineBreak.test(this.input.slice(this.pos, next))) { + return false; + } + if (isAwaitUsing) { + var usingEndPos = next + 5, after; + if (this.input.slice(next, usingEndPos) !== "using" || usingEndPos === this.input.length || isIdentifierChar(after = this.fullCharCodeAt(usingEndPos)) || after === 92) { + return false; + } + skipWhiteSpace.lastIndex = usingEndPos; + var skipAfterUsing = skipWhiteSpace.exec(this.input); + next = usingEndPos + skipAfterUsing[0].length; + if (skipAfterUsing && lineBreak.test(this.input.slice(usingEndPos, next))) { + return false; + } + } + var ch = this.fullCharCodeAt(next); + if (!isIdentifierStart(ch) && ch !== 92) { + return false; + } + var idStart = next; + do { + next += ch <= 65535 ? 1 : 2; + } while (isIdentifierChar(ch = this.fullCharCodeAt(next))); + if (ch === 92) { + return true; + } + var id = this.input.slice(idStart, next); + if (keywordRelationalOperator.test(id)) { + return false; + } + if (isFor && !isAwaitUsing && id === "of") { + skipWhiteSpace.lastIndex = next; + var skipAfterOf = skipWhiteSpace.exec(this.input); + next = next + skipAfterOf[0].length; + if (this.input.charCodeAt(next) !== 61 || // Check for ==, === and => operators + (ch = this.input.charCodeAt(next + 1)) === 61 || ch === 62) { + return false; + } + } + return true; + }; + pp$8.isAwaitUsing = function(isFor) { + return this.isUsingKeyword(true, isFor); + }; + pp$8.isUsing = function(isFor) { + return this.isUsingKeyword(false, isFor); + }; + pp$8.parseStatement = function(context, topLevel, exports$1) { + var starttype = this.type, node = this.startNode(), kind; + if (this.isLet(context)) { + starttype = types$1._var; + kind = "let"; + } + switch (starttype) { + case types$1._break: + case types$1._continue: + return this.parseBreakContinueStatement(node, starttype.keyword); + case types$1._debugger: + return this.parseDebuggerStatement(node); + case types$1._do: + return this.parseDoStatement(node); + case types$1._for: + return this.parseForStatement(node); + case types$1._function: + if (context && (this.strict || context !== "if" && context !== "label") && this.options.ecmaVersion >= 6) { + this.unexpected(); + } + return this.parseFunctionStatement(node, false, !context); + case types$1._class: + if (context) { + this.unexpected(); + } + return this.parseClass(node, true); + case types$1._if: + return this.parseIfStatement(node); + case types$1._return: + return this.parseReturnStatement(node); + case types$1._switch: + return this.parseSwitchStatement(node); + case types$1._throw: + return this.parseThrowStatement(node); + case types$1._try: + return this.parseTryStatement(node); + case types$1._const: + case types$1._var: + kind = kind || this.value; + if (context && kind !== "var") { + this.unexpected(); + } + return this.parseVarStatement(node, kind); + case types$1._while: + return this.parseWhileStatement(node); + case types$1._with: + return this.parseWithStatement(node); + case types$1.braceL: + return this.parseBlock(true, node); + case types$1.semi: + return this.parseEmptyStatement(node); + case types$1._export: + case types$1._import: + if (this.options.ecmaVersion > 10 && starttype === types$1._import) { + skipWhiteSpace.lastIndex = this.pos; + var skip = skipWhiteSpace.exec(this.input); + var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next); + if (nextCh === 40 || nextCh === 46) { + return this.parseExpressionStatement(node, this.parseExpression()); + } + } + if (!this.options.allowImportExportEverywhere) { + if (!topLevel) { + this.raise(this.start, "'import' and 'export' may only appear at the top level"); + } + if (!this.inModule) { + this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); + } + } + return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports$1); + // If the statement does not start with a statement keyword or a + // brace, it's an ExpressionStatement or LabeledStatement. We + // simply start parsing an expression, and afterwards, if the + // next token is a colon and the expression was a simple + // Identifier node, we switch to interpreting it as a label. + default: + if (this.isAsyncFunction()) { + if (context) { + this.unexpected(); + } + this.next(); + return this.parseFunctionStatement(node, true, !context); + } + var usingKind = this.isAwaitUsing(false) ? "await using" : this.isUsing(false) ? "using" : null; + if (usingKind) { + if (!this.allowUsing) { + this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"); + } + if (context) { + this.raise(this.start, "Using declaration is not allowed in single-statement positions"); + } + if (usingKind === "await using") { + if (!this.canAwait) { + this.raise(this.start, "Await using cannot appear outside of async function"); + } + this.next(); + } + this.next(); + this.parseVar(node, false, usingKind); + this.semicolon(); + return this.finishNode(node, "VariableDeclaration"); + } + var maybeName = this.value, expr = this.parseExpression(); + if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) { + return this.parseLabeledStatement(node, maybeName, expr, context); + } else { + return this.parseExpressionStatement(node, expr); + } + } + }; + pp$8.parseBreakContinueStatement = function(node, keyword) { + var isBreak = keyword === "break"; + this.next(); + if (this.eat(types$1.semi) || this.insertSemicolon()) { + node.label = null; + } else if (this.type !== types$1.name) { + this.unexpected(); + } else { + node.label = this.parseIdent(); + this.semicolon(); + } + var i = 0; + for (; i < this.labels.length; ++i) { + var lab = this.labels[i]; + if (node.label == null || lab.name === node.label.name) { + if (lab.kind != null && (isBreak || lab.kind === "loop")) { + break; + } + if (node.label && isBreak) { + break; + } + } + } + if (i === this.labels.length) { + this.raise(node.start, "Unsyntactic " + keyword); + } + return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement"); + }; + pp$8.parseDebuggerStatement = function(node) { + this.next(); + this.semicolon(); + return this.finishNode(node, "DebuggerStatement"); + }; + pp$8.parseDoStatement = function(node) { + this.next(); + this.labels.push(loopLabel); + node.body = this.parseStatement("do"); + this.labels.pop(); + this.expect(types$1._while); + node.test = this.parseParenExpression(); + if (this.options.ecmaVersion >= 6) { + this.eat(types$1.semi); + } else { + this.semicolon(); + } + return this.finishNode(node, "DoWhileStatement"); + }; + pp$8.parseForStatement = function(node) { + this.next(); + var awaitAt = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1; + this.labels.push(loopLabel); + this.enterScope(0); + this.expect(types$1.parenL); + if (this.type === types$1.semi) { + if (awaitAt > -1) { + this.unexpected(awaitAt); + } + return this.parseFor(node, null); + } + var isLet = this.isLet(); + if (this.type === types$1._var || this.type === types$1._const || isLet) { + var init$1 = this.startNode(), kind = isLet ? "let" : this.value; + this.next(); + this.parseVar(init$1, true, kind); + this.finishNode(init$1, "VariableDeclaration"); + return this.parseForAfterInit(node, init$1, awaitAt); + } + var startsWithLet = this.isContextual("let"), isForOf = false; + var usingKind = this.isUsing(true) ? "using" : this.isAwaitUsing(true) ? "await using" : null; + if (usingKind) { + var init$2 = this.startNode(); + this.next(); + if (usingKind === "await using") { + if (!this.canAwait) { + this.raise(this.start, "Await using cannot appear outside of async function"); + } + this.next(); + } + this.parseVar(init$2, true, usingKind); + this.finishNode(init$2, "VariableDeclaration"); + return this.parseForAfterInit(node, init$2, awaitAt); + } + var containsEsc = this.containsEsc; + var refDestructuringErrors = new DestructuringErrors(); + var initPos = this.start; + var init = awaitAt > -1 ? this.parseExprSubscripts(refDestructuringErrors, "await") : this.parseExpression(true, refDestructuringErrors); + if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) { + if (awaitAt > -1) { + if (this.type === types$1._in) { + this.unexpected(awaitAt); + } + node.await = true; + } else if (isForOf && this.options.ecmaVersion >= 8) { + if (init.start === initPos && !containsEsc && init.type === "Identifier" && init.name === "async") { + this.unexpected(); + } else if (this.options.ecmaVersion >= 9) { + node.await = false; + } + } + if (startsWithLet && isForOf) { + this.raise(init.start, "The left-hand side of a for-of loop may not start with 'let'."); + } + this.toAssignable(init, false, refDestructuringErrors); + this.checkLValPattern(init); + return this.parseForIn(node, init); + } else { + this.checkExpressionErrors(refDestructuringErrors, true); + } + if (awaitAt > -1) { + this.unexpected(awaitAt); + } + return this.parseFor(node, init); + }; + pp$8.parseForAfterInit = function(node, init, awaitAt) { + if ((this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && init.declarations.length === 1) { + if (this.type === types$1._in) { + if ((init.kind === "using" || init.kind === "await using") && !init.declarations[0].init) { + this.raise(this.start, "Using declaration is not allowed in for-in loops"); + } + if (this.options.ecmaVersion >= 9 && awaitAt > -1) { + this.unexpected(awaitAt); + } + } else if (this.options.ecmaVersion >= 9) { + node.await = awaitAt > -1; + } + return this.parseForIn(node, init); + } + if (awaitAt > -1) { + this.unexpected(awaitAt); + } + return this.parseFor(node, init); + }; + pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) { + this.next(); + return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync); + }; + pp$8.parseIfStatement = function(node) { + this.next(); + node.test = this.parseParenExpression(); + node.consequent = this.parseStatement("if"); + node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null; + return this.finishNode(node, "IfStatement"); + }; + pp$8.parseReturnStatement = function(node) { + if (!this.allowReturn) { + this.raise(this.start, "'return' outside of function"); + } + this.next(); + if (this.eat(types$1.semi) || this.insertSemicolon()) { + node.argument = null; + } else { + node.argument = this.parseExpression(); + this.semicolon(); + } + return this.finishNode(node, "ReturnStatement"); + }; + pp$8.parseSwitchStatement = function(node) { + this.next(); + node.discriminant = this.parseParenExpression(); + node.cases = []; + this.expect(types$1.braceL); + this.labels.push(switchLabel); + this.enterScope(SCOPE_SWITCH); + var cur; + for (var sawDefault = false; this.type !== types$1.braceR; ) { + if (this.type === types$1._case || this.type === types$1._default) { + var isCase = this.type === types$1._case; + if (cur) { + this.finishNode(cur, "SwitchCase"); + } + node.cases.push(cur = this.startNode()); + cur.consequent = []; + this.next(); + if (isCase) { + cur.test = this.parseExpression(); + } else { + if (sawDefault) { + this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"); + } + sawDefault = true; + cur.test = null; + } + this.expect(types$1.colon); + } else { + if (!cur) { + this.unexpected(); + } + cur.consequent.push(this.parseStatement(null)); + } + } + this.exitScope(); + if (cur) { + this.finishNode(cur, "SwitchCase"); + } + this.next(); + this.labels.pop(); + return this.finishNode(node, "SwitchStatement"); + }; + pp$8.parseThrowStatement = function(node) { + this.next(); + if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) { + this.raise(this.lastTokEnd, "Illegal newline after throw"); + } + node.argument = this.parseExpression(); + this.semicolon(); + return this.finishNode(node, "ThrowStatement"); + }; + var empty$1 = []; + pp$8.parseCatchClauseParam = function() { + var param = this.parseBindingAtom(); + var simple = param.type === "Identifier"; + this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0); + this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL); + this.expect(types$1.parenR); + return param; + }; + pp$8.parseTryStatement = function(node) { + this.next(); + node.block = this.parseBlock(); + node.handler = null; + if (this.type === types$1._catch) { + var clause = this.startNode(); + this.next(); + if (this.eat(types$1.parenL)) { + clause.param = this.parseCatchClauseParam(); + } else { + if (this.options.ecmaVersion < 10) { + this.unexpected(); + } + clause.param = null; + this.enterScope(0); + } + clause.body = this.parseBlock(false); + this.exitScope(); + node.handler = this.finishNode(clause, "CatchClause"); + } + node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null; + if (!node.handler && !node.finalizer) { + this.raise(node.start, "Missing catch or finally clause"); + } + return this.finishNode(node, "TryStatement"); + }; + pp$8.parseVarStatement = function(node, kind, allowMissingInitializer) { + this.next(); + this.parseVar(node, false, kind, allowMissingInitializer); + this.semicolon(); + return this.finishNode(node, "VariableDeclaration"); + }; + pp$8.parseWhileStatement = function(node) { + this.next(); + node.test = this.parseParenExpression(); + this.labels.push(loopLabel); + node.body = this.parseStatement("while"); + this.labels.pop(); + return this.finishNode(node, "WhileStatement"); + }; + pp$8.parseWithStatement = function(node) { + if (this.strict) { + this.raise(this.start, "'with' in strict mode"); + } + this.next(); + node.object = this.parseParenExpression(); + node.body = this.parseStatement("with"); + return this.finishNode(node, "WithStatement"); + }; + pp$8.parseEmptyStatement = function(node) { + this.next(); + return this.finishNode(node, "EmptyStatement"); + }; + pp$8.parseLabeledStatement = function(node, maybeName, expr, context) { + for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1) { + var label = list[i$1]; + if (label.name === maybeName) { + this.raise(expr.start, "Label '" + maybeName + "' is already declared"); + } + } + var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null; + for (var i = this.labels.length - 1; i >= 0; i--) { + var label$1 = this.labels[i]; + if (label$1.statementStart === node.start) { + label$1.statementStart = this.start; + label$1.kind = kind; + } else { + break; + } + } + this.labels.push({ name: maybeName, kind, statementStart: this.start }); + node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label"); + this.labels.pop(); + node.label = expr; + return this.finishNode(node, "LabeledStatement"); + }; + pp$8.parseExpressionStatement = function(node, expr) { + node.expression = expr; + this.semicolon(); + return this.finishNode(node, "ExpressionStatement"); + }; + pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) { + if (createNewLexicalScope === void 0) createNewLexicalScope = true; + if (node === void 0) node = this.startNode(); + node.body = []; + this.expect(types$1.braceL); + if (createNewLexicalScope) { + this.enterScope(0); + } + while (this.type !== types$1.braceR) { + var stmt = this.parseStatement(null); + node.body.push(stmt); + } + if (exitStrict) { + this.strict = false; + } + this.next(); + if (createNewLexicalScope) { + this.exitScope(); + } + return this.finishNode(node, "BlockStatement"); + }; + pp$8.parseFor = function(node, init) { + node.init = init; + this.expect(types$1.semi); + node.test = this.type === types$1.semi ? null : this.parseExpression(); + this.expect(types$1.semi); + node.update = this.type === types$1.parenR ? null : this.parseExpression(); + this.expect(types$1.parenR); + node.body = this.parseStatement("for"); + this.exitScope(); + this.labels.pop(); + return this.finishNode(node, "ForStatement"); + }; + pp$8.parseForIn = function(node, init) { + var isForIn = this.type === types$1._in; + this.next(); + if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || this.options.ecmaVersion < 8 || this.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) { + this.raise( + init.start, + (isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer" + ); + } + node.left = init; + node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign(); + this.expect(types$1.parenR); + node.body = this.parseStatement("for"); + this.exitScope(); + this.labels.pop(); + return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement"); + }; + pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) { + node.declarations = []; + node.kind = kind; + for (; ; ) { + var decl = this.startNode(); + this.parseVarId(decl, kind); + if (this.eat(types$1.eq)) { + decl.init = this.parseMaybeAssign(isFor); + } else if (!allowMissingInitializer && kind === "const" && !(this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) { + this.unexpected(); + } else if (!allowMissingInitializer && (kind === "using" || kind === "await using") && this.options.ecmaVersion >= 17 && this.type !== types$1._in && !this.isContextual("of")) { + this.raise(this.lastTokEnd, "Missing initializer in " + kind + " declaration"); + } else if (!allowMissingInitializer && decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) { + this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value"); + } else { + decl.init = null; + } + node.declarations.push(this.finishNode(decl, "VariableDeclarator")); + if (!this.eat(types$1.comma)) { + break; + } + } + return node; + }; + pp$8.parseVarId = function(decl, kind) { + decl.id = kind === "using" || kind === "await using" ? this.parseIdent() : this.parseBindingAtom(); + this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false); + }; + var FUNC_STATEMENT = 1; + var FUNC_HANGING_STATEMENT = 2; + var FUNC_NULLABLE_ID = 4; + pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) { + this.initFunction(node); + if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) { + if (this.type === types$1.star && statement & FUNC_HANGING_STATEMENT) { + this.unexpected(); + } + node.generator = this.eat(types$1.star); + } + if (this.options.ecmaVersion >= 8) { + node.async = !!isAsync; + } + if (statement & FUNC_STATEMENT) { + node.id = statement & FUNC_NULLABLE_ID && this.type !== types$1.name ? null : this.parseIdent(); + if (node.id && !(statement & FUNC_HANGING_STATEMENT)) { + this.checkLValSimple(node.id, this.strict || node.generator || node.async ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); + } + } + var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + this.yieldPos = 0; + this.awaitPos = 0; + this.awaitIdentPos = 0; + this.enterScope(functionFlags(node.async, node.generator)); + if (!(statement & FUNC_STATEMENT)) { + node.id = this.type === types$1.name ? this.parseIdent() : null; + } + this.parseFunctionParams(node); + this.parseFunctionBody(node, allowExpressionBody, false, forInit); + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; + return this.finishNode(node, statement & FUNC_STATEMENT ? "FunctionDeclaration" : "FunctionExpression"); + }; + pp$8.parseFunctionParams = function(node) { + this.expect(types$1.parenL); + node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); + this.checkYieldAwaitInDefaultParams(); + }; + pp$8.parseClass = function(node, isStatement) { + this.next(); + var oldStrict = this.strict; + this.strict = true; + this.parseClassId(node, isStatement); + this.parseClassSuper(node); + var privateNameMap = this.enterClassBody(); + var classBody = this.startNode(); + var hadConstructor = false; + classBody.body = []; + this.expect(types$1.braceL); + while (this.type !== types$1.braceR) { + var element = this.parseClassElement(node.superClass !== null); + if (element) { + classBody.body.push(element); + if (element.type === "MethodDefinition" && element.kind === "constructor") { + if (hadConstructor) { + this.raiseRecoverable(element.start, "Duplicate constructor in the same class"); + } + hadConstructor = true; + } else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) { + this.raiseRecoverable(element.key.start, "Identifier '#" + element.key.name + "' has already been declared"); + } + } + } + this.strict = oldStrict; + this.next(); + node.body = this.finishNode(classBody, "ClassBody"); + this.exitClassBody(); + return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression"); + }; + pp$8.parseClassElement = function(constructorAllowsSuper) { + if (this.eat(types$1.semi)) { + return null; + } + var ecmaVersion = this.options.ecmaVersion; + var node = this.startNode(); + var keyName = ""; + var isGenerator = false; + var isAsync = false; + var kind = "method"; + var isStatic = false; + if (this.eatContextual("static")) { + if (ecmaVersion >= 13 && this.eat(types$1.braceL)) { + this.parseClassStaticBlock(node); + return node; + } + if (this.isClassElementNameStart() || this.type === types$1.star) { + isStatic = true; + } else { + keyName = "static"; + } + } + node.static = isStatic; + if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) { + if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) { + isAsync = true; + } else { + keyName = "async"; + } + } + if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) { + isGenerator = true; + } + if (!keyName && !isAsync && !isGenerator) { + var lastValue = this.value; + if (this.eatContextual("get") || this.eatContextual("set")) { + if (this.isClassElementNameStart()) { + kind = lastValue; + } else { + keyName = lastValue; + } + } + } + if (keyName) { + node.computed = false; + node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc); + node.key.name = keyName; + this.finishNode(node.key, "Identifier"); + } else { + this.parseClassElementName(node); + } + if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) { + var isConstructor = !node.static && checkKeyName(node, "constructor"); + var allowsDirectSuper = isConstructor && constructorAllowsSuper; + if (isConstructor && kind !== "method") { + this.raise(node.key.start, "Constructor can't have get/set modifier"); + } + node.kind = isConstructor ? "constructor" : kind; + this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper); + } else { + this.parseClassField(node); + } + return node; + }; + pp$8.isClassElementNameStart = function() { + return this.type === types$1.name || this.type === types$1.privateId || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword; + }; + pp$8.parseClassElementName = function(element) { + if (this.type === types$1.privateId) { + if (this.value === "constructor") { + this.raise(this.start, "Classes can't have an element named '#constructor'"); + } + element.computed = false; + element.key = this.parsePrivateIdent(); + } else { + this.parsePropertyName(element); + } + }; + pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) { + var key = method.key; + if (method.kind === "constructor") { + if (isGenerator) { + this.raise(key.start, "Constructor can't be a generator"); + } + if (isAsync) { + this.raise(key.start, "Constructor can't be an async method"); + } + } else if (method.static && checkKeyName(method, "prototype")) { + this.raise(key.start, "Classes may not have a static property named prototype"); + } + var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper); + if (method.kind === "get" && value.params.length !== 0) { + this.raiseRecoverable(value.start, "getter should have no params"); + } + if (method.kind === "set" && value.params.length !== 1) { + this.raiseRecoverable(value.start, "setter should have exactly one param"); + } + if (method.kind === "set" && value.params[0].type === "RestElement") { + this.raiseRecoverable(value.params[0].start, "Setter cannot use rest params"); + } + return this.finishNode(method, "MethodDefinition"); + }; + pp$8.parseClassField = function(field) { + if (checkKeyName(field, "constructor")) { + this.raise(field.key.start, "Classes can't have a field named 'constructor'"); + } else if (field.static && checkKeyName(field, "prototype")) { + this.raise(field.key.start, "Classes can't have a static field named 'prototype'"); + } + if (this.eat(types$1.eq)) { + this.enterScope(SCOPE_CLASS_FIELD_INIT | SCOPE_SUPER); + field.value = this.parseMaybeAssign(); + this.exitScope(); + } else { + field.value = null; + } + this.semicolon(); + return this.finishNode(field, "PropertyDefinition"); + }; + pp$8.parseClassStaticBlock = function(node) { + node.body = []; + var oldLabels = this.labels; + this.labels = []; + this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER); + while (this.type !== types$1.braceR) { + var stmt = this.parseStatement(null); + node.body.push(stmt); + } + this.next(); + this.exitScope(); + this.labels = oldLabels; + return this.finishNode(node, "StaticBlock"); + }; + pp$8.parseClassId = function(node, isStatement) { + if (this.type === types$1.name) { + node.id = this.parseIdent(); + if (isStatement) { + this.checkLValSimple(node.id, BIND_LEXICAL, false); + } + } else { + if (isStatement === true) { + this.unexpected(); + } + node.id = null; + } + }; + pp$8.parseClassSuper = function(node) { + node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(null, false) : null; + }; + pp$8.enterClassBody = function() { + var element = { declared: /* @__PURE__ */ Object.create(null), used: [] }; + this.privateNameStack.push(element); + return element.declared; + }; + pp$8.exitClassBody = function() { + var ref2 = this.privateNameStack.pop(); + var declared = ref2.declared; + var used = ref2.used; + if (!this.options.checkPrivateFields) { + return; + } + var len = this.privateNameStack.length; + var parent = len === 0 ? null : this.privateNameStack[len - 1]; + for (var i = 0; i < used.length; ++i) { + var id = used[i]; + if (!hasOwn(declared, id.name)) { + if (parent) { + parent.used.push(id); + } else { + this.raiseRecoverable(id.start, "Private field '#" + id.name + "' must be declared in an enclosing class"); + } + } + } + }; + function isPrivateNameConflicted(privateNameMap, element) { + var name = element.key.name; + var curr = privateNameMap[name]; + var next = "true"; + if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) { + next = (element.static ? "s" : "i") + element.kind; + } + if (curr === "iget" && next === "iset" || curr === "iset" && next === "iget" || curr === "sget" && next === "sset" || curr === "sset" && next === "sget") { + privateNameMap[name] = "true"; + return false; + } else if (!curr) { + privateNameMap[name] = next; + return false; + } else { + return true; + } + } + function checkKeyName(node, name) { + var computed = node.computed; + var key = node.key; + return !computed && (key.type === "Identifier" && key.name === name || key.type === "Literal" && key.value === name); + } + pp$8.parseExportAllDeclaration = function(node, exports$1) { + if (this.options.ecmaVersion >= 11) { + if (this.eatContextual("as")) { + node.exported = this.parseModuleExportName(); + this.checkExport(exports$1, node.exported, this.lastTokStart); + } else { + node.exported = null; + } + } + this.expectContextual("from"); + if (this.type !== types$1.string) { + this.unexpected(); + } + node.source = this.parseExprAtom(); + if (this.options.ecmaVersion >= 16) { + node.attributes = this.parseWithClause(); + } + this.semicolon(); + return this.finishNode(node, "ExportAllDeclaration"); + }; + pp$8.parseExport = function(node, exports$1) { + this.next(); + if (this.eat(types$1.star)) { + return this.parseExportAllDeclaration(node, exports$1); + } + if (this.eat(types$1._default)) { + this.checkExport(exports$1, "default", this.lastTokStart); + node.declaration = this.parseExportDefaultDeclaration(); + return this.finishNode(node, "ExportDefaultDeclaration"); + } + if (this.shouldParseExportStatement()) { + node.declaration = this.parseExportDeclaration(node); + if (node.declaration.type === "VariableDeclaration") { + this.checkVariableExport(exports$1, node.declaration.declarations); + } else { + this.checkExport(exports$1, node.declaration.id, node.declaration.id.start); + } + node.specifiers = []; + node.source = null; + if (this.options.ecmaVersion >= 16) { + node.attributes = []; + } + } else { + node.declaration = null; + node.specifiers = this.parseExportSpecifiers(exports$1); + if (this.eatContextual("from")) { + if (this.type !== types$1.string) { + this.unexpected(); + } + node.source = this.parseExprAtom(); + if (this.options.ecmaVersion >= 16) { + node.attributes = this.parseWithClause(); + } + } else { + for (var i = 0, list = node.specifiers; i < list.length; i += 1) { + var spec = list[i]; + this.checkUnreserved(spec.local); + this.checkLocalExport(spec.local); + if (spec.local.type === "Literal") { + this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`."); + } + } + node.source = null; + if (this.options.ecmaVersion >= 16) { + node.attributes = []; + } + } + this.semicolon(); + } + return this.finishNode(node, "ExportNamedDeclaration"); + }; + pp$8.parseExportDeclaration = function(node) { + return this.parseStatement(null); + }; + pp$8.parseExportDefaultDeclaration = function() { + var isAsync; + if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) { + var fNode = this.startNode(); + this.next(); + if (isAsync) { + this.next(); + } + return this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync); + } else if (this.type === types$1._class) { + var cNode = this.startNode(); + return this.parseClass(cNode, "nullableID"); + } else { + var declaration = this.parseMaybeAssign(); + this.semicolon(); + return declaration; + } + }; + pp$8.checkExport = function(exports$1, name, pos) { + if (!exports$1) { + return; + } + if (typeof name !== "string") { + name = name.type === "Identifier" ? name.name : name.value; + } + if (hasOwn(exports$1, name)) { + this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); + } + exports$1[name] = true; + }; + pp$8.checkPatternExport = function(exports$1, pat) { + var type = pat.type; + if (type === "Identifier") { + this.checkExport(exports$1, pat, pat.start); + } else if (type === "ObjectPattern") { + for (var i = 0, list = pat.properties; i < list.length; i += 1) { + var prop = list[i]; + this.checkPatternExport(exports$1, prop); + } + } else if (type === "ArrayPattern") { + for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) { + var elt = list$1[i$1]; + if (elt) { + this.checkPatternExport(exports$1, elt); + } + } + } else if (type === "Property") { + this.checkPatternExport(exports$1, pat.value); + } else if (type === "AssignmentPattern") { + this.checkPatternExport(exports$1, pat.left); + } else if (type === "RestElement") { + this.checkPatternExport(exports$1, pat.argument); + } + }; + pp$8.checkVariableExport = function(exports$1, decls) { + if (!exports$1) { + return; + } + for (var i = 0, list = decls; i < list.length; i += 1) { + var decl = list[i]; + this.checkPatternExport(exports$1, decl.id); + } + }; + pp$8.shouldParseExportStatement = function() { + return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction(); + }; + pp$8.parseExportSpecifier = function(exports$1) { + var node = this.startNode(); + node.local = this.parseModuleExportName(); + node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local; + this.checkExport( + exports$1, + node.exported, + node.exported.start + ); + return this.finishNode(node, "ExportSpecifier"); + }; + pp$8.parseExportSpecifiers = function(exports$1) { + var nodes = [], first = true; + this.expect(types$1.braceL); + while (!this.eat(types$1.braceR)) { + if (!first) { + this.expect(types$1.comma); + if (this.afterTrailingComma(types$1.braceR)) { + break; + } + } else { + first = false; + } + nodes.push(this.parseExportSpecifier(exports$1)); + } + return nodes; + }; + pp$8.parseImport = function(node) { + this.next(); + if (this.type === types$1.string) { + node.specifiers = empty$1; + node.source = this.parseExprAtom(); + } else { + node.specifiers = this.parseImportSpecifiers(); + this.expectContextual("from"); + node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected(); + } + if (this.options.ecmaVersion >= 16) { + node.attributes = this.parseWithClause(); + } + this.semicolon(); + return this.finishNode(node, "ImportDeclaration"); + }; + pp$8.parseImportSpecifier = function() { + var node = this.startNode(); + node.imported = this.parseModuleExportName(); + if (this.eatContextual("as")) { + node.local = this.parseIdent(); + } else { + this.checkUnreserved(node.imported); + node.local = node.imported; + } + this.checkLValSimple(node.local, BIND_LEXICAL); + return this.finishNode(node, "ImportSpecifier"); + }; + pp$8.parseImportDefaultSpecifier = function() { + var node = this.startNode(); + node.local = this.parseIdent(); + this.checkLValSimple(node.local, BIND_LEXICAL); + return this.finishNode(node, "ImportDefaultSpecifier"); + }; + pp$8.parseImportNamespaceSpecifier = function() { + var node = this.startNode(); + this.next(); + this.expectContextual("as"); + node.local = this.parseIdent(); + this.checkLValSimple(node.local, BIND_LEXICAL); + return this.finishNode(node, "ImportNamespaceSpecifier"); + }; + pp$8.parseImportSpecifiers = function() { + var nodes = [], first = true; + if (this.type === types$1.name) { + nodes.push(this.parseImportDefaultSpecifier()); + if (!this.eat(types$1.comma)) { + return nodes; + } + } + if (this.type === types$1.star) { + nodes.push(this.parseImportNamespaceSpecifier()); + return nodes; + } + this.expect(types$1.braceL); + while (!this.eat(types$1.braceR)) { + if (!first) { + this.expect(types$1.comma); + if (this.afterTrailingComma(types$1.braceR)) { + break; + } + } else { + first = false; + } + nodes.push(this.parseImportSpecifier()); + } + return nodes; + }; + pp$8.parseWithClause = function() { + var nodes = []; + if (!this.eat(types$1._with)) { + return nodes; + } + this.expect(types$1.braceL); + var attributeKeys = {}; + var first = true; + while (!this.eat(types$1.braceR)) { + if (!first) { + this.expect(types$1.comma); + if (this.afterTrailingComma(types$1.braceR)) { + break; + } + } else { + first = false; + } + var attr = this.parseImportAttribute(); + var keyName = attr.key.type === "Identifier" ? attr.key.name : attr.key.value; + if (hasOwn(attributeKeys, keyName)) { + this.raiseRecoverable(attr.key.start, "Duplicate attribute key '" + keyName + "'"); + } + attributeKeys[keyName] = true; + nodes.push(attr); + } + return nodes; + }; + pp$8.parseImportAttribute = function() { + var node = this.startNode(); + node.key = this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never"); + this.expect(types$1.colon); + if (this.type !== types$1.string) { + this.unexpected(); + } + node.value = this.parseExprAtom(); + return this.finishNode(node, "ImportAttribute"); + }; + pp$8.parseModuleExportName = function() { + if (this.options.ecmaVersion >= 13 && this.type === types$1.string) { + var stringLiteral = this.parseLiteral(this.value); + if (loneSurrogate.test(stringLiteral.value)) { + this.raise(stringLiteral.start, "An export name cannot include a lone surrogate."); + } + return stringLiteral; + } + return this.parseIdent(true); + }; + pp$8.adaptDirectivePrologue = function(statements) { + for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) { + statements[i].directive = statements[i].expression.raw.slice(1, -1); + } + }; + pp$8.isDirectiveCandidate = function(statement) { + return this.options.ecmaVersion >= 5 && statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" && // Reject parenthesized strings. + (this.input[statement.start] === '"' || this.input[statement.start] === "'"); + }; + var pp$7 = Parser.prototype; + pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) { + if (this.options.ecmaVersion >= 6 && node) { + switch (node.type) { + case "Identifier": + if (this.inAsync && node.name === "await") { + this.raise(node.start, "Cannot use 'await' as identifier inside an async function"); + } + break; + case "ObjectPattern": + case "ArrayPattern": + case "AssignmentPattern": + case "RestElement": + break; + case "ObjectExpression": + node.type = "ObjectPattern"; + if (refDestructuringErrors) { + this.checkPatternErrors(refDestructuringErrors, true); + } + for (var i = 0, list = node.properties; i < list.length; i += 1) { + var prop = list[i]; + this.toAssignable(prop, isBinding); + if (prop.type === "RestElement" && (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")) { + this.raise(prop.argument.start, "Unexpected token"); + } + } + break; + case "Property": + if (node.kind !== "init") { + this.raise(node.key.start, "Object pattern can't contain getter or setter"); + } + this.toAssignable(node.value, isBinding); + break; + case "ArrayExpression": + node.type = "ArrayPattern"; + if (refDestructuringErrors) { + this.checkPatternErrors(refDestructuringErrors, true); + } + this.toAssignableList(node.elements, isBinding); + break; + case "SpreadElement": + node.type = "RestElement"; + this.toAssignable(node.argument, isBinding); + if (node.argument.type === "AssignmentPattern") { + this.raise(node.argument.start, "Rest elements cannot have a default value"); + } + break; + case "AssignmentExpression": + if (node.operator !== "=") { + this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); + } + node.type = "AssignmentPattern"; + delete node.operator; + this.toAssignable(node.left, isBinding); + break; + case "ParenthesizedExpression": + this.toAssignable(node.expression, isBinding, refDestructuringErrors); + break; + case "ChainExpression": + this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side"); + break; + case "MemberExpression": + if (!isBinding) { + break; + } + default: + this.raise(node.start, "Assigning to rvalue"); + } + } else if (refDestructuringErrors) { + this.checkPatternErrors(refDestructuringErrors, true); + } + return node; + }; + pp$7.toAssignableList = function(exprList, isBinding) { + var end = exprList.length; + for (var i = 0; i < end; i++) { + var elt = exprList[i]; + if (elt) { + this.toAssignable(elt, isBinding); + } + } + if (end) { + var last = exprList[end - 1]; + if (this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier") { + this.unexpected(last.argument.start); + } + } + return exprList; + }; + pp$7.parseSpread = function(refDestructuringErrors) { + var node = this.startNode(); + this.next(); + node.argument = this.parseMaybeAssign(false, refDestructuringErrors); + return this.finishNode(node, "SpreadElement"); + }; + pp$7.parseRestBinding = function() { + var node = this.startNode(); + this.next(); + if (this.options.ecmaVersion === 6 && this.type !== types$1.name) { + this.unexpected(); + } + node.argument = this.parseBindingAtom(); + return this.finishNode(node, "RestElement"); + }; + pp$7.parseBindingAtom = function() { + if (this.options.ecmaVersion >= 6) { + switch (this.type) { + case types$1.bracketL: + var node = this.startNode(); + this.next(); + node.elements = this.parseBindingList(types$1.bracketR, true, true); + return this.finishNode(node, "ArrayPattern"); + case types$1.braceL: + return this.parseObj(true); + } + } + return this.parseIdent(); + }; + pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowModifiers) { + var elts = [], first = true; + while (!this.eat(close)) { + if (first) { + first = false; + } else { + this.expect(types$1.comma); + } + if (allowEmpty && this.type === types$1.comma) { + elts.push(null); + } else if (allowTrailingComma && this.afterTrailingComma(close)) { + break; + } else if (this.type === types$1.ellipsis) { + var rest = this.parseRestBinding(); + this.parseBindingListItem(rest); + elts.push(rest); + if (this.type === types$1.comma) { + this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"); + } + this.expect(close); + break; + } else { + elts.push(this.parseAssignableListItem(allowModifiers)); + } + } + return elts; + }; + pp$7.parseAssignableListItem = function(allowModifiers) { + var elem = this.parseMaybeDefault(this.start, this.startLoc); + this.parseBindingListItem(elem); + return elem; + }; + pp$7.parseBindingListItem = function(param) { + return param; + }; + pp$7.parseMaybeDefault = function(startPos, startLoc, left) { + left = left || this.parseBindingAtom(); + if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { + return left; + } + var node = this.startNodeAt(startPos, startLoc); + node.left = left; + node.right = this.parseMaybeAssign(); + return this.finishNode(node, "AssignmentPattern"); + }; + pp$7.checkLValSimple = function(expr, bindingType, checkClashes) { + if (bindingType === void 0) bindingType = BIND_NONE; + var isBind = bindingType !== BIND_NONE; + switch (expr.type) { + case "Identifier": + if (this.strict && this.reservedWordsStrictBind.test(expr.name)) { + this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); + } + if (isBind) { + if (bindingType === BIND_LEXICAL && expr.name === "let") { + this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name"); + } + if (checkClashes) { + if (hasOwn(checkClashes, expr.name)) { + this.raiseRecoverable(expr.start, "Argument name clash"); + } + checkClashes[expr.name] = true; + } + if (bindingType !== BIND_OUTSIDE) { + this.declareName(expr.name, bindingType, expr.start); + } + } + break; + case "ChainExpression": + this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side"); + break; + case "MemberExpression": + if (isBind) { + this.raiseRecoverable(expr.start, "Binding member expression"); + } + break; + case "ParenthesizedExpression": + if (isBind) { + this.raiseRecoverable(expr.start, "Binding parenthesized expression"); + } + return this.checkLValSimple(expr.expression, bindingType, checkClashes); + default: + this.raise(expr.start, (isBind ? "Binding" : "Assigning to") + " rvalue"); + } + }; + pp$7.checkLValPattern = function(expr, bindingType, checkClashes) { + if (bindingType === void 0) bindingType = BIND_NONE; + switch (expr.type) { + case "ObjectPattern": + for (var i = 0, list = expr.properties; i < list.length; i += 1) { + var prop = list[i]; + this.checkLValInnerPattern(prop, bindingType, checkClashes); + } + break; + case "ArrayPattern": + for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) { + var elem = list$1[i$1]; + if (elem) { + this.checkLValInnerPattern(elem, bindingType, checkClashes); + } + } + break; + default: + this.checkLValSimple(expr, bindingType, checkClashes); + } + }; + pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) { + if (bindingType === void 0) bindingType = BIND_NONE; + switch (expr.type) { + case "Property": + this.checkLValInnerPattern(expr.value, bindingType, checkClashes); + break; + case "AssignmentPattern": + this.checkLValPattern(expr.left, bindingType, checkClashes); + break; + case "RestElement": + this.checkLValPattern(expr.argument, bindingType, checkClashes); + break; + default: + this.checkLValPattern(expr, bindingType, checkClashes); + } + }; + var TokContext = function TokContext2(token, isExpr, preserveSpace, override, generator) { + this.token = token; + this.isExpr = !!isExpr; + this.preserveSpace = !!preserveSpace; + this.override = override; + this.generator = !!generator; + }; + var types = { + b_stat: new TokContext("{", false), + b_expr: new TokContext("{", true), + b_tmpl: new TokContext("${", false), + p_stat: new TokContext("(", false), + p_expr: new TokContext("(", true), + q_tmpl: new TokContext("`", true, true, function(p) { + return p.tryReadTemplateToken(); + }), + f_stat: new TokContext("function", false), + f_expr: new TokContext("function", true), + f_expr_gen: new TokContext("function", true, false, null, true), + f_gen: new TokContext("function", false, false, null, true) + }; + var pp$6 = Parser.prototype; + pp$6.initialContext = function() { + return [types.b_stat]; + }; + pp$6.curContext = function() { + return this.context[this.context.length - 1]; + }; + pp$6.braceIsBlock = function(prevType) { + var parent = this.curContext(); + if (parent === types.f_expr || parent === types.f_stat) { + return true; + } + if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr)) { + return !parent.isExpr; + } + if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed) { + return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); + } + if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow) { + return true; + } + if (prevType === types$1.braceL) { + return parent === types.b_stat; + } + if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name) { + return false; + } + return !this.exprAllowed; + }; + pp$6.inGeneratorContext = function() { + for (var i = this.context.length - 1; i >= 1; i--) { + var context = this.context[i]; + if (context.token === "function") { + return context.generator; + } + } + return false; + }; + pp$6.updateContext = function(prevType) { + var update, type = this.type; + if (type.keyword && prevType === types$1.dot) { + this.exprAllowed = false; + } else if (update = type.updateContext) { + update.call(this, prevType); + } else { + this.exprAllowed = type.beforeExpr; + } + }; + pp$6.overrideContext = function(tokenCtx) { + if (this.curContext() !== tokenCtx) { + this.context[this.context.length - 1] = tokenCtx; + } + }; + types$1.parenR.updateContext = types$1.braceR.updateContext = function() { + if (this.context.length === 1) { + this.exprAllowed = true; + return; + } + var out = this.context.pop(); + if (out === types.b_stat && this.curContext().token === "function") { + out = this.context.pop(); + } + this.exprAllowed = !out.isExpr; + }; + types$1.braceL.updateContext = function(prevType) { + this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr); + this.exprAllowed = true; + }; + types$1.dollarBraceL.updateContext = function() { + this.context.push(types.b_tmpl); + this.exprAllowed = true; + }; + types$1.parenL.updateContext = function(prevType) { + var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while; + this.context.push(statementParens ? types.p_stat : types.p_expr); + this.exprAllowed = true; + }; + types$1.incDec.updateContext = function() { + }; + types$1._function.updateContext = types$1._class.updateContext = function(prevType) { + if (prevType.beforeExpr && prevType !== types$1._else && !(prevType === types$1.semi && this.curContext() !== types.p_stat) && !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) && !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat)) { + this.context.push(types.f_expr); + } else { + this.context.push(types.f_stat); + } + this.exprAllowed = false; + }; + types$1.colon.updateContext = function() { + if (this.curContext().token === "function") { + this.context.pop(); + } + this.exprAllowed = true; + }; + types$1.backQuote.updateContext = function() { + if (this.curContext() === types.q_tmpl) { + this.context.pop(); + } else { + this.context.push(types.q_tmpl); + } + this.exprAllowed = false; + }; + types$1.star.updateContext = function(prevType) { + if (prevType === types$1._function) { + var index = this.context.length - 1; + if (this.context[index] === types.f_expr) { + this.context[index] = types.f_expr_gen; + } else { + this.context[index] = types.f_gen; + } + } + this.exprAllowed = true; + }; + types$1.name.updateContext = function(prevType) { + var allowed = false; + if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) { + if (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) { + allowed = true; + } + } + this.exprAllowed = allowed; + }; + var pp$5 = Parser.prototype; + pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) { + if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement") { + return; + } + if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand)) { + return; + } + var key = prop.key; + var name; + switch (key.type) { + case "Identifier": + name = key.name; + break; + case "Literal": + name = String(key.value); + break; + default: + return; + } + var kind = prop.kind; + if (this.options.ecmaVersion >= 6) { + if (name === "__proto__" && kind === "init") { + if (propHash.proto) { + if (refDestructuringErrors) { + if (refDestructuringErrors.doubleProto < 0) { + refDestructuringErrors.doubleProto = key.start; + } + } else { + this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); + } + } + propHash.proto = true; + } + return; + } + name = "$" + name; + var other = propHash[name]; + if (other) { + var redefinition; + if (kind === "init") { + redefinition = this.strict && other.init || other.get || other.set; + } else { + redefinition = other.init || other[kind]; + } + if (redefinition) { + this.raiseRecoverable(key.start, "Redefinition of property"); + } + } else { + other = propHash[name] = { + init: false, + get: false, + set: false + }; + } + other[kind] = true; + }; + pp$5.parseExpression = function(forInit, refDestructuringErrors) { + var this$1$1 = this; + return this.catchStackOverflow(function() { + var startPos = this$1$1.start, startLoc = this$1$1.startLoc; + var expr = this$1$1.parseMaybeAssign(forInit, refDestructuringErrors); + if (this$1$1.type === types$1.comma) { + var node = this$1$1.startNodeAt(startPos, startLoc); + node.expressions = [expr]; + while (this$1$1.eat(types$1.comma)) { + node.expressions.push(this$1$1.parseMaybeAssign(forInit, refDestructuringErrors)); + } + return this$1$1.finishNode(node, "SequenceExpression"); + } + return expr; + }); + }; + pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) { + if (this.isContextual("yield")) { + if (this.inGenerator) { + return this.parseYield(forInit); + } else { + this.exprAllowed = false; + } + } + var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1; + if (refDestructuringErrors) { + oldParenAssign = refDestructuringErrors.parenthesizedAssign; + oldTrailingComma = refDestructuringErrors.trailingComma; + oldDoubleProto = refDestructuringErrors.doubleProto; + refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1; + } else { + refDestructuringErrors = new DestructuringErrors(); + ownDestructuringErrors = true; + } + var startPos = this.start, startLoc = this.startLoc; + if (this.type === types$1.parenL || this.type === types$1.name) { + this.potentialArrowAt = this.start; + this.potentialArrowInForAwait = forInit === "await"; + } + var left = this.parseMaybeConditional(forInit, refDestructuringErrors); + if (afterLeftParse) { + left = afterLeftParse.call(this, left, startPos, startLoc); + } + if (this.type.isAssign) { + var node = this.startNodeAt(startPos, startLoc); + node.operator = this.value; + if (this.type === types$1.eq) { + left = this.toAssignable(left, false, refDestructuringErrors); + } + if (!ownDestructuringErrors) { + refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1; + } + if (refDestructuringErrors.shorthandAssign >= left.start) { + refDestructuringErrors.shorthandAssign = -1; + } + if (this.type === types$1.eq) { + this.checkLValPattern(left); + } else { + this.checkLValSimple(left); + } + node.left = left; + this.next(); + node.right = this.parseMaybeAssign(forInit); + if (oldDoubleProto > -1) { + refDestructuringErrors.doubleProto = oldDoubleProto; + } + return this.finishNode(node, "AssignmentExpression"); + } else { + if (ownDestructuringErrors) { + this.checkExpressionErrors(refDestructuringErrors, true); + } + } + if (oldParenAssign > -1) { + refDestructuringErrors.parenthesizedAssign = oldParenAssign; + } + if (oldTrailingComma > -1) { + refDestructuringErrors.trailingComma = oldTrailingComma; + } + return left; + }; + pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) { + var startPos = this.start, startLoc = this.startLoc; + var expr = this.parseExprOps(forInit, refDestructuringErrors); + if (this.checkExpressionErrors(refDestructuringErrors)) { + return expr; + } + if (!(expr.type === "ArrowFunctionExpression" && expr.start === startPos) && this.eat(types$1.question)) { + var node = this.startNodeAt(startPos, startLoc); + node.test = expr; + node.consequent = this.parseMaybeAssign(); + this.expect(types$1.colon); + node.alternate = this.parseMaybeAssign(forInit); + return this.finishNode(node, "ConditionalExpression"); + } + return expr; + }; + pp$5.parseExprOps = function(forInit, refDestructuringErrors) { + var startPos = this.start, startLoc = this.startLoc; + var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit); + if (this.checkExpressionErrors(refDestructuringErrors)) { + return expr; + } + return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit); + }; + pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) { + var prec = this.type.binop; + if (prec != null && (!forInit || this.type !== types$1._in)) { + if (prec > minPrec) { + var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND; + var coalesce = this.type === types$1.coalesce; + if (coalesce) { + prec = types$1.logicalAND.binop; + } + var op = this.value; + this.next(); + var startPos = this.start, startLoc = this.startLoc; + var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit); + var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce); + if (logical && this.type === types$1.coalesce || coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND)) { + this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"); + } + return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit); + } + } + return left; + }; + pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) { + if (right.type === "PrivateIdentifier") { + this.raise(right.start, "Private identifier can only be left side of binary expression"); + } + var node = this.startNodeAt(startPos, startLoc); + node.left = left; + node.operator = op; + node.right = right; + return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression"); + }; + pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) { + var startPos = this.start, startLoc = this.startLoc, expr; + if (this.isContextual("await") && this.canAwait) { + expr = this.parseAwait(forInit); + sawUnary = true; + } else if (this.type.prefix) { + var node = this.startNode(), update = this.type === types$1.incDec; + node.operator = this.value; + node.prefix = true; + this.next(); + node.argument = this.parseMaybeUnary(null, true, update, forInit); + this.checkExpressionErrors(refDestructuringErrors, true); + if (update) { + this.checkLValSimple(node.argument); + } else if (this.strict && node.operator === "delete" && isLocalVariableAccess(node.argument)) { + this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); + } else if (node.operator === "delete" && isPrivateFieldAccess(node.argument)) { + this.raiseRecoverable(node.start, "Private fields can not be deleted"); + } else { + sawUnary = true; + } + expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression"); + } else if (!sawUnary && this.type === types$1.privateId) { + if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) { + this.unexpected(); + } + expr = this.parsePrivateIdent(); + if (this.type !== types$1._in) { + this.unexpected(); + } + } else { + expr = this.parseExprSubscripts(refDestructuringErrors, forInit); + if (this.checkExpressionErrors(refDestructuringErrors)) { + return expr; + } + while (this.type.postfix && !this.canInsertSemicolon()) { + var node$1 = this.startNodeAt(startPos, startLoc); + node$1.operator = this.value; + node$1.prefix = false; + node$1.argument = expr; + this.checkLValSimple(expr); + this.next(); + expr = this.finishNode(node$1, "UpdateExpression"); + } + } + if (!incDec && !(expr.type === "ArrowFunctionExpression" && expr.start === startPos) && this.eat(types$1.starstar)) { + if (sawUnary) { + this.unexpected(this.lastTokStart); + } else { + return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), "**", false); + } + } else { + return expr; + } + }; + function isLocalVariableAccess(node) { + return node.type === "Identifier" || node.type === "ParenthesizedExpression" && isLocalVariableAccess(node.expression); + } + function isPrivateFieldAccess(node) { + return node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" || node.type === "ChainExpression" && isPrivateFieldAccess(node.expression) || node.type === "ParenthesizedExpression" && isPrivateFieldAccess(node.expression); + } + pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) { + var startPos = this.start, startLoc = this.startLoc; + var expr = this.parseExprAtom(refDestructuringErrors, forInit); + if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") { + return expr; + } + var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit); + if (refDestructuringErrors && result.type === "MemberExpression") { + if (refDestructuringErrors.parenthesizedAssign >= result.start) { + refDestructuringErrors.parenthesizedAssign = -1; + } + if (refDestructuringErrors.parenthesizedBind >= result.start) { + refDestructuringErrors.parenthesizedBind = -1; + } + if (refDestructuringErrors.trailingComma >= result.start) { + refDestructuringErrors.trailingComma = -1; + } + } + return result; + }; + pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) { + var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && this.potentialArrowAt === base.start; + var optionalChained = false; + while (true) { + var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit); + if (element.optional) { + optionalChained = true; + } + if (element === base || element.type === "ArrowFunctionExpression") { + if (optionalChained) { + var chainNode = this.startNodeAt(startPos, startLoc); + chainNode.expression = element; + element = this.finishNode(chainNode, "ChainExpression"); + } + return element; + } + base = element; + } + }; + pp$5.shouldParseAsyncArrow = function() { + return !this.canInsertSemicolon() && this.eat(types$1.arrow); + }; + pp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) { + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit); + }; + pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) { + var optionalSupported = this.options.ecmaVersion >= 11; + var optional = optionalSupported && this.eat(types$1.questionDot); + if (noCalls && optional) { + this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); + } + var computed = this.eat(types$1.bracketL); + if (computed || optional && this.type !== types$1.parenL && this.type !== types$1.backQuote || this.eat(types$1.dot)) { + var node = this.startNodeAt(startPos, startLoc); + node.object = base; + if (computed) { + node.property = this.parseExpression(); + this.expect(types$1.bracketR); + } else if (this.type === types$1.privateId && base.type !== "Super") { + node.property = this.parsePrivateIdent(); + } else { + node.property = this.parseIdent(this.options.allowReserved !== "never"); + } + node.computed = !!computed; + if (optionalSupported) { + node.optional = optional; + } + base = this.finishNode(node, "MemberExpression"); + } else if (!noCalls && this.eat(types$1.parenL)) { + var refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + this.yieldPos = 0; + this.awaitPos = 0; + this.awaitIdentPos = 0; + var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors); + if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) { + this.checkPatternErrors(refDestructuringErrors, false); + this.checkYieldAwaitInDefaultParams(); + if (this.awaitIdentPos > 0) { + this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); + } + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; + return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit); + } + this.checkExpressionErrors(refDestructuringErrors, true); + this.yieldPos = oldYieldPos || this.yieldPos; + this.awaitPos = oldAwaitPos || this.awaitPos; + this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos; + var node$1 = this.startNodeAt(startPos, startLoc); + node$1.callee = base; + node$1.arguments = exprList; + if (optionalSupported) { + node$1.optional = optional; + } + base = this.finishNode(node$1, "CallExpression"); + } else if (this.type === types$1.backQuote) { + if (optional || optionalChained) { + this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions"); + } + var node$2 = this.startNodeAt(startPos, startLoc); + node$2.tag = base; + node$2.quasi = this.parseTemplate({ isTagged: true }); + base = this.finishNode(node$2, "TaggedTemplateExpression"); + } + return base; + }; + pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) { + if (this.type === types$1.slash) { + this.readRegexp(); + } + var node, canBeArrow = this.potentialArrowAt === this.start; + switch (this.type) { + case types$1._super: + if (!this.allowSuper) { + this.raise(this.start, "'super' keyword outside a method"); + } + node = this.startNode(); + this.next(); + if (this.type === types$1.parenL && !this.allowDirectSuper) { + this.raise(node.start, "super() call outside constructor of a subclass"); + } + if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL) { + this.unexpected(); + } + return this.finishNode(node, "Super"); + case types$1._this: + node = this.startNode(); + this.next(); + return this.finishNode(node, "ThisExpression"); + case types$1.name: + var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc; + var id = this.parseIdent(false); + if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) { + this.overrideContext(types.f_expr); + return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit); + } + if (canBeArrow && !this.canInsertSemicolon()) { + if (this.eat(types$1.arrow)) { + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit); + } + if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc && (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) { + id = this.parseIdent(false); + if (this.canInsertSemicolon() || !this.eat(types$1.arrow)) { + this.unexpected(); + } + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit); + } + } + return id; + case types$1.regexp: + var value = this.value; + node = this.parseLiteral(value.value); + node.regex = { pattern: value.pattern, flags: value.flags }; + return node; + case types$1.num: + case types$1.string: + return this.parseLiteral(this.value); + case types$1._null: + case types$1._true: + case types$1._false: + node = this.startNode(); + node.value = this.type === types$1._null ? null : this.type === types$1._true; + node.raw = this.type.keyword; + this.next(); + return this.finishNode(node, "Literal"); + case types$1.parenL: + var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit); + if (refDestructuringErrors) { + if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr)) { + refDestructuringErrors.parenthesizedAssign = start; + } + if (refDestructuringErrors.parenthesizedBind < 0) { + refDestructuringErrors.parenthesizedBind = start; + } + } + return expr; + case types$1.bracketL: + node = this.startNode(); + this.next(); + node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors); + return this.finishNode(node, "ArrayExpression"); + case types$1.braceL: + this.overrideContext(types.b_expr); + return this.parseObj(false, refDestructuringErrors); + case types$1._function: + node = this.startNode(); + this.next(); + return this.parseFunction(node, 0); + case types$1._class: + return this.parseClass(this.startNode(), false); + case types$1._new: + return this.parseNew(); + case types$1.backQuote: + return this.parseTemplate(); + case types$1._import: + if (this.options.ecmaVersion >= 11) { + return this.parseExprImport(forNew); + } else { + return this.unexpected(); + } + default: + return this.parseExprAtomDefault(); + } + }; + pp$5.parseExprAtomDefault = function() { + this.unexpected(); + }; + pp$5.parseExprImport = function(forNew) { + var node = this.startNode(); + if (this.containsEsc) { + this.raiseRecoverable(this.start, "Escape sequence in keyword import"); + } + this.next(); + if (this.type === types$1.parenL && !forNew) { + return this.parseDynamicImport(node); + } else if (this.type === types$1.dot) { + var meta = this.startNodeAt(node.start, node.loc && node.loc.start); + meta.name = "import"; + node.meta = this.finishNode(meta, "Identifier"); + return this.parseImportMeta(node); + } else { + this.unexpected(); + } + }; + pp$5.parseDynamicImport = function(node) { + this.next(); + node.source = this.parseMaybeAssign(); + if (this.options.ecmaVersion >= 16) { + if (!this.eat(types$1.parenR)) { + this.expect(types$1.comma); + if (!this.afterTrailingComma(types$1.parenR)) { + node.options = this.parseMaybeAssign(); + if (!this.eat(types$1.parenR)) { + this.expect(types$1.comma); + if (!this.afterTrailingComma(types$1.parenR)) { + this.unexpected(); + } + } + } else { + node.options = null; + } + } else { + node.options = null; + } + } else { + if (!this.eat(types$1.parenR)) { + var errorPos = this.start; + if (this.eat(types$1.comma) && this.eat(types$1.parenR)) { + this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()"); + } else { + this.unexpected(errorPos); + } + } + } + return this.finishNode(node, "ImportExpression"); + }; + pp$5.parseImportMeta = function(node) { + this.next(); + var containsEsc = this.containsEsc; + node.property = this.parseIdent(true); + if (node.property.name !== "meta") { + this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); + } + if (containsEsc) { + this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); + } + if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere) { + this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); + } + return this.finishNode(node, "MetaProperty"); + }; + pp$5.parseLiteral = function(value) { + var node = this.startNode(); + node.value = value; + node.raw = this.input.slice(this.start, this.end); + if (node.raw.charCodeAt(node.raw.length - 1) === 110) { + node.bigint = node.value != null ? node.value.toString() : node.raw.slice(0, -1).replace(/_/g, ""); + } + this.next(); + return this.finishNode(node, "Literal"); + }; + pp$5.parseParenExpression = function() { + this.expect(types$1.parenL); + var val = this.parseExpression(); + this.expect(types$1.parenR); + return val; + }; + pp$5.shouldParseArrow = function(exprList) { + return !this.canInsertSemicolon(); + }; + pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) { + var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8; + if (this.options.ecmaVersion >= 6) { + this.next(); + var innerStartPos = this.start, innerStartLoc = this.startLoc; + var exprList = [], first = true, lastIsComma = false; + var refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart; + this.yieldPos = 0; + this.awaitPos = 0; + while (this.type !== types$1.parenR) { + first ? first = false : this.expect(types$1.comma); + if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) { + lastIsComma = true; + break; + } else if (this.type === types$1.ellipsis) { + spreadStart = this.start; + exprList.push(this.parseParenItem(this.parseRestBinding())); + if (this.type === types$1.comma) { + this.raiseRecoverable( + this.start, + "Comma is not permitted after the rest element" + ); + } + break; + } else { + exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem)); + } + } + var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc; + this.expect(types$1.parenR); + if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow)) { + this.checkPatternErrors(refDestructuringErrors, false); + this.checkYieldAwaitInDefaultParams(); + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + return this.parseParenArrowList(startPos, startLoc, exprList, forInit); + } + if (!exprList.length || lastIsComma) { + this.unexpected(this.lastTokStart); + } + if (spreadStart) { + this.unexpected(spreadStart); + } + this.checkExpressionErrors(refDestructuringErrors, true); + this.yieldPos = oldYieldPos || this.yieldPos; + this.awaitPos = oldAwaitPos || this.awaitPos; + if (exprList.length > 1) { + val = this.startNodeAt(innerStartPos, innerStartLoc); + val.expressions = exprList; + this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc); + } else { + val = exprList[0]; + } + } else { + val = this.parseParenExpression(); + } + if (this.options.preserveParens) { + var par = this.startNodeAt(startPos, startLoc); + par.expression = val; + return this.finishNode(par, "ParenthesizedExpression"); + } else { + return val; + } + }; + pp$5.parseParenItem = function(item) { + return item; + }; + pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) { + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit); + }; + var empty = []; + pp$5.parseNew = function() { + if (this.containsEsc) { + this.raiseRecoverable(this.start, "Escape sequence in keyword new"); + } + var node = this.startNode(); + this.next(); + if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) { + var meta = this.startNodeAt(node.start, node.loc && node.loc.start); + meta.name = "new"; + node.meta = this.finishNode(meta, "Identifier"); + this.next(); + var containsEsc = this.containsEsc; + node.property = this.parseIdent(true); + if (node.property.name !== "target") { + this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'"); + } + if (containsEsc) { + this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); + } + if (!this.allowNewDotTarget) { + this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); + } + return this.finishNode(node, "MetaProperty"); + } + var startPos = this.start, startLoc = this.startLoc; + node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false); + if (node.callee.type === "Super") { + this.raiseRecoverable(startPos, "Invalid use of 'super'"); + } + if (this.eat(types$1.parenL)) { + node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); + } else { + node.arguments = empty; + } + return this.finishNode(node, "NewExpression"); + }; + pp$5.parseTemplateElement = function(ref2) { + var isTagged = ref2.isTagged; + var elem = this.startNode(); + if (this.type === types$1.invalidTemplate) { + if (!isTagged) { + this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal"); + } + elem.value = { + raw: this.value.replace(/\r\n?/g, "\n"), + cooked: null + }; + } else { + elem.value = { + raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"), + cooked: this.value + }; + } + this.next(); + elem.tail = this.type === types$1.backQuote; + return this.finishNode(elem, "TemplateElement"); + }; + pp$5.parseTemplate = function(ref2) { + if (ref2 === void 0) ref2 = {}; + var isTagged = ref2.isTagged; + if (isTagged === void 0) isTagged = false; + var node = this.startNode(); + this.next(); + node.expressions = []; + var curElt = this.parseTemplateElement({ isTagged }); + node.quasis = [curElt]; + while (!curElt.tail) { + if (this.type === types$1.eof) { + this.raise(this.pos, "Unterminated template literal"); + } + this.expect(types$1.dollarBraceL); + node.expressions.push(this.parseExpression()); + this.expect(types$1.braceR); + node.quasis.push(curElt = this.parseTemplateElement({ isTagged })); + } + this.next(); + return this.finishNode(node, "TemplateLiteral"); + }; + pp$5.isAsyncProp = function(prop) { + return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" && (this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || this.options.ecmaVersion >= 9 && this.type === types$1.star) && !lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); + }; + pp$5.parseObj = function(isPattern, refDestructuringErrors) { + var node = this.startNode(), first = true, propHash = {}; + node.properties = []; + this.next(); + while (!this.eat(types$1.braceR)) { + if (!first) { + this.expect(types$1.comma); + if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { + break; + } + } else { + first = false; + } + var prop = this.parseProperty(isPattern, refDestructuringErrors); + if (!isPattern) { + this.checkPropClash(prop, propHash, refDestructuringErrors); + } + node.properties.push(prop); + } + return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression"); + }; + pp$5.parseProperty = function(isPattern, refDestructuringErrors) { + var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc; + if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) { + if (isPattern) { + prop.argument = this.parseIdent(false); + if (this.type === types$1.comma) { + this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"); + } + return this.finishNode(prop, "RestElement"); + } + prop.argument = this.parseMaybeAssign(false, refDestructuringErrors); + if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) { + refDestructuringErrors.trailingComma = this.start; + } + return this.finishNode(prop, "SpreadElement"); + } + if (this.options.ecmaVersion >= 6) { + prop.method = false; + prop.shorthand = false; + if (isPattern || refDestructuringErrors) { + startPos = this.start; + startLoc = this.startLoc; + } + if (!isPattern) { + isGenerator = this.eat(types$1.star); + } + } + var containsEsc = this.containsEsc; + this.parsePropertyName(prop); + if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) { + isAsync = true; + isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star); + this.parsePropertyName(prop); + } else { + isAsync = false; + } + this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc); + return this.finishNode(prop, "Property"); + }; + pp$5.parseGetterSetter = function(prop) { + var kind = prop.key.name; + this.parsePropertyName(prop); + prop.value = this.parseMethod(false); + prop.kind = kind; + var paramCount = prop.kind === "get" ? 0 : 1; + if (prop.value.params.length !== paramCount) { + var start = prop.value.start; + if (prop.kind === "get") { + this.raiseRecoverable(start, "getter should have no params"); + } else { + this.raiseRecoverable(start, "setter should have exactly one param"); + } + } else { + if (prop.kind === "set" && prop.value.params[0].type === "RestElement") { + this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); + } + } + }; + pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) { + if ((isGenerator || isAsync) && this.type === types$1.colon) { + this.unexpected(); + } + if (this.eat(types$1.colon)) { + prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors); + prop.kind = "init"; + } else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) { + if (isPattern) { + this.unexpected(); + } + prop.method = true; + prop.value = this.parseMethod(isGenerator, isAsync); + prop.kind = "init"; + } else if (!isPattern && !containsEsc && this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) { + if (isGenerator || isAsync) { + this.unexpected(); + } + this.parseGetterSetter(prop); + } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") { + if (isGenerator || isAsync) { + this.unexpected(); + } + this.checkUnreserved(prop.key); + if (prop.key.name === "await" && !this.awaitIdentPos) { + this.awaitIdentPos = startPos; + } + if (isPattern) { + prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key)); + } else if (this.type === types$1.eq && refDestructuringErrors) { + if (refDestructuringErrors.shorthandAssign < 0) { + refDestructuringErrors.shorthandAssign = this.start; + } + prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key)); + } else { + prop.value = this.copyNode(prop.key); + } + prop.kind = "init"; + prop.shorthand = true; + } else { + this.unexpected(); + } + }; + pp$5.parsePropertyName = function(prop) { + if (this.options.ecmaVersion >= 6) { + if (this.eat(types$1.bracketL)) { + prop.computed = true; + prop.key = this.parseMaybeAssign(); + this.expect(types$1.bracketR); + return prop.key; + } else { + prop.computed = false; + } + } + return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never"); + }; + pp$5.initFunction = function(node) { + node.id = null; + if (this.options.ecmaVersion >= 6) { + node.generator = node.expression = false; + } + if (this.options.ecmaVersion >= 8) { + node.async = false; + } + }; + pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) { + var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + this.initFunction(node); + if (this.options.ecmaVersion >= 6) { + node.generator = isGenerator; + } + if (this.options.ecmaVersion >= 8) { + node.async = !!isAsync; + } + this.yieldPos = 0; + this.awaitPos = 0; + this.awaitIdentPos = 0; + this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0)); + this.expect(types$1.parenL); + node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); + this.checkYieldAwaitInDefaultParams(); + this.parseFunctionBody(node, false, true, false); + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; + return this.finishNode(node, "FunctionExpression"); + }; + pp$5.parseArrowExpression = function(node, params, isAsync, forInit) { + var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; + this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW); + this.initFunction(node); + if (this.options.ecmaVersion >= 8) { + node.async = !!isAsync; + } + this.yieldPos = 0; + this.awaitPos = 0; + this.awaitIdentPos = 0; + node.params = this.toAssignableList(params, true); + this.parseFunctionBody(node, true, false, forInit); + this.yieldPos = oldYieldPos; + this.awaitPos = oldAwaitPos; + this.awaitIdentPos = oldAwaitIdentPos; + return this.finishNode(node, "ArrowFunctionExpression"); + }; + pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) { + var isExpression = isArrowFunction && this.type !== types$1.braceL; + var oldStrict = this.strict, useStrict = false; + if (isExpression) { + node.body = this.parseMaybeAssign(forInit); + node.expression = true; + this.checkParams(node, false); + } else { + var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params); + if (!oldStrict || nonSimple) { + useStrict = this.strictDirective(this.end); + if (useStrict && nonSimple) { + this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list"); + } + } + var oldLabels = this.labels; + this.labels = []; + if (useStrict) { + this.strict = true; + } + this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params)); + if (this.strict && node.id) { + this.checkLValSimple(node.id, BIND_OUTSIDE); + } + node.body = this.parseBlock(false, void 0, useStrict && !oldStrict); + node.expression = false; + this.adaptDirectivePrologue(node.body.body); + this.labels = oldLabels; + } + this.exitScope(); + }; + pp$5.isSimpleParamList = function(params) { + for (var i = 0, list = params; i < list.length; i += 1) { + var param = list[i]; + if (param.type !== "Identifier") { + return false; + } + } + return true; + }; + pp$5.checkParams = function(node, allowDuplicates) { + var nameHash = /* @__PURE__ */ Object.create(null); + for (var i = 0, list = node.params; i < list.length; i += 1) { + var param = list[i]; + this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash); + } + }; + pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) { + var elts = [], first = true; + while (!this.eat(close)) { + if (!first) { + this.expect(types$1.comma); + if (allowTrailingComma && this.afterTrailingComma(close)) { + break; + } + } else { + first = false; + } + var elt = void 0; + if (allowEmpty && this.type === types$1.comma) { + elt = null; + } else if (this.type === types$1.ellipsis) { + elt = this.parseSpread(refDestructuringErrors); + if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0) { + refDestructuringErrors.trailingComma = this.start; + } + } else { + elt = this.parseMaybeAssign(false, refDestructuringErrors); + } + elts.push(elt); + } + return elts; + }; + pp$5.checkUnreserved = function(ref2) { + var start = ref2.start; + var end = ref2.end; + var name = ref2.name; + if (this.inGenerator && name === "yield") { + this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); + } + if (this.inAsync && name === "await") { + this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); + } + if (!(this.currentThisScope().flags & SCOPE_VAR) && name === "arguments") { + this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer"); + } + if (this.inClassStaticBlock && (name === "arguments" || name === "await")) { + this.raise(start, "Cannot use " + name + " in class static initialization block"); + } + if (this.keywords.test(name)) { + this.raise(start, "Unexpected keyword '" + name + "'"); + } + if (this.options.ecmaVersion < 6 && this.input.slice(start, end).indexOf("\\") !== -1) { + return; + } + var re = this.strict ? this.reservedWordsStrict : this.reservedWords; + if (re.test(name)) { + if (!this.inAsync && name === "await") { + this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function"); + } + this.raiseRecoverable(start, "The keyword '" + name + "' is reserved"); + } + }; + pp$5.parseIdent = function(liberal) { + var node = this.parseIdentNode(); + this.next(!!liberal); + this.finishNode(node, "Identifier"); + if (!liberal) { + this.checkUnreserved(node); + if (node.name === "await" && !this.awaitIdentPos) { + this.awaitIdentPos = node.start; + } + } + return node; + }; + pp$5.parseIdentNode = function() { + var node = this.startNode(); + if (this.type === types$1.name) { + node.name = this.value; + } else if (this.type.keyword) { + node.name = this.type.keyword; + if ((node.name === "class" || node.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) { + this.context.pop(); + } + this.type = types$1.name; + } else { + this.unexpected(); + } + return node; + }; + pp$5.parsePrivateIdent = function() { + var node = this.startNode(); + if (this.type === types$1.privateId) { + node.name = this.value; + } else { + this.unexpected(); + } + this.next(); + this.finishNode(node, "PrivateIdentifier"); + if (this.options.checkPrivateFields) { + if (this.privateNameStack.length === 0) { + this.raise(node.start, "Private field '#" + node.name + "' must be declared in an enclosing class"); + } else { + this.privateNameStack[this.privateNameStack.length - 1].used.push(node); + } + } + return node; + }; + pp$5.parseYield = function(forInit) { + if (!this.yieldPos) { + this.yieldPos = this.start; + } + var node = this.startNode(); + this.next(); + if (this.type === types$1.semi || this.canInsertSemicolon() || this.type !== types$1.star && !this.type.startsExpr) { + node.delegate = false; + node.argument = null; + } else { + node.delegate = this.eat(types$1.star); + node.argument = this.parseMaybeAssign(forInit); + } + return this.finishNode(node, "YieldExpression"); + }; + pp$5.parseAwait = function(forInit) { + if (!this.awaitPos) { + this.awaitPos = this.start; + } + var node = this.startNode(); + this.next(); + node.argument = this.parseMaybeUnary(null, true, false, forInit); + return this.finishNode(node, "AwaitExpression"); + }; + var pp$4 = Parser.prototype; + pp$4.raise = function(pos, message) { + var loc = getLineInfo(this.input, pos); + message += " (" + loc.line + ":" + loc.column + ")"; + if (this.sourceFile) { + message += " in " + this.sourceFile; + } + var err = new SyntaxError(message); + err.pos = pos; + err.loc = loc; + err.raisedAt = this.pos; + throw err; + }; + pp$4.raiseRecoverable = pp$4.raise; + pp$4.curPosition = function() { + if (this.options.locations) { + return new Position(this.curLine, this.pos - this.lineStart); + } + }; + var pp$3 = Parser.prototype; + var Scope = function Scope2(flags) { + this.flags = flags; + this.var = []; + this.lexical = []; + this.functions = []; + }; + pp$3.enterScope = function(flags) { + this.scopeStack.push(new Scope(flags)); + }; + pp$3.exitScope = function() { + this.scopeStack.pop(); + }; + pp$3.treatFunctionsAsVarInScope = function(scope) { + return scope.flags & SCOPE_FUNCTION || !this.inModule && scope.flags & SCOPE_TOP; + }; + pp$3.declareName = function(name, bindingType, pos) { + var redeclared = false; + if (bindingType === BIND_LEXICAL) { + var scope = this.currentScope(); + redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1; + scope.lexical.push(name); + if (this.inModule && scope.flags & SCOPE_TOP) { + delete this.undefinedExports[name]; + } + } else if (bindingType === BIND_SIMPLE_CATCH) { + var scope$1 = this.currentScope(); + scope$1.lexical.push(name); + } else if (bindingType === BIND_FUNCTION) { + var scope$2 = this.currentScope(); + if (this.treatFunctionsAsVar) { + redeclared = scope$2.lexical.indexOf(name) > -1; + } else { + redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1; + } + scope$2.functions.push(name); + } else { + for (var i = this.scopeStack.length - 1; i >= 0; --i) { + var scope$3 = this.scopeStack[i]; + if (scope$3.lexical.indexOf(name) > -1 && !(scope$3.flags & SCOPE_SIMPLE_CATCH && scope$3.lexical[0] === name) || !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) { + redeclared = true; + break; + } + scope$3.var.push(name); + if (this.inModule && scope$3.flags & SCOPE_TOP) { + delete this.undefinedExports[name]; + } + if (scope$3.flags & SCOPE_VAR) { + break; + } + } + } + if (redeclared) { + this.raiseRecoverable(pos, "Identifier '" + name + "' has already been declared"); + } + }; + pp$3.checkLocalExport = function(id) { + if (this.scopeStack[0].lexical.indexOf(id.name) === -1 && this.scopeStack[0].var.indexOf(id.name) === -1) { + this.undefinedExports[id.name] = id; + } + }; + pp$3.currentScope = function() { + return this.scopeStack[this.scopeStack.length - 1]; + }; + pp$3.currentVarScope = function() { + for (var i = this.scopeStack.length - 1; ; i--) { + var scope = this.scopeStack[i]; + if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK)) { + return scope; + } + } + }; + pp$3.currentThisScope = function() { + for (var i = this.scopeStack.length - 1; ; i--) { + var scope = this.scopeStack[i]; + if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK) && !(scope.flags & SCOPE_ARROW)) { + return scope; + } + } + }; + var Node = function Node2(parser, pos, loc) { + this.type = ""; + this.start = pos; + this.end = 0; + if (parser.options.locations) { + this.loc = new SourceLocation(parser, loc); + } + if (parser.options.directSourceFile) { + this.sourceFile = parser.options.directSourceFile; + } + if (parser.options.ranges) { + this.range = [pos, 0]; + } + }; + var pp$2 = Parser.prototype; + pp$2.startNode = function() { + return new Node(this, this.start, this.startLoc); + }; + pp$2.startNodeAt = function(pos, loc) { + return new Node(this, pos, loc); + }; + function finishNodeAt(node, type, pos, loc) { + node.type = type; + node.end = pos; + if (this.options.locations) { + node.loc.end = loc; + } + if (this.options.ranges) { + node.range[1] = pos; + } + return node; + } + pp$2.finishNode = function(node, type) { + return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc); + }; + pp$2.finishNodeAt = function(node, type, pos, loc) { + return finishNodeAt.call(this, node, type, pos, loc); + }; + pp$2.copyNode = function(node) { + var newNode = new Node(this, node.start, this.startLoc); + for (var prop in node) { + newNode[prop] = node[prop]; + } + return newNode; + }; + var scriptValuesAddedInUnicode = "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz"; + var ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS"; + var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic"; + var ecma11BinaryProperties = ecma10BinaryProperties; + var ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict"; + var ecma13BinaryProperties = ecma12BinaryProperties; + var ecma14BinaryProperties = ecma13BinaryProperties; + var unicodeBinaryProperties = { + 9: ecma9BinaryProperties, + 10: ecma10BinaryProperties, + 11: ecma11BinaryProperties, + 12: ecma12BinaryProperties, + 13: ecma13BinaryProperties, + 14: ecma14BinaryProperties + }; + var ecma14BinaryPropertiesOfStrings = "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"; + var unicodeBinaryPropertiesOfStrings = { + 9: "", + 10: "", + 11: "", + 12: "", + 13: "", + 14: ecma14BinaryPropertiesOfStrings + }; + var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu"; + var ecma9ScriptValues = "Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb"; + var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd"; + var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho"; + var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi"; + var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith"; + var ecma14ScriptValues = ecma13ScriptValues + " " + scriptValuesAddedInUnicode; + var unicodeScriptValues = { + 9: ecma9ScriptValues, + 10: ecma10ScriptValues, + 11: ecma11ScriptValues, + 12: ecma12ScriptValues, + 13: ecma13ScriptValues, + 14: ecma14ScriptValues + }; + var data = {}; + function buildUnicodeData(ecmaVersion) { + var d = data[ecmaVersion] = { + binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues), + binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]), + nonBinary: { + General_Category: wordsRegexp(unicodeGeneralCategoryValues), + Script: wordsRegexp(unicodeScriptValues[ecmaVersion]) + } + }; + d.nonBinary.Script_Extensions = d.nonBinary.Script; + d.nonBinary.gc = d.nonBinary.General_Category; + d.nonBinary.sc = d.nonBinary.Script; + d.nonBinary.scx = d.nonBinary.Script_Extensions; + } + for (i = 0, list = [9, 10, 11, 12, 13, 14]; i < list.length; i += 1) { + ecmaVersion = list[i]; + buildUnicodeData(ecmaVersion); + } + var ecmaVersion; + var i; + var list; + var pp$1 = Parser.prototype; + var BranchID = function BranchID2(parent, base) { + this.parent = parent; + this.base = base || this; + }; + BranchID.prototype.separatedFrom = function separatedFrom(alt) { + for (var self2 = this; self2; self2 = self2.parent) { + for (var other = alt; other; other = other.parent) { + if (self2.base === other.base && self2 !== other) { + return true; + } + } + } + return false; + }; + BranchID.prototype.sibling = function sibling() { + return new BranchID(this.parent, this.base); + }; + var RegExpValidationState = function RegExpValidationState2(parser) { + this.parser = parser; + this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : ""); + this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion]; + this.source = ""; + this.flags = ""; + this.start = 0; + this.switchU = false; + this.switchV = false; + this.switchN = false; + this.pos = 0; + this.lastIntValue = 0; + this.lastStringValue = ""; + this.lastAssertionIsQuantifiable = false; + this.numCapturingParens = 0; + this.maxBackReference = 0; + this.groupNames = /* @__PURE__ */ Object.create(null); + this.backReferenceNames = []; + this.branchID = null; + }; + RegExpValidationState.prototype.reset = function reset(start, pattern, flags) { + var unicodeSets = flags.indexOf("v") !== -1; + var unicode = flags.indexOf("u") !== -1; + this.start = start | 0; + this.source = pattern + ""; + this.flags = flags; + if (unicodeSets && this.parser.options.ecmaVersion >= 15) { + this.switchU = true; + this.switchV = true; + this.switchN = true; + } else { + this.switchU = unicode && this.parser.options.ecmaVersion >= 6; + this.switchV = false; + this.switchN = unicode && this.parser.options.ecmaVersion >= 9; + } + }; + RegExpValidationState.prototype.raise = function raise(message) { + this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + message); + }; + RegExpValidationState.prototype.at = function at(i, forceU) { + if (forceU === void 0) forceU = false; + var s = this.source; + var l = s.length; + if (i >= l) { + return -1; + } + var c = s.charCodeAt(i); + if (!(forceU || this.switchU) || c <= 55295 || c >= 57344 || i + 1 >= l) { + return c; + } + var next = s.charCodeAt(i + 1); + return next >= 56320 && next <= 57343 ? (c << 10) + next - 56613888 : c; + }; + RegExpValidationState.prototype.nextIndex = function nextIndex(i, forceU) { + if (forceU === void 0) forceU = false; + var s = this.source; + var l = s.length; + if (i >= l) { + return l; + } + var c = s.charCodeAt(i), next; + if (!(forceU || this.switchU) || c <= 55295 || c >= 57344 || i + 1 >= l || (next = s.charCodeAt(i + 1)) < 56320 || next > 57343) { + return i + 1; + } + return i + 2; + }; + RegExpValidationState.prototype.current = function current(forceU) { + if (forceU === void 0) forceU = false; + return this.at(this.pos, forceU); + }; + RegExpValidationState.prototype.lookahead = function lookahead(forceU) { + if (forceU === void 0) forceU = false; + return this.at(this.nextIndex(this.pos, forceU), forceU); + }; + RegExpValidationState.prototype.advance = function advance(forceU) { + if (forceU === void 0) forceU = false; + this.pos = this.nextIndex(this.pos, forceU); + }; + RegExpValidationState.prototype.eat = function eat(ch, forceU) { + if (forceU === void 0) forceU = false; + if (this.current(forceU) === ch) { + this.advance(forceU); + return true; + } + return false; + }; + RegExpValidationState.prototype.eatChars = function eatChars(chs, forceU) { + if (forceU === void 0) forceU = false; + var pos = this.pos; + for (var i = 0, list = chs; i < list.length; i += 1) { + var ch = list[i]; + var current2 = this.at(pos, forceU); + if (current2 === -1 || current2 !== ch) { + return false; + } + pos = this.nextIndex(pos, forceU); + } + this.pos = pos; + return true; + }; + pp$1.validateRegExpFlags = function(state) { + var validFlags = state.validFlags; + var flags = state.flags; + var u = false; + var v = false; + for (var i = 0; i < flags.length; i++) { + var flag = flags.charAt(i); + if (validFlags.indexOf(flag) === -1) { + this.raise(state.start, "Invalid regular expression flag"); + } + if (flags.indexOf(flag, i + 1) > -1) { + this.raise(state.start, "Duplicate regular expression flag"); + } + if (flag === "u") { + u = true; + } + if (flag === "v") { + v = true; + } + } + if (this.options.ecmaVersion >= 15 && u && v) { + this.raise(state.start, "Invalid regular expression flag"); + } + }; + function hasProp(obj) { + for (var _ in obj) { + return true; + } + return false; + } + pp$1.validateRegExpPattern = function(state) { + this.regexp_pattern(state); + if (!state.switchN && this.options.ecmaVersion >= 9 && hasProp(state.groupNames)) { + state.switchN = true; + this.regexp_pattern(state); + } + }; + pp$1.regexp_pattern = function(state) { + state.pos = 0; + state.lastIntValue = 0; + state.lastStringValue = ""; + state.lastAssertionIsQuantifiable = false; + state.numCapturingParens = 0; + state.maxBackReference = 0; + state.groupNames = /* @__PURE__ */ Object.create(null); + state.backReferenceNames.length = 0; + state.branchID = null; + this.regexp_disjunction(state); + if (state.pos !== state.source.length) { + if (state.eat( + 41 + /* ) */ + )) { + state.raise("Unmatched ')'"); + } + if (state.eat( + 93 + /* ] */ + ) || state.eat( + 125 + /* } */ + )) { + state.raise("Lone quantifier brackets"); + } + } + if (state.maxBackReference > state.numCapturingParens) { + state.raise("Invalid escape"); + } + for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) { + var name = list[i]; + if (!state.groupNames[name]) { + state.raise("Invalid named capture referenced"); + } + } + }; + pp$1.regexp_disjunction = function(state) { + var trackDisjunction = this.options.ecmaVersion >= 16; + if (trackDisjunction) { + state.branchID = new BranchID(state.branchID, null); + } + this.regexp_alternative(state); + while (state.eat( + 124 + /* | */ + )) { + if (trackDisjunction) { + state.branchID = state.branchID.sibling(); + } + this.regexp_alternative(state); + } + if (trackDisjunction) { + state.branchID = state.branchID.parent; + } + if (this.regexp_eatQuantifier(state, true)) { + state.raise("Nothing to repeat"); + } + if (state.eat( + 123 + /* { */ + )) { + state.raise("Lone quantifier brackets"); + } + }; + pp$1.regexp_alternative = function(state) { + while (state.pos < state.source.length && this.regexp_eatTerm(state)) { + } + }; + pp$1.regexp_eatTerm = function(state) { + if (this.regexp_eatAssertion(state)) { + if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) { + if (state.switchU) { + state.raise("Invalid quantifier"); + } + } + return true; + } + if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) { + this.regexp_eatQuantifier(state); + return true; + } + return false; + }; + pp$1.regexp_eatAssertion = function(state) { + var start = state.pos; + state.lastAssertionIsQuantifiable = false; + if (state.eat( + 94 + /* ^ */ + ) || state.eat( + 36 + /* $ */ + )) { + return true; + } + if (state.eat( + 92 + /* \ */ + )) { + if (state.eat( + 66 + /* B */ + ) || state.eat( + 98 + /* b */ + )) { + return true; + } + state.pos = start; + } + if (state.eat( + 40 + /* ( */ + ) && state.eat( + 63 + /* ? */ + )) { + var lookbehind = false; + if (this.options.ecmaVersion >= 9) { + lookbehind = state.eat( + 60 + /* < */ + ); + } + if (state.eat( + 61 + /* = */ + ) || state.eat( + 33 + /* ! */ + )) { + this.regexp_disjunction(state); + if (!state.eat( + 41 + /* ) */ + )) { + state.raise("Unterminated group"); + } + state.lastAssertionIsQuantifiable = !lookbehind; + return true; + } + } + state.pos = start; + return false; + }; + pp$1.regexp_eatQuantifier = function(state, noError) { + if (noError === void 0) noError = false; + if (this.regexp_eatQuantifierPrefix(state, noError)) { + state.eat( + 63 + /* ? */ + ); + return true; + } + return false; + }; + pp$1.regexp_eatQuantifierPrefix = function(state, noError) { + return state.eat( + 42 + /* * */ + ) || state.eat( + 43 + /* + */ + ) || state.eat( + 63 + /* ? */ + ) || this.regexp_eatBracedQuantifier(state, noError); + }; + pp$1.regexp_eatBracedQuantifier = function(state, noError) { + var start = state.pos; + if (state.eat( + 123 + /* { */ + )) { + var min = 0, max = -1; + if (this.regexp_eatDecimalDigits(state)) { + min = state.lastIntValue; + if (state.eat( + 44 + /* , */ + ) && this.regexp_eatDecimalDigits(state)) { + max = state.lastIntValue; + } + if (state.eat( + 125 + /* } */ + )) { + if (max !== -1 && max < min && !noError) { + state.raise("numbers out of order in {} quantifier"); + } + return true; + } + } + if (state.switchU && !noError) { + state.raise("Incomplete quantifier"); + } + state.pos = start; + } + return false; + }; + pp$1.regexp_eatAtom = function(state) { + return this.regexp_eatPatternCharacters(state) || state.eat( + 46 + /* . */ + ) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state); + }; + pp$1.regexp_eatReverseSolidusAtomEscape = function(state) { + var start = state.pos; + if (state.eat( + 92 + /* \ */ + )) { + if (this.regexp_eatAtomEscape(state)) { + return true; + } + state.pos = start; + } + return false; + }; + pp$1.regexp_eatUncapturingGroup = function(state) { + var start = state.pos; + if (state.eat( + 40 + /* ( */ + )) { + if (state.eat( + 63 + /* ? */ + )) { + if (this.options.ecmaVersion >= 16) { + var addModifiers = this.regexp_eatModifiers(state); + var hasHyphen = state.eat( + 45 + /* - */ + ); + if (addModifiers || hasHyphen) { + for (var i = 0; i < addModifiers.length; i++) { + var modifier = addModifiers.charAt(i); + if (addModifiers.indexOf(modifier, i + 1) > -1) { + state.raise("Duplicate regular expression modifiers"); + } + } + if (hasHyphen) { + var removeModifiers = this.regexp_eatModifiers(state); + if (!addModifiers && !removeModifiers && state.current() === 58) { + state.raise("Invalid regular expression modifiers"); + } + for (var i$1 = 0; i$1 < removeModifiers.length; i$1++) { + var modifier$1 = removeModifiers.charAt(i$1); + if (removeModifiers.indexOf(modifier$1, i$1 + 1) > -1 || addModifiers.indexOf(modifier$1) > -1) { + state.raise("Duplicate regular expression modifiers"); + } + } + } + } + } + if (state.eat( + 58 + /* : */ + )) { + this.regexp_disjunction(state); + if (state.eat( + 41 + /* ) */ + )) { + return true; + } + state.raise("Unterminated group"); + } + } + state.pos = start; + } + return false; + }; + pp$1.regexp_eatCapturingGroup = function(state) { + if (state.eat( + 40 + /* ( */ + )) { + if (this.options.ecmaVersion >= 9) { + this.regexp_groupSpecifier(state); + } else if (state.current() === 63) { + state.raise("Invalid group"); + } + this.regexp_disjunction(state); + if (state.eat( + 41 + /* ) */ + )) { + state.numCapturingParens += 1; + return true; + } + state.raise("Unterminated group"); + } + return false; + }; + pp$1.regexp_eatModifiers = function(state) { + var modifiers = ""; + var ch = 0; + while ((ch = state.current()) !== -1 && isRegularExpressionModifier(ch)) { + modifiers += codePointToString(ch); + state.advance(); + } + return modifiers; + }; + function isRegularExpressionModifier(ch) { + return ch === 105 || ch === 109 || ch === 115; + } + pp$1.regexp_eatExtendedAtom = function(state) { + return state.eat( + 46 + /* . */ + ) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state) || this.regexp_eatInvalidBracedQuantifier(state) || this.regexp_eatExtendedPatternCharacter(state); + }; + pp$1.regexp_eatInvalidBracedQuantifier = function(state) { + if (this.regexp_eatBracedQuantifier(state, true)) { + state.raise("Nothing to repeat"); + } + return false; + }; + pp$1.regexp_eatSyntaxCharacter = function(state) { + var ch = state.current(); + if (isSyntaxCharacter(ch)) { + state.lastIntValue = ch; + state.advance(); + return true; + } + return false; + }; + function isSyntaxCharacter(ch) { + return ch === 36 || ch >= 40 && ch <= 43 || ch === 46 || ch === 63 || ch >= 91 && ch <= 94 || ch >= 123 && ch <= 125; + } + pp$1.regexp_eatPatternCharacters = function(state) { + var start = state.pos; + var ch = 0; + while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) { + state.advance(); + } + return state.pos !== start; + }; + pp$1.regexp_eatExtendedPatternCharacter = function(state) { + var ch = state.current(); + if (ch !== -1 && ch !== 36 && !(ch >= 40 && ch <= 43) && ch !== 46 && ch !== 63 && ch !== 91 && ch !== 94 && ch !== 124) { + state.advance(); + return true; + } + return false; + }; + pp$1.regexp_groupSpecifier = function(state) { + if (state.eat( + 63 + /* ? */ + )) { + if (!this.regexp_eatGroupName(state)) { + state.raise("Invalid group"); + } + var trackDisjunction = this.options.ecmaVersion >= 16; + var known = state.groupNames[state.lastStringValue]; + if (known) { + if (trackDisjunction) { + for (var i = 0, list = known; i < list.length; i += 1) { + var altID = list[i]; + if (!altID.separatedFrom(state.branchID)) { + state.raise("Duplicate capture group name"); + } + } + } else { + state.raise("Duplicate capture group name"); + } + } + if (trackDisjunction) { + (known || (state.groupNames[state.lastStringValue] = [])).push(state.branchID); + } else { + state.groupNames[state.lastStringValue] = true; + } + } + }; + pp$1.regexp_eatGroupName = function(state) { + state.lastStringValue = ""; + if (state.eat( + 60 + /* < */ + )) { + if (this.regexp_eatRegExpIdentifierName(state) && state.eat( + 62 + /* > */ + )) { + return true; + } + state.raise("Invalid capture group name"); + } + return false; + }; + pp$1.regexp_eatRegExpIdentifierName = function(state) { + state.lastStringValue = ""; + if (this.regexp_eatRegExpIdentifierStart(state)) { + state.lastStringValue += codePointToString(state.lastIntValue); + while (this.regexp_eatRegExpIdentifierPart(state)) { + state.lastStringValue += codePointToString(state.lastIntValue); + } + return true; + } + return false; + }; + pp$1.regexp_eatRegExpIdentifierStart = function(state) { + var start = state.pos; + var forceU = this.options.ecmaVersion >= 11; + var ch = state.current(forceU); + state.advance(forceU); + if (ch === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) { + ch = state.lastIntValue; + } + if (isRegExpIdentifierStart(ch)) { + state.lastIntValue = ch; + return true; + } + state.pos = start; + return false; + }; + function isRegExpIdentifierStart(ch) { + return isIdentifierStart(ch, true) || ch === 36 || ch === 95; + } + pp$1.regexp_eatRegExpIdentifierPart = function(state) { + var start = state.pos; + var forceU = this.options.ecmaVersion >= 11; + var ch = state.current(forceU); + state.advance(forceU); + if (ch === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) { + ch = state.lastIntValue; + } + if (isRegExpIdentifierPart(ch)) { + state.lastIntValue = ch; + return true; + } + state.pos = start; + return false; + }; + function isRegExpIdentifierPart(ch) { + return isIdentifierChar(ch, true) || ch === 36 || ch === 95 || ch === 8204 || ch === 8205; + } + pp$1.regexp_eatAtomEscape = function(state) { + if (this.regexp_eatBackReference(state) || this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state) || state.switchN && this.regexp_eatKGroupName(state)) { + return true; + } + if (state.switchU) { + if (state.current() === 99) { + state.raise("Invalid unicode escape"); + } + state.raise("Invalid escape"); + } + return false; + }; + pp$1.regexp_eatBackReference = function(state) { + var start = state.pos; + if (this.regexp_eatDecimalEscape(state)) { + var n = state.lastIntValue; + if (state.switchU) { + if (n > state.maxBackReference) { + state.maxBackReference = n; + } + return true; + } + if (n <= state.numCapturingParens) { + return true; + } + state.pos = start; + } + return false; + }; + pp$1.regexp_eatKGroupName = function(state) { + if (state.eat( + 107 + /* k */ + )) { + if (this.regexp_eatGroupName(state)) { + state.backReferenceNames.push(state.lastStringValue); + return true; + } + state.raise("Invalid named reference"); + } + return false; + }; + pp$1.regexp_eatCharacterEscape = function(state) { + return this.regexp_eatControlEscape(state) || this.regexp_eatCControlLetter(state) || this.regexp_eatZero(state) || this.regexp_eatHexEscapeSequence(state) || this.regexp_eatRegExpUnicodeEscapeSequence(state, false) || !state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state) || this.regexp_eatIdentityEscape(state); + }; + pp$1.regexp_eatCControlLetter = function(state) { + var start = state.pos; + if (state.eat( + 99 + /* c */ + )) { + if (this.regexp_eatControlLetter(state)) { + return true; + } + state.pos = start; + } + return false; + }; + pp$1.regexp_eatZero = function(state) { + if (state.current() === 48 && !isDecimalDigit(state.lookahead())) { + state.lastIntValue = 0; + state.advance(); + return true; + } + return false; + }; + pp$1.regexp_eatControlEscape = function(state) { + var ch = state.current(); + if (ch === 116) { + state.lastIntValue = 9; + state.advance(); + return true; + } + if (ch === 110) { + state.lastIntValue = 10; + state.advance(); + return true; + } + if (ch === 118) { + state.lastIntValue = 11; + state.advance(); + return true; + } + if (ch === 102) { + state.lastIntValue = 12; + state.advance(); + return true; + } + if (ch === 114) { + state.lastIntValue = 13; + state.advance(); + return true; + } + return false; + }; + pp$1.regexp_eatControlLetter = function(state) { + var ch = state.current(); + if (isControlLetter(ch)) { + state.lastIntValue = ch % 32; + state.advance(); + return true; + } + return false; + }; + function isControlLetter(ch) { + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122; + } + pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) { + if (forceU === void 0) forceU = false; + var start = state.pos; + var switchU = forceU || state.switchU; + if (state.eat( + 117 + /* u */ + )) { + if (this.regexp_eatFixedHexDigits(state, 4)) { + var lead = state.lastIntValue; + if (switchU && lead >= 55296 && lead <= 56319) { + var leadSurrogateEnd = state.pos; + if (state.eat( + 92 + /* \ */ + ) && state.eat( + 117 + /* u */ + ) && this.regexp_eatFixedHexDigits(state, 4)) { + var trail = state.lastIntValue; + if (trail >= 56320 && trail <= 57343) { + state.lastIntValue = (lead - 55296) * 1024 + (trail - 56320) + 65536; + return true; + } + } + state.pos = leadSurrogateEnd; + state.lastIntValue = lead; + } + return true; + } + if (switchU && state.eat( + 123 + /* { */ + ) && this.regexp_eatHexDigits(state) && state.eat( + 125 + /* } */ + ) && isValidUnicode(state.lastIntValue)) { + return true; + } + if (switchU) { + state.raise("Invalid unicode escape"); + } + state.pos = start; + } + return false; + }; + function isValidUnicode(ch) { + return ch >= 0 && ch <= 1114111; + } + pp$1.regexp_eatIdentityEscape = function(state) { + if (state.switchU) { + if (this.regexp_eatSyntaxCharacter(state)) { + return true; + } + if (state.eat( + 47 + /* / */ + )) { + state.lastIntValue = 47; + return true; + } + return false; + } + var ch = state.current(); + if (ch !== 99 && (!state.switchN || ch !== 107)) { + state.lastIntValue = ch; + state.advance(); + return true; + } + return false; + }; + pp$1.regexp_eatDecimalEscape = function(state) { + state.lastIntValue = 0; + var ch = state.current(); + if (ch >= 49 && ch <= 57) { + do { + state.lastIntValue = 10 * state.lastIntValue + (ch - 48); + state.advance(); + } while ((ch = state.current()) >= 48 && ch <= 57); + return true; + } + return false; + }; + var CharSetNone = 0; + var CharSetOk = 1; + var CharSetString = 2; + pp$1.regexp_eatCharacterClassEscape = function(state) { + var ch = state.current(); + if (isCharacterClassEscape(ch)) { + state.lastIntValue = -1; + state.advance(); + return CharSetOk; + } + var negate = false; + if (state.switchU && this.options.ecmaVersion >= 9 && ((negate = ch === 80) || ch === 112)) { + state.lastIntValue = -1; + state.advance(); + var result; + if (state.eat( + 123 + /* { */ + ) && (result = this.regexp_eatUnicodePropertyValueExpression(state)) && state.eat( + 125 + /* } */ + )) { + if (negate && result === CharSetString) { + state.raise("Invalid property name"); + } + return result; + } + state.raise("Invalid property name"); + } + return CharSetNone; + }; + function isCharacterClassEscape(ch) { + return ch === 100 || ch === 68 || ch === 115 || ch === 83 || ch === 119 || ch === 87; + } + pp$1.regexp_eatUnicodePropertyValueExpression = function(state) { + var start = state.pos; + if (this.regexp_eatUnicodePropertyName(state) && state.eat( + 61 + /* = */ + )) { + var name = state.lastStringValue; + if (this.regexp_eatUnicodePropertyValue(state)) { + var value = state.lastStringValue; + this.regexp_validateUnicodePropertyNameAndValue(state, name, value); + return CharSetOk; + } + } + state.pos = start; + if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) { + var nameOrValue = state.lastStringValue; + return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue); + } + return CharSetNone; + }; + pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) { + if (!hasOwn(state.unicodeProperties.nonBinary, name)) { + state.raise("Invalid property name"); + } + if (!state.unicodeProperties.nonBinary[name].test(value)) { + state.raise("Invalid property value"); + } + }; + pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) { + if (state.unicodeProperties.binary.test(nameOrValue)) { + return CharSetOk; + } + if (state.switchV && state.unicodeProperties.binaryOfStrings.test(nameOrValue)) { + return CharSetString; + } + state.raise("Invalid property name"); + }; + pp$1.regexp_eatUnicodePropertyName = function(state) { + var ch = 0; + state.lastStringValue = ""; + while (isUnicodePropertyNameCharacter(ch = state.current())) { + state.lastStringValue += codePointToString(ch); + state.advance(); + } + return state.lastStringValue !== ""; + }; + function isUnicodePropertyNameCharacter(ch) { + return isControlLetter(ch) || ch === 95; + } + pp$1.regexp_eatUnicodePropertyValue = function(state) { + var ch = 0; + state.lastStringValue = ""; + while (isUnicodePropertyValueCharacter(ch = state.current())) { + state.lastStringValue += codePointToString(ch); + state.advance(); + } + return state.lastStringValue !== ""; + }; + function isUnicodePropertyValueCharacter(ch) { + return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch); + } + pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) { + return this.regexp_eatUnicodePropertyValue(state); + }; + pp$1.regexp_eatCharacterClass = function(state) { + if (state.eat( + 91 + /* [ */ + )) { + var negate = state.eat( + 94 + /* ^ */ + ); + var result = this.regexp_classContents(state); + if (!state.eat( + 93 + /* ] */ + )) { + state.raise("Unterminated character class"); + } + if (negate && result === CharSetString) { + state.raise("Negated character class may contain strings"); + } + return true; + } + return false; + }; + pp$1.regexp_classContents = function(state) { + if (state.current() === 93) { + return CharSetOk; + } + if (state.switchV) { + return this.regexp_classSetExpression(state); + } + this.regexp_nonEmptyClassRanges(state); + return CharSetOk; + }; + pp$1.regexp_nonEmptyClassRanges = function(state) { + while (this.regexp_eatClassAtom(state)) { + var left = state.lastIntValue; + if (state.eat( + 45 + /* - */ + ) && this.regexp_eatClassAtom(state)) { + var right = state.lastIntValue; + if (state.switchU && (left === -1 || right === -1)) { + state.raise("Invalid character class"); + } + if (left !== -1 && right !== -1 && left > right) { + state.raise("Range out of order in character class"); + } + } + } + }; + pp$1.regexp_eatClassAtom = function(state) { + var start = state.pos; + if (state.eat( + 92 + /* \ */ + )) { + if (this.regexp_eatClassEscape(state)) { + return true; + } + if (state.switchU) { + var ch$1 = state.current(); + if (ch$1 === 99 || isOctalDigit(ch$1)) { + state.raise("Invalid class escape"); + } + state.raise("Invalid escape"); + } + state.pos = start; + } + var ch = state.current(); + if (ch !== 93) { + state.lastIntValue = ch; + state.advance(); + return true; + } + return false; + }; + pp$1.regexp_eatClassEscape = function(state) { + var start = state.pos; + if (state.eat( + 98 + /* b */ + )) { + state.lastIntValue = 8; + return true; + } + if (state.switchU && state.eat( + 45 + /* - */ + )) { + state.lastIntValue = 45; + return true; + } + if (!state.switchU && state.eat( + 99 + /* c */ + )) { + if (this.regexp_eatClassControlLetter(state)) { + return true; + } + state.pos = start; + } + return this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state); + }; + pp$1.regexp_classSetExpression = function(state) { + var result = CharSetOk, subResult; + if (this.regexp_eatClassSetRange(state)) ; + else if (subResult = this.regexp_eatClassSetOperand(state)) { + if (subResult === CharSetString) { + result = CharSetString; + } + var start = state.pos; + while (state.eatChars( + [38, 38] + /* && */ + )) { + if (state.current() !== 38 && (subResult = this.regexp_eatClassSetOperand(state))) { + if (subResult !== CharSetString) { + result = CharSetOk; + } + continue; + } + state.raise("Invalid character in character class"); + } + if (start !== state.pos) { + return result; + } + while (state.eatChars( + [45, 45] + /* -- */ + )) { + if (this.regexp_eatClassSetOperand(state)) { + continue; + } + state.raise("Invalid character in character class"); + } + if (start !== state.pos) { + return result; + } + } else { + state.raise("Invalid character in character class"); + } + for (; ; ) { + if (this.regexp_eatClassSetRange(state)) { + continue; + } + subResult = this.regexp_eatClassSetOperand(state); + if (!subResult) { + return result; + } + if (subResult === CharSetString) { + result = CharSetString; + } + } + }; + pp$1.regexp_eatClassSetRange = function(state) { + var start = state.pos; + if (this.regexp_eatClassSetCharacter(state)) { + var left = state.lastIntValue; + if (state.eat( + 45 + /* - */ + ) && this.regexp_eatClassSetCharacter(state)) { + var right = state.lastIntValue; + if (left !== -1 && right !== -1 && left > right) { + state.raise("Range out of order in character class"); + } + return true; + } + state.pos = start; + } + return false; + }; + pp$1.regexp_eatClassSetOperand = function(state) { + if (this.regexp_eatClassSetCharacter(state)) { + return CharSetOk; + } + return this.regexp_eatClassStringDisjunction(state) || this.regexp_eatNestedClass(state); + }; + pp$1.regexp_eatNestedClass = function(state) { + var start = state.pos; + if (state.eat( + 91 + /* [ */ + )) { + var negate = state.eat( + 94 + /* ^ */ + ); + var result = this.regexp_classContents(state); + if (state.eat( + 93 + /* ] */ + )) { + if (negate && result === CharSetString) { + state.raise("Negated character class may contain strings"); + } + return result; + } + state.pos = start; + } + if (state.eat( + 92 + /* \ */ + )) { + var result$1 = this.regexp_eatCharacterClassEscape(state); + if (result$1) { + return result$1; + } + state.pos = start; + } + return null; + }; + pp$1.regexp_eatClassStringDisjunction = function(state) { + var start = state.pos; + if (state.eatChars( + [92, 113] + /* \q */ + )) { + if (state.eat( + 123 + /* { */ + )) { + var result = this.regexp_classStringDisjunctionContents(state); + if (state.eat( + 125 + /* } */ + )) { + return result; + } + } else { + state.raise("Invalid escape"); + } + state.pos = start; + } + return null; + }; + pp$1.regexp_classStringDisjunctionContents = function(state) { + var result = this.regexp_classString(state); + while (state.eat( + 124 + /* | */ + )) { + if (this.regexp_classString(state) === CharSetString) { + result = CharSetString; + } + } + return result; + }; + pp$1.regexp_classString = function(state) { + var count = 0; + while (this.regexp_eatClassSetCharacter(state)) { + count++; + } + return count === 1 ? CharSetOk : CharSetString; + }; + pp$1.regexp_eatClassSetCharacter = function(state) { + var start = state.pos; + if (state.eat( + 92 + /* \ */ + )) { + if (this.regexp_eatCharacterEscape(state) || this.regexp_eatClassSetReservedPunctuator(state)) { + return true; + } + if (state.eat( + 98 + /* b */ + )) { + state.lastIntValue = 8; + return true; + } + state.pos = start; + return false; + } + var ch = state.current(); + if (ch < 0 || ch === state.lookahead() && isClassSetReservedDoublePunctuatorCharacter(ch)) { + return false; + } + if (isClassSetSyntaxCharacter(ch)) { + return false; + } + state.advance(); + state.lastIntValue = ch; + return true; + }; + function isClassSetReservedDoublePunctuatorCharacter(ch) { + return ch === 33 || ch >= 35 && ch <= 38 || ch >= 42 && ch <= 44 || ch === 46 || ch >= 58 && ch <= 64 || ch === 94 || ch === 96 || ch === 126; + } + function isClassSetSyntaxCharacter(ch) { + return ch === 40 || ch === 41 || ch === 45 || ch === 47 || ch >= 91 && ch <= 93 || ch >= 123 && ch <= 125; + } + pp$1.regexp_eatClassSetReservedPunctuator = function(state) { + var ch = state.current(); + if (isClassSetReservedPunctuator(ch)) { + state.lastIntValue = ch; + state.advance(); + return true; + } + return false; + }; + function isClassSetReservedPunctuator(ch) { + return ch === 33 || ch === 35 || ch === 37 || ch === 38 || ch === 44 || ch === 45 || ch >= 58 && ch <= 62 || ch === 64 || ch === 96 || ch === 126; + } + pp$1.regexp_eatClassControlLetter = function(state) { + var ch = state.current(); + if (isDecimalDigit(ch) || ch === 95) { + state.lastIntValue = ch % 32; + state.advance(); + return true; + } + return false; + }; + pp$1.regexp_eatHexEscapeSequence = function(state) { + var start = state.pos; + if (state.eat( + 120 + /* x */ + )) { + if (this.regexp_eatFixedHexDigits(state, 2)) { + return true; + } + if (state.switchU) { + state.raise("Invalid escape"); + } + state.pos = start; + } + return false; + }; + pp$1.regexp_eatDecimalDigits = function(state) { + var start = state.pos; + var ch = 0; + state.lastIntValue = 0; + while (isDecimalDigit(ch = state.current())) { + state.lastIntValue = 10 * state.lastIntValue + (ch - 48); + state.advance(); + } + return state.pos !== start; + }; + function isDecimalDigit(ch) { + return ch >= 48 && ch <= 57; + } + pp$1.regexp_eatHexDigits = function(state) { + var start = state.pos; + var ch = 0; + state.lastIntValue = 0; + while (isHexDigit(ch = state.current())) { + state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch); + state.advance(); + } + return state.pos !== start; + }; + function isHexDigit(ch) { + return ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102; + } + function hexToInt(ch) { + if (ch >= 65 && ch <= 70) { + return 10 + (ch - 65); + } + if (ch >= 97 && ch <= 102) { + return 10 + (ch - 97); + } + return ch - 48; + } + pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) { + if (this.regexp_eatOctalDigit(state)) { + var n1 = state.lastIntValue; + if (this.regexp_eatOctalDigit(state)) { + var n2 = state.lastIntValue; + if (n1 <= 3 && this.regexp_eatOctalDigit(state)) { + state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue; + } else { + state.lastIntValue = n1 * 8 + n2; + } + } else { + state.lastIntValue = n1; + } + return true; + } + return false; + }; + pp$1.regexp_eatOctalDigit = function(state) { + var ch = state.current(); + if (isOctalDigit(ch)) { + state.lastIntValue = ch - 48; + state.advance(); + return true; + } + state.lastIntValue = 0; + return false; + }; + function isOctalDigit(ch) { + return ch >= 48 && ch <= 55; + } + pp$1.regexp_eatFixedHexDigits = function(state, length) { + var start = state.pos; + state.lastIntValue = 0; + for (var i = 0; i < length; ++i) { + var ch = state.current(); + if (!isHexDigit(ch)) { + state.pos = start; + return false; + } + state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch); + state.advance(); + } + return true; + }; + var Token = function Token2(p) { + this.type = p.type; + this.value = p.value; + this.start = p.start; + this.end = p.end; + if (p.options.locations) { + this.loc = new SourceLocation(p, p.startLoc, p.endLoc); + } + if (p.options.ranges) { + this.range = [p.start, p.end]; + } + }; + var pp = Parser.prototype; + pp.next = function(ignoreEscapeSequenceInKeyword) { + if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc) { + this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); + } + if (this.options.onToken) { + this.options.onToken(new Token(this)); + } + this.lastTokEnd = this.end; + this.lastTokStart = this.start; + this.lastTokEndLoc = this.endLoc; + this.lastTokStartLoc = this.startLoc; + this.nextToken(); + }; + pp.getToken = function() { + this.next(); + return new Token(this); + }; + if (typeof Symbol !== "undefined") { + pp[Symbol.iterator] = function() { + var this$1$1 = this; + return { + next: function() { + var token = this$1$1.getToken(); + return { + done: token.type === types$1.eof, + value: token + }; + } + }; + }; + } + pp.nextToken = function() { + var curContext = this.curContext(); + if (!curContext || !curContext.preserveSpace) { + this.skipSpace(); + } + this.start = this.pos; + if (this.options.locations) { + this.startLoc = this.curPosition(); + } + if (this.pos >= this.input.length) { + return this.finishToken(types$1.eof); + } + if (curContext.override) { + return curContext.override(this); + } else { + this.readToken(this.fullCharCodeAtPos()); + } + }; + pp.readToken = function(code) { + if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92) { + return this.readWord(); + } + return this.getTokenFromCode(code); + }; + pp.fullCharCodeAt = function(pos) { + var code = this.input.charCodeAt(pos); + if (code <= 55295 || code >= 56320) { + return code; + } + var next = this.input.charCodeAt(pos + 1); + return next <= 56319 || next >= 57344 ? code : (code << 10) + next - 56613888; + }; + pp.fullCharCodeAtPos = function() { + return this.fullCharCodeAt(this.pos); + }; + pp.skipBlockComment = function() { + var startLoc = this.options.onComment && this.curPosition(); + var start = this.pos, end = this.input.indexOf("*/", this.pos += 2); + if (end === -1) { + this.raise(this.pos - 2, "Unterminated comment"); + } + this.pos = end + 2; + if (this.options.locations) { + for (var nextBreak = void 0, pos = start; (nextBreak = nextLineBreak(this.input, pos, this.pos)) > -1; ) { + ++this.curLine; + pos = this.lineStart = nextBreak; + } + } + if (this.options.onComment) { + this.options.onComment( + true, + this.input.slice(start + 2, end), + start, + this.pos, + startLoc, + this.curPosition() + ); + } + }; + pp.skipLineComment = function(startSkip) { + var start = this.pos; + var startLoc = this.options.onComment && this.curPosition(); + var ch = this.input.charCodeAt(this.pos += startSkip); + while (this.pos < this.input.length && !isNewLine(ch)) { + ch = this.input.charCodeAt(++this.pos); + } + if (this.options.onComment) { + this.options.onComment( + false, + this.input.slice(start + startSkip, this.pos), + start, + this.pos, + startLoc, + this.curPosition() + ); + } + }; + pp.skipSpace = function() { + loop: while (this.pos < this.input.length) { + var ch = this.input.charCodeAt(this.pos); + switch (ch) { + case 32: + case 160: + ++this.pos; + break; + case 13: + if (this.input.charCodeAt(this.pos + 1) === 10) { + ++this.pos; + } + case 10: + case 8232: + case 8233: + ++this.pos; + if (this.options.locations) { + ++this.curLine; + this.lineStart = this.pos; + } + break; + case 47: + switch (this.input.charCodeAt(this.pos + 1)) { + case 42: + this.skipBlockComment(); + break; + case 47: + this.skipLineComment(2); + break; + default: + break loop; + } + break; + default: + if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) { + ++this.pos; + } else { + break loop; + } + } + } + }; + pp.finishToken = function(type, val) { + this.end = this.pos; + if (this.options.locations) { + this.endLoc = this.curPosition(); + } + var prevType = this.type; + this.type = type; + this.value = val; + this.updateContext(prevType); + }; + pp.readToken_dot = function() { + var next = this.input.charCodeAt(this.pos + 1); + if (next >= 48 && next <= 57) { + return this.readNumber(true); + } + var next2 = this.input.charCodeAt(this.pos + 2); + if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { + this.pos += 3; + return this.finishToken(types$1.ellipsis); + } else { + ++this.pos; + return this.finishToken(types$1.dot); + } + }; + pp.readToken_slash = function() { + var next = this.input.charCodeAt(this.pos + 1); + if (this.exprAllowed) { + ++this.pos; + return this.readRegexp(); + } + if (next === 61) { + return this.finishOp(types$1.assign, 2); + } + return this.finishOp(types$1.slash, 1); + }; + pp.readToken_mult_modulo_exp = function(code) { + var next = this.input.charCodeAt(this.pos + 1); + var size = 1; + var tokentype = code === 42 ? types$1.star : types$1.modulo; + if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) { + ++size; + tokentype = types$1.starstar; + next = this.input.charCodeAt(this.pos + 2); + } + if (next === 61) { + return this.finishOp(types$1.assign, size + 1); + } + return this.finishOp(tokentype, size); + }; + pp.readToken_pipe_amp = function(code) { + var next = this.input.charCodeAt(this.pos + 1); + if (next === code) { + if (this.options.ecmaVersion >= 12) { + var next2 = this.input.charCodeAt(this.pos + 2); + if (next2 === 61) { + return this.finishOp(types$1.assign, 3); + } + } + return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2); + } + if (next === 61) { + return this.finishOp(types$1.assign, 2); + } + return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1); + }; + pp.readToken_caret = function() { + var next = this.input.charCodeAt(this.pos + 1); + if (next === 61) { + return this.finishOp(types$1.assign, 2); + } + return this.finishOp(types$1.bitwiseXOR, 1); + }; + pp.readToken_plus_min = function(code) { + var next = this.input.charCodeAt(this.pos + 1); + if (next === code) { + if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) { + this.skipLineComment(3); + this.skipSpace(); + return this.nextToken(); + } + return this.finishOp(types$1.incDec, 2); + } + if (next === 61) { + return this.finishOp(types$1.assign, 2); + } + return this.finishOp(types$1.plusMin, 1); + }; + pp.readToken_lt_gt = function(code) { + var next = this.input.charCodeAt(this.pos + 1); + var size = 1; + if (next === code) { + size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2; + if (this.input.charCodeAt(this.pos + size) === 61) { + return this.finishOp(types$1.assign, size + 1); + } + return this.finishOp(types$1.bitShift, size); + } + if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45) { + this.skipLineComment(4); + this.skipSpace(); + return this.nextToken(); + } + if (next === 61) { + size = 2; + } + return this.finishOp(types$1.relational, size); + }; + pp.readToken_eq_excl = function(code) { + var next = this.input.charCodeAt(this.pos + 1); + if (next === 61) { + return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2); + } + if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { + this.pos += 2; + return this.finishToken(types$1.arrow); + } + return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1); + }; + pp.readToken_question = function() { + var ecmaVersion = this.options.ecmaVersion; + if (ecmaVersion >= 11) { + var next = this.input.charCodeAt(this.pos + 1); + if (next === 46) { + var next2 = this.input.charCodeAt(this.pos + 2); + if (next2 < 48 || next2 > 57) { + return this.finishOp(types$1.questionDot, 2); + } + } + if (next === 63) { + if (ecmaVersion >= 12) { + var next2$1 = this.input.charCodeAt(this.pos + 2); + if (next2$1 === 61) { + return this.finishOp(types$1.assign, 3); + } + } + return this.finishOp(types$1.coalesce, 2); + } + } + return this.finishOp(types$1.question, 1); + }; + pp.readToken_numberSign = function() { + var ecmaVersion = this.options.ecmaVersion; + var code = 35; + if (ecmaVersion >= 13) { + ++this.pos; + code = this.fullCharCodeAtPos(); + if (isIdentifierStart(code, true) || code === 92) { + return this.finishToken(types$1.privateId, this.readWord1()); + } + } + this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'"); + }; + pp.getTokenFromCode = function(code) { + switch (code) { + // The interpretation of a dot depends on whether it is followed + // by a digit or another two dots. + case 46: + return this.readToken_dot(); + // Punctuation tokens. + case 40: + ++this.pos; + return this.finishToken(types$1.parenL); + case 41: + ++this.pos; + return this.finishToken(types$1.parenR); + case 59: + ++this.pos; + return this.finishToken(types$1.semi); + case 44: + ++this.pos; + return this.finishToken(types$1.comma); + case 91: + ++this.pos; + return this.finishToken(types$1.bracketL); + case 93: + ++this.pos; + return this.finishToken(types$1.bracketR); + case 123: + ++this.pos; + return this.finishToken(types$1.braceL); + case 125: + ++this.pos; + return this.finishToken(types$1.braceR); + case 58: + ++this.pos; + return this.finishToken(types$1.colon); + case 96: + if (this.options.ecmaVersion < 6) { + break; + } + ++this.pos; + return this.finishToken(types$1.backQuote); + case 48: + var next = this.input.charCodeAt(this.pos + 1); + if (next === 120 || next === 88) { + return this.readRadixNumber(16); + } + if (this.options.ecmaVersion >= 6) { + if (next === 111 || next === 79) { + return this.readRadixNumber(8); + } + if (next === 98 || next === 66) { + return this.readRadixNumber(2); + } + } + // Anything else beginning with a digit is an integer, octal + // number, or float. + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + return this.readNumber(false); + // Quotes produce strings. + case 34: + case 39: + return this.readString(code); + // Operators are parsed inline in tiny state machines. '=' (61) is + // often referred to. `finishOp` simply skips the amount of + // characters it is given as second argument, and returns a token + // of the type given by its first argument. + case 47: + return this.readToken_slash(); + case 37: + case 42: + return this.readToken_mult_modulo_exp(code); + case 124: + case 38: + return this.readToken_pipe_amp(code); + case 94: + return this.readToken_caret(); + case 43: + case 45: + return this.readToken_plus_min(code); + case 60: + case 62: + return this.readToken_lt_gt(code); + case 61: + case 33: + return this.readToken_eq_excl(code); + case 63: + return this.readToken_question(); + case 126: + return this.finishOp(types$1.prefix, 1); + case 35: + return this.readToken_numberSign(); + } + this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'"); + }; + pp.finishOp = function(type, size) { + var str = this.input.slice(this.pos, this.pos + size); + this.pos += size; + return this.finishToken(type, str); + }; + pp.readRegexp = function() { + var escaped, inClass, start = this.pos; + for (; ; ) { + if (this.pos >= this.input.length) { + this.raise(start, "Unterminated regular expression"); + } + var ch = this.input.charAt(this.pos); + if (lineBreak.test(ch)) { + this.raise(start, "Unterminated regular expression"); + } + if (!escaped) { + if (ch === "[") { + inClass = true; + } else if (ch === "]" && inClass) { + inClass = false; + } else if (ch === "/" && !inClass) { + break; + } + escaped = ch === "\\"; + } else { + escaped = false; + } + ++this.pos; + } + var pattern = this.input.slice(start, this.pos); + ++this.pos; + var flagsStart = this.pos; + var flags = this.readWord1(); + if (this.containsEsc) { + this.unexpected(flagsStart); + } + var state = this.regexpState || (this.regexpState = new RegExpValidationState(this)); + state.reset(start, pattern, flags); + this.validateRegExpFlags(state); + this.validateRegExpPattern(state); + var value = null; + try { + value = new RegExp(pattern, flags); + } catch (e) { + } + return this.finishToken(types$1.regexp, { pattern, flags, value }); + }; + pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) { + var allowSeparators = this.options.ecmaVersion >= 12 && len === void 0; + var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48; + var start = this.pos, total = 0, lastCode = 0; + for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) { + var code = this.input.charCodeAt(this.pos), val = void 0; + if (allowSeparators && code === 95) { + if (isLegacyOctalNumericLiteral) { + this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals"); + } + if (lastCode === 95) { + this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore"); + } + if (i === 0) { + this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits"); + } + lastCode = code; + continue; + } + if (code >= 97) { + val = code - 97 + 10; + } else if (code >= 65) { + val = code - 65 + 10; + } else if (code >= 48 && code <= 57) { + val = code - 48; + } else { + val = Infinity; + } + if (val >= radix) { + break; + } + lastCode = code; + total = total * radix + val; + } + if (allowSeparators && lastCode === 95) { + this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits"); + } + if (this.pos === start || len != null && this.pos - start !== len) { + return null; + } + return total; + }; + function stringToNumber(str, isLegacyOctalNumericLiteral) { + if (isLegacyOctalNumericLiteral) { + return parseInt(str, 8); + } + return parseFloat(str.replace(/_/g, "")); + } + function stringToBigInt(str) { + if (typeof BigInt !== "function") { + return null; + } + return BigInt(str.replace(/_/g, "")); + } + pp.readRadixNumber = function(radix) { + var start = this.pos; + this.pos += 2; + var val = this.readInt(radix); + if (val == null) { + this.raise(this.start + 2, "Expected number in radix " + radix); + } + if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) { + val = stringToBigInt(this.input.slice(start, this.pos)); + ++this.pos; + } else if (isIdentifierStart(this.fullCharCodeAtPos())) { + this.raise(this.pos, "Identifier directly after number"); + } + return this.finishToken(types$1.num, val); + }; + pp.readNumber = function(startsWithDot) { + var start = this.pos; + if (!startsWithDot && this.readInt(10, void 0, true) === null) { + this.raise(start, "Invalid number"); + } + var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48; + if (octal && this.strict) { + this.raise(start, "Invalid number"); + } + var next = this.input.charCodeAt(this.pos); + if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) { + var val$1 = stringToBigInt(this.input.slice(start, this.pos)); + ++this.pos; + if (isIdentifierStart(this.fullCharCodeAtPos())) { + this.raise(this.pos, "Identifier directly after number"); + } + return this.finishToken(types$1.num, val$1); + } + if (octal && /[89]/.test(this.input.slice(start, this.pos))) { + octal = false; + } + if (next === 46 && !octal) { + ++this.pos; + this.readInt(10); + next = this.input.charCodeAt(this.pos); + } + if ((next === 69 || next === 101) && !octal) { + next = this.input.charCodeAt(++this.pos); + if (next === 43 || next === 45) { + ++this.pos; + } + if (this.readInt(10) === null) { + this.raise(start, "Invalid number"); + } + } + if (isIdentifierStart(this.fullCharCodeAtPos())) { + this.raise(this.pos, "Identifier directly after number"); + } + var val = stringToNumber(this.input.slice(start, this.pos), octal); + return this.finishToken(types$1.num, val); + }; + pp.readCodePoint = function() { + var ch = this.input.charCodeAt(this.pos), code; + if (ch === 123) { + if (this.options.ecmaVersion < 6) { + this.unexpected(); + } + var codePos = ++this.pos; + code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos); + ++this.pos; + if (code > 1114111) { + this.invalidStringToken(codePos, "Code point out of bounds"); + } + } else { + code = this.readHexChar(4); + } + return code; + }; + pp.readString = function(quote) { + var out = "", chunkStart = ++this.pos; + for (; ; ) { + if (this.pos >= this.input.length) { + this.raise(this.start, "Unterminated string constant"); + } + var ch = this.input.charCodeAt(this.pos); + if (ch === quote) { + break; + } + if (ch === 92) { + out += this.input.slice(chunkStart, this.pos); + out += this.readEscapedChar(false); + chunkStart = this.pos; + } else if (ch === 8232 || ch === 8233) { + if (this.options.ecmaVersion < 10) { + this.raise(this.start, "Unterminated string constant"); + } + ++this.pos; + if (this.options.locations) { + this.curLine++; + this.lineStart = this.pos; + } + } else { + if (isNewLine(ch)) { + this.raise(this.start, "Unterminated string constant"); + } + ++this.pos; + } + } + out += this.input.slice(chunkStart, this.pos++); + return this.finishToken(types$1.string, out); + }; + var INVALID_TEMPLATE_ESCAPE_ERROR = {}; + pp.tryReadTemplateToken = function() { + this.inTemplateElement = true; + try { + this.readTmplToken(); + } catch (err) { + if (err === INVALID_TEMPLATE_ESCAPE_ERROR) { + this.readInvalidTemplateToken(); + } else { + throw err; + } + } + this.inTemplateElement = false; + }; + pp.invalidStringToken = function(position, message) { + if (this.inTemplateElement && this.options.ecmaVersion >= 9) { + throw INVALID_TEMPLATE_ESCAPE_ERROR; + } else { + this.raise(position, message); + } + }; + pp.readTmplToken = function() { + var out = "", chunkStart = this.pos; + for (; ; ) { + if (this.pos >= this.input.length) { + this.raise(this.start, "Unterminated template"); + } + var ch = this.input.charCodeAt(this.pos); + if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { + if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) { + if (ch === 36) { + this.pos += 2; + return this.finishToken(types$1.dollarBraceL); + } else { + ++this.pos; + return this.finishToken(types$1.backQuote); + } + } + out += this.input.slice(chunkStart, this.pos); + return this.finishToken(types$1.template, out); + } + if (ch === 92) { + out += this.input.slice(chunkStart, this.pos); + out += this.readEscapedChar(true); + chunkStart = this.pos; + } else if (isNewLine(ch)) { + out += this.input.slice(chunkStart, this.pos); + ++this.pos; + switch (ch) { + case 13: + if (this.input.charCodeAt(this.pos) === 10) { + ++this.pos; + } + case 10: + out += "\n"; + break; + default: + out += String.fromCharCode(ch); + break; + } + if (this.options.locations) { + ++this.curLine; + this.lineStart = this.pos; + } + chunkStart = this.pos; + } else { + ++this.pos; + } + } + }; + pp.readInvalidTemplateToken = function() { + for (; this.pos < this.input.length; this.pos++) { + switch (this.input[this.pos]) { + case "\\": + ++this.pos; + break; + case "$": + if (this.input[this.pos + 1] !== "{") { + break; + } + // fall through + case "`": + return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos)); + case "\r": + if (this.input[this.pos + 1] === "\n") { + ++this.pos; + } + // fall through + case "\n": + case "\u2028": + case "\u2029": + ++this.curLine; + this.lineStart = this.pos + 1; + break; + } + } + this.raise(this.start, "Unterminated template"); + }; + pp.readEscapedChar = function(inTemplate) { + var ch = this.input.charCodeAt(++this.pos); + ++this.pos; + switch (ch) { + case 110: + return "\n"; + // 'n' -> '\n' + case 114: + return "\r"; + // 'r' -> '\r' + case 120: + return String.fromCharCode(this.readHexChar(2)); + // 'x' + case 117: + return codePointToString(this.readCodePoint()); + // 'u' + case 116: + return " "; + // 't' -> '\t' + case 98: + return "\b"; + // 'b' -> '\b' + case 118: + return "\v"; + // 'v' -> '\u000b' + case 102: + return "\f"; + // 'f' -> '\f' + case 13: + if (this.input.charCodeAt(this.pos) === 10) { + ++this.pos; + } + // '\r\n' + case 10: + if (this.options.locations) { + this.lineStart = this.pos; + ++this.curLine; + } + return ""; + case 56: + case 57: + if (this.strict) { + this.invalidStringToken( + this.pos - 1, + "Invalid escape sequence" + ); + } + if (inTemplate) { + var codePos = this.pos - 1; + this.invalidStringToken( + codePos, + "Invalid escape sequence in template string" + ); + } + default: + if (ch >= 48 && ch <= 55) { + var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0]; + var octal = parseInt(octalStr, 8); + if (octal > 255) { + octalStr = octalStr.slice(0, -1); + octal = parseInt(octalStr, 8); + } + this.pos += octalStr.length - 1; + ch = this.input.charCodeAt(this.pos); + if ((octalStr !== "0" || ch === 56 || ch === 57) && (this.strict || inTemplate)) { + this.invalidStringToken( + this.pos - 1 - octalStr.length, + inTemplate ? "Octal literal in template string" : "Octal literal in strict mode" + ); + } + return String.fromCharCode(octal); + } + if (isNewLine(ch)) { + if (this.options.locations) { + this.lineStart = this.pos; + ++this.curLine; + } + return ""; + } + return String.fromCharCode(ch); + } + }; + pp.readHexChar = function(len) { + var codePos = this.pos; + var n = this.readInt(16, len); + if (n === null) { + this.invalidStringToken(codePos, "Bad character escape sequence"); + } + return n; + }; + pp.readWord1 = function() { + this.containsEsc = false; + var word = "", first = true, chunkStart = this.pos; + var astral = this.options.ecmaVersion >= 6; + while (this.pos < this.input.length) { + var ch = this.fullCharCodeAtPos(); + if (isIdentifierChar(ch, astral)) { + this.pos += ch <= 65535 ? 1 : 2; + } else if (ch === 92) { + this.containsEsc = true; + word += this.input.slice(chunkStart, this.pos); + var escStart = this.pos; + if (this.input.charCodeAt(++this.pos) !== 117) { + this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX"); + } + ++this.pos; + var esc = this.readCodePoint(); + if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral)) { + this.invalidStringToken(escStart, "Invalid Unicode escape"); + } + word += codePointToString(esc); + chunkStart = this.pos; + } else { + break; + } + first = false; + } + return word + this.input.slice(chunkStart, this.pos); + }; + pp.readWord = function() { + var word = this.readWord1(); + var type = types$1.name; + if (this.keywords.test(word)) { + type = keywords[word]; + } + return this.finishToken(type, word); + }; + var version = "8.18.0"; + Parser.acorn = { + Parser, + version, + defaultOptions, + Position, + SourceLocation, + getLineInfo, + Node, + TokenType, + tokTypes: types$1, + keywordTypes: keywords, + TokContext, + tokContexts: types, + isIdentifierChar, + isIdentifierStart, + Token, + isNewLine, + lineBreak, + lineBreakG, + nonASCIIwhitespace + }; + function parse3(input, options) { + return Parser.parse(input, options); + } + + // node_modules/eslint-scope/lib/assert.js + function assert3(condition, message = "Assertion failed.") { + if (!condition) { + throw new Error(message); + } + } + + // node_modules/eslint-scope/lib/scope.js + var import_estraverse = __toESM(require_estraverse(), 1); + + // node_modules/eslint-scope/lib/reference.js + var READ = 1; + var WRITE = 2; + var RW = READ | WRITE; + var Reference = class _Reference { + constructor(ident, scope, flag, writeExpr, maybeImplicitGlobal, partial, init) { + this.identifier = ident; + this.from = scope; + this.tainted = false; + this.resolved = null; + this.flag = flag; + if (this.isWrite()) { + this.writeExpr = writeExpr; + this.partial = partial; + this.init = init; + } + this.__maybeImplicitGlobal = maybeImplicitGlobal; + } + /** + * Whether the reference is static. + * @function Reference#isStatic + * @returns {boolean} static + */ + isStatic() { + return !this.tainted && !!this.resolved && this.resolved.scope.isStatic(); + } + /** + * Whether the reference is writeable. + * @function Reference#isWrite + * @returns {boolean} write + */ + isWrite() { + return !!(this.flag & _Reference.WRITE); + } + /** + * Whether the reference is readable. + * @function Reference#isRead + * @returns {boolean} read + */ + isRead() { + return !!(this.flag & _Reference.READ); + } + /** + * Whether the reference is read-only. + * @function Reference#isReadOnly + * @returns {boolean} read only + */ + isReadOnly() { + return this.flag === _Reference.READ; + } + /** + * Whether the reference is write-only. + * @function Reference#isWriteOnly + * @returns {boolean} write only + */ + isWriteOnly() { + return this.flag === _Reference.WRITE; + } + /** + * Whether the reference is read-write. + * @function Reference#isReadWrite + * @returns {boolean} read write + */ + isReadWrite() { + return this.flag === _Reference.RW; + } + }; + Reference.READ = READ; + Reference.WRITE = WRITE; + Reference.RW = RW; + var reference_default = Reference; + + // node_modules/eslint-scope/lib/variable.js + var Variable = class { + constructor(name, scope) { + this.name = name; + this.identifiers = []; + this.references = []; + this.defs = []; + this.tainted = false; + this.stack = true; + this.scope = scope; + } + }; + Variable.CatchClause = "CatchClause"; + Variable.Parameter = "Parameter"; + Variable.FunctionName = "FunctionName"; + Variable.ClassName = "ClassName"; + Variable.Variable = "Variable"; + Variable.ImportBinding = "ImportBinding"; + Variable.ImplicitGlobalVariable = "ImplicitGlobalVariable"; + var variable_default = Variable; + + // node_modules/eslint-scope/lib/definition.js + var Definition = class { + constructor(type, name, node, parent, index, kind) { + this.type = type; + this.name = name; + this.node = node; + this.parent = parent; + this.index = index; + this.kind = kind; + } + }; + var ParameterDefinition = class extends Definition { + constructor(name, node, index, rest) { + super(variable_default.Parameter, name, node, null, index, null); + this.rest = rest; + } + }; + + // node_modules/eslint-scope/lib/scope.js + var { Syntax } = import_estraverse.default; + function isStrictScope(scope, block, isMethodDefinition) { + let body; + if (scope.upper && scope.upper.isStrict) { + return true; + } + if (isMethodDefinition) { + return true; + } + if (scope.type === "class" || scope.type === "module") { + return true; + } + if (scope.type === "block" || scope.type === "switch") { + return false; + } + if (scope.type === "function") { + if (block.type === Syntax.ArrowFunctionExpression && // @ts-ignore -- when block is ArrowFunctionExpression + block.body.type !== Syntax.BlockStatement) { + return false; + } + if (block.type === Syntax.Program) { + body = block; + } else { + body = block.body; + } + if (!body) { + return false; + } + } else if (scope.type === "global") { + body = block; + } else { + return false; + } + for (let i = 0, iz = body.body.length; i < iz; ++i) { + const stmt = body.body[i]; + if (typeof stmt.directive !== "string") { + break; + } + if (stmt.directive === "use strict") { + return true; + } + } + return false; + } + function registerScope(scopeManager, scope) { + scopeManager.scopes.push(scope); + const scopes = scopeManager.__nodeToScope.get(scope.block); + if (scopes) { + scopes.push(scope); + } else { + scopeManager.__nodeToScope.set(scope.block, [scope]); + } + } + var Scope3 = class { + constructor(scopeManager, type, upperScope, block, isMethodDefinition) { + this.type = type; + this.set = /* @__PURE__ */ new Map(); + this.taints = /* @__PURE__ */ new Map(); + this.dynamic = this.type === "global" || this.type === "with"; + this.block = block; + this.through = []; + this.variables = []; + this.references = []; + this.variableScope = this.type === "global" || this.type === "module" || this.type === "function" || this.type === "class-field-initializer" || this.type === "class-static-block" ? this : upperScope.variableScope; + this.functionExpressionScope = /** @type {any} */ + false; + this.directCallToEvalScope = false; + this.thisFound = false; + this.__left = []; + this.upper = upperScope; + this.isStrict = scopeManager.isStrictModeSupported() ? isStrictScope(this, block, isMethodDefinition) : false; + this.childScopes = []; + if (this.upper) { + this.upper.childScopes.push(this); + } + this.__declaredVariables = scopeManager.__declaredVariables; + registerScope(scopeManager, this); + } + __shouldStaticallyClose(scopeManager) { + return !this.dynamic || scopeManager.__isOptimistic() || this.type === "global"; + } + __staticCloseRef(ref2) { + if (!this.__resolve(ref2)) { + this.__delegateToUpperScope(ref2); + } + } + __dynamicCloseRef(ref2) { + let current2 = this; + do { + current2.through.push(ref2); + current2 = current2.upper; + } while (current2); + } + __close(scopeManager) { + let closeRef; + if (this.__shouldStaticallyClose(scopeManager)) { + closeRef = this.__staticCloseRef; + } else { + closeRef = this.__dynamicCloseRef; + } + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref2 = this.__left[i]; + closeRef.call(this, ref2); + } + this.__left = null; + return this.upper; + } + // To override by function scopes. + // References in default parameters isn't resolved to variables which are in their function body. + // eslint-disable-next-line class-methods-use-this, no-unused-vars -- Desired as instance method with signature + __isValidResolution(ref2, variable) { + return true; + } + __resolve(ref2) { + const name = ref2.identifier.name; + if (!this.set.has(name)) { + return false; + } + const variable = this.set.get(name); + if (!this.__isValidResolution(ref2, variable)) { + return false; + } + variable.references.push(ref2); + variable.stack = variable.stack && ref2.from.variableScope === this.variableScope; + if (ref2.tainted) { + variable.tainted = true; + this.taints.set(variable.name, true); + } + ref2.resolved = variable; + return true; + } + __delegateToUpperScope(ref2) { + if (this.upper) { + this.upper.__left.push(ref2); + } + this.through.push(ref2); + } + __addDeclaredVariablesOfNode(variable, node) { + if (node === null || node === void 0) { + return; + } + let variables = this.__declaredVariables.get(node); + if (variables === null || variables === void 0) { + variables = []; + this.__declaredVariables.set(node, variables); + } + if (!variables.includes(variable)) { + variables.push(variable); + } + } + __defineGeneric(name, set, variables, node, def) { + let variable; + variable = set.get(name); + if (!variable) { + variable = new variable_default(name, this); + set.set(name, variable); + variables.push(variable); + } + if (def) { + variable.defs.push(def); + this.__addDeclaredVariablesOfNode(variable, def.node); + this.__addDeclaredVariablesOfNode(variable, def.parent); + } + if (node) { + variable.identifiers.push(node); + } + } + __define(node, def) { + if (node && node.type === Syntax.Identifier) { + this.__defineGeneric( + node.name, + this.set, + this.variables, + node, + def + ); + } + } + __referencing(node, assign, writeExpr, maybeImplicitGlobal, partial, init) { + if (!node || node.type !== Syntax.Identifier && node.type !== "JSXIdentifier") { + return; + } + if (node.name === "super") { + return; + } + const ref2 = new reference_default( + node, + this, + assign || reference_default.READ, + writeExpr, + maybeImplicitGlobal, + !!partial, + !!init + ); + this.references.push(ref2); + this.__left.push(ref2); + } + __detectEval() { + let current2 = this; + this.directCallToEvalScope = true; + do { + current2.dynamic = true; + current2 = current2.upper; + } while (current2); + } + __detectThis() { + this.thisFound = true; + } + __isClosed() { + return this.__left === null; + } + /** + * returns resolved {Reference} + * @function Scope#resolve + * @param {ESTree.Identifier} ident identifier to be resolved. + * @returns {?Reference} reference + */ + resolve(ident) { + let ref2, i, iz; + assert3(this.__isClosed(), "Scope should be closed."); + assert3( + ident.type === Syntax.Identifier, + "Target should be identifier." + ); + for (i = 0, iz = this.references.length; i < iz; ++i) { + ref2 = this.references[i]; + if (ref2.identifier === ident) { + return ref2; + } + } + return null; + } + /** + * returns this scope is static + * @function Scope#isStatic + * @returns {boolean} static + */ + isStatic() { + return !this.dynamic; + } + /** + * returns this scope has materialized arguments + * @function Scope#isArgumentsMaterialized + * @returns {any} arguments materialized + */ + // eslint-disable-next-line class-methods-use-this -- Desired as instance method + isArgumentsMaterialized() { + return true; + } + /** + * returns this scope has materialized `this` reference + * @function Scope#isThisMaterialized + * @returns {any} this materialized + */ + // eslint-disable-next-line class-methods-use-this -- Desired as instance method + isThisMaterialized() { + return true; + } + isUsedName(name) { + if (this.set.has(name)) { + return true; + } + for (let i = 0, iz = this.through.length; i < iz; ++i) { + if (this.through[i].identifier.name === name) { + return true; + } + } + return false; + } + }; + var GlobalScope = class extends Scope3 { + constructor(scopeManager, block) { + super(scopeManager, "global", null, block, false); + this.implicit = { + set: /* @__PURE__ */ new Map(), + /** @type {Variable[]} */ + variables: [], + /** + * List of {@link Reference}s that are left to be resolved (i.e. which + * need to be linked to the variable they refer to). + * @member {Reference[]} Scope#implicit#left + * @type {Reference[]} + */ + left: [] + }; + } + __close(scopeManager) { + const implicit = []; + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref2 = this.__left[i]; + if (ref2.__maybeImplicitGlobal && !this.set.has(ref2.identifier.name)) { + implicit.push(ref2.__maybeImplicitGlobal); + } + } + for (let i = 0, iz = implicit.length; i < iz; ++i) { + const info = implicit[i]; + this.__defineImplicit( + info.pattern, + new Definition( + variable_default.ImplicitGlobalVariable, + info.pattern, + info.node, + null, + null, + null + ) + ); + } + super.__close(scopeManager); + this.implicit.left = [...this.through]; + return null; + } + __defineImplicit(node, def) { + if (node && node.type === Syntax.Identifier) { + this.__defineGeneric( + node.name, + this.implicit.set, + this.implicit.variables, + node, + def + ); + } + } + __addVariables(names) { + for (const name of names) { + this.__defineGeneric(name, this.set, this.variables, null, null); + } + const namesSet = new Set(names); + this.through = this.through.filter((reference) => { + const name = reference.identifier.name; + if (namesSet.has(name)) { + const variable = this.set.get(name); + reference.resolved = variable; + variable.references.push(reference); + return false; + } + return true; + }); + this.implicit.variables = this.implicit.variables.filter((variable) => { + const name = variable.name; + if (namesSet.has(name)) { + this.implicit.set.delete(name); + return false; + } + return true; + }); + this.implicit.left = this.implicit.left.filter( + (reference) => !namesSet.has(reference.identifier.name) + ); + } + }; + var ModuleScope = class extends Scope3 { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "module", upperScope, block, false); + } + }; + var FunctionExpressionNameScope = class extends Scope3 { + constructor(scopeManager, upperScope, block) { + super( + scopeManager, + "function-expression-name", + upperScope, + block, + false + ); + this.__define( + block.id, + new Definition( + variable_default.FunctionName, + block.id, + block, + null, + null, + null + ) + ); + this.functionExpressionScope = /** @type {const} */ + true; + } + }; + var CatchScope = class extends Scope3 { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "catch", upperScope, block, false); + } + }; + var WithScope = class extends Scope3 { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "with", upperScope, block, false); + } + __close(scopeManager) { + if (this.__shouldStaticallyClose(scopeManager)) { + return super.__close(scopeManager); + } + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref2 = this.__left[i]; + ref2.tainted = true; + this.__delegateToUpperScope(ref2); + } + this.__left = null; + return this.upper; + } + }; + var BlockScope = class extends Scope3 { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "block", upperScope, block, false); + } + }; + var SwitchScope = class extends Scope3 { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "switch", upperScope, block, false); + } + }; + var FunctionScope = class extends Scope3 { + constructor(scopeManager, upperScope, block, isMethodDefinition) { + super(scopeManager, "function", upperScope, block, isMethodDefinition); + if (this.block.type !== Syntax.ArrowFunctionExpression) { + this.__defineArguments(); + } + } + isArgumentsMaterialized() { + if (this.block.type === Syntax.ArrowFunctionExpression) { + return false; + } + if (!this.isStatic()) { + return true; + } + const variable = this.set.get("arguments"); + assert3(variable, "Always have arguments variable."); + return variable.tainted || variable.references.length !== 0; + } + isThisMaterialized() { + if (!this.isStatic()) { + return true; + } + return this.thisFound; + } + __defineArguments() { + this.__defineGeneric("arguments", this.set, this.variables, null, null); + this.taints.set("arguments", true); + } + // References in default parameters isn't resolved to variables which are in their function body. + // const x = 1 + // function f(a = x) { // This `x` is resolved to the `x` in the outer scope. + // const x = 2 + // console.log(a) + // } + __isValidResolution(ref2, variable) { + if (this.block.type === "Program") { + return true; + } + const bodyStart = this.block.body.range[0]; + return !(variable.scope === this && ref2.identifier.range[0] < bodyStart && // the reference is in the parameter part. + variable.defs.every((d) => d.name.range[0] >= bodyStart)); + } + }; + var ForScope = class extends Scope3 { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "for", upperScope, block, false); + } + }; + var ClassScope = class extends Scope3 { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "class", upperScope, block, false); + } + }; + var ClassFieldInitializerScope = class extends Scope3 { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "class-field-initializer", upperScope, block, true); + } + }; + var ClassStaticBlockScope = class extends Scope3 { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "class-static-block", upperScope, block, true); + } + }; + + // node_modules/eslint-scope/lib/scope-manager.js + var ScopeManager = class { + constructor(options) { + this.scopes = []; + this.globalScope = null; + this.__nodeToScope = /* @__PURE__ */ new WeakMap(); + this.__currentScope = null; + this.__options = options; + this.__declaredVariables = /* @__PURE__ */ new WeakMap(); + } + __isOptimistic() { + return this.__options.optimistic; + } + __ignoreEval() { + return this.__options.ignoreEval; + } + __isJSXEnabled() { + return this.__options.jsx === true; + } + isGlobalReturn() { + return this.__options.nodejsScope || this.__options.sourceType === "commonjs"; + } + isModule() { + return this.__options.sourceType === "module"; + } + isImpliedStrict() { + return !!this.__options.impliedStrict; + } + isStrictModeSupported() { + return this.__options.ecmaVersion >= 5; + } + // Returns appropriate scope for this node. + __get(node) { + return this.__nodeToScope.get(node); + } + /** + * Get variables that are declared by the node. + * + * "are declared by the node" means the node is same as `Variable.defs[].node` or `Variable.defs[].parent`. + * If the node declares nothing, this method returns an empty array. + * CAUTION: This API is experimental. See https://github.com/estools/escope/pull/69 for more details. + * @param {ESTree.Node} node a node to get. + * @returns {Variable[]} variables that declared by the node. + */ + getDeclaredVariables(node) { + return this.__declaredVariables.get(node) || []; + } + /** + * acquire scope from node. + * @function ScopeManager#acquire + * @param {ESTree.Node} node node for the acquired scope. + * @param {?boolean} [inner=false] look up the most inner scope, default value is false. + * @returns {Scope?} Scope from node + */ + acquire(node, inner) { + function predicate(testScope) { + if (testScope.type === "function" && testScope.functionExpressionScope) { + return false; + } + return true; + } + const scopes = this.__get(node); + if (!scopes || scopes.length === 0) { + return null; + } + if (scopes.length === 1) { + return scopes[0]; + } + if (inner) { + for (let i = scopes.length - 1; i >= 0; --i) { + const scope = scopes[i]; + if (predicate(scope)) { + return scope; + } + } + } else { + for (let i = 0, iz = scopes.length; i < iz; ++i) { + const scope = scopes[i]; + if (predicate(scope)) { + return scope; + } + } + } + return null; + } + /** + * acquire all scopes from node. + * @function ScopeManager#acquireAll + * @param {ESTree.Node} node node for the acquired scope. + * @returns {Scope[]?} Scope array + */ + acquireAll(node) { + return this.__get(node); + } + /** + * release the node. + * @function ScopeManager#release + * @param {ESTree.Node} node releasing node. + * @param {?boolean} [inner=false] look up the most inner scope, default value is false. + * @returns {Scope?} upper scope for the node. + */ + release(node, inner) { + const scopes = this.__get(node); + if (scopes && scopes.length) { + const scope = scopes[0].upper; + if (!scope) { + return null; + } + return this.acquire(scope.block, inner); + } + return null; + } + /** + * Add global variables and resolve their references. + * @function ScopeManager#addGlobals + * @param {string[]} names Names of global variables to add. + * @returns {void} + */ + addGlobals(names) { + this.globalScope.__addVariables(names); + } + attach() { + } + // eslint-disable-line class-methods-use-this -- Desired as instance method + detach() { + } + // eslint-disable-line class-methods-use-this -- Desired as instance method + __nestScope(scope) { + if (scope instanceof GlobalScope) { + assert3(this.__currentScope === null); + this.globalScope = scope; + } + this.__currentScope = scope; + return scope; + } + __nestGlobalScope(node) { + return this.__nestScope(new GlobalScope(this, node)); + } + __nestBlockScope(node) { + return this.__nestScope( + new BlockScope(this, this.__currentScope, node) + ); + } + __nestFunctionScope(node, isMethodDefinition) { + return this.__nestScope( + new FunctionScope( + this, + this.__currentScope, + node, + isMethodDefinition + ) + ); + } + __nestForScope(node) { + return this.__nestScope(new ForScope(this, this.__currentScope, node)); + } + __nestCatchScope(node) { + return this.__nestScope( + new CatchScope(this, this.__currentScope, node) + ); + } + __nestWithScope(node) { + return this.__nestScope(new WithScope(this, this.__currentScope, node)); + } + __nestClassScope(node) { + return this.__nestScope( + new ClassScope(this, this.__currentScope, node) + ); + } + __nestClassFieldInitializerScope(node) { + return this.__nestScope( + new ClassFieldInitializerScope(this, this.__currentScope, node) + ); + } + __nestClassStaticBlockScope(node) { + return this.__nestScope( + new ClassStaticBlockScope(this, this.__currentScope, node) + ); + } + __nestSwitchScope(node) { + return this.__nestScope( + new SwitchScope(this, this.__currentScope, node) + ); + } + __nestModuleScope(node) { + return this.__nestScope( + new ModuleScope(this, this.__currentScope, node) + ); + } + __nestFunctionExpressionNameScope(node) { + return this.__nestScope( + new FunctionExpressionNameScope(this, this.__currentScope, node) + ); + } + __isES6() { + return this.__options.ecmaVersion >= 6; + } + }; + var scope_manager_default = ScopeManager; + + // node_modules/eslint-scope/lib/referencer.js + var import_estraverse3 = __toESM(require_estraverse(), 1); + var import_esrecurse2 = __toESM(require_esrecurse(), 1); + + // node_modules/eslint-scope/lib/pattern-visitor.js + var import_estraverse2 = __toESM(require_estraverse(), 1); + var import_esrecurse = __toESM(require_esrecurse(), 1); + var { Syntax: Syntax2 } = import_estraverse2.default; + function getLast(xs) { + return xs.at(-1) || null; + } + var PatternVisitor = class extends import_esrecurse.default.Visitor { + static isPattern(node) { + const nodeType = node.type; + return nodeType === Syntax2.Identifier || nodeType === Syntax2.ObjectPattern || nodeType === Syntax2.ArrayPattern || nodeType === Syntax2.SpreadElement || nodeType === Syntax2.RestElement || nodeType === Syntax2.AssignmentPattern; + } + constructor(options, rootPattern, callback) { + super(null, options); + this.rootPattern = rootPattern; + this.callback = callback; + this.assignments = []; + this.rightHandNodes = []; + this.restElements = []; + } + Identifier(pattern) { + const lastRestElement = getLast(this.restElements); + this.callback(pattern, { + topLevel: pattern === this.rootPattern, + rest: lastRestElement !== null && lastRestElement !== void 0 && lastRestElement.argument === pattern, + assignments: this.assignments + }); + } + Property(property) { + if (property.computed) { + this.rightHandNodes.push(property.key); + } + this.visit(property.value); + } + ArrayPattern(pattern) { + for (let i = 0, iz = pattern.elements.length; i < iz; ++i) { + const element = pattern.elements[i]; + this.visit(element); + } + } + AssignmentPattern(pattern) { + this.assignments.push(pattern); + this.visit(pattern.left); + this.rightHandNodes.push(pattern.right); + this.assignments.pop(); + } + RestElement(pattern) { + this.restElements.push(pattern); + this.visit(pattern.argument); + this.restElements.pop(); + } + MemberExpression(node) { + if (node.computed) { + this.rightHandNodes.push(node.property); + } + this.rightHandNodes.push(node.object); + } + // + // ForInStatement.left and AssignmentExpression.left are LeftHandSideExpression. + // By spec, LeftHandSideExpression is Pattern or MemberExpression. + // (see also: https://github.com/estree/estree/pull/20#issuecomment-74584758) + // But espree 2.0 parses to ArrayExpression, ObjectExpression, etc... + // + SpreadElement(node) { + this.visit(node.argument); + } + ArrayExpression(node) { + node.elements.forEach(this.visit, this); + } + AssignmentExpression(node) { + this.assignments.push(node); + this.visit(node.left); + this.rightHandNodes.push(node.right); + this.assignments.pop(); + } + CallExpression(node) { + node.arguments.forEach((a) => { + this.rightHandNodes.push(a); + }); + this.visit(node.callee); + } + }; + var pattern_visitor_default = PatternVisitor; + + // node_modules/eslint-scope/lib/referencer.js + var { Syntax: Syntax3 } = import_estraverse3.default; + function traverseIdentifierInPattern(options, rootPattern, referencer, callback) { + const visitor = new pattern_visitor_default(options, rootPattern, callback); + visitor.visit(rootPattern); + if (referencer !== null && referencer !== void 0) { + visitor.rightHandNodes.forEach(referencer.visit, referencer); + } + } + var Importer = class extends import_esrecurse2.default.Visitor { + constructor(declaration, referencer) { + super(null, referencer.options); + this.declaration = declaration; + this.referencer = referencer; + } + visitImport(id, specifier) { + this.referencer.visitPattern(id, (pattern) => { + this.referencer.currentScope().__define( + pattern, + new Definition( + variable_default.ImportBinding, + pattern, + specifier, + this.declaration, + null, + null + ) + ); + }); + } + ImportNamespaceSpecifier(node) { + const local = node.local || node.id; + if (local) { + this.visitImport(local, node); + } + } + ImportDefaultSpecifier(node) { + const local = node.local || node.id; + this.visitImport(local, node); + } + ImportSpecifier(node) { + const local = node.local || node.id; + if (node.name) { + this.visitImport(node.name, node); + } else { + this.visitImport(local, node); + } + } + }; + var Referencer = class extends import_esrecurse2.default.Visitor { + constructor(options, scopeManager) { + super(null, options); + this.options = options; + this.scopeManager = scopeManager; + this.parent = null; + this.isInnerMethodDefinition = false; + } + currentScope() { + return this.scopeManager.__currentScope; + } + close(node) { + while (this.currentScope() && node === this.currentScope().block) { + this.scopeManager.__currentScope = this.currentScope().__close( + this.scopeManager + ); + } + } + pushInnerMethodDefinition(isInnerMethodDefinition) { + const previous = this.isInnerMethodDefinition; + this.isInnerMethodDefinition = isInnerMethodDefinition; + return previous; + } + popInnerMethodDefinition(isInnerMethodDefinition) { + this.isInnerMethodDefinition = isInnerMethodDefinition; + } + referencingDefaultValue(pattern, assignments, maybeImplicitGlobal, init) { + const scope = this.currentScope(); + assignments.forEach((assignment) => { + scope.__referencing( + pattern, + reference_default.WRITE, + assignment.right, + maybeImplicitGlobal, + pattern !== assignment.left, + init + ); + }); + } + visitPattern(node, options, callback) { + let visitPatternOptions = options; + let visitPatternCallback = callback; + if (typeof options === "function") { + visitPatternCallback = options; + visitPatternOptions = { processRightHandNodes: false }; + } + traverseIdentifierInPattern( + this.options, + node, + visitPatternOptions.processRightHandNodes ? this : null, + visitPatternCallback + ); + } + visitFunction(node) { + let i, iz; + if (node.type === Syntax3.FunctionDeclaration) { + this.currentScope().__define( + node.id, + new Definition( + variable_default.FunctionName, + node.id, + node, + null, + null, + null + ) + ); + } + if (node.type === Syntax3.FunctionExpression && node.id) { + this.scopeManager.__nestFunctionExpressionNameScope(node); + } + this.scopeManager.__nestFunctionScope( + node, + this.isInnerMethodDefinition + ); + const that = this; + function visitPatternCallback(pattern, info) { + that.currentScope().__define( + pattern, + new ParameterDefinition(pattern, node, i, info.rest) + ); + that.referencingDefaultValue(pattern, info.assignments, null, true); + } + for (i = 0, iz = node.params.length; i < iz; ++i) { + this.visitPattern( + node.params[i], + { processRightHandNodes: true }, + visitPatternCallback + ); + } + if (node.rest) { + this.visitPattern( + { + type: "RestElement", + argument: node.rest + }, + (pattern) => { + this.currentScope().__define( + pattern, + new ParameterDefinition( + pattern, + node, + node.params.length, + true + ) + ); + } + ); + } + if (node.body) { + if (node.body.type === Syntax3.BlockStatement) { + this.visitChildren(node.body); + } else { + this.visit(node.body); + } + } + this.close(node); + } + visitClass(node) { + if (node.type === Syntax3.ClassDeclaration) { + this.currentScope().__define( + node.id, + new Definition( + variable_default.ClassName, + node.id, + node, + null, + null, + null + ) + ); + } + this.scopeManager.__nestClassScope(node); + if (node.id) { + this.currentScope().__define( + node.id, + new Definition(variable_default.ClassName, node.id, node) + ); + } + this.visit(node.superClass); + this.visit(node.body); + this.close(node); + } + visitProperty(node) { + let previous; + if (node.computed) { + this.visit(node.key); + } + const isMethodDefinition = node.type === Syntax3.MethodDefinition; + if (isMethodDefinition) { + previous = this.pushInnerMethodDefinition(true); + } + this.visit(node.value); + if (isMethodDefinition) { + this.popInnerMethodDefinition(previous); + } + } + visitForIn(node) { + if (node.left.type === Syntax3.VariableDeclaration && node.left.kind !== "var") { + this.scopeManager.__nestForScope(node); + } + if (node.left.type === Syntax3.VariableDeclaration) { + this.visit(node.left); + this.visitPattern(node.left.declarations[0].id, (pattern) => { + this.currentScope().__referencing( + pattern, + reference_default.WRITE, + node.right, + null, + true, + true + ); + }); + } else { + this.visitPattern( + node.left, + { processRightHandNodes: true }, + (pattern, info) => { + let maybeImplicitGlobal = null; + if (!this.currentScope().isStrict) { + maybeImplicitGlobal = { + pattern, + node + }; + } + this.referencingDefaultValue( + pattern, + info.assignments, + maybeImplicitGlobal, + false + ); + this.currentScope().__referencing( + pattern, + reference_default.WRITE, + node.right, + maybeImplicitGlobal, + true, + false + ); + } + ); + } + this.visit(node.right); + this.visit(node.body); + this.close(node); + } + visitVariableDeclaration(variableTargetScope, type, node, index) { + const decl = node.declarations[index]; + const init = decl.init; + this.visitPattern( + decl.id, + { processRightHandNodes: true }, + (pattern, info) => { + variableTargetScope.__define( + pattern, + new Definition(type, pattern, decl, node, index, node.kind) + ); + this.referencingDefaultValue( + pattern, + info.assignments, + null, + true + ); + if (init) { + this.currentScope().__referencing( + pattern, + reference_default.WRITE, + init, + null, + !info.topLevel, + true + ); + } + } + ); + } + AssignmentExpression(node) { + if (pattern_visitor_default.isPattern(node.left)) { + if (node.operator === "=") { + this.visitPattern( + node.left, + { processRightHandNodes: true }, + (pattern, info) => { + let maybeImplicitGlobal = null; + if (!this.currentScope().isStrict) { + maybeImplicitGlobal = { + pattern, + node + }; + } + this.referencingDefaultValue( + pattern, + info.assignments, + maybeImplicitGlobal, + false + ); + this.currentScope().__referencing( + pattern, + reference_default.WRITE, + node.right, + maybeImplicitGlobal, + !info.topLevel, + false + ); + } + ); + } else { + this.currentScope().__referencing( + node.left, + reference_default.RW, + node.right + ); + } + } else { + this.visit(node.left); + } + this.visit(node.right); + } + CatchClause(node) { + this.scopeManager.__nestCatchScope(node); + this.visitPattern( + node.param, + { processRightHandNodes: true }, + (pattern, info) => { + this.currentScope().__define( + pattern, + new Definition( + variable_default.CatchClause, + pattern, + node, + null, + null, + null + ) + ); + this.referencingDefaultValue( + pattern, + info.assignments, + null, + true + ); + } + ); + this.visit(node.body); + this.close(node); + } + Program(node) { + this.scopeManager.__nestGlobalScope(node); + if (this.scopeManager.isGlobalReturn()) { + this.currentScope().isStrict = false; + this.scopeManager.__nestFunctionScope(node, false); + } + if (this.scopeManager.__isES6() && this.scopeManager.isModule()) { + this.scopeManager.__nestModuleScope(node); + } + if (this.scopeManager.isStrictModeSupported() && this.scopeManager.isImpliedStrict()) { + this.currentScope().isStrict = true; + } + this.visitChildren(node); + this.close(node); + } + Identifier(node) { + this.currentScope().__referencing(node); + } + // eslint-disable-next-line class-methods-use-this -- Desired as instance method + PrivateIdentifier() { + } + UpdateExpression(node) { + if (pattern_visitor_default.isPattern(node.argument)) { + this.currentScope().__referencing( + node.argument, + reference_default.RW, + null + ); + } else { + this.visitChildren(node); + } + } + MemberExpression(node) { + this.visit(node.object); + if (node.computed) { + this.visit(node.property); + } + } + Property(node) { + this.visitProperty(node); + } + PropertyDefinition(node) { + const { computed, key, value } = node; + if (computed) { + this.visit(key); + } + if (value) { + this.scopeManager.__nestClassFieldInitializerScope(value); + this.visit(value); + this.close(value); + } + } + StaticBlock(node) { + this.scopeManager.__nestClassStaticBlockScope(node); + this.visitChildren(node); + this.close(node); + } + MethodDefinition(node) { + this.visitProperty(node); + } + BreakStatement() { + } + // eslint-disable-line class-methods-use-this -- Desired as instance method + ContinueStatement() { + } + // eslint-disable-line class-methods-use-this -- Desired as instance method + LabeledStatement(node) { + this.visit(node.body); + } + ForStatement(node) { + if (node.init && node.init.type === Syntax3.VariableDeclaration && node.init.kind !== "var") { + this.scopeManager.__nestForScope(node); + } + this.visitChildren(node); + this.close(node); + } + ClassExpression(node) { + this.visitClass(node); + } + ClassDeclaration(node) { + this.visitClass(node); + } + CallExpression(node) { + if (!this.scopeManager.__ignoreEval() && node.callee.type === Syntax3.Identifier && node.callee.name === "eval") { + this.currentScope().variableScope.__detectEval(); + } + this.visitChildren(node); + } + BlockStatement(node) { + if (this.scopeManager.__isES6()) { + this.scopeManager.__nestBlockScope(node); + } + this.visitChildren(node); + this.close(node); + } + ThisExpression() { + this.currentScope().variableScope.__detectThis(); + } + WithStatement(node) { + this.visit(node.object); + this.scopeManager.__nestWithScope(node); + this.visit(node.body); + this.close(node); + } + VariableDeclaration(node) { + const variableTargetScope = node.kind === "var" ? this.currentScope().variableScope : this.currentScope(); + for (let i = 0, iz = node.declarations.length; i < iz; ++i) { + const decl = node.declarations[i]; + this.visitVariableDeclaration( + variableTargetScope, + variable_default.Variable, + node, + i + ); + if (decl.init) { + this.visit(decl.init); + } + } + } + // sec 13.11.8 + SwitchStatement(node) { + this.visit(node.discriminant); + if (this.scopeManager.__isES6()) { + this.scopeManager.__nestSwitchScope(node); + } + for (let i = 0, iz = node.cases.length; i < iz; ++i) { + this.visit(node.cases[i]); + } + this.close(node); + } + FunctionDeclaration(node) { + this.visitFunction(node); + } + FunctionExpression(node) { + this.visitFunction(node); + } + ForOfStatement(node) { + this.visitForIn(node); + } + ForInStatement(node) { + this.visitForIn(node); + } + ArrowFunctionExpression(node) { + this.visitFunction(node); + } + ImportDeclaration(node) { + assert3( + this.scopeManager.__isES6() && this.scopeManager.isModule(), + "ImportDeclaration should appear when the mode is ES6 and in the module context." + ); + const importer = new Importer(node, this); + importer.visit(node); + } + visitExportDeclaration(node) { + if (node.source) { + return; + } + if (node.declaration) { + this.visit(node.declaration); + return; + } + this.visitChildren(node); + } + // TODO: ExportDeclaration doesn't exist. for bc? + ExportDeclaration(node) { + this.visitExportDeclaration(node); + } + ExportAllDeclaration(node) { + this.visitExportDeclaration(node); + } + ExportDefaultDeclaration(node) { + this.visitExportDeclaration(node); + } + ExportNamedDeclaration(node) { + this.visitExportDeclaration(node); + } + ExportSpecifier(node) { + const local = node.id || node.local; + this.visit(local); + } + // eslint-disable-next-line class-methods-use-this -- Desired as instance method + MetaProperty() { + } + JSXIdentifier(node) { + if (this.scopeManager.__isJSXEnabled() && node.name !== "this") { + this.currentScope().__referencing(node); + } + } + JSXMemberExpression(node) { + this.visit(node.object); + } + JSXElement(node) { + if (this.scopeManager.__isJSXEnabled()) { + this.visit(node.openingElement); + node.children.forEach(this.visit, this); + } else { + this.visitChildren(node); + } + } + JSXOpeningElement(node) { + if (this.scopeManager.__isJSXEnabled()) { + const nameNode = node.name; + const isComponentName = nameNode.type === "JSXIdentifier" && nameNode.name[0].toUpperCase() === nameNode.name[0]; + const isComponent = isComponentName || nameNode.type === "JSXMemberExpression"; + if (isComponent) { + this.visit(nameNode); + } + } + node.attributes.forEach(this.visit, this); + } + JSXAttribute(node) { + if (node.value) { + this.visit(node.value); + } + } + JSXExpressionContainer(node) { + this.visit(node.expression); + } + JSXNamespacedName(node) { + this.visit(node.namespace); + this.visit(node.name); + } + }; + var referencer_default = Referencer; + + // node_modules/eslint-scope/lib/index.js + function defaultOptions2() { + return { + optimistic: false, + nodejsScope: false, + impliedStrict: false, + sourceType: "script", + // one of ['script', 'module', 'commonjs'] + ecmaVersion: 5, + childVisitorKeys: null, + fallback: "iteration" + }; + } + function updateDeeply(target, override) { + function isHashObject(value) { + return typeof value === "object" && value instanceof Object && !(value instanceof Array) && !(value instanceof RegExp); + } + for (const key in override) { + if (Object.hasOwn(override, key)) { + const val = override[key]; + if (isHashObject(val)) { + if (isHashObject(target[key])) { + updateDeeply(target[key], val); + } else { + target[key] = updateDeeply({}, val); + } + } else { + target[key] = val; + } + } + } + return target; + } + function analyze(tree, providedOptions) { + const options = updateDeeply(defaultOptions2(), providedOptions); + const scopeManager = new scope_manager_default(options); + const referencer = new referencer_default(options, scopeManager); + referencer.visit(tree); + assert3( + scopeManager.__currentScope === null, + "currentScope should be null." + ); + return scopeManager; + } + + // src/binance-orderbook-trade/order-notifications/factory-structure.js + var MAX_FACTORY_SOURCE_LENGTH = 64 * 1024; + var SUPPORTED_SCOPES = /* @__PURE__ */ new Set([ + "global", + "function", + "function-expression-name", + "block", + "for", + "switch", + "catch", + "class", + "class-field-initializer", + "class-static-block" + ]); + var SOURCE_POSITION_FIELDS = /* @__PURE__ */ new Set(["start", "end", "loc", "range"]); + function isPropertyName(parent, key) { + return parent && !parent.computed && (key === "key" && ["Property", "MethodDefinition", "PropertyDefinition"].includes(parent.type) || key === "property" && parent.type === "MemberExpression"); + } + function collectBindingIdentities(scopeManager) { + const identities = /* @__PURE__ */ new Map(); + scopeManager.scopes.forEach((scope, scopeIndex) => { + if (!SUPPORTED_SCOPES.has(scope.type) || scope.directCallToEvalScope || scope.dynamic && scope.type !== "global") { + throw new Error(`Unsupported native notification factory dynamic scope: ${scope.type}`); + } + const declaredVariables = scope.variables.filter((variable) => variable.defs.length > 0).sort((left, right) => left.identifiers[0].range[0] - right.identifiers[0].range[0]); + const declarationIndices = new Map(declaredVariables.map((variable, index) => [variable, index])); + for (const variable of scope.variables) { + let identity; + if (variable.defs.length === 0) { + if (variable.name !== "arguments" || scope.type !== "function") { + throw new Error("Unsupported native notification factory implicit binding"); + } + identity = { scope: scopeIndex, implicit: "arguments" }; + } else { + identity = { scope: scopeIndex, variable: declarationIndices.get(variable) }; + if (variable.name === "arguments" && !variable.defs.every((definition) => definition.type === "Parameter")) { + identity.name = "arguments"; + } + } + for (const identifier of [...variable.identifiers, ...variable.references.map((reference) => reference.identifier)]) { + if (!identities.has(identifier)) identities.set(identifier, []); + const bindings = identities.get(identifier); + if (!bindings.includes(identity)) bindings.push(identity); + } + } + }); + return identities; + } + function canonicalize(value, bindings, parent, key) { + if (typeof value === "bigint") return { bigintValue: String(value) }; + if (typeof value === "number" && !Number.isFinite(value)) return { numericValue: String(value) }; + if (value instanceof RegExp) return { pattern: value.source, flags: value.flags }; + if (value === null || typeof value !== "object") return value; + if (Array.isArray(value)) return value.map((child) => canonicalize(child, bindings, parent, key)); + if (value.type === "UnaryExpression" && value.operator === "!" && value.prefix === true && value.argument.type === "Literal" && typeof value.argument.value === "number" && (value.argument.value === 0 || value.argument.value === 1)) { + return canonicalize({ type: "Literal", value: value.argument.value === 0 }, bindings, parent, key); + } + const result = {}; + const isNode = typeof value.type === "string"; + for (const field of Object.keys(value).sort()) { + if (isNode && (SOURCE_POSITION_FIELDS.has(field) || value.type === "Literal" && field === "raw")) continue; + if (value.type === "Identifier" && field === "name" && bindings.has(value) && !isPropertyName(parent, key)) { + result.binding = bindings.get(value); + } else { + result[field] = canonicalize(value[field], bindings, value, field); + } + } + return result; + } + function createOrderNotificationFactorySignature(source, moduleId) { + if (typeof source !== "string") throw new TypeError("Native notification factory source must be a string"); + if (source.length > MAX_FACTORY_SOURCE_LENGTH) throw new Error("Native notification factory source exceeds 64 KiB"); + if (typeof moduleId !== "string" && typeof moduleId !== "number") { + throw new TypeError("Native notification module ID must be a string or number"); + } + const ast = parse3(`({${source}})`, { ecmaVersion: 2022, sourceType: "script", ranges: true }); + if (ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement" || ast.body[0].expression.type !== "ObjectExpression" || ast.body[0].expression.properties.length !== 1) { + throw new Error("Native notification source must contain one module factory"); + } + const factory = ast.body[0].expression.properties[0]; + if (factory.type !== "Property" || factory.computed || !factory.method || factory.kind !== "init" || factory.value.type !== "FunctionExpression" || factory.key.type !== "Literal") { + throw new Error("Native notification source must contain one ordinary module factory"); + } + if (String(factory.key.value) !== String(moduleId)) throw new Error("Native notification factory module ID does not match"); + const scopeManager = analyze(ast, { + ecmaVersion: 2022, + sourceType: "script", + optimistic: false, + ignoreEval: false, + fallback: null + }); + return JSON.stringify(canonicalize(factory, collectBindingIdentities(scopeManager), null, null)); + } + + // src/binance-orderbook-trade/order-notifications/native-modules.js + var verifiedFactories = [ + { + id: "39116", + signature: '{"computed":false,"key":{"type":"Literal","value":39116},"kind":"init","method":true,"shorthand":false,"type":"Property","value":{"async":false,"body":{"body":[{"directive":"use strict","expression":{"type":"Literal","value":"use strict"},"type":"ExpressionStatement"},{"expression":{"arguments":[{"binding":[{"scope":1,"variable":1}],"type":"Identifier"},{"properties":[{"computed":false,"key":{"name":"QZ","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"async":false,"body":{"computed":false,"object":{"binding":[{"scope":1,"variable":12}],"type":"Identifier"},"optional":false,"property":{"name":"Q","type":"Identifier"},"type":"MemberExpression"},"expression":true,"generator":false,"id":null,"params":[],"type":"ArrowFunctionExpression"}},{"computed":false,"key":{"name":"$$","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"async":false,"body":{"binding":[{"scope":1,"variable":6}],"type":"Identifier"},"expression":true,"generator":false,"id":null,"params":[],"type":"ArrowFunctionExpression"}},{"computed":false,"key":{"name":"E$","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"async":false,"body":{"binding":[{"scope":1,"variable":14}],"type":"Identifier"},"expression":true,"generator":false,"id":null,"params":[],"type":"ArrowFunctionExpression"}}],"type":"ObjectExpression"}],"callee":{"computed":false,"object":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"property":{"name":"d","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"ExpressionStatement"},{"declarations":[{"id":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":41594}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":4}],"type":"Identifier"},"init":{"type":"Literal","value":2000},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":5}],"type":"Identifier"},"init":{"type":"Literal","value":2},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":6}],"type":"Identifier"},"init":{"async":false,"body":{"body":[{"declarations":[{"id":{"binding":[{"scope":5,"variable":0}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":null}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"useRef","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":5,"variable":1}],"type":"Identifier"},"init":{"async":false,"body":{"body":[{"expression":{"left":{"computed":false,"object":{"binding":[{"scope":5,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"current","type":"Identifier"},"type":"MemberExpression"},"operator":"=","right":{"arguments":[{"async":false,"body":{"body":[{"expression":{"expressions":[{"arguments":[],"callee":{"binding":[{"scope":6,"variable":0}],"type":"Identifier"},"optional":false,"type":"CallExpression"},{"left":{"computed":false,"object":{"binding":[{"scope":5,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"current","type":"Identifier"},"type":"MemberExpression"},"operator":"&&","right":{"arguments":[{"computed":false,"object":{"binding":[{"scope":5,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"current","type":"Identifier"},"type":"MemberExpression"}],"callee":{"name":"clearTimeout","type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"LogicalExpression"},{"left":{"computed":false,"object":{"binding":[{"scope":5,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"current","type":"Identifier"},"type":"MemberExpression"},"operator":"=","right":{"type":"Literal","value":null},"type":"AssignmentExpression"}],"type":"SequenceExpression"},"type":"ExpressionStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"},{"binding":[{"scope":1,"variable":4}],"type":"Identifier"}],"callee":{"name":"setTimeout","type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"AssignmentExpression"},"type":"ExpressionStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":6,"variable":0}],"type":"Identifier"}],"type":"FunctionExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"argument":{"arguments":[{"async":false,"body":{"body":[{"argument":{"properties":[{"computed":false,"key":{"name":"interval","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"binding":[{"scope":5,"variable":0}],"type":"Identifier"}},{"computed":false,"key":{"name":"intervalFunc","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"binding":[{"scope":5,"variable":1}],"type":"Identifier"}}],"type":"ObjectExpression"},"type":"ReturnStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"},{"elements":[],"type":"ArrayExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"useMemo","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"ReturnStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":7}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":75510}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":8}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":16921}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":9}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":72363}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":10}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":79515}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":11}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":40477}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":12}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":70020}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":13}],"type":"Identifier"},"init":{"async":false,"body":{"body":[{"declarations":[{"id":{"binding":[{"scope":9,"variable":2}],"type":"Identifier"},"init":{"arguments":[],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":10}],"type":"Identifier"},"optional":false,"property":{"name":"nH","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":9,"variable":3}],"type":"Identifier"},"init":{"computed":false,"object":{"arguments":[],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":10}],"type":"Identifier"},"optional":false,"property":{"name":"Py","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"optional":false,"property":{"name":"isExistFutureAccount","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":9,"variable":4}],"type":"Identifier"},"init":{"arguments":[{"binding":[{"scope":9,"variable":1}],"type":"Identifier"},{"type":"Literal","value":500}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":11}],"type":"Identifier"},"optional":false,"property":{"name":"A","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":9,"variable":5}],"type":"Identifier"},"init":{"computed":false,"object":{"binding":[{"scope":9,"variable":4}],"type":"Identifier"},"optional":false,"property":{"name":"run","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":9,"variable":6}],"type":"Identifier"},"init":{"computed":false,"object":{"arguments":[],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":10}],"type":"Identifier"},"optional":false,"property":{"name":"ON","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"optional":false,"property":{"name":"isPM2","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":9,"variable":7}],"type":"Identifier"},"init":{"arguments":[],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":8}],"type":"Identifier"},"optional":false,"property":{"name":"Gw","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"expression":{"expressions":[{"arguments":[{"async":false,"body":{"body":[{"alternate":null,"consequent":{"argument":{"async":false,"body":{"body":[{"argument":{"type":"Literal","value":null},"type":"ReturnStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"},"type":"ReturnStatement"},"test":{"left":{"left":{"argument":{"binding":[{"scope":9,"variable":2}],"type":"Identifier"},"operator":"!","prefix":true,"type":"UnaryExpression"},"operator":"||","right":{"argument":{"binding":[{"scope":9,"variable":3}],"type":"Identifier"},"operator":"!","prefix":true,"type":"UnaryExpression"},"type":"LogicalExpression"},"operator":"||","right":{"argument":{"binding":[{"scope":9,"variable":0}],"type":"Identifier"},"operator":"!","prefix":true,"type":"UnaryExpression"},"type":"LogicalExpression"},"type":"IfStatement"},{"declarations":[{"id":{"binding":[{"scope":10,"variable":0}],"type":"Identifier"},"init":{"arguments":[{"properties":[{"computed":false,"key":{"name":"isCM","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"type":"Literal","value":true}}],"type":"ObjectExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":9}],"type":"Identifier"},"optional":false,"property":{"name":"Ri","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"argument":{"arguments":[{"async":false,"body":{"body":[{"declarations":[{"id":{"binding":[{"scope":12,"variable":1}],"type":"Identifier"},"init":{"alternate":{"elements":[{"binding":[{"scope":12,"variable":0}],"type":"Identifier"}],"type":"ArrayExpression"},"consequent":{"arguments":[{"binding":[{"scope":12,"variable":0}],"type":"Identifier"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":7}],"type":"Identifier"},"optional":false,"property":{"name":"_","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"test":{"arguments":[{"binding":[{"scope":12,"variable":0}],"type":"Identifier"}],"callee":{"computed":false,"object":{"name":"Array","type":"Identifier"},"optional":false,"property":{"name":"isArray","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"ConditionalExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"expression":{"arguments":[{"async":false,"body":{"body":[{"expression":{"left":{"left":{"left":{"left":{"computed":false,"object":{"binding":[{"scope":13,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"status","type":"Identifier"},"type":"MemberExpression"},"operator":"===","right":{"type":"Literal","value":"FILLED"},"type":"BinaryExpression"},"operator":"||","right":{"left":{"computed":false,"object":{"binding":[{"scope":13,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"status","type":"Identifier"},"type":"MemberExpression"},"operator":"===","right":{"type":"Literal","value":"PARTIALLY_FILLED"},"type":"BinaryExpression"},"type":"LogicalExpression"},"operator":"||","right":{"left":{"computed":false,"object":{"binding":[{"scope":13,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"status","type":"Identifier"},"type":"MemberExpression"},"operator":"===","right":{"type":"Literal","value":"EXPIRED"},"type":"BinaryExpression"},"type":"LogicalExpression"},"operator":"&&","right":{"arguments":[{"arguments":[{"computed":false,"object":{"binding":[{"scope":13,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"orderId","type":"Identifier"},"type":"MemberExpression"}],"callee":{"name":"String","type":"Identifier"},"optional":false,"type":"CallExpression"}],"callee":{"binding":[{"scope":9,"variable":5}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"LogicalExpression"},"type":"ExpressionStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":13,"variable":0}],"type":"Identifier"}],"type":"FunctionExpression"}],"callee":{"computed":false,"object":{"binding":[{"scope":12,"variable":1}],"type":"Identifier"},"optional":false,"property":{"name":"forEach","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"ExpressionStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":12,"variable":0}],"type":"Identifier"}],"type":"FunctionExpression"}],"callee":{"computed":false,"object":{"arguments":[{"properties":[{"computed":false,"key":{"name":"isPM2","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"binding":[{"scope":9,"variable":6}],"type":"Identifier"}},{"computed":false,"key":{"name":"params","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"binding":[{"scope":9,"variable":7}],"type":"Identifier"}}],"type":"ObjectExpression"}],"callee":{"computed":false,"object":{"binding":[{"scope":10,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"getUserOrderStream","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"optional":false,"property":{"name":"subscribe","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"ReturnStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"},{"elements":[{"binding":[{"scope":9,"variable":5}],"type":"Identifier"},{"binding":[{"scope":9,"variable":0}],"type":"Identifier"},{"binding":[{"scope":9,"variable":3}],"type":"Identifier"},{"binding":[{"scope":9,"variable":2}],"type":"Identifier"},{"binding":[{"scope":9,"variable":6}],"type":"Identifier"},{"binding":[{"scope":9,"variable":7}],"type":"Identifier"}],"type":"ArrayExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"useEffect","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},{"arguments":[{"async":false,"body":{"body":[{"alternate":null,"consequent":{"argument":{"async":false,"body":{"body":[{"argument":{"type":"Literal","value":null},"type":"ReturnStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"},"type":"ReturnStatement"},"test":{"left":{"left":{"argument":{"binding":[{"scope":9,"variable":2}],"type":"Identifier"},"operator":"!","prefix":true,"type":"UnaryExpression"},"operator":"||","right":{"argument":{"binding":[{"scope":9,"variable":3}],"type":"Identifier"},"operator":"!","prefix":true,"type":"UnaryExpression"},"type":"LogicalExpression"},"operator":"||","right":{"argument":{"binding":[{"scope":9,"variable":0}],"type":"Identifier"},"operator":"!","prefix":true,"type":"UnaryExpression"},"type":"LogicalExpression"},"type":"IfStatement"},{"declarations":[{"id":{"binding":[{"scope":14,"variable":0}],"type":"Identifier"},"init":{"arguments":[{"properties":[{"computed":false,"key":{"name":"isCM","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"type":"Literal","value":false}}],"type":"ObjectExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":9}],"type":"Identifier"},"optional":false,"property":{"name":"Ri","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"argument":{"arguments":[{"async":false,"body":{"body":[{"declarations":[{"id":{"binding":[{"scope":16,"variable":1}],"type":"Identifier"},"init":{"alternate":{"elements":[{"binding":[{"scope":16,"variable":0}],"type":"Identifier"}],"type":"ArrayExpression"},"consequent":{"arguments":[{"binding":[{"scope":16,"variable":0}],"type":"Identifier"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":7}],"type":"Identifier"},"optional":false,"property":{"name":"_","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"test":{"arguments":[{"binding":[{"scope":16,"variable":0}],"type":"Identifier"}],"callee":{"computed":false,"object":{"name":"Array","type":"Identifier"},"optional":false,"property":{"name":"isArray","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"ConditionalExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"expression":{"arguments":[{"async":false,"body":{"body":[{"expression":{"left":{"left":{"left":{"left":{"computed":false,"object":{"binding":[{"scope":17,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"status","type":"Identifier"},"type":"MemberExpression"},"operator":"===","right":{"type":"Literal","value":"FILLED"},"type":"BinaryExpression"},"operator":"||","right":{"left":{"computed":false,"object":{"binding":[{"scope":17,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"status","type":"Identifier"},"type":"MemberExpression"},"operator":"===","right":{"type":"Literal","value":"PARTIALLY_FILLED"},"type":"BinaryExpression"},"type":"LogicalExpression"},"operator":"||","right":{"left":{"computed":false,"object":{"binding":[{"scope":17,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"status","type":"Identifier"},"type":"MemberExpression"},"operator":"===","right":{"type":"Literal","value":"EXPIRED"},"type":"BinaryExpression"},"type":"LogicalExpression"},"operator":"&&","right":{"arguments":[{"arguments":[{"computed":false,"object":{"binding":[{"scope":17,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"orderId","type":"Identifier"},"type":"MemberExpression"}],"callee":{"name":"String","type":"Identifier"},"optional":false,"type":"CallExpression"}],"callee":{"binding":[{"scope":9,"variable":5}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"LogicalExpression"},"type":"ExpressionStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":17,"variable":0}],"type":"Identifier"}],"type":"FunctionExpression"}],"callee":{"computed":false,"object":{"binding":[{"scope":16,"variable":1}],"type":"Identifier"},"optional":false,"property":{"name":"forEach","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"ExpressionStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":16,"variable":0}],"type":"Identifier"}],"type":"FunctionExpression"}],"callee":{"computed":false,"object":{"arguments":[{"properties":[{"computed":false,"key":{"name":"isPM2","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"binding":[{"scope":9,"variable":6}],"type":"Identifier"}},{"computed":false,"key":{"name":"params","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"binding":[{"scope":9,"variable":7}],"type":"Identifier"}}],"type":"ObjectExpression"}],"callee":{"computed":false,"object":{"binding":[{"scope":14,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"getUserOrderStream","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"optional":false,"property":{"name":"subscribe","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"ReturnStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"},{"elements":[{"binding":[{"scope":9,"variable":5}],"type":"Identifier"},{"binding":[{"scope":9,"variable":0}],"type":"Identifier"},{"binding":[{"scope":9,"variable":3}],"type":"Identifier"},{"binding":[{"scope":9,"variable":2}],"type":"Identifier"},{"binding":[{"scope":9,"variable":6}],"type":"Identifier"},{"binding":[{"scope":9,"variable":7}],"type":"Identifier"}],"type":"ArrayExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"useEffect","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"}],"type":"SequenceExpression"},"type":"ExpressionStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":9,"variable":0}],"type":"Identifier"},{"binding":[{"scope":9,"variable":1}],"type":"Identifier"}],"type":"FunctionExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":14}],"type":"Identifier"},"init":{"async":false,"body":{"body":[{"declarations":[{"id":{"binding":[{"scope":18,"variable":0}],"type":"Identifier"},"init":{"arguments":[{"arguments":[],"callee":{"name":"Date","type":"Identifier"},"type":"NewExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"useState","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":18,"variable":1}],"type":"Identifier"},"init":{"computed":true,"object":{"binding":[{"scope":18,"variable":0}],"type":"Identifier"},"optional":false,"property":{"type":"Literal","value":0},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":18,"variable":2}],"type":"Identifier"},"init":{"computed":true,"object":{"binding":[{"scope":18,"variable":0}],"type":"Identifier"},"optional":false,"property":{"type":"Literal","value":1},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":18,"variable":3}],"type":"Identifier"},"init":{"arguments":[{"elements":[],"type":"ArrayExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"useRef","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":18,"variable":4}],"type":"Identifier"},"init":{"arguments":[],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":12}],"type":"Identifier"},"optional":false,"property":{"name":"Q","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":18,"variable":5}],"type":"Identifier"},"init":{"computed":false,"object":{"binding":[{"scope":18,"variable":4}],"type":"Identifier"},"optional":false,"property":{"name":"showNotification","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":18,"variable":6}],"type":"Identifier"},"init":{"computed":false,"object":{"binding":[{"scope":18,"variable":4}],"type":"Identifier"},"optional":false,"property":{"name":"enableNotification","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":18,"variable":7}],"type":"Identifier"},"init":{"arguments":[{"async":false,"body":{"body":[{"declarations":[{"id":{"binding":[{"scope":19,"variable":0}],"type":"Identifier"},"init":null,"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"expression":{"expressions":[{"left":{"left":{"left":{"left":{"binding":[{"scope":19,"variable":0}],"type":"Identifier"},"operator":"=","right":{"binding":[{"scope":18,"variable":3}],"type":"Identifier"},"type":"AssignmentExpression"},"operator":"===","right":{"type":"Literal","value":null},"type":"BinaryExpression"},"operator":"||","right":{"left":{"binding":[{"scope":19,"variable":0}],"type":"Identifier"},"operator":"===","right":{"argument":{"type":"Literal","value":0},"operator":"void","prefix":true,"type":"UnaryExpression"},"type":"BinaryExpression"},"type":"LogicalExpression"},"operator":"||","right":{"arguments":[],"callee":{"computed":false,"object":{"computed":false,"object":{"binding":[{"scope":19,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"current","type":"Identifier"},"type":"MemberExpression"},"optional":false,"property":{"name":"shift","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"LogicalExpression"},{"arguments":[{"arguments":[],"callee":{"name":"Date","type":"Identifier"},"type":"NewExpression"}],"callee":{"binding":[{"scope":18,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"}],"type":"SequenceExpression"},"type":"ExpressionStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"},{"elements":[],"type":"ArrayExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"useCallback","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":18,"variable":8}],"type":"Identifier"},"init":{"arguments":[{"async":false,"body":{"body":[{"declarations":[{"id":{"binding":[{"scope":20,"variable":1}],"type":"Identifier"},"init":null,"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"alternate":null,"consequent":{"body":[{"declarations":[{"id":{"binding":[{"scope":20,"variable":2}],"type":"Identifier"},"init":null,"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"expression":{"expressions":[{"left":{"left":{"left":{"left":{"binding":[{"scope":20,"variable":2}],"type":"Identifier"},"operator":"=","right":{"binding":[{"scope":18,"variable":3}],"type":"Identifier"},"type":"AssignmentExpression"},"operator":"===","right":{"type":"Literal","value":null},"type":"BinaryExpression"},"operator":"||","right":{"left":{"binding":[{"scope":20,"variable":2}],"type":"Identifier"},"operator":"===","right":{"argument":{"type":"Literal","value":0},"operator":"void","prefix":true,"type":"UnaryExpression"},"type":"BinaryExpression"},"type":"LogicalExpression"},"operator":"||","right":{"arguments":[{"binding":[{"scope":20,"variable":0}],"type":"Identifier"}],"callee":{"computed":false,"object":{"computed":false,"object":{"binding":[{"scope":20,"variable":2}],"type":"Identifier"},"optional":false,"property":{"name":"current","type":"Identifier"},"type":"MemberExpression"},"optional":false,"property":{"name":"push","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"LogicalExpression"},{"arguments":[{"arguments":[],"callee":{"name":"Date","type":"Identifier"},"type":"NewExpression"}],"callee":{"binding":[{"scope":18,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"}],"type":"SequenceExpression"},"type":"ExpressionStatement"}],"type":"BlockStatement"},"test":{"left":{"left":{"left":{"binding":[{"scope":18,"variable":5}],"type":"Identifier"},"operator":"&&","right":{"left":{"alternate":{"computed":false,"object":{"computed":false,"object":{"binding":[{"scope":20,"variable":1}],"type":"Identifier"},"optional":false,"property":{"name":"current","type":"Identifier"},"type":"MemberExpression"},"optional":false,"property":{"name":"length","type":"Identifier"},"type":"MemberExpression"},"consequent":{"argument":{"type":"Literal","value":0},"operator":"void","prefix":true,"type":"UnaryExpression"},"test":{"left":{"left":{"left":{"binding":[{"scope":20,"variable":1}],"type":"Identifier"},"operator":"=","right":{"binding":[{"scope":18,"variable":3}],"type":"Identifier"},"type":"AssignmentExpression"},"operator":"===","right":{"type":"Literal","value":null},"type":"BinaryExpression"},"operator":"||","right":{"left":{"binding":[{"scope":20,"variable":1}],"type":"Identifier"},"operator":"===","right":{"argument":{"type":"Literal","value":0},"operator":"void","prefix":true,"type":"UnaryExpression"},"type":"BinaryExpression"},"type":"LogicalExpression"},"type":"ConditionalExpression"},"operator":"<","right":{"binding":[{"scope":1,"variable":5}],"type":"Identifier"},"type":"BinaryExpression"},"type":"LogicalExpression"},"operator":"&&","right":{"binding":[{"scope":18,"variable":6}],"type":"Identifier"},"type":"LogicalExpression"},"operator":"&&","right":{"binding":[{"scope":20,"variable":0}],"type":"Identifier"},"type":"LogicalExpression"},"type":"IfStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":20,"variable":0}],"type":"Identifier"}],"type":"FunctionExpression"},{"elements":[{"binding":[{"scope":18,"variable":6}],"type":"Identifier"},{"binding":[{"scope":18,"variable":5}],"type":"Identifier"}],"type":"ArrayExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"useCallback","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"argument":{"expressions":[{"arguments":[{"left":{"binding":[{"scope":18,"variable":5}],"type":"Identifier"},"operator":"&&","right":{"binding":[{"scope":18,"variable":6}],"type":"Identifier"},"type":"LogicalExpression"},{"binding":[{"scope":18,"variable":8}],"type":"Identifier"}],"callee":{"binding":[{"scope":1,"variable":13}],"type":"Identifier"},"optional":false,"type":"CallExpression"},{"arguments":[{"async":false,"body":{"body":[{"argument":{"properties":[{"computed":false,"key":{"name":"notifications","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"binding":[{"scope":18,"variable":3}],"type":"Identifier"}},{"computed":false,"key":{"name":"lastNotifyTime","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"binding":[{"scope":18,"variable":1}],"type":"Identifier"}},{"computed":false,"key":{"name":"popNotification","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"binding":[{"scope":18,"variable":7}],"type":"Identifier"}}],"type":"ObjectExpression"},"type":"ReturnStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"},{"elements":[{"binding":[{"scope":18,"variable":1}],"type":"Identifier"},{"binding":[{"scope":18,"variable":7}],"type":"Identifier"}],"type":"ArrayExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"useMemo","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"}],"type":"SequenceExpression"},"type":"ReturnStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":1,"variable":0}],"type":"Identifier"},{"binding":[{"scope":1,"variable":1}],"type":"Identifier"},{"binding":[{"scope":1,"variable":2}],"type":"Identifier"}],"type":"FunctionExpression"}}', + create(__notify) { + return { 39116(D, l, t) { + "use strict"; + t.d(l, { QZ: () => p.Q, $$: () => n, E$: () => S }); + var e = t(41594), a = 2e3, r = 2, n = function() { + var E = (0, e.useRef)(null), A = function(O) { + E.current = setTimeout(function() { + O(), E.current && clearTimeout(E.current), E.current = null; + }, a); + }; + return (0, e.useMemo)(function() { + return { interval: E, intervalFunc: A }; + }, []); + }, i = t(75510), s = t(16921), c = t(72363), d = t(79515), y = t(40477), p = t(70020), T = function(E, A) { + var O = (0, d.nH)(), m = (0, d.Py)().isExistFutureAccount, g = (0, y.A)(function(__event) { + if (__notify.allowSoundInput(__event)) return Reflect.apply(A, this, [__event]); + }, 500), u = g.run, o = (0, d.ON)().isPM2, f = (0, s.Gw)(); + (0, e.useEffect)(function() { + if (!O || !m || !E) return function() { + return null; + }; + var _ = (0, c.Ri)({ isCM: true }); + return _.getUserOrderStream({ isPM2: o, params: f }).subscribe(function(v) { + var L = Array.isArray(v) ? (0, i._)(v) : [v]; + L.forEach(function(P) { + (P.status === "FILLED" || P.status === "PARTIALLY_FILLED" || P.status === "EXPIRED") && ((!__notify.soundReady() || __notify.allowOrder(P)) && u(__notify.soundInput(P))); + }); + }); + }, [u, E, m, O, o, f]), (0, e.useEffect)(function() { + if (!O || !m || !E) return function() { + return null; + }; + var _ = (0, c.Ri)({ isCM: false }); + return _.getUserOrderStream({ isPM2: o, params: f }).subscribe(function(v) { + var L = Array.isArray(v) ? (0, i._)(v) : [v]; + L.forEach(function(P) { + (P.status === "FILLED" || P.status === "PARTIALLY_FILLED" || P.status === "EXPIRED") && ((!__notify.soundReady() || __notify.allowOrder(P)) && u(__notify.soundInput(P))); + }); + }); + }, [u, E, m, O, o, f]); + }, S = function() { + var E = (0, e.useState)(/* @__PURE__ */ new Date()), A = E[0], O = E[1], m = (0, e.useRef)([]), g = (0, p.Q)(), u = g.showNotification, o = g.enableNotification, f = (0, e.useCallback)(function() { + var v; + (v = m) === null || v === void 0 || v.current.shift(), O(/* @__PURE__ */ new Date()); + }, []), _ = (0, e.useCallback)(function(v) { + var L; + if (u && ((L = m) === null || L === void 0 ? void 0 : L.current.length) < r && o && v) { + var P; + (P = m) === null || P === void 0 || P.current.push(v), O(/* @__PURE__ */ new Date()); + } + }, [o, u]); + return T(u && o, _), (0, e.useMemo)(function() { + return { notifications: m, lastNotifyTime: A, popNotification: f }; + }, [A, f]); + }; + } }[39116]; + } + }, + { + id: "30877", + signature: '{"computed":false,"key":{"type":"Literal","value":30877},"kind":"init","method":true,"shorthand":false,"type":"Property","value":{"async":false,"body":{"body":[{"expression":{"arguments":[{"binding":[{"scope":1,"variable":1}],"type":"Identifier"},{"properties":[{"computed":false,"key":{"name":"F","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"async":false,"body":{"binding":[{"scope":1,"variable":14}],"type":"Identifier"},"expression":true,"generator":false,"id":null,"params":[],"type":"ArrowFunctionExpression"}},{"computed":false,"key":{"name":"z","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"async":false,"body":{"binding":[{"scope":1,"variable":13}],"type":"Identifier"},"expression":true,"generator":false,"id":null,"params":[],"type":"ArrowFunctionExpression"}}],"type":"ObjectExpression"}],"callee":{"computed":false,"object":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"property":{"name":"d","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"ExpressionStatement"},{"declarations":[{"id":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":41594}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":4}],"type":"Identifier"},"init":{"arguments":[{"binding":[{"scope":1,"variable":3}],"type":"Identifier"}],"callee":{"computed":false,"object":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"property":{"name":"n","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":5}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":61523}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":6}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":92873}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":7}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":64041}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":8}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":17409}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":9}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":51471}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":10}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":40477}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":11}],"type":"Identifier"},"init":{"type":"Literal","value":"trd-openOrder"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":12}],"type":"Identifier"},"init":{"async":false,"body":{"body":[{"argument":{"arguments":[{"binding":[{"scope":1,"variable":11}],"type":"Identifier"},{"binding":[{"scope":4,"variable":0}],"type":"Identifier"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":6}],"type":"Identifier"},"optional":false,"property":{"name":"o","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"ReturnStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":4,"variable":0}],"type":"Identifier"}],"type":"FunctionExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":13}],"type":"Identifier"},"init":{"async":false,"body":{"body":[{"declarations":[{"id":{"binding":[{"scope":5,"variable":0}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":"open_order_status_toast"},{"type":"Literal","value":true}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":9}],"type":"Identifier"},"optional":false,"property":{"name":"zr","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":5,"variable":1}],"type":"Identifier"},"init":{"computed":false,"object":{"binding":[{"scope":5,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"data","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":5,"variable":2}],"type":"Identifier"},"init":{"computed":false,"object":{"binding":[{"scope":5,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"setData","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":5,"variable":3}],"type":"Identifier"},"init":{"computed":false,"object":{"binding":[{"scope":5,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"hasInitialized","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":5,"variable":4}],"type":"Identifier"},"init":{"arguments":[{"async":false,"body":{"body":[{"expression":{"arguments":[{"argument":{"binding":[{"scope":5,"variable":1}],"type":"Identifier"},"operator":"!","prefix":true,"type":"UnaryExpression"}],"callee":{"binding":[{"scope":5,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"ExpressionStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"},{"elements":[{"binding":[{"scope":5,"variable":1}],"type":"Identifier"},{"binding":[{"scope":5,"variable":2}],"type":"Identifier"}],"type":"ArrayExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"useCallback","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"argument":{"properties":[{"computed":false,"key":{"name":"enableToast","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"alternate":{"type":"Literal","value":false},"consequent":{"binding":[{"scope":5,"variable":1}],"type":"Identifier"},"test":{"binding":[{"scope":5,"variable":3}],"type":"Identifier"},"type":"ConditionalExpression"}},{"computed":false,"key":{"name":"toggleToast","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"binding":[{"scope":5,"variable":4}],"type":"Identifier"}}],"type":"ObjectExpression"},"type":"ReturnStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":14}],"type":"Identifier"},"init":{"async":false,"body":{"body":[{"declarations":[{"id":{"binding":[{"scope":7,"variable":0}],"type":"Identifier"},"init":{"computed":false,"object":{"arguments":[],"callee":{"binding":[{"scope":1,"variable":12}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"optional":false,"property":{"name":"getI18n","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":7,"variable":1}],"type":"Identifier"},"init":{"computed":false,"object":{"arguments":[],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":7}],"type":"Identifier"},"optional":false,"property":{"name":"h","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"optional":false,"property":{"name":"enqueueNotification","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":7,"variable":2}],"type":"Identifier"},"init":{"computed":false,"object":{"arguments":[],"callee":{"binding":[{"scope":1,"variable":13}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"optional":false,"property":{"name":"enableToast","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":7,"variable":3}],"type":"Identifier"},"init":{"arguments":[{"binding":[{"scope":7,"variable":1}],"type":"Identifier"},{"type":"Literal","value":30}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":10}],"type":"Identifier"},"optional":false,"property":{"name":"A","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":7,"variable":4}],"type":"Identifier"},"init":{"computed":false,"object":{"binding":[{"scope":7,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"run","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":7,"variable":5}],"type":"Identifier"},"init":{"arguments":[{"async":false,"body":{"body":[{"argument":{"computed":false,"object":{"computed":false,"object":{"binding":[{"scope":8,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"setting","type":"Identifier"},"type":"MemberExpression"},"optional":false,"property":{"name":"layout","type":"Identifier"},"type":"MemberExpression"},"type":"ReturnStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":8,"variable":0}],"type":"Identifier"}],"type":"FunctionExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":5}],"type":"Identifier"},"optional":false,"property":{"name":"d4","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":7,"variable":6}],"type":"Identifier"},"init":{"arguments":[{"async":false,"body":{"body":[{"argument":{"left":{"binding":[{"scope":7,"variable":5}],"type":"Identifier"},"operator":"===","right":{"computed":false,"object":{"binding":[{"scope":1,"variable":8}],"type":"Identifier"},"optional":false,"property":{"name":"a0","type":"Identifier"},"type":"MemberExpression"},"type":"BinaryExpression"},"type":"ReturnStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"},{"elements":[{"binding":[{"scope":7,"variable":5}],"type":"Identifier"}],"type":"ArrayExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"useMemo","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":7,"variable":7}],"type":"Identifier"},"init":{"arguments":[{"async":false,"body":{"body":[{"declarations":[{"id":{"binding":[{"scope":10,"variable":1}],"type":"Identifier"},"init":{"arguments":[],"callee":{"computed":false,"object":{"computed":false,"object":{"binding":[{"scope":10,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"side","type":"Identifier"},"type":"MemberExpression"},"optional":false,"property":{"name":"toUpperCase","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":10,"variable":2}],"type":"Identifier"},"init":{"arguments":[{"regex":{"flags":"g","pattern":"[-_]"},"type":"Literal","value":{"pattern":"[-_]","flags":"g"}},{"type":"Literal","value":""}],"callee":{"computed":false,"object":{"computed":false,"object":{"binding":[{"scope":10,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"type","type":"Identifier"},"type":"MemberExpression"},"optional":false,"property":{"name":"replace","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"argument":{"arguments":[{"binding":[{"scope":10,"variable":2}],"type":"Identifier"}],"callee":{"computed":false,"object":{"arguments":[{"binding":[{"scope":10,"variable":1}],"type":"Identifier"}],"callee":{"computed":false,"object":{"type":"Literal","value":""},"optional":false,"property":{"name":"concat","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"optional":false,"property":{"name":"concat","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"ReturnStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":10,"variable":0}],"type":"Identifier"}],"type":"FunctionExpression"},{"elements":[],"type":"ArrayExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"useCallback","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":7,"variable":8}],"type":"Identifier"},"init":{"arguments":[{"async":false,"body":{"body":[{"alternate":null,"consequent":{"body":[{"declarations":[{"id":{"binding":[{"scope":11,"variable":1}],"type":"Identifier"},"init":{"arguments":[{"binding":[{"scope":11,"variable":0}],"type":"Identifier"}],"callee":{"binding":[{"scope":7,"variable":7}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":11,"variable":2}],"type":"Identifier"},"init":{"arguments":[{"arguments":[{"binding":[{"scope":11,"variable":1}],"type":"Identifier"},{"type":"Literal","value":"CancelTitle"}],"callee":{"computed":false,"object":{"type":"Literal","value":""},"optional":false,"property":{"name":"concat","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},{"properties":[{"computed":false,"key":{"name":"defaultValue","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"arguments":[{"computed":false,"object":{"binding":[{"scope":11,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"side","type":"Identifier"},"type":"MemberExpression"},{"type":"Literal","value":" Order Canceled"}],"callee":{"computed":false,"object":{"arguments":[{"computed":false,"object":{"binding":[{"scope":11,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"type","type":"Identifier"},"type":"MemberExpression"},{"type":"Literal","value":" "}],"callee":{"computed":false,"object":{"type":"Literal","value":""},"optional":false,"property":{"name":"concat","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"optional":false,"property":{"name":"concat","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"}}],"type":"ObjectExpression"}],"callee":{"binding":[{"scope":7,"variable":0}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"expression":{"arguments":[{"binding":[{"scope":11,"variable":2}],"type":"Identifier"}],"callee":{"binding":[{"scope":7,"variable":4}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"ExpressionStatement"}],"type":"BlockStatement"},"test":{"argument":{"left":{"left":{"computed":false,"object":{"binding":[{"scope":11,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"type","type":"Identifier"},"type":"MemberExpression"},"operator":"===","right":{"type":"Literal","value":"LIQUIDATION"},"type":"BinaryExpression"},"operator":"||","right":{"argument":{"binding":[{"scope":7,"variable":2}],"type":"Identifier"},"operator":"!","prefix":true,"type":"UnaryExpression"},"type":"LogicalExpression"},"operator":"!","prefix":true,"type":"UnaryExpression"},"type":"IfStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":11,"variable":0}],"type":"Identifier"}],"type":"FunctionExpression"},{"elements":[{"binding":[{"scope":7,"variable":7}],"type":"Identifier"},{"binding":[{"scope":7,"variable":0}],"type":"Identifier"},{"binding":[{"scope":7,"variable":4}],"type":"Identifier"},{"binding":[{"scope":7,"variable":2}],"type":"Identifier"}],"type":"ArrayExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"useCallback","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":7,"variable":9}],"type":"Identifier"},"init":{"arguments":[{"async":false,"body":{"body":[{"alternate":null,"consequent":{"body":[{"declarations":[{"id":{"binding":[{"scope":13,"variable":1}],"type":"Identifier"},"init":{"arguments":[{"binding":[{"scope":13,"variable":0}],"type":"Identifier"}],"callee":{"binding":[{"scope":7,"variable":7}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":13,"variable":2}],"type":"Identifier"},"init":{"arguments":[{"arguments":[{"binding":[{"scope":13,"variable":1}],"type":"Identifier"},{"type":"Literal","value":"FillTitle"}],"callee":{"computed":false,"object":{"type":"Literal","value":""},"optional":false,"property":{"name":"concat","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},{"properties":[{"computed":false,"key":{"name":"defaultValue","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"arguments":[{"computed":false,"object":{"binding":[{"scope":13,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"side","type":"Identifier"},"type":"MemberExpression"},{"type":"Literal","value":" Order Filled"}],"callee":{"computed":false,"object":{"arguments":[{"computed":false,"object":{"binding":[{"scope":13,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"type","type":"Identifier"},"type":"MemberExpression"},{"type":"Literal","value":" "}],"callee":{"computed":false,"object":{"type":"Literal","value":""},"optional":false,"property":{"name":"concat","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"optional":false,"property":{"name":"concat","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"}}],"type":"ObjectExpression"}],"callee":{"binding":[{"scope":7,"variable":0}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"expression":{"arguments":[{"binding":[{"scope":13,"variable":2}],"type":"Identifier"},{"properties":[{"computed":false,"key":{"name":"variant","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"type":"Literal","value":"success"}}],"type":"ObjectExpression"}],"callee":{"binding":[{"scope":7,"variable":4}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"ExpressionStatement"}],"type":"BlockStatement"},"test":{"argument":{"left":{"left":{"computed":false,"object":{"binding":[{"scope":13,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"type","type":"Identifier"},"type":"MemberExpression"},"operator":"===","right":{"type":"Literal","value":"LIQUIDATION"},"type":"BinaryExpression"},"operator":"||","right":{"argument":{"binding":[{"scope":7,"variable":2}],"type":"Identifier"},"operator":"!","prefix":true,"type":"UnaryExpression"},"type":"LogicalExpression"},"operator":"!","prefix":true,"type":"UnaryExpression"},"type":"IfStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":13,"variable":0}],"type":"Identifier"}],"type":"FunctionExpression"},{"elements":[{"binding":[{"scope":7,"variable":7}],"type":"Identifier"},{"binding":[{"scope":7,"variable":0}],"type":"Identifier"},{"binding":[{"scope":7,"variable":4}],"type":"Identifier"},{"binding":[{"scope":7,"variable":2}],"type":"Identifier"}],"type":"ArrayExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"useCallback","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":7,"variable":10}],"type":"Identifier"},"init":{"arguments":[{"async":false,"body":{"body":[{"alternate":null,"consequent":{"body":[{"declarations":[{"id":{"binding":[{"scope":15,"variable":1}],"type":"Identifier"},"init":{"arguments":[{"binding":[{"scope":15,"variable":0}],"type":"Identifier"}],"callee":{"binding":[{"scope":7,"variable":7}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":15,"variable":2}],"type":"Identifier"},"init":{"arguments":[{"arguments":[{"binding":[{"scope":15,"variable":1}],"type":"Identifier"},{"type":"Literal","value":"PFTitle"}],"callee":{"computed":false,"object":{"type":"Literal","value":""},"optional":false,"property":{"name":"concat","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},{"properties":[{"computed":false,"key":{"name":"defaultValue","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"arguments":[{"computed":false,"object":{"binding":[{"scope":15,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"side","type":"Identifier"},"type":"MemberExpression"},{"type":"Literal","value":" Order Partially Filled"}],"callee":{"computed":false,"object":{"arguments":[{"computed":false,"object":{"binding":[{"scope":15,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"type","type":"Identifier"},"type":"MemberExpression"},{"type":"Literal","value":" "}],"callee":{"computed":false,"object":{"type":"Literal","value":""},"optional":false,"property":{"name":"concat","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"optional":false,"property":{"name":"concat","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"}}],"type":"ObjectExpression"}],"callee":{"binding":[{"scope":7,"variable":0}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"expression":{"arguments":[{"binding":[{"scope":15,"variable":2}],"type":"Identifier"},{"properties":[{"computed":false,"key":{"name":"variant","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"type":"Literal","value":"success"}}],"type":"ObjectExpression"}],"callee":{"binding":[{"scope":7,"variable":4}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"ExpressionStatement"}],"type":"BlockStatement"},"test":{"argument":{"left":{"left":{"computed":false,"object":{"binding":[{"scope":15,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"type","type":"Identifier"},"type":"MemberExpression"},"operator":"===","right":{"type":"Literal","value":"LIQUIDATION"},"type":"BinaryExpression"},"operator":"||","right":{"argument":{"binding":[{"scope":7,"variable":2}],"type":"Identifier"},"operator":"!","prefix":true,"type":"UnaryExpression"},"type":"LogicalExpression"},"operator":"!","prefix":true,"type":"UnaryExpression"},"type":"IfStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":15,"variable":0}],"type":"Identifier"}],"type":"FunctionExpression"},{"elements":[{"binding":[{"scope":7,"variable":7}],"type":"Identifier"},{"binding":[{"scope":7,"variable":0}],"type":"Identifier"},{"binding":[{"scope":7,"variable":4}],"type":"Identifier"},{"binding":[{"scope":7,"variable":2}],"type":"Identifier"}],"type":"ArrayExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"useCallback","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"argument":{"arguments":[{"async":false,"body":{"body":[{"argument":{"properties":[{"computed":false,"key":{"name":"cancelOrderNotify","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"binding":[{"scope":7,"variable":8}],"type":"Identifier"}},{"computed":false,"key":{"name":"fillOrderNotify","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"binding":[{"scope":7,"variable":9}],"type":"Identifier"}},{"computed":false,"key":{"name":"fillOrderPartNotify","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"binding":[{"scope":7,"variable":10}],"type":"Identifier"}}],"type":"ObjectExpression"},"type":"ReturnStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"},{"elements":[{"binding":[{"scope":7,"variable":8}],"type":"Identifier"},{"binding":[{"scope":7,"variable":9}],"type":"Identifier"},{"binding":[{"scope":7,"variable":10}],"type":"Identifier"}],"type":"ArrayExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"useMemo","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"ReturnStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":1,"variable":0}],"type":"Identifier"},{"binding":[{"scope":1,"variable":1}],"type":"Identifier"},{"binding":[{"scope":1,"variable":2}],"type":"Identifier"}],"type":"FunctionExpression"}}', + create(__notify) { + return { 30877(be, W, e) { + e.d(W, { F: () => N, z: () => o }); + var r = e(41594), a = e.n(r), T = e(61523), p = e(92873), P = e(64041), b = e(17409), S = e(51471), E = e(40477), $ = "trd-openOrder", G = function(c) { + return (0, p.o)($, c); + }, o = function() { + var c = (0, S.zr)("open_order_status_toast", true), h = c.data, R = c.setData, K = c.hasInitialized, x = (0, r.useCallback)(function() { + R(!h); + }, [h, R]); + return { enableToast: K ? h : false, toggleToast: x }; }, N = function() { var c = G().getI18n, h = (0, P.h)().enqueueNotification, R = o().enableToast, K = (0, E.A)(function(__token, ...__args) { if (__notify.allowToken(__token)) return Reflect.apply(h, this, __args); @@ -7060,107 +15236,9 @@ } }[30877]; } }, - { - id: "30877", - original: '30877(V,b,e){e.d(b,{F:()=>m,z:()=>I});var r=e(41594),A=e.n(r),s=e(61523),f=e(92873),v=e(64041),o=e(17409),l=e(51471),P=e(40477),k="trd-openOrder",y=function(g){return(0,f.o)(k,g)},I=function(){var g=(0,l.zr)("open_order_status_toast",!0),_=g.data,F=g.setData,R=g.hasInitialized,L=(0,r.useCallback)(function(){F(!_)},[_,F]);return{enableToast:R?_:!1,toggleToast:L}},m=function(){var g=y().getI18n,_=(0,v.h)().enqueueNotification,F=I().enableToast,R=(0,P.A)(_,30),L=R.run,a=(0,s.d4)(function(i){return i.setting.layout}),M=(0,r.useMemo)(function(){return a===o.a0},[a]),C=(0,r.useCallback)(function(i){var S=i.side.toUpperCase(),T=i.type.replace(/[-_]/g,"");return"".concat(S).concat(T)},[]),c=(0,r.useCallback)(function(i){if(!(i.type==="LIQUIDATION"||!F)){var S=C(i),T=g("".concat(S,"CancelTitle"),{defaultValue:"".concat(i.type," ").concat(i.side," Order Canceled")});L(T)}},[C,g,L,F]),u=(0,r.useCallback)(function(i){if(!(i.type==="LIQUIDATION"||!F)){var S=C(i),T=g("".concat(S,"FillTitle"),{defaultValue:"".concat(i.type," ").concat(i.side," Order Filled")});L(T,{variant:"success"})}},[C,g,L,F]),h=(0,r.useCallback)(function(i){if(!(i.type==="LIQUIDATION"||!F)){var S=C(i),T=g("".concat(S,"PFTitle"),{defaultValue:"".concat(i.type," ").concat(i.side," Order Partially Filled")});L(T,{variant:"success"})}},[C,g,L,F]);return(0,r.useMemo)(function(){return{cancelOrderNotify:c,fillOrderNotify:u,fillOrderPartNotify:h}},[c,u,h])}}', - create(__notify) { - return { 30877(V, b, e) { - e.d(b, { F: () => m, z: () => I }); - var r = e(41594), A = e.n(r), s = e(61523), f = e(92873), v = e(64041), o = e(17409), l = e(51471), P = e(40477), k = "trd-openOrder", y = function(g) { - return (0, f.o)(k, g); - }, I = function() { - var g = (0, l.zr)("open_order_status_toast", true), _ = g.data, F = g.setData, R = g.hasInitialized, L = (0, r.useCallback)(function() { - F(!_); - }, [_, F]); - return { enableToast: R ? _ : false, toggleToast: L }; - }, m = function() { - var g = y().getI18n, _ = (0, v.h)().enqueueNotification, F = I().enableToast, R = (0, P.A)(function(__token, ...__args) { - if (__notify.allowToken(__token)) return Reflect.apply(_, this, __args); - }, 30), L = R.run, a = (0, s.d4)(function(i) { - return i.setting.layout; - }), M = (0, r.useMemo)(function() { - return a === o.a0; - }, [a]), C = (0, r.useCallback)(function(i) { - var S = i.side.toUpperCase(), T = i.type.replace(/[-_]/g, ""); - return "".concat(S).concat(T); - }, []), c = (0, r.useCallback)(function(i) { - if (!__notify.allowOrder(i)) return; - if (!(i.type === "LIQUIDATION" || !F)) { - var S = C(i), T = g("".concat(S, "CancelTitle"), { defaultValue: "".concat(i.type, " ").concat(i.side, " Order Canceled") }); - L(__notify.token(i), T); - } - }, [C, g, L, F]), u = (0, r.useCallback)(function(i) { - if (!__notify.allowOrder(i)) return; - if (!(i.type === "LIQUIDATION" || !F)) { - var S = C(i), T = g("".concat(S, "FillTitle"), { defaultValue: "".concat(i.type, " ").concat(i.side, " Order Filled") }); - L(__notify.token(i), T, { variant: "success" }); - } - }, [C, g, L, F]), h = (0, r.useCallback)(function(i) { - if (!__notify.allowOrder(i)) return; - if (!(i.type === "LIQUIDATION" || !F)) { - var S = C(i), T = g("".concat(S, "PFTitle"), { defaultValue: "".concat(i.type, " ").concat(i.side, " Order Partially Filled") }); - L(__notify.token(i), T, { variant: "success" }); - } - }, [C, g, L, F]); - return (0, r.useMemo)(function() { - return { cancelOrderNotify: c, fillOrderNotify: u, fillOrderPartNotify: h }; - }, [c, u, h]); - }; - } }[30877]; - } - }, - { - id: "30877", - original: '30877(K,T,e){e.d(T,{F:()=>i,z:()=>E});var t=e(41594),r=e.n(t),n=e(61523),s=e(92873),g=e(64041),c=e(17409),h=e(51471),p=e(40477),b="trd-openOrder",S=function(y){return(0,s.o)(b,y)},E=function(){var y=(0,h.zr)("open_order_status_toast",!0),C=y.data,f=y.setData,I=y.hasInitialized,d=(0,t.useCallback)(function(){f(!C)},[C,f]);return{enableToast:I?C:!1,toggleToast:d}},i=function(){var y=S().getI18n,C=(0,g.h)().enqueueNotification,f=E().enableToast,I=(0,p.A)(C,30),d=I.run,P=(0,n.d4)(function(a){return a.setting.layout}),M=(0,t.useMemo)(function(){return P===c.a0},[P]),k=(0,t.useCallback)(function(a){var o=a.side.toUpperCase(),u=a.type.replace(/[-_]/g,"");return"".concat(o).concat(u)},[]),A=(0,t.useCallback)(function(a){if(!(a.type==="LIQUIDATION"||!f)){var o=k(a),u=y("".concat(o,"CancelTitle"),{defaultValue:"".concat(a.type," ").concat(a.side," Order Canceled")});d(u)}},[k,y,d,f]),O=(0,t.useCallback)(function(a){if(!(a.type==="LIQUIDATION"||!f)){var o=k(a),u=y("".concat(o,"FillTitle"),{defaultValue:"".concat(a.type," ").concat(a.side," Order Filled")});d(u,{variant:"success"})}},[k,y,d,f]),x=(0,t.useCallback)(function(a){if(!(a.type==="LIQUIDATION"||!f)){var o=k(a),u=y("".concat(o,"PFTitle"),{defaultValue:"".concat(a.type," ").concat(a.side," Order Partially Filled")});d(u,{variant:"success"})}},[k,y,d,f]);return(0,t.useMemo)(function(){return{cancelOrderNotify:A,fillOrderNotify:O,fillOrderPartNotify:x}},[A,O,x])}}', - create(__notify) { - return { 30877(K, T, e) { - e.d(T, { F: () => i, z: () => E }); - var t = e(41594), r = e.n(t), n = e(61523), s = e(92873), g = e(64041), c = e(17409), h = e(51471), p = e(40477), b = "trd-openOrder", S = function(y) { - return (0, s.o)(b, y); - }, E = function() { - var y = (0, h.zr)("open_order_status_toast", true), C = y.data, f = y.setData, I = y.hasInitialized, d = (0, t.useCallback)(function() { - f(!C); - }, [C, f]); - return { enableToast: I ? C : false, toggleToast: d }; - }, i = function() { - var y = S().getI18n, C = (0, g.h)().enqueueNotification, f = E().enableToast, I = (0, p.A)(function(__token, ...__args) { - if (__notify.allowToken(__token)) return Reflect.apply(C, this, __args); - }, 30), d = I.run, P = (0, n.d4)(function(a) { - return a.setting.layout; - }), M = (0, t.useMemo)(function() { - return P === c.a0; - }, [P]), k = (0, t.useCallback)(function(a) { - var o = a.side.toUpperCase(), u = a.type.replace(/[-_]/g, ""); - return "".concat(o).concat(u); - }, []), A = (0, t.useCallback)(function(a) { - if (!__notify.allowOrder(a)) return; - if (!(a.type === "LIQUIDATION" || !f)) { - var o = k(a), u = y("".concat(o, "CancelTitle"), { defaultValue: "".concat(a.type, " ").concat(a.side, " Order Canceled") }); - d(__notify.token(a), u); - } - }, [k, y, d, f]), O = (0, t.useCallback)(function(a) { - if (!__notify.allowOrder(a)) return; - if (!(a.type === "LIQUIDATION" || !f)) { - var o = k(a), u = y("".concat(o, "FillTitle"), { defaultValue: "".concat(a.type, " ").concat(a.side, " Order Filled") }); - d(__notify.token(a), u, { variant: "success" }); - } - }, [k, y, d, f]), x = (0, t.useCallback)(function(a) { - if (!__notify.allowOrder(a)) return; - if (!(a.type === "LIQUIDATION" || !f)) { - var o = k(a), u = y("".concat(o, "PFTitle"), { defaultValue: "".concat(a.type, " ").concat(a.side, " Order Partially Filled") }); - d(__notify.token(a), u, { variant: "success" }); - } - }, [k, y, d, f]); - return (0, t.useMemo)(function() { - return { cancelOrderNotify: A, fillOrderNotify: O, fillOrderPartNotify: x }; - }, [A, O, x]); - }; - } }[30877]; - } - }, { id: "55401", - original: '55401(S,f,o){o.r(f),o.d(f,{SoundNotificationProvider:()=>C});var c=o(31085),e=o(41594),x=o(17409),s=o(39116),E=function(a){var r,n;(r=a)===null||r===void 0||r.load();var u=(n=a)===null||n===void 0?void 0:n.play();u&&u.then(function(){var t;(t=a)===null||t===void 0||t.play()}).catch(function(){})},C=function(a){var r=a.children,n=(0,s.$$)(),u=n.interval,t=n.intervalFunc,h=(0,e.useRef)(null),N=(0,s.QZ)(),p=N.enableNotification,m=N.showNotification,d=(0,s.E$)(),l=d.notifications,P=d.lastNotifyTime,y=d.popNotification,j=(0,e.useCallback)(function(){var i,v=(i=h)===null||i===void 0?void 0:i.current;v&&(v.src="".concat(x.K5,"/static/spot-trade-ui/trade-sound.mp3"),E(v),t(y))},[t,y]);return(0,e.useEffect)(function(){var i;(!m||!p)&&(l.current=[]),l&&((i=l)===null||i===void 0?void 0:i.current.length)>0&&(u.current||j())},[P,p,j,l,u,m]),(0,c.jsxs)("div",{children:[r,(0,c.jsx)("div",{children:(0,c.jsx)("audio",{ref:h,children:(0,c.jsx)("source",{src:""})})})]})}}', + signature: '{"computed":false,"key":{"type":"Literal","value":55401},"kind":"init","method":true,"shorthand":false,"type":"Property","value":{"async":false,"body":{"body":[{"expression":{"expressions":[{"arguments":[{"binding":[{"scope":1,"variable":1}],"type":"Identifier"}],"callee":{"computed":false,"object":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"property":{"name":"r","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},{"arguments":[{"binding":[{"scope":1,"variable":1}],"type":"Identifier"},{"properties":[{"computed":false,"key":{"name":"SoundNotificationProvider","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"async":false,"body":{"binding":[{"scope":1,"variable":8}],"type":"Identifier"},"expression":true,"generator":false,"id":null,"params":[],"type":"ArrowFunctionExpression"}}],"type":"ObjectExpression"}],"callee":{"computed":false,"object":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"property":{"name":"d","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"}],"type":"SequenceExpression"},"type":"ExpressionStatement"},{"declarations":[{"id":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":31085}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":4}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":41594}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":5}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":17409}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":6}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":39116}],"callee":{"binding":[{"scope":1,"variable":2}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":7}],"type":"Identifier"},"init":{"async":false,"body":{"body":[{"declarations":[{"id":{"binding":[{"scope":3,"variable":1}],"type":"Identifier"},"init":null,"type":"VariableDeclarator"},{"id":{"binding":[{"scope":3,"variable":2}],"type":"Identifier"},"init":null,"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"expression":{"left":{"left":{"left":{"left":{"binding":[{"scope":3,"variable":1}],"type":"Identifier"},"operator":"=","right":{"binding":[{"scope":3,"variable":0}],"type":"Identifier"},"type":"AssignmentExpression"},"operator":"===","right":{"type":"Literal","value":null},"type":"BinaryExpression"},"operator":"||","right":{"left":{"binding":[{"scope":3,"variable":1}],"type":"Identifier"},"operator":"===","right":{"argument":{"type":"Literal","value":0},"operator":"void","prefix":true,"type":"UnaryExpression"},"type":"BinaryExpression"},"type":"LogicalExpression"},"operator":"||","right":{"arguments":[],"callee":{"computed":false,"object":{"binding":[{"scope":3,"variable":1}],"type":"Identifier"},"optional":false,"property":{"name":"load","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"LogicalExpression"},"type":"ExpressionStatement"},{"declarations":[{"id":{"binding":[{"scope":3,"variable":3}],"type":"Identifier"},"init":{"alternate":{"arguments":[],"callee":{"computed":false,"object":{"binding":[{"scope":3,"variable":2}],"type":"Identifier"},"optional":false,"property":{"name":"play","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"consequent":{"argument":{"type":"Literal","value":0},"operator":"void","prefix":true,"type":"UnaryExpression"},"test":{"left":{"left":{"left":{"binding":[{"scope":3,"variable":2}],"type":"Identifier"},"operator":"=","right":{"binding":[{"scope":3,"variable":0}],"type":"Identifier"},"type":"AssignmentExpression"},"operator":"===","right":{"type":"Literal","value":null},"type":"BinaryExpression"},"operator":"||","right":{"left":{"binding":[{"scope":3,"variable":2}],"type":"Identifier"},"operator":"===","right":{"argument":{"type":"Literal","value":0},"operator":"void","prefix":true,"type":"UnaryExpression"},"type":"BinaryExpression"},"type":"LogicalExpression"},"type":"ConditionalExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"expression":{"left":{"binding":[{"scope":3,"variable":3}],"type":"Identifier"},"operator":"&&","right":{"arguments":[{"async":false,"body":{"body":[],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"}],"callee":{"computed":false,"object":{"arguments":[{"async":false,"body":{"body":[{"declarations":[{"id":{"binding":[{"scope":4,"variable":0}],"type":"Identifier"},"init":null,"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"expression":{"left":{"left":{"left":{"left":{"binding":[{"scope":4,"variable":0}],"type":"Identifier"},"operator":"=","right":{"binding":[{"scope":3,"variable":0}],"type":"Identifier"},"type":"AssignmentExpression"},"operator":"===","right":{"type":"Literal","value":null},"type":"BinaryExpression"},"operator":"||","right":{"left":{"binding":[{"scope":4,"variable":0}],"type":"Identifier"},"operator":"===","right":{"argument":{"type":"Literal","value":0},"operator":"void","prefix":true,"type":"UnaryExpression"},"type":"BinaryExpression"},"type":"LogicalExpression"},"operator":"||","right":{"arguments":[],"callee":{"computed":false,"object":{"binding":[{"scope":4,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"play","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"LogicalExpression"},"type":"ExpressionStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"}],"callee":{"computed":false,"object":{"binding":[{"scope":3,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"then","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"optional":false,"property":{"name":"catch","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"LogicalExpression"},"type":"ExpressionStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":3,"variable":0}],"type":"Identifier"}],"type":"FunctionExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":1,"variable":8}],"type":"Identifier"},"init":{"async":false,"body":{"body":[{"declarations":[{"id":{"binding":[{"scope":6,"variable":1}],"type":"Identifier"},"init":{"computed":false,"object":{"binding":[{"scope":6,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"children","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":6,"variable":2}],"type":"Identifier"},"init":{"arguments":[],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":6}],"type":"Identifier"},"optional":false,"property":{"name":"$$","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":6,"variable":3}],"type":"Identifier"},"init":{"computed":false,"object":{"binding":[{"scope":6,"variable":2}],"type":"Identifier"},"optional":false,"property":{"name":"interval","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":6,"variable":4}],"type":"Identifier"},"init":{"computed":false,"object":{"binding":[{"scope":6,"variable":2}],"type":"Identifier"},"optional":false,"property":{"name":"intervalFunc","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":6,"variable":5}],"type":"Identifier"},"init":{"arguments":[{"type":"Literal","value":null}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":4}],"type":"Identifier"},"optional":false,"property":{"name":"useRef","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":6,"variable":6}],"type":"Identifier"},"init":{"arguments":[],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":6}],"type":"Identifier"},"optional":false,"property":{"name":"QZ","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":6,"variable":7}],"type":"Identifier"},"init":{"computed":false,"object":{"binding":[{"scope":6,"variable":6}],"type":"Identifier"},"optional":false,"property":{"name":"enableNotification","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":6,"variable":8}],"type":"Identifier"},"init":{"computed":false,"object":{"binding":[{"scope":6,"variable":6}],"type":"Identifier"},"optional":false,"property":{"name":"showNotification","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":6,"variable":9}],"type":"Identifier"},"init":{"arguments":[],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":6}],"type":"Identifier"},"optional":false,"property":{"name":"E$","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":6,"variable":10}],"type":"Identifier"},"init":{"computed":false,"object":{"binding":[{"scope":6,"variable":9}],"type":"Identifier"},"optional":false,"property":{"name":"notifications","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":6,"variable":11}],"type":"Identifier"},"init":{"computed":false,"object":{"binding":[{"scope":6,"variable":9}],"type":"Identifier"},"optional":false,"property":{"name":"lastNotifyTime","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":6,"variable":12}],"type":"Identifier"},"init":{"computed":false,"object":{"binding":[{"scope":6,"variable":9}],"type":"Identifier"},"optional":false,"property":{"name":"popNotification","type":"Identifier"},"type":"MemberExpression"},"type":"VariableDeclarator"},{"id":{"binding":[{"scope":6,"variable":13}],"type":"Identifier"},"init":{"arguments":[{"async":false,"body":{"body":[{"declarations":[{"id":{"binding":[{"scope":7,"variable":0}],"type":"Identifier"},"init":null,"type":"VariableDeclarator"},{"id":{"binding":[{"scope":7,"variable":1}],"type":"Identifier"},"init":{"alternate":{"computed":false,"object":{"binding":[{"scope":7,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"current","type":"Identifier"},"type":"MemberExpression"},"consequent":{"argument":{"type":"Literal","value":0},"operator":"void","prefix":true,"type":"UnaryExpression"},"test":{"left":{"left":{"left":{"binding":[{"scope":7,"variable":0}],"type":"Identifier"},"operator":"=","right":{"binding":[{"scope":6,"variable":5}],"type":"Identifier"},"type":"AssignmentExpression"},"operator":"===","right":{"type":"Literal","value":null},"type":"BinaryExpression"},"operator":"||","right":{"left":{"binding":[{"scope":7,"variable":0}],"type":"Identifier"},"operator":"===","right":{"argument":{"type":"Literal","value":0},"operator":"void","prefix":true,"type":"UnaryExpression"},"type":"BinaryExpression"},"type":"LogicalExpression"},"type":"ConditionalExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"expression":{"left":{"binding":[{"scope":7,"variable":1}],"type":"Identifier"},"operator":"&&","right":{"expressions":[{"left":{"computed":false,"object":{"binding":[{"scope":7,"variable":1}],"type":"Identifier"},"optional":false,"property":{"name":"src","type":"Identifier"},"type":"MemberExpression"},"operator":"=","right":{"arguments":[{"computed":false,"object":{"binding":[{"scope":1,"variable":5}],"type":"Identifier"},"optional":false,"property":{"name":"K5","type":"Identifier"},"type":"MemberExpression"},{"type":"Literal","value":"/static/spot-trade-ui/trade-sound.mp3"}],"callee":{"computed":false,"object":{"type":"Literal","value":""},"optional":false,"property":{"name":"concat","type":"Identifier"},"type":"MemberExpression"},"optional":false,"type":"CallExpression"},"type":"AssignmentExpression"},{"arguments":[{"binding":[{"scope":7,"variable":1}],"type":"Identifier"}],"callee":{"binding":[{"scope":1,"variable":7}],"type":"Identifier"},"optional":false,"type":"CallExpression"},{"arguments":[{"binding":[{"scope":6,"variable":12}],"type":"Identifier"}],"callee":{"binding":[{"scope":6,"variable":4}],"type":"Identifier"},"optional":false,"type":"CallExpression"}],"type":"SequenceExpression"},"type":"LogicalExpression"},"type":"ExpressionStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"},{"elements":[{"binding":[{"scope":6,"variable":4}],"type":"Identifier"},{"binding":[{"scope":6,"variable":12}],"type":"Identifier"}],"type":"ArrayExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":4}],"type":"Identifier"},"optional":false,"property":{"name":"useCallback","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"argument":{"expressions":[{"arguments":[{"async":false,"body":{"body":[{"declarations":[{"id":{"binding":[{"scope":8,"variable":0}],"type":"Identifier"},"init":null,"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"},{"expression":{"expressions":[{"left":{"left":{"argument":{"binding":[{"scope":6,"variable":8}],"type":"Identifier"},"operator":"!","prefix":true,"type":"UnaryExpression"},"operator":"||","right":{"argument":{"binding":[{"scope":6,"variable":7}],"type":"Identifier"},"operator":"!","prefix":true,"type":"UnaryExpression"},"type":"LogicalExpression"},"operator":"&&","right":{"left":{"computed":false,"object":{"binding":[{"scope":6,"variable":10}],"type":"Identifier"},"optional":false,"property":{"name":"current","type":"Identifier"},"type":"MemberExpression"},"operator":"=","right":{"elements":[],"type":"ArrayExpression"},"type":"AssignmentExpression"},"type":"LogicalExpression"},{"left":{"left":{"binding":[{"scope":6,"variable":10}],"type":"Identifier"},"operator":"&&","right":{"left":{"alternate":{"computed":false,"object":{"computed":false,"object":{"binding":[{"scope":8,"variable":0}],"type":"Identifier"},"optional":false,"property":{"name":"current","type":"Identifier"},"type":"MemberExpression"},"optional":false,"property":{"name":"length","type":"Identifier"},"type":"MemberExpression"},"consequent":{"argument":{"type":"Literal","value":0},"operator":"void","prefix":true,"type":"UnaryExpression"},"test":{"left":{"left":{"left":{"binding":[{"scope":8,"variable":0}],"type":"Identifier"},"operator":"=","right":{"binding":[{"scope":6,"variable":10}],"type":"Identifier"},"type":"AssignmentExpression"},"operator":"===","right":{"type":"Literal","value":null},"type":"BinaryExpression"},"operator":"||","right":{"left":{"binding":[{"scope":8,"variable":0}],"type":"Identifier"},"operator":"===","right":{"argument":{"type":"Literal","value":0},"operator":"void","prefix":true,"type":"UnaryExpression"},"type":"BinaryExpression"},"type":"LogicalExpression"},"type":"ConditionalExpression"},"operator":">","right":{"type":"Literal","value":0},"type":"BinaryExpression"},"type":"LogicalExpression"},"operator":"&&","right":{"left":{"computed":false,"object":{"binding":[{"scope":6,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"current","type":"Identifier"},"type":"MemberExpression"},"operator":"||","right":{"arguments":[],"callee":{"binding":[{"scope":6,"variable":13}],"type":"Identifier"},"optional":false,"type":"CallExpression"},"type":"LogicalExpression"},"type":"LogicalExpression"}],"type":"SequenceExpression"},"type":"ExpressionStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[],"type":"FunctionExpression"},{"elements":[{"binding":[{"scope":6,"variable":11}],"type":"Identifier"},{"binding":[{"scope":6,"variable":7}],"type":"Identifier"},{"binding":[{"scope":6,"variable":13}],"type":"Identifier"},{"binding":[{"scope":6,"variable":10}],"type":"Identifier"},{"binding":[{"scope":6,"variable":3}],"type":"Identifier"},{"binding":[{"scope":6,"variable":8}],"type":"Identifier"}],"type":"ArrayExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":4}],"type":"Identifier"},"optional":false,"property":{"name":"useEffect","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"},{"arguments":[{"type":"Literal","value":"div"},{"properties":[{"computed":false,"key":{"name":"children","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"elements":[{"binding":[{"scope":6,"variable":1}],"type":"Identifier"},{"arguments":[{"type":"Literal","value":"div"},{"properties":[{"computed":false,"key":{"name":"children","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"arguments":[{"type":"Literal","value":"audio"},{"properties":[{"computed":false,"key":{"name":"ref","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"binding":[{"scope":6,"variable":5}],"type":"Identifier"}},{"computed":false,"key":{"name":"children","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"arguments":[{"type":"Literal","value":"source"},{"properties":[{"computed":false,"key":{"name":"src","type":"Identifier"},"kind":"init","method":false,"shorthand":false,"type":"Property","value":{"type":"Literal","value":""}}],"type":"ObjectExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"jsx","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"}}],"type":"ObjectExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"jsx","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"}}],"type":"ObjectExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"jsx","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"}],"type":"ArrayExpression"}}],"type":"ObjectExpression"}],"callee":{"expressions":[{"type":"Literal","value":0},{"computed":false,"object":{"binding":[{"scope":1,"variable":3}],"type":"Identifier"},"optional":false,"property":{"name":"jsxs","type":"Identifier"},"type":"MemberExpression"}],"type":"SequenceExpression"},"optional":false,"type":"CallExpression"}],"type":"SequenceExpression"},"type":"ReturnStatement"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":6,"variable":0}],"type":"Identifier"}],"type":"FunctionExpression"},"type":"VariableDeclarator"}],"kind":"var","type":"VariableDeclaration"}],"type":"BlockStatement"},"expression":false,"generator":false,"id":null,"params":[{"binding":[{"scope":1,"variable":0}],"type":"Identifier"},{"binding":[{"scope":1,"variable":1}],"type":"Identifier"},{"binding":[{"scope":1,"variable":2}],"type":"Identifier"}],"type":"FunctionExpression"}}', create(__notify) { return { 55401(S, f, o) { o.r(f), o.d(f, { SoundNotificationProvider: () => C }); @@ -7188,161 +15266,15 @@ }; } }[55401]; } - }, - { - id: "30877", - original: '30877(Y,T,e){e.d(T,{F:()=>o,z:()=>N});var a=e(41594),k=e.n(a),P=e(61523),l=e(92873),O=e(64041),C=e(17409),h=e(51471),M=e(40477),p="trd-openOrder",R=function(n){return(0,l.o)(p,n)},N=function(){var n=(0,h.zr)("open_order_status_toast",!0),c=n.data,i=n.setData,F=n.hasInitialized,u=(0,a.useCallback)(function(){i(!c)},[c,i]);return{enableToast:F?c:!1,toggleToast:u}},o=function(){var n=R().getI18n,c=(0,O.h)().enqueueNotification,i=N().enableToast,F=(0,M.A)(c,30),u=F.run,L=(0,P.d4)(function(r){return r.setting.layout}),g=(0,a.useMemo)(function(){return L===C.a0},[L]),I=(0,a.useCallback)(function(r){var d=r.side.toUpperCase(),f=r.type.replace(/[-_]/g,"");return"".concat(d).concat(f)},[]),S=(0,a.useCallback)(function(r){if(!(r.type==="LIQUIDATION"||!i)){var d=I(r),f=n("".concat(d,"CancelTitle"),{defaultValue:"".concat(r.type," ").concat(r.side," Order Canceled")});u(f)}},[I,n,u,i]),A=(0,a.useCallback)(function(r){if(!(r.type==="LIQUIDATION"||!i)){var d=I(r),f=n("".concat(d,"FillTitle"),{defaultValue:"".concat(r.type," ").concat(r.side," Order Filled")});u(f,{variant:"success"})}},[I,n,u,i]),Q=(0,a.useCallback)(function(r){if(!(r.type==="LIQUIDATION"||!i)){var d=I(r),f=n("".concat(d,"PFTitle"),{defaultValue:"".concat(r.type," ").concat(r.side," Order Partially Filled")});u(f,{variant:"success"})}},[I,n,u,i]);return(0,a.useMemo)(function(){return{cancelOrderNotify:S,fillOrderNotify:A,fillOrderPartNotify:Q}},[S,A,Q])}}', - create(__notify) { - return { 30877(Y, T, e) { - e.d(T, { F: () => o, z: () => N }); - var a = e(41594), k = e.n(a), P = e(61523), l = e(92873), O = e(64041), C = e(17409), h = e(51471), M = e(40477), p = "trd-openOrder", R = function(n) { - return (0, l.o)(p, n); - }, N = function() { - var n = (0, h.zr)("open_order_status_toast", true), c = n.data, i = n.setData, F = n.hasInitialized, u = (0, a.useCallback)(function() { - i(!c); - }, [c, i]); - return { enableToast: F ? c : false, toggleToast: u }; - }, o = function() { - var n = R().getI18n, c = (0, O.h)().enqueueNotification, i = N().enableToast, F = (0, M.A)(function(__token, ...__args) { - if (__notify.allowToken(__token)) return Reflect.apply(c, this, __args); - }, 30), u = F.run, L = (0, P.d4)(function(r) { - return r.setting.layout; - }), g = (0, a.useMemo)(function() { - return L === C.a0; - }, [L]), I = (0, a.useCallback)(function(r) { - var d = r.side.toUpperCase(), f = r.type.replace(/[-_]/g, ""); - return "".concat(d).concat(f); - }, []), S = (0, a.useCallback)(function(r) { - if (!__notify.allowOrder(r)) return; - if (!(r.type === "LIQUIDATION" || !i)) { - var d = I(r), f = n("".concat(d, "CancelTitle"), { defaultValue: "".concat(r.type, " ").concat(r.side, " Order Canceled") }); - u(__notify.token(r), f); - } - }, [I, n, u, i]), A = (0, a.useCallback)(function(r) { - if (!__notify.allowOrder(r)) return; - if (!(r.type === "LIQUIDATION" || !i)) { - var d = I(r), f = n("".concat(d, "FillTitle"), { defaultValue: "".concat(r.type, " ").concat(r.side, " Order Filled") }); - u(__notify.token(r), f, { variant: "success" }); - } - }, [I, n, u, i]), Q = (0, a.useCallback)(function(r) { - if (!__notify.allowOrder(r)) return; - if (!(r.type === "LIQUIDATION" || !i)) { - var d = I(r), f = n("".concat(d, "PFTitle"), { defaultValue: "".concat(r.type, " ").concat(r.side, " Order Partially Filled") }); - u(__notify.token(r), f, { variant: "success" }); - } - }, [I, n, u, i]); - return (0, a.useMemo)(function() { - return { cancelOrderNotify: S, fillOrderNotify: A, fillOrderPartNotify: Q }; - }, [S, A, Q]); - }; - } }[30877]; - } - }, - { - id: "30877", - original: '30877(L,T,e){e.d(T,{F:()=>_,z:()=>v});var r=e(41594),x=e.n(r),O=e(61523),h=e(92873),p=e(64041),k=e(17409),C=e(51471),I=e(40477),g="trd-openOrder",f=function(s){return(0,h.o)(g,s)},v=function(){var s=(0,C.zr)("open_order_status_toast",!0),c=s.data,o=s.setData,d=s.hasInitialized,n=(0,r.useCallback)(function(){o(!c)},[c,o]);return{enableToast:d?c:!1,toggleToast:n}},_=function(){var s=f().getI18n,c=(0,p.h)().enqueueNotification,o=v().enableToast,d=(0,I.A)(c,30),n=d.run,a=(0,O.d4)(function(t){return t.setting.layout}),S=(0,r.useMemo)(function(){return a===k.a0},[a]),i=(0,r.useCallback)(function(t){var l=t.side.toUpperCase(),u=t.type.replace(/[-_]/g,"");return"".concat(l).concat(u)},[]),y=(0,r.useCallback)(function(t){if(!(t.type==="LIQUIDATION"||!o)){var l=i(t),u=s("".concat(l,"CancelTitle"),{defaultValue:"".concat(t.type," ").concat(t.side," Order Canceled")});n(u)}},[i,s,n,o]),F=(0,r.useCallback)(function(t){if(!(t.type==="LIQUIDATION"||!o)){var l=i(t),u=s("".concat(l,"FillTitle"),{defaultValue:"".concat(t.type," ").concat(t.side," Order Filled")});n(u,{variant:"success"})}},[i,s,n,o]),m=(0,r.useCallback)(function(t){if(!(t.type==="LIQUIDATION"||!o)){var l=i(t),u=s("".concat(l,"PFTitle"),{defaultValue:"".concat(t.type," ").concat(t.side," Order Partially Filled")});n(u,{variant:"success"})}},[i,s,n,o]);return(0,r.useMemo)(function(){return{cancelOrderNotify:y,fillOrderNotify:F,fillOrderPartNotify:m}},[y,F,m])}}', - create(__notify) { - return { 30877(L, T, e) { - e.d(T, { F: () => _, z: () => v }); - var r = e(41594), x = e.n(r), O = e(61523), h = e(92873), p = e(64041), k = e(17409), C = e(51471), I = e(40477), g = "trd-openOrder", f = function(s) { - return (0, h.o)(g, s); - }, v = function() { - var s = (0, C.zr)("open_order_status_toast", true), c = s.data, o = s.setData, d = s.hasInitialized, n = (0, r.useCallback)(function() { - o(!c); - }, [c, o]); - return { enableToast: d ? c : false, toggleToast: n }; - }, _ = function() { - var s = f().getI18n, c = (0, p.h)().enqueueNotification, o = v().enableToast, d = (0, I.A)(function(__token, ...__args) { - if (__notify.allowToken(__token)) return Reflect.apply(c, this, __args); - }, 30), n = d.run, a = (0, O.d4)(function(t) { - return t.setting.layout; - }), S = (0, r.useMemo)(function() { - return a === k.a0; - }, [a]), i = (0, r.useCallback)(function(t) { - var l = t.side.toUpperCase(), u = t.type.replace(/[-_]/g, ""); - return "".concat(l).concat(u); - }, []), y = (0, r.useCallback)(function(t) { - if (!__notify.allowOrder(t)) return; - if (!(t.type === "LIQUIDATION" || !o)) { - var l = i(t), u = s("".concat(l, "CancelTitle"), { defaultValue: "".concat(t.type, " ").concat(t.side, " Order Canceled") }); - n(__notify.token(t), u); - } - }, [i, s, n, o]), F = (0, r.useCallback)(function(t) { - if (!__notify.allowOrder(t)) return; - if (!(t.type === "LIQUIDATION" || !o)) { - var l = i(t), u = s("".concat(l, "FillTitle"), { defaultValue: "".concat(t.type, " ").concat(t.side, " Order Filled") }); - n(__notify.token(t), u, { variant: "success" }); - } - }, [i, s, n, o]), m = (0, r.useCallback)(function(t) { - if (!__notify.allowOrder(t)) return; - if (!(t.type === "LIQUIDATION" || !o)) { - var l = i(t), u = s("".concat(l, "PFTitle"), { defaultValue: "".concat(t.type, " ").concat(t.side, " Order Partially Filled") }); - n(__notify.token(t), u, { variant: "success" }); - } - }, [i, s, n, o]); - return (0, r.useMemo)(function() { - return { cancelOrderNotify: y, fillOrderNotify: F, fillOrderPartNotify: m }; - }, [y, F, m]); - }; - } }[30877]; - } - }, - { - id: "30877", - original: '30877(R,T,e){e.d(T,{F:()=>y,z:()=>D});var t=e(41594),O=e.n(t),u=e(61523),i=e(92873),m=e(64041),d=e(17409),f=e(51471),a=e(40477),o="trd-openOrder",b=function(S){return(0,i.o)(o,S)},D=function(){var S=(0,f.zr)("open_order_status_toast",!0),M=S.data,P=S.setData,N=S.hasInitialized,_=(0,t.useCallback)(function(){P(!M)},[M,P]);return{enableToast:N?M:!1,toggleToast:_}},y=function(){var S=b().getI18n,M=(0,m.h)().enqueueNotification,P=D().enableToast,N=(0,a.A)(M,30),_=N.run,v=(0,u.d4)(function(n){return n.setting.layout}),l=(0,t.useMemo)(function(){return v===d.a0},[v]),s=(0,t.useCallback)(function(n){var g=n.side.toUpperCase(),c=n.type.replace(/[-_]/g,"");return"".concat(g).concat(c)},[]),r=(0,t.useCallback)(function(n){if(!(n.type==="LIQUIDATION"||!P)){var g=s(n),c=S("".concat(g,"CancelTitle"),{defaultValue:"".concat(n.type," ").concat(n.side," Order Canceled")});_(c)}},[s,S,_,P]),p=(0,t.useCallback)(function(n){if(!(n.type==="LIQUIDATION"||!P)){var g=s(n),c=S("".concat(g,"FillTitle"),{defaultValue:"".concat(n.type," ").concat(n.side," Order Filled")});_(c,{variant:"success"})}},[s,S,_,P]),h=(0,t.useCallback)(function(n){if(!(n.type==="LIQUIDATION"||!P)){var g=s(n),c=S("".concat(g,"PFTitle"),{defaultValue:"".concat(n.type," ").concat(n.side," Order Partially Filled")});_(c,{variant:"success"})}},[s,S,_,P]);return(0,t.useMemo)(function(){return{cancelOrderNotify:r,fillOrderNotify:p,fillOrderPartNotify:h}},[r,p,h])}}', - create(__notify) { - return { 30877(R, T, e) { - e.d(T, { F: () => y, z: () => D }); - var t = e(41594), O = e.n(t), u = e(61523), i = e(92873), m = e(64041), d = e(17409), f = e(51471), a = e(40477), o = "trd-openOrder", b = function(S) { - return (0, i.o)(o, S); - }, D = function() { - var S = (0, f.zr)("open_order_status_toast", true), M = S.data, P = S.setData, N = S.hasInitialized, _ = (0, t.useCallback)(function() { - P(!M); - }, [M, P]); - return { enableToast: N ? M : false, toggleToast: _ }; - }, y = function() { - var S = b().getI18n, M = (0, m.h)().enqueueNotification, P = D().enableToast, N = (0, a.A)(function(__token, ...__args) { - if (__notify.allowToken(__token)) return Reflect.apply(M, this, __args); - }, 30), _ = N.run, v = (0, u.d4)(function(n) { - return n.setting.layout; - }), l = (0, t.useMemo)(function() { - return v === d.a0; - }, [v]), s = (0, t.useCallback)(function(n) { - var g = n.side.toUpperCase(), c = n.type.replace(/[-_]/g, ""); - return "".concat(g).concat(c); - }, []), r = (0, t.useCallback)(function(n) { - if (!__notify.allowOrder(n)) return; - if (!(n.type === "LIQUIDATION" || !P)) { - var g = s(n), c = S("".concat(g, "CancelTitle"), { defaultValue: "".concat(n.type, " ").concat(n.side, " Order Canceled") }); - _(__notify.token(n), c); - } - }, [s, S, _, P]), p = (0, t.useCallback)(function(n) { - if (!__notify.allowOrder(n)) return; - if (!(n.type === "LIQUIDATION" || !P)) { - var g = s(n), c = S("".concat(g, "FillTitle"), { defaultValue: "".concat(n.type, " ").concat(n.side, " Order Filled") }); - _(__notify.token(n), c, { variant: "success" }); - } - }, [s, S, _, P]), h = (0, t.useCallback)(function(n) { - if (!__notify.allowOrder(n)) return; - if (!(n.type === "LIQUIDATION" || !P)) { - var g = s(n), c = S("".concat(g, "PFTitle"), { defaultValue: "".concat(n.type, " ").concat(n.side, " Order Partially Filled") }); - _(__notify.token(n), c, { variant: "success" }); - } - }, [s, S, _, P]); - return (0, t.useMemo)(function() { - return { cancelOrderNotify: r, fillOrderNotify: p, fillOrderPartNotify: h }; - }, [r, p, h]); - }; - } }[30877]; - } } ]; function replaceOrderNotificationFactory(id, originalFactory, bridge) { if (typeof originalFactory !== "function") throw new TypeError("Native notification factory must be a function"); const source = Function.prototype.toString.call(originalFactory); - const pinned = pinnedFactories.find((entry) => entry.id === String(id) && entry.original === source); - if (!pinned) throw new Error("Native notification factory source does not match a pinned public module"); - return pinned.create(bridge); + const signature = createOrderNotificationFactorySignature(source, String(id)); + const verified = verifiedFactories.find((entry) => entry.id === String(id) && entry.signature === signature); + if (!verified) throw new Error("Native notification factory behavior does not match a verified structure"); + return verified.create(bridge); } // src/binance-orderbook-trade/order-notifications/scope.js @@ -8024,8 +15956,8 @@ return left.percent === right.percent && left.levels === right.levels && left.ladderStep === right.ladderStep; } function hasLadderOptionContextChanged(plan) { - const current = readLadderOptionContext(plan.spec, plan.symbol, plan.precision); - return !areLadderOptionContextsEqual(current, plan.optionContext); + const current2 = readLadderOptionContext(plan.spec, plan.symbol, plan.precision); + return !areLadderOptionContextsEqual(current2, plan.optionContext); } function ui(text) { return formatLocalizedText(text, activeUiLocale); @@ -8654,9 +16586,9 @@ } ); if (!resp.ok) throw new Error(`杠杆调整接口异常:HTTP ${resp.status}`); - const data = await resp.json(); - if (!data.success) throw new Error(data.message || `code=${data.code}`); - return data; + const data2 = await resp.json(); + if (!data2.success) throw new Error(data2.message || `code=${data2.code}`); + return data2; } finally { window.clearTimeout(timer); } @@ -8904,16 +16836,16 @@ const deadline = Date.now() + Math.max(0, Number(timeoutMs) || 0); while (!document.hidden && isFuturesTradingPage()) { if (!isCurrentObservedSymbol(symbol)) return false; - const current = readCurrentOrderbookPrecisionValue(); - if (current === targetPrecision) return true; - if (current && current !== startPrecision) return false; + const current2 = readCurrentOrderbookPrecisionValue(); + if (current2 === targetPrecision) return true; + if (current2 && current2 !== startPrecision) return false; if (Date.now() >= deadline) return false; await delay(50); } return false; } - function renderOrderbookPrecisionShortcut(value, current, recommendation, disabled) { - const selected = value === current; + function renderOrderbookPrecisionShortcut(value, current2, recommendation, disabled) { + const selected = value === current2; const recommended = value === recommendation; const disabledAttrs = disabled ? ' disabled aria-disabled="true"' : ""; const title = disabled ? ui(localizedText("价格精度暂不可调整", "Precision is temporarily unavailable")) : selected && recommended ? ui(localizedText(`当前且推荐的价格精度 ${value}`, `Current and recommended precision: ${value}`)) : selected ? ui(localizedText(`当前价格精度 ${value}`, `Current precision: ${value}`)) : recommended ? ui(localizedText(`推荐价格精度 ${value}`, `Recommended precision: ${value}`)) : ui(localizedText(`切换到价格精度 ${value}`, `Switch to precision ${value}`)); @@ -8925,11 +16857,11 @@ )); return ``; } - function renderOrderbookPrecisionShortcutSlots(options, current, recommendation, disabled, emptyLabel) { + function renderOrderbookPrecisionShortcutSlots(options, current2, recommendation, disabled, emptyLabel) { if (!options.length) { return [`${emptyLabel}`]; } - const slots = options.map((value) => renderOrderbookPrecisionShortcut(value, current, recommendation, disabled)); + const slots = options.map((value) => renderOrderbookPrecisionShortcut(value, current2, recommendation, disabled)); while (slots.length < ORDERBOOK_PRECISION_SHORTCUT_LIMIT) { slots.push(''); } @@ -8983,7 +16915,7 @@ samples, options: ORDERBOOK_PRECISION_CANDIDATE_OPTIONS }); - const current = readCurrentOrderbookPrecisionValue(); + const current2 = readCurrentOrderbookPrecisionValue(); const existingStatus = orderbookPrecisionState.symbol === symbol ? orderbookPrecisionState.status : null; const status = recommendation ? "ready" : existingStatus && existingStatus !== "ready" ? existingStatus : PANEL_COPY.status.precisionInsufficient; orderbookPrecisionState = { @@ -8991,7 +16923,7 @@ symbol, samples, recommendation, - current, + current: current2, status }; const selectionBusy = Boolean(orderbookPrecisionSelectionTask); @@ -9008,7 +16940,7 @@ '
', `
`, `${ui(PANEL_COPY.field.pricePrecision)}`, - ...renderOrderbookPrecisionShortcutSlots(shortcutOptions, current, recommendation, controlsBusy, emptyPrecisionLabel), + ...renderOrderbookPrecisionShortcutSlots(shortcutOptions, current2, recommendation, controlsBusy, emptyPrecisionLabel), renderOrderbookPrecisionRefreshButton(symbol, !canRefresh), "
", "
" @@ -11811,23 +19743,23 @@ async function waitForBinanceChartOrdersPopover(target, expectedChecked = null) { const deadline = Date.now() + CHART_ORDERS_MENU_TIMEOUT_MS; while (Date.now() < deadline) { - const current2 = findActiveBinanceChartOrdersPopover( + const current3 = findActiveBinanceChartOrdersPopover( document, target, isVisibleElement ); - if (current2 && (expectedChecked === null || current2.checked === expectedChecked)) { - return current2; + if (current3 && (expectedChecked === null || current3.checked === expectedChecked)) { + return current3; } await delay(CHART_ORDERS_MENU_POLL_MS); } - const current = findActiveBinanceChartOrdersPopover( + const current2 = findActiveBinanceChartOrdersPopover( document, target, isVisibleElement ); - if (current && (expectedChecked === null || current.checked === expectedChecked)) { - return current; + if (current2 && (expectedChecked === null || current2.checked === expectedChecked)) { + return current2; } throw new Error(expectedChecked === null ? "图表“显示当前委托”菜单未打开" : `图表“显示当前委托”未切换为${expectedChecked ? "显示" : "隐藏"}`); } @@ -11843,14 +19775,14 @@ async function closeBinanceChartOrdersPopover(target) { const currentTarget = getBinanceChartOrdersTarget2(); assertSameBinanceChartOrdersTarget(target, currentTarget); - const current = findActiveBinanceChartOrdersPopover( + const current2 = findActiveBinanceChartOrdersPopover( document, currentTarget, isVisibleElement ); - if (!current) return; + if (!current2) return; dispatchChartOrdersPointerEvents( - current.popover, + current2.popover, ["pointerout", "mouseout", "mouseleave"], currentTarget.chartRoot ); @@ -11890,11 +19822,11 @@ target.tradingViewApi, async () => { assertSameBinanceChartOrdersTarget(target, getBinanceChartOrdersTarget2()); - const current = findActiveBinanceChartOrdersPopover(document, target, isVisibleElement); - if (!current || current.checked === expectedChecked) { + const current2 = findActiveBinanceChartOrdersPopover(document, target, isVisibleElement); + if (!current2 || current2.checked === expectedChecked) { throw new Error("Chart orders checkbox changed while waiting for marker saves"); } - current.checkbox.click(); + current2.checkbox.click(); await waitForBinanceChartOrdersPopover(target, expectedChecked); popoverCloseOutcomePromise = closeBinanceChartOrdersPopover(target).then( () => null, @@ -11918,8 +19850,8 @@ } async function restoreLegacyHiddenBinanceChartOrders(target) { assertSameBinanceChartOrdersTarget(target, getBinanceChartOrdersTarget2()); - const current = await openBinanceChartOrdersPopover(target); - if (!current.checked) { + const current2 = await openBinanceChartOrdersPopover(target); + if (!current2.checked) { await toggleBinanceChartOrdersWithCoalescedSave( target, true, @@ -12454,8 +20386,8 @@ findHideOtherSymbolCheckbox(root) ) !== symbolFilterOriginalChecked) return null; const hasRows = readOpenOrderRowElements(root).length > 0; - const empty = !hasRows && !findCurrentSymbolCancelAllButton(root) && hasBinanceCurrentSymbolOpenOrdersEmptyText(readOpenOrdersScopeText2(root)); - if (!hasRows && !empty) return null; + const empty2 = !hasRows && !findCurrentSymbolCancelAllButton(root) && hasBinanceCurrentSymbolOpenOrdersEmptyText(readOpenOrdersScopeText2(root)); + if (!hasRows && !empty2) return null; return { root, scrollContainer: findOpenOrderRowsScrollContainer(root) }; }, 2200); const scrollContainer = restoredRows?.scrollContainer; @@ -13536,8 +21468,8 @@ rulesFailedUntil[symbol] = Date.now() + RULES_RETRY_COOLDOWN_MS; return null; } - const data = await resp.json(); - const sInfo = data.symbols?.find((s) => s.symbol === symbol); + const data2 = await resp.json(); + const sInfo = data2.symbols?.find((s) => s.symbol === symbol); if (!sInfo) { rulesFailedUntil[symbol] = Date.now() + RULES_RETRY_COOLDOWN_MS; return null; @@ -13571,15 +21503,15 @@ try { const el = document.querySelector("#__APP_DATA"); if (!el || !el.textContent) return null; - let data; + let data2; if (el.textContent === appDataCache.text) { - data = appDataCache.parsed; + data2 = appDataCache.parsed; } else { - data = JSON.parse(el.textContent); - appDataCache = { text: el.textContent, parsed: data }; + data2 = JSON.parse(el.textContent); + appDataCache = { text: el.textContent, parsed: data2 }; } - if (!data) return null; - const reactQueryData = data?.appState?.loader?.dataByRouteId?.bd56?.reactQueryData; + if (!data2) return null; + const reactQueryData = data2?.appState?.loader?.dataByRouteId?.bd56?.reactQueryData; const markPrice = reactQueryData?.[`queryMarkPrice,${symbol}`]?.markPrice || null; const toStr = (v) => { if (typeof v === "string" && v) return v; @@ -14274,8 +22206,8 @@ decBtn.addEventListener("click", () => { const context = getPanelOptionContext(); if (!context || !isCurrentObservedSymbol(context.symbol)) return; - const current = Number(loadMultiplier(context.mode, context.symbol, context.precision)); - if (updateMultiplier(String(Math.max(1, current - 1)), context)) { + const current2 = Number(loadMultiplier(context.mode, context.symbol, context.precision)); + if (updateMultiplier(String(Math.max(1, current2 - 1)), context)) { showMultiplierPressFeedback(decBtn); } }); @@ -14284,8 +22216,8 @@ incBtn.addEventListener("click", () => { const context = getPanelOptionContext(); if (!context || !isCurrentObservedSymbol(context.symbol)) return; - const current = Number(loadMultiplier(context.mode, context.symbol, context.precision)); - if (updateMultiplier(String(current + 1), context)) { + const current2 = Number(loadMultiplier(context.mode, context.symbol, context.precision)); + if (updateMultiplier(String(current2 + 1), context)) { showMultiplierPressFeedback(incBtn); } }); @@ -14703,9 +22635,9 @@ } if (isEnteringOpen) { invalidateTradeButtonCache(); - const reset = () => queueAutoOpenLeveragePositionCheck(source, { resetIfFlat: true }); - if (source === "click") window.requestAnimationFrame(reset); - else reset(); + const reset2 = () => queueAutoOpenLeveragePositionCheck(source, { resetIfFlat: true }); + if (source === "click") window.requestAnimationFrame(reset2); + else reset2(); } const apply = () => applyCachedCloseUiState(); if (source === "click") window.requestAnimationFrame(apply); diff --git a/scripts/build-userscript.mjs b/scripts/build-userscript.mjs index fe24128..4787d2e 100644 --- a/scripts/build-userscript.mjs +++ b/scripts/build-userscript.mjs @@ -17,6 +17,7 @@ export const TARGETS = { 'binance-orderbook-trade': { entry: 'src/binance-orderbook-trade/index.user.js', output: 'scripts/binance-orderbook-trade.user.js', + licenseNotices: 'docs/licenses/binance-notification-parser.txt', }, 'binance-trading-data': { entry: 'src/binance-trading-data/index.user.js', @@ -40,6 +41,14 @@ export const TARGETS = { }, }; +/** Keep release and coverage compilation byte-identical, including dependency notices. */ +export async function createUserscriptBanner(metadata, target) { + const licenseBanner = target.licenseNotices + ? `\n/*\n${await readFile(resolve(root, target.licenseNotices), 'utf8')}\n*/` + : ''; + return metadata + licenseBanner; +} + async function buildTarget(name) { const target = TARGETS[name]; if (!target) { @@ -64,7 +73,7 @@ async function buildTarget(name) { const sourceWithoutMetadata = source.replace(metadata, '').trimStart(); const result = await esbuild.build({ absWorkingDir: root, - banner: { js: metadata }, + banner: { js: await createUserscriptBanner(metadata, target) }, bundle: true, charset: 'utf8', format: 'iife', diff --git a/scripts/generate-order-notification-modules.mjs b/scripts/generate-order-notification-modules.mjs index a4a7095..6cb22f9 100644 --- a/scripts/generate-order-notification-modules.mjs +++ b/scripts/generate-order-notification-modules.mjs @@ -2,12 +2,13 @@ import assert from 'node:assert/strict'; import { createHash } from 'node:crypto'; import { mkdir, readFile, writeFile } from 'node:fs/promises'; import { parse } from 'acorn'; +import { createOrderNotificationFactorySignature } from '../src/binance-orderbook-trade/order-notifications/factory-structure.js'; const fixtureRoot = new URL('../test/fixtures/binance-order-notifications/', import.meta.url); const sourceFile = new URL('native-factories.json', fixtureRoot); const snapshot = await readFile(sourceFile, 'utf8'); const sha = value => createHash('sha256').update(value).digest('hex'); -assert.equal(sha(snapshot), '10744d8bd43ff1910729cc3b81eb553014ec9f3bde6b95ccf92c004c3f4a7381', +assert.equal(sha(snapshot), '6abce8ab71349c94c786b0d628844d21224018e8cb1f4f43f4441428b9312f33', 'The native capture changed; inspect and repin its public-source evidence first'); const { factories } = JSON.parse(snapshot); const notificationIds = new Set(['30877', '39116', '55401']); @@ -184,39 +185,58 @@ function transform(record) { for (const record of factories) assert.equal(sha(record.source), record.sha256); const modified = factories.filter(record => notificationIds.has(record.id)).map(transform); -assert.equal(modified.length, 8); +assert.equal(modified.length, 9); +assert.equal(modified.filter(record => record.id === '39116').length, 2); assert.equal(modified.filter(record => record.id === '30877').length, 6); +const templates = new Map(); +for (const record of modified) { + const signature = createOrderNotificationFactorySignature(record.source, record.id); + const transformedSignature = createOrderNotificationFactorySignature(record.transformed, record.id); + const previous = templates.get(signature); + if (previous) { + assert.equal(transformedSignature, previous.transformedSignature, + 'Equivalent native factories must produce equivalent notification replacements'); + } else { + templates.set(signature, { ...record, signature, transformedSignature }); + } +} +assert.equal(templates.size, 3, 'The captured notifications have three distinct behavioral structures'); + const moduleSource = `/* Generated by scripts/generate-order-notification-modules.mjs; see notification-manifest.json. */ -const pinnedFactories = [ -${modified.map(record => ` { +import { createOrderNotificationFactorySignature } from './factory-structure.js'; + +const verifiedFactories = [ +${[...templates.values()].map(record => ` { id: ${JSON.stringify(record.id)}, - original: ${JSON.stringify(record.source)}, + signature: ${JSON.stringify(record.signature)}, create(__notify) { return {${record.transformed}}[${record.id}]; }, }`).join(',\n')} ]; -/** Preserve the complete native factories and alter only the verified notification side effects. */ +/** Accept local renaming and formatting while preserving the verified native behavior. */ export function replaceOrderNotificationFactory(id, originalFactory, bridge) { if (typeof originalFactory !== 'function') throw new TypeError('Native notification factory must be a function'); const source = Function.prototype.toString.call(originalFactory); - const pinned = pinnedFactories.find(entry => entry.id === String(id) && entry.original === source); - if (!pinned) throw new Error('Native notification factory source does not match a pinned public module'); - return pinned.create(bridge); + const signature = createOrderNotificationFactorySignature(source, String(id)); + const verified = verifiedFactories.find(entry => entry.id === String(id) && entry.signature === signature); + if (!verified) throw new Error('Native notification factory behavior does not match a verified structure'); + return verified.create(bridge); } `; const fixtureSource = `/* Complete native factory sources, unchanged from the public runtime capture. */ -export const nativeOrderNotificationSources = ${JSON.stringify(factories.map(({ id, chunks, source }) => ({ id, chunks, source })), null, 2)}; +export const nativeOrderNotificationSources = ${JSON.stringify(factories.map(({ id, chunks, source, sha256 }) => ({ id, chunks, source, sha256 })), null, 2)}; const nativeFactories = [ -${factories.map(({ id, chunks, source }) => ` { id: ${JSON.stringify(id)}, chunkId: ${JSON.stringify(chunks[0])}, factory: {${source}}[${id}] }`).join(',\n')} +${factories.map(({ id, chunks, source, sha256 }) => ` { sourceSha256: ${JSON.stringify(sha256)}, id: ${JSON.stringify(id)}, chunkId: ${JSON.stringify(chunks[0])}, factory: {${source}}[${id}] }`).join(',\n')} ]; /** Select a captured factory without evaluating source strings. */ -export function createNativeOrderNotificationFactory(id, chunkId) { - const matches = nativeFactories.filter(entry => entry.id === String(id) && (chunkId === undefined || entry.chunkId === String(chunkId))); - if (matches.length !== 1) throw new Error('Native notification fixture needs one exact module and chunk'); +export function createNativeOrderNotificationFactory(id, chunkId, sourceSha256) { + const matches = nativeFactories.filter(entry => entry.id === String(id) && (chunkId === undefined || entry.chunkId === String(chunkId)) + && (sourceSha256 === undefined || entry.sourceSha256 === sourceSha256)); + if (matches.length !== 1) throw new Error('Native notification fixture needs one exact module source'); return matches[0].factory; } `; @@ -231,10 +251,13 @@ const manifest = { capture_date: '2026-10-07', source_snapshot: { file: 'native-factories.json', sha256: sha(snapshot) }, parser: 'acorn@8.18.0', + scope_analyzer: 'eslint-scope@9.1.2', + runtime_matching: 'Lexical binding equivalence; property names, globals, constants, directives and all other behavior remain exact.', + runtime_templates: templates.size, offsets: 'Zero-based UTF-16 offsets; end is exclusive. Factory ranges refer to exact Function.prototype.toString sources.', scope: 'Only native order toast and sound side effects are scoped. Native subscriptions, event emitters, preferences, queue limit, throttles, cooldown, JSX and other factory behavior remain unchanged.', factories: factories.map(record => { - const patch = modified.find(candidate => candidate.id === record.id && candidate.chunks[0] === record.chunks[0]); + const patch = modified.find(candidate => candidate.id === record.id && candidate.sha256 === record.sha256); return { id: record.id, chunks: record.chunks, evidence: record.evidence, bundle: record.bundle, original_sha256: record.sha256, @@ -245,4 +268,4 @@ const manifest = { outputs: { module_sha256: sha(moduleSource), fixture_sha256: sha(fixtureSource) }, }; await writeFile(new URL('notification-manifest.json', fixtureRoot), JSON.stringify(manifest, null, 2) + '\n'); -console.log(JSON.stringify({ pinned_factories: modified.length, native_fixtures: factories.length, inverse_replacement_verified: true, outputs: manifest.outputs })); +console.log(JSON.stringify({ captured_factories: modified.length, runtime_templates: templates.size, native_fixtures: factories.length, inverse_replacement_verified: true, outputs: manifest.outputs })); diff --git a/scripts/test-coverage/source-maps.mjs b/scripts/test-coverage/source-maps.mjs index eab4dd0..f97959b 100644 --- a/scripts/test-coverage/source-maps.mjs +++ b/scripts/test-coverage/source-maps.mjs @@ -6,12 +6,33 @@ import { pathToFileURL } from 'node:url'; import { parse } from 'acorn'; import { decode, encode } from '@jridgewell/sourcemap-codec'; import * as esbuild from 'esbuild'; -import { TARGETS } from '../build-userscript.mjs'; +import { TARGETS, createUserscriptBanner } from '../build-userscript.mjs'; import { ROOT, productionSourceFiles, relativeSourcePath } from './config.mjs'; import { findArtifactSegments } from './split-entries.mjs'; const parserOptions = { ecmaVersion: 'latest', sourceType: 'module' }; +/** A vendor segment must clear the previous mapping, never inherit project coverage. */ +export function retainProjectSourceMappings(map, projectSources) { + const indexes = new Map(); + const sources = []; + const sourcesContent = []; + map.sources.forEach((path, index) => { + if (projectSources.has(path)) { + indexes.set(index, sources.length); + sources.push(path); + sourcesContent.push(map.sourcesContent[index]); + } else { + assert.ok(path.startsWith('node_modules/'), 'Unexpected non-project coverage source: ' + path); + } + }); + const mappings = decode(map.mappings).map(line => line.map(segment => { + if (segment.length === 1 || !indexes.has(segment[1])) return [segment[0]]; + return [segment[0], indexes.get(segment[1]), ...segment.slice(2)]; + })); + return { ...map, sources, sourcesContent, mappings: encode(mappings) }; +} + /** A coverage-only compilation must execute exactly the public artifact's bytes. */ export async function createSourceRegistry() { const sources = new Map(await Promise.all((await productionSourceFiles()).map(async (path) => ( @@ -26,7 +47,7 @@ export async function createSourceRegistry() { const outfile = resolve(ROOT, 'test-results/coverage/maps', name + '.js'); const result = await esbuild.build({ absWorkingDir: ROOT, - banner: { js: metadata }, + banner: { js: await createUserscriptBanner(metadata, target) }, bundle: true, charset: 'utf8', format: 'iife', @@ -42,15 +63,21 @@ export async function createSourceRegistry() { write: false, }); const code = result.outputFiles.find((file) => file.path.endsWith('.js')).text; - const map = JSON.parse(result.outputFiles.find((file) => file.path.endsWith('.map')).text); + let map = JSON.parse(result.outputFiles.find((file) => file.path.endsWith('.map')).text); assert.equal(code, await readFile(resolve(ROOT, target.output), 'utf8'), 'Coverage build differs from the public artifact; rebuild ' + name); - map.sources = map.sources.map((path, index) => { + map.sources = await Promise.all(map.sources.map(async (path, index) => { const normalized = relativeSourcePath(resolve(dirname(outfile), path)); - assert.equal(map.sourcesContent[index], sources.get(normalized), + assert.ok(sources.has(normalized) || normalized.startsWith('node_modules/'), + 'Unexpected coverage source: ' + normalized); + const expected = sources.has(normalized) + ? sources.get(normalized) + : await readFile(resolve(ROOT, normalized), 'utf8'); + assert.equal(map.sourcesContent[index], expected, 'Coverage source content differs from ' + normalized); return normalized; - }); + })); + map = retainProjectSourceMappings(map, sources); const body = parse(code, parserOptions).body; artifacts.push({ path: target.output, code, map, body }); } diff --git a/src/binance-orderbook-trade/index.user.js b/src/binance-orderbook-trade/index.user.js index 222b4de..aa89889 100644 --- a/src/binance-orderbook-trade/index.user.js +++ b/src/binance-orderbook-trade/index.user.js @@ -3,7 +3,7 @@ // @namespace binance.orderbook.trade // @icon data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2214%22%20fill%3D%22%23f0b90b%22%2F%3E%3Ctext%20x%3D%2232%22%20y%3D%2249%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-size%3D%2242%22%20font-weight%3D%22800%22%20fill%3D%22%23111827%22%3EJ%3C%2Ftext%3E%3C%2Fsvg%3E // @icon64 data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2214%22%20fill%3D%22%23f0b90b%22%2F%3E%3Ctext%20x%3D%2232%22%20y%3D%2249%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-size%3D%2242%22%20font-weight%3D%22800%22%20fill%3D%22%23111827%22%3EJ%3C%2Ftext%3E%3C%2Fsvg%3E -// @version 2.7.221 +// @version 2.7.222 // @author jackhai9 // @description 单击订单簿价格,按当前开仓/平仓 tab 自动填数量并执行下单,内置数量倍率面板 // @match https://www.binance.com/*/futures/* diff --git a/src/binance-orderbook-trade/order-notifications/factory-structure.js b/src/binance-orderbook-trade/order-notifications/factory-structure.js new file mode 100644 index 0000000..cae37ae --- /dev/null +++ b/src/binance-orderbook-trade/order-notifications/factory-structure.js @@ -0,0 +1,118 @@ +import { parse } from 'acorn'; +import { analyze } from 'eslint-scope'; + +const MAX_FACTORY_SOURCE_LENGTH = 64 * 1024; +const SUPPORTED_SCOPES = new Set([ + 'global', 'function', 'function-expression-name', 'block', 'for', 'switch', + 'catch', 'class', 'class-field-initializer', 'class-static-block', +]); +const SOURCE_POSITION_FIELDS = new Set(['start', 'end', 'loc', 'range']); + +/** Property names stay observable even when Acorn reuses a shorthand identifier. */ +function isPropertyName(parent, key) { + return parent && !parent.computed && ( + (key === 'key' && ['Property', 'MethodDefinition', 'PropertyDefinition'].includes(parent.type)) + || (key === 'property' && parent.type === 'MemberExpression') + ); +} + +/** + * Canonical identities come from resolved variables, never identifier spelling. + * Declaration positions define local indices because eslint-scope reserves its + * first variable slot for arguments even when a later parameter declares it. + */ +function collectBindingIdentities(scopeManager) { + const identities = new Map(); + scopeManager.scopes.forEach((scope, scopeIndex) => { + if (!SUPPORTED_SCOPES.has(scope.type) || scope.directCallToEvalScope + || (scope.dynamic && scope.type !== 'global')) { + throw new Error(`Unsupported native notification factory dynamic scope: ${scope.type}`); + } + const declaredVariables = scope.variables.filter(variable => variable.defs.length > 0) + .sort((left, right) => left.identifiers[0].range[0] - right.identifiers[0].range[0]); + const declarationIndices = new Map(declaredVariables.map((variable, index) => [variable, index])); + for (const variable of scope.variables) { + let identity; + if (variable.defs.length === 0) { + if (variable.name !== 'arguments' || scope.type !== 'function') { + throw new Error('Unsupported native notification factory implicit binding'); + } + identity = { scope: scopeIndex, implicit: 'arguments' }; + } else { + identity = { scope: scopeIndex, variable: declarationIndices.get(variable) }; + // A var named arguments can reuse the preinitialized arguments object. + if (variable.name === 'arguments' && !variable.defs.every(definition => definition.type === 'Parameter')) { + identity.name = 'arguments'; + } + } + for (const identifier of [...variable.identifiers, ...variable.references.map(reference => reference.identifier)]) { + if (!identities.has(identifier)) identities.set(identifier, []); + const bindings = identities.get(identifier); + // A class declaration can define its outer and inner name at one node. + if (!bindings.includes(identity)) bindings.push(identity); + } + } + }); + return identities; +} + +/** + * Preserve all parsed semantics while discarding source locations and literal + * spelling. Template raw strings remain significant for tagged templates. + */ +function canonicalize(value, bindings, parent, key) { + if (typeof value === 'bigint') return { bigintValue: String(value) }; + if (typeof value === 'number' && !Number.isFinite(value)) return { numericValue: String(value) }; + if (value instanceof RegExp) return { pattern: value.source, flags: value.flags }; + if (value === null || typeof value !== 'object') return value; + if (Array.isArray(value)) return value.map(child => canonicalize(child, bindings, parent, key)); + + // Repackers expand these pure boolean literals even without syntax minification. + if (value.type === 'UnaryExpression' && value.operator === '!' && value.prefix === true + && value.argument.type === 'Literal' && typeof value.argument.value === 'number' + && (value.argument.value === 0 || value.argument.value === 1)) { + return canonicalize({ type: 'Literal', value: value.argument.value === 0 }, bindings, parent, key); + } + + const result = {}; + const isNode = typeof value.type === 'string'; + for (const field of Object.keys(value).sort()) { + if (isNode && (SOURCE_POSITION_FIELDS.has(field) || (value.type === 'Literal' && field === 'raw'))) continue; + if (value.type === 'Identifier' && field === 'name' && bindings.has(value) && !isPropertyName(parent, key)) { + result.binding = bindings.get(value); + } else { + result[field] = canonicalize(value[field], bindings, value, field); + } + } + return result; +} + +/** + * Recognize a complete pinned webpack factory under formatting and lexical + * alpha-renaming only. Parsing never executes host source; changed globals, + * properties, literals, control flow and binding relationships remain distinct. + * This is deliberately not a proof of arbitrary JavaScript semantic equivalence. + */ +export function createOrderNotificationFactorySignature(source, moduleId) { + if (typeof source !== 'string') throw new TypeError('Native notification factory source must be a string'); + if (source.length > MAX_FACTORY_SOURCE_LENGTH) throw new Error('Native notification factory source exceeds 64 KiB'); + if (typeof moduleId !== 'string' && typeof moduleId !== 'number') { + throw new TypeError('Native notification module ID must be a string or number'); + } + const ast = parse(`({${source}})`, { ecmaVersion: 2022, sourceType: 'script', ranges: true }); + if (ast.body.length !== 1 || ast.body[0].type !== 'ExpressionStatement' + || ast.body[0].expression.type !== 'ObjectExpression' || ast.body[0].expression.properties.length !== 1) { + throw new Error('Native notification source must contain one module factory'); + } + const factory = ast.body[0].expression.properties[0]; + if (factory.type !== 'Property' || factory.computed || !factory.method + || factory.kind !== 'init' || factory.value.type !== 'FunctionExpression' || factory.key.type !== 'Literal') { + throw new Error('Native notification source must contain one ordinary module factory'); + } + if (String(factory.key.value) !== String(moduleId)) throw new Error('Native notification factory module ID does not match'); + + const scopeManager = analyze(ast, { + ecmaVersion: 2022, sourceType: 'script', optimistic: false, ignoreEval: false, fallback: null, + }); + return JSON.stringify(canonicalize(factory, collectBindingIdentities(scopeManager), null, null)); +} diff --git a/src/binance-orderbook-trade/order-notifications/native-modules.js b/src/binance-orderbook-trade/order-notifications/native-modules.js index 8a31ebd..83bc113 100644 --- a/src/binance-orderbook-trade/order-notifications/native-modules.js +++ b/src/binance-orderbook-trade/order-notifications/native-modules.js @@ -1,52 +1,30 @@ /* Generated by scripts/generate-order-notification-modules.mjs; see notification-manifest.json. */ -const pinnedFactories = [ +import { createOrderNotificationFactorySignature } from './factory-structure.js'; + +const verifiedFactories = [ { id: "39116", - original: "39116(D,l,t){\"use strict\";t.d(l,{QZ:()=>p.Q,$$:()=>n,E$:()=>S});var e=t(41594),a=2e3,r=2,n=function(){var E=(0,e.useRef)(null),A=function(O){E.current=setTimeout(function(){O(),E.current&&clearTimeout(E.current),E.current=null},a)};return(0,e.useMemo)(function(){return{interval:E,intervalFunc:A}},[])},i=t(75510),s=t(16921),c=t(72363),d=t(79515),y=t(40477),p=t(70020),T=function(E,A){var O=(0,d.nH)(),m=(0,d.Py)().isExistFutureAccount,g=(0,y.A)(A,500),u=g.run,o=(0,d.ON)().isPM2,f=(0,s.Gw)();(0,e.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!0});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(P){(P.status===\"FILLED\"||P.status===\"PARTIALLY_FILLED\"||P.status===\"EXPIRED\")&&u(String(P.orderId))})})},[u,E,m,O,o,f]),(0,e.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!1});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(P){(P.status===\"FILLED\"||P.status===\"PARTIALLY_FILLED\"||P.status===\"EXPIRED\")&&u(String(P.orderId))})})},[u,E,m,O,o,f])},S=function(){var E=(0,e.useState)(new Date),A=E[0],O=E[1],m=(0,e.useRef)([]),g=(0,p.Q)(),u=g.showNotification,o=g.enableNotification,f=(0,e.useCallback)(function(){var v;(v=m)===null||v===void 0||v.current.shift(),O(new Date)},[]),_=(0,e.useCallback)(function(v){var L;if(u&&((L=m)===null||L===void 0?void 0:L.current.length)p.Q,$$:()=>n,E$:()=>S});var e=t(41594),a=2e3,r=2,n=function(){var E=(0,e.useRef)(null),A=function(O){E.current=setTimeout(function(){O(),E.current&&clearTimeout(E.current),E.current=null},a)};return(0,e.useMemo)(function(){return{interval:E,intervalFunc:A}},[])},i=t(75510),s=t(16921),c=t(72363),d=t(79515),y=t(40477),p=t(70020),T=function(E,A){var O=(0,d.nH)(),m=(0,d.Py)().isExistFutureAccount,g=(0,y.A)(function(__event){if(__notify.allowSoundInput(__event))return Reflect.apply(A,this,[__event])},500),u=g.run,o=(0,d.ON)().isPM2,f=(0,s.Gw)();(0,e.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!0});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(P){(P.status==="FILLED"||P.status==="PARTIALLY_FILLED"||P.status==="EXPIRED")&&((!__notify.soundReady()||__notify.allowOrder(P))&&u(__notify.soundInput(P)))})})},[u,E,m,O,o,f]),(0,e.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!1});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(P){(P.status==="FILLED"||P.status==="PARTIALLY_FILLED"||P.status==="EXPIRED")&&((!__notify.soundReady()||__notify.allowOrder(P))&&u(__notify.soundInput(P)))})})},[u,E,m,O,o,f])},S=function(){var E=(0,e.useState)(new Date),A=E[0],O=E[1],m=(0,e.useRef)([]),g=(0,p.Q)(),u=g.showNotification,o=g.enableNotification,f=(0,e.useCallback)(function(){var v;(v=m)===null||v===void 0||v.current.shift(),O(new Date)},[]),_=(0,e.useCallback)(function(v){var L;if(u&&((L=m)===null||L===void 0?void 0:L.current.length)N,z:()=>o});var r=e(41594),a=e.n(r),T=e(61523),p=e(92873),P=e(64041),b=e(17409),S=e(51471),E=e(40477),$=\"trd-openOrder\",G=function(c){return(0,p.o)($,c)},o=function(){var c=(0,S.zr)(\"open_order_status_toast\",!0),h=c.data,R=c.setData,K=c.hasInitialized,x=(0,r.useCallback)(function(){R(!h)},[h,R]);return{enableToast:K?h:!1,toggleToast:x}},N=function(){var c=G().getI18n,h=(0,P.h)().enqueueNotification,R=o().enableToast,K=(0,E.A)(h,30),x=K.run,i=(0,T.d4)(function(l){return l.setting.layout}),d=(0,r.useMemo)(function(){return i===b.a0},[i]),A=(0,r.useCallback)(function(l){var D=l.side.toUpperCase(),Y=l.type.replace(/[-_]/g,\"\");return\"\".concat(D).concat(Y)},[]),g=(0,r.useCallback)(function(l){if(!(l.type===\"LIQUIDATION\"||!R)){var D=A(l),Y=c(\"\".concat(D,\"CancelTitle\"),{defaultValue:\"\".concat(l.type,\" \").concat(l.side,\" Order Canceled\")});x(Y)}},[A,c,x,R]),C=(0,r.useCallback)(function(l){if(!(l.type===\"LIQUIDATION\"||!R)){var D=A(l),Y=c(\"\".concat(D,\"FillTitle\"),{defaultValue:\"\".concat(l.type,\" \").concat(l.side,\" Order Filled\")});x(Y,{variant:\"success\"})}},[A,c,x,R]),I=(0,r.useCallback)(function(l){if(!(l.type===\"LIQUIDATION\"||!R)){var D=A(l),Y=c(\"\".concat(D,\"PFTitle\"),{defaultValue:\"\".concat(l.type,\" \").concat(l.side,\" Order Partially Filled\")});x(Y,{variant:\"success\"})}},[A,c,x,R]);return(0,r.useMemo)(function(){return{cancelOrderNotify:g,fillOrderNotify:C,fillOrderPartNotify:I}},[g,C,I])}}", + signature: "{\"computed\":false,\"key\":{\"type\":\"Literal\",\"value\":30877},\"kind\":\"init\",\"method\":true,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"async\":false,\"body\":{\"body\":[{\"expression\":{\"arguments\":[{\"binding\":[{\"scope\":1,\"variable\":1}],\"type\":\"Identifier\"},{\"properties\":[{\"computed\":false,\"key\":{\"name\":\"F\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"async\":false,\"body\":{\"binding\":[{\"scope\":1,\"variable\":14}],\"type\":\"Identifier\"},\"expression\":true,\"generator\":false,\"id\":null,\"params\":[],\"type\":\"ArrowFunctionExpression\"}},{\"computed\":false,\"key\":{\"name\":\"z\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"async\":false,\"body\":{\"binding\":[{\"scope\":1,\"variable\":13}],\"type\":\"Identifier\"},\"expression\":true,\"generator\":false,\"id\":null,\"params\":[],\"type\":\"ArrowFunctionExpression\"}}],\"type\":\"ObjectExpression\"}],\"callee\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"d\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"ExpressionStatement\"},{\"declarations\":[{\"id\":{\"binding\":[{\"scope\":1,\"variable\":3}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"type\":\"Literal\",\"value\":41594}],\"callee\":{\"binding\":[{\"scope\":1,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":1,\"variable\":4}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"binding\":[{\"scope\":1,\"variable\":3}],\"type\":\"Identifier\"}],\"callee\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"n\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":1,\"variable\":5}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"type\":\"Literal\",\"value\":61523}],\"callee\":{\"binding\":[{\"scope\":1,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":1,\"variable\":6}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"type\":\"Literal\",\"value\":92873}],\"callee\":{\"binding\":[{\"scope\":1,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":1,\"variable\":7}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"type\":\"Literal\",\"value\":64041}],\"callee\":{\"binding\":[{\"scope\":1,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":1,\"variable\":8}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"type\":\"Literal\",\"value\":17409}],\"callee\":{\"binding\":[{\"scope\":1,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":1,\"variable\":9}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"type\":\"Literal\",\"value\":51471}],\"callee\":{\"binding\":[{\"scope\":1,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":1,\"variable\":10}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"type\":\"Literal\",\"value\":40477}],\"callee\":{\"binding\":[{\"scope\":1,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":1,\"variable\":11}],\"type\":\"Identifier\"},\"init\":{\"type\":\"Literal\",\"value\":\"trd-openOrder\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":1,\"variable\":12}],\"type\":\"Identifier\"},\"init\":{\"async\":false,\"body\":{\"body\":[{\"argument\":{\"arguments\":[{\"binding\":[{\"scope\":1,\"variable\":11}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":4,\"variable\":0}],\"type\":\"Identifier\"}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":6}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"o\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"ReturnStatement\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[{\"binding\":[{\"scope\":4,\"variable\":0}],\"type\":\"Identifier\"}],\"type\":\"FunctionExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":1,\"variable\":13}],\"type\":\"Identifier\"},\"init\":{\"async\":false,\"body\":{\"body\":[{\"declarations\":[{\"id\":{\"binding\":[{\"scope\":5,\"variable\":0}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"type\":\"Literal\",\"value\":\"open_order_status_toast\"},{\"type\":\"Literal\",\"value\":true}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":9}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"zr\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":5,\"variable\":1}],\"type\":\"Identifier\"},\"init\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":5,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"data\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":5,\"variable\":2}],\"type\":\"Identifier\"},\"init\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":5,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"setData\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":5,\"variable\":3}],\"type\":\"Identifier\"},\"init\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":5,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"hasInitialized\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":5,\"variable\":4}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"async\":false,\"body\":{\"body\":[{\"expression\":{\"arguments\":[{\"argument\":{\"binding\":[{\"scope\":5,\"variable\":1}],\"type\":\"Identifier\"},\"operator\":\"!\",\"prefix\":true,\"type\":\"UnaryExpression\"}],\"callee\":{\"binding\":[{\"scope\":5,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"ExpressionStatement\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[],\"type\":\"FunctionExpression\"},{\"elements\":[{\"binding\":[{\"scope\":5,\"variable\":1}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":5,\"variable\":2}],\"type\":\"Identifier\"}],\"type\":\"ArrayExpression\"}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":3}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"useCallback\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"}],\"kind\":\"var\",\"type\":\"VariableDeclaration\"},{\"argument\":{\"properties\":[{\"computed\":false,\"key\":{\"name\":\"enableToast\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"alternate\":{\"type\":\"Literal\",\"value\":false},\"consequent\":{\"binding\":[{\"scope\":5,\"variable\":1}],\"type\":\"Identifier\"},\"test\":{\"binding\":[{\"scope\":5,\"variable\":3}],\"type\":\"Identifier\"},\"type\":\"ConditionalExpression\"}},{\"computed\":false,\"key\":{\"name\":\"toggleToast\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"binding\":[{\"scope\":5,\"variable\":4}],\"type\":\"Identifier\"}}],\"type\":\"ObjectExpression\"},\"type\":\"ReturnStatement\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[],\"type\":\"FunctionExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":1,\"variable\":14}],\"type\":\"Identifier\"},\"init\":{\"async\":false,\"body\":{\"body\":[{\"declarations\":[{\"id\":{\"binding\":[{\"scope\":7,\"variable\":0}],\"type\":\"Identifier\"},\"init\":{\"computed\":false,\"object\":{\"arguments\":[],\"callee\":{\"binding\":[{\"scope\":1,\"variable\":12}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"optional\":false,\"property\":{\"name\":\"getI18n\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":7,\"variable\":1}],\"type\":\"Identifier\"},\"init\":{\"computed\":false,\"object\":{\"arguments\":[],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":7}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"h\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"optional\":false,\"property\":{\"name\":\"enqueueNotification\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":7,\"variable\":2}],\"type\":\"Identifier\"},\"init\":{\"computed\":false,\"object\":{\"arguments\":[],\"callee\":{\"binding\":[{\"scope\":1,\"variable\":13}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"optional\":false,\"property\":{\"name\":\"enableToast\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":7,\"variable\":3}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"binding\":[{\"scope\":7,\"variable\":1}],\"type\":\"Identifier\"},{\"type\":\"Literal\",\"value\":30}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":10}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"A\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":7,\"variable\":4}],\"type\":\"Identifier\"},\"init\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":7,\"variable\":3}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"run\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":7,\"variable\":5}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"async\":false,\"body\":{\"body\":[{\"argument\":{\"computed\":false,\"object\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":8,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"setting\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"property\":{\"name\":\"layout\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"type\":\"ReturnStatement\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[{\"binding\":[{\"scope\":8,\"variable\":0}],\"type\":\"Identifier\"}],\"type\":\"FunctionExpression\"}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":5}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"d4\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":7,\"variable\":6}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"async\":false,\"body\":{\"body\":[{\"argument\":{\"left\":{\"binding\":[{\"scope\":7,\"variable\":5}],\"type\":\"Identifier\"},\"operator\":\"===\",\"right\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":8}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"a0\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"type\":\"BinaryExpression\"},\"type\":\"ReturnStatement\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[],\"type\":\"FunctionExpression\"},{\"elements\":[{\"binding\":[{\"scope\":7,\"variable\":5}],\"type\":\"Identifier\"}],\"type\":\"ArrayExpression\"}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":3}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"useMemo\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":7,\"variable\":7}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"async\":false,\"body\":{\"body\":[{\"declarations\":[{\"id\":{\"binding\":[{\"scope\":10,\"variable\":1}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[],\"callee\":{\"computed\":false,\"object\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":10,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"side\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"property\":{\"name\":\"toUpperCase\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":10,\"variable\":2}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"regex\":{\"flags\":\"g\",\"pattern\":\"[-_]\"},\"type\":\"Literal\",\"value\":{\"pattern\":\"[-_]\",\"flags\":\"g\"}},{\"type\":\"Literal\",\"value\":\"\"}],\"callee\":{\"computed\":false,\"object\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":10,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"type\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"property\":{\"name\":\"replace\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"}],\"kind\":\"var\",\"type\":\"VariableDeclaration\"},{\"argument\":{\"arguments\":[{\"binding\":[{\"scope\":10,\"variable\":2}],\"type\":\"Identifier\"}],\"callee\":{\"computed\":false,\"object\":{\"arguments\":[{\"binding\":[{\"scope\":10,\"variable\":1}],\"type\":\"Identifier\"}],\"callee\":{\"computed\":false,\"object\":{\"type\":\"Literal\",\"value\":\"\"},\"optional\":false,\"property\":{\"name\":\"concat\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"optional\":false,\"property\":{\"name\":\"concat\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"ReturnStatement\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[{\"binding\":[{\"scope\":10,\"variable\":0}],\"type\":\"Identifier\"}],\"type\":\"FunctionExpression\"},{\"elements\":[],\"type\":\"ArrayExpression\"}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":3}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"useCallback\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":7,\"variable\":8}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"async\":false,\"body\":{\"body\":[{\"alternate\":null,\"consequent\":{\"body\":[{\"declarations\":[{\"id\":{\"binding\":[{\"scope\":11,\"variable\":1}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"binding\":[{\"scope\":11,\"variable\":0}],\"type\":\"Identifier\"}],\"callee\":{\"binding\":[{\"scope\":7,\"variable\":7}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":11,\"variable\":2}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"arguments\":[{\"binding\":[{\"scope\":11,\"variable\":1}],\"type\":\"Identifier\"},{\"type\":\"Literal\",\"value\":\"CancelTitle\"}],\"callee\":{\"computed\":false,\"object\":{\"type\":\"Literal\",\"value\":\"\"},\"optional\":false,\"property\":{\"name\":\"concat\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},{\"properties\":[{\"computed\":false,\"key\":{\"name\":\"defaultValue\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"arguments\":[{\"computed\":false,\"object\":{\"binding\":[{\"scope\":11,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"side\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},{\"type\":\"Literal\",\"value\":\" Order Canceled\"}],\"callee\":{\"computed\":false,\"object\":{\"arguments\":[{\"computed\":false,\"object\":{\"binding\":[{\"scope\":11,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"type\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},{\"type\":\"Literal\",\"value\":\" \"}],\"callee\":{\"computed\":false,\"object\":{\"type\":\"Literal\",\"value\":\"\"},\"optional\":false,\"property\":{\"name\":\"concat\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"optional\":false,\"property\":{\"name\":\"concat\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"}}],\"type\":\"ObjectExpression\"}],\"callee\":{\"binding\":[{\"scope\":7,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"}],\"kind\":\"var\",\"type\":\"VariableDeclaration\"},{\"expression\":{\"arguments\":[{\"binding\":[{\"scope\":11,\"variable\":2}],\"type\":\"Identifier\"}],\"callee\":{\"binding\":[{\"scope\":7,\"variable\":4}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"ExpressionStatement\"}],\"type\":\"BlockStatement\"},\"test\":{\"argument\":{\"left\":{\"left\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":11,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"type\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"operator\":\"===\",\"right\":{\"type\":\"Literal\",\"value\":\"LIQUIDATION\"},\"type\":\"BinaryExpression\"},\"operator\":\"||\",\"right\":{\"argument\":{\"binding\":[{\"scope\":7,\"variable\":2}],\"type\":\"Identifier\"},\"operator\":\"!\",\"prefix\":true,\"type\":\"UnaryExpression\"},\"type\":\"LogicalExpression\"},\"operator\":\"!\",\"prefix\":true,\"type\":\"UnaryExpression\"},\"type\":\"IfStatement\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[{\"binding\":[{\"scope\":11,\"variable\":0}],\"type\":\"Identifier\"}],\"type\":\"FunctionExpression\"},{\"elements\":[{\"binding\":[{\"scope\":7,\"variable\":7}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":7,\"variable\":0}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":7,\"variable\":4}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":7,\"variable\":2}],\"type\":\"Identifier\"}],\"type\":\"ArrayExpression\"}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":3}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"useCallback\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":7,\"variable\":9}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"async\":false,\"body\":{\"body\":[{\"alternate\":null,\"consequent\":{\"body\":[{\"declarations\":[{\"id\":{\"binding\":[{\"scope\":13,\"variable\":1}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"binding\":[{\"scope\":13,\"variable\":0}],\"type\":\"Identifier\"}],\"callee\":{\"binding\":[{\"scope\":7,\"variable\":7}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":13,\"variable\":2}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"arguments\":[{\"binding\":[{\"scope\":13,\"variable\":1}],\"type\":\"Identifier\"},{\"type\":\"Literal\",\"value\":\"FillTitle\"}],\"callee\":{\"computed\":false,\"object\":{\"type\":\"Literal\",\"value\":\"\"},\"optional\":false,\"property\":{\"name\":\"concat\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},{\"properties\":[{\"computed\":false,\"key\":{\"name\":\"defaultValue\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"arguments\":[{\"computed\":false,\"object\":{\"binding\":[{\"scope\":13,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"side\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},{\"type\":\"Literal\",\"value\":\" Order Filled\"}],\"callee\":{\"computed\":false,\"object\":{\"arguments\":[{\"computed\":false,\"object\":{\"binding\":[{\"scope\":13,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"type\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},{\"type\":\"Literal\",\"value\":\" \"}],\"callee\":{\"computed\":false,\"object\":{\"type\":\"Literal\",\"value\":\"\"},\"optional\":false,\"property\":{\"name\":\"concat\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"optional\":false,\"property\":{\"name\":\"concat\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"}}],\"type\":\"ObjectExpression\"}],\"callee\":{\"binding\":[{\"scope\":7,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"}],\"kind\":\"var\",\"type\":\"VariableDeclaration\"},{\"expression\":{\"arguments\":[{\"binding\":[{\"scope\":13,\"variable\":2}],\"type\":\"Identifier\"},{\"properties\":[{\"computed\":false,\"key\":{\"name\":\"variant\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"type\":\"Literal\",\"value\":\"success\"}}],\"type\":\"ObjectExpression\"}],\"callee\":{\"binding\":[{\"scope\":7,\"variable\":4}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"ExpressionStatement\"}],\"type\":\"BlockStatement\"},\"test\":{\"argument\":{\"left\":{\"left\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":13,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"type\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"operator\":\"===\",\"right\":{\"type\":\"Literal\",\"value\":\"LIQUIDATION\"},\"type\":\"BinaryExpression\"},\"operator\":\"||\",\"right\":{\"argument\":{\"binding\":[{\"scope\":7,\"variable\":2}],\"type\":\"Identifier\"},\"operator\":\"!\",\"prefix\":true,\"type\":\"UnaryExpression\"},\"type\":\"LogicalExpression\"},\"operator\":\"!\",\"prefix\":true,\"type\":\"UnaryExpression\"},\"type\":\"IfStatement\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[{\"binding\":[{\"scope\":13,\"variable\":0}],\"type\":\"Identifier\"}],\"type\":\"FunctionExpression\"},{\"elements\":[{\"binding\":[{\"scope\":7,\"variable\":7}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":7,\"variable\":0}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":7,\"variable\":4}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":7,\"variable\":2}],\"type\":\"Identifier\"}],\"type\":\"ArrayExpression\"}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":3}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"useCallback\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":7,\"variable\":10}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"async\":false,\"body\":{\"body\":[{\"alternate\":null,\"consequent\":{\"body\":[{\"declarations\":[{\"id\":{\"binding\":[{\"scope\":15,\"variable\":1}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"binding\":[{\"scope\":15,\"variable\":0}],\"type\":\"Identifier\"}],\"callee\":{\"binding\":[{\"scope\":7,\"variable\":7}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":15,\"variable\":2}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"arguments\":[{\"binding\":[{\"scope\":15,\"variable\":1}],\"type\":\"Identifier\"},{\"type\":\"Literal\",\"value\":\"PFTitle\"}],\"callee\":{\"computed\":false,\"object\":{\"type\":\"Literal\",\"value\":\"\"},\"optional\":false,\"property\":{\"name\":\"concat\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},{\"properties\":[{\"computed\":false,\"key\":{\"name\":\"defaultValue\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"arguments\":[{\"computed\":false,\"object\":{\"binding\":[{\"scope\":15,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"side\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},{\"type\":\"Literal\",\"value\":\" Order Partially Filled\"}],\"callee\":{\"computed\":false,\"object\":{\"arguments\":[{\"computed\":false,\"object\":{\"binding\":[{\"scope\":15,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"type\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},{\"type\":\"Literal\",\"value\":\" \"}],\"callee\":{\"computed\":false,\"object\":{\"type\":\"Literal\",\"value\":\"\"},\"optional\":false,\"property\":{\"name\":\"concat\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"optional\":false,\"property\":{\"name\":\"concat\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"}}],\"type\":\"ObjectExpression\"}],\"callee\":{\"binding\":[{\"scope\":7,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"}],\"kind\":\"var\",\"type\":\"VariableDeclaration\"},{\"expression\":{\"arguments\":[{\"binding\":[{\"scope\":15,\"variable\":2}],\"type\":\"Identifier\"},{\"properties\":[{\"computed\":false,\"key\":{\"name\":\"variant\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"type\":\"Literal\",\"value\":\"success\"}}],\"type\":\"ObjectExpression\"}],\"callee\":{\"binding\":[{\"scope\":7,\"variable\":4}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"ExpressionStatement\"}],\"type\":\"BlockStatement\"},\"test\":{\"argument\":{\"left\":{\"left\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":15,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"type\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"operator\":\"===\",\"right\":{\"type\":\"Literal\",\"value\":\"LIQUIDATION\"},\"type\":\"BinaryExpression\"},\"operator\":\"||\",\"right\":{\"argument\":{\"binding\":[{\"scope\":7,\"variable\":2}],\"type\":\"Identifier\"},\"operator\":\"!\",\"prefix\":true,\"type\":\"UnaryExpression\"},\"type\":\"LogicalExpression\"},\"operator\":\"!\",\"prefix\":true,\"type\":\"UnaryExpression\"},\"type\":\"IfStatement\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[{\"binding\":[{\"scope\":15,\"variable\":0}],\"type\":\"Identifier\"}],\"type\":\"FunctionExpression\"},{\"elements\":[{\"binding\":[{\"scope\":7,\"variable\":7}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":7,\"variable\":0}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":7,\"variable\":4}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":7,\"variable\":2}],\"type\":\"Identifier\"}],\"type\":\"ArrayExpression\"}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":3}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"useCallback\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"}],\"kind\":\"var\",\"type\":\"VariableDeclaration\"},{\"argument\":{\"arguments\":[{\"async\":false,\"body\":{\"body\":[{\"argument\":{\"properties\":[{\"computed\":false,\"key\":{\"name\":\"cancelOrderNotify\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"binding\":[{\"scope\":7,\"variable\":8}],\"type\":\"Identifier\"}},{\"computed\":false,\"key\":{\"name\":\"fillOrderNotify\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"binding\":[{\"scope\":7,\"variable\":9}],\"type\":\"Identifier\"}},{\"computed\":false,\"key\":{\"name\":\"fillOrderPartNotify\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"binding\":[{\"scope\":7,\"variable\":10}],\"type\":\"Identifier\"}}],\"type\":\"ObjectExpression\"},\"type\":\"ReturnStatement\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[],\"type\":\"FunctionExpression\"},{\"elements\":[{\"binding\":[{\"scope\":7,\"variable\":8}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":7,\"variable\":9}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":7,\"variable\":10}],\"type\":\"Identifier\"}],\"type\":\"ArrayExpression\"}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":3}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"useMemo\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"ReturnStatement\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[],\"type\":\"FunctionExpression\"},\"type\":\"VariableDeclarator\"}],\"kind\":\"var\",\"type\":\"VariableDeclaration\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[{\"binding\":[{\"scope\":1,\"variable\":0}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":1,\"variable\":1}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":1,\"variable\":2}],\"type\":\"Identifier\"}],\"type\":\"FunctionExpression\"}}", create(__notify) { return {30877(be,W,e){e.d(W,{F:()=>N,z:()=>o});var r=e(41594),a=e.n(r),T=e(61523),p=e(92873),P=e(64041),b=e(17409),S=e(51471),E=e(40477),$="trd-openOrder",G=function(c){return(0,p.o)($,c)},o=function(){var c=(0,S.zr)("open_order_status_toast",!0),h=c.data,R=c.setData,K=c.hasInitialized,x=(0,r.useCallback)(function(){R(!h)},[h,R]);return{enableToast:K?h:!1,toggleToast:x}},N=function(){var c=G().getI18n,h=(0,P.h)().enqueueNotification,R=o().enableToast,K=(0,E.A)(function(__token,...__args){if(__notify.allowToken(__token))return Reflect.apply(h,this,__args)},30),x=K.run,i=(0,T.d4)(function(l){return l.setting.layout}),d=(0,r.useMemo)(function(){return i===b.a0},[i]),A=(0,r.useCallback)(function(l){var D=l.side.toUpperCase(),Y=l.type.replace(/[-_]/g,"");return"".concat(D).concat(Y)},[]),g=(0,r.useCallback)(function(l){if(!__notify.allowOrder(l))return;if(!(l.type==="LIQUIDATION"||!R)){var D=A(l),Y=c("".concat(D,"CancelTitle"),{defaultValue:"".concat(l.type," ").concat(l.side," Order Canceled")});x(__notify.token(l),Y)}},[A,c,x,R]),C=(0,r.useCallback)(function(l){if(!__notify.allowOrder(l))return;if(!(l.type==="LIQUIDATION"||!R)){var D=A(l),Y=c("".concat(D,"FillTitle"),{defaultValue:"".concat(l.type," ").concat(l.side," Order Filled")});x(__notify.token(l),Y,{variant:"success"})}},[A,c,x,R]),I=(0,r.useCallback)(function(l){if(!__notify.allowOrder(l))return;if(!(l.type==="LIQUIDATION"||!R)){var D=A(l),Y=c("".concat(D,"PFTitle"),{defaultValue:"".concat(l.type," ").concat(l.side," Order Partially Filled")});x(__notify.token(l),Y,{variant:"success"})}},[A,c,x,R]);return(0,r.useMemo)(function(){return{cancelOrderNotify:g,fillOrderNotify:C,fillOrderPartNotify:I}},[g,C,I])}}}[30877]; }, }, - { - id: "30877", - original: "30877(V,b,e){e.d(b,{F:()=>m,z:()=>I});var r=e(41594),A=e.n(r),s=e(61523),f=e(92873),v=e(64041),o=e(17409),l=e(51471),P=e(40477),k=\"trd-openOrder\",y=function(g){return(0,f.o)(k,g)},I=function(){var g=(0,l.zr)(\"open_order_status_toast\",!0),_=g.data,F=g.setData,R=g.hasInitialized,L=(0,r.useCallback)(function(){F(!_)},[_,F]);return{enableToast:R?_:!1,toggleToast:L}},m=function(){var g=y().getI18n,_=(0,v.h)().enqueueNotification,F=I().enableToast,R=(0,P.A)(_,30),L=R.run,a=(0,s.d4)(function(i){return i.setting.layout}),M=(0,r.useMemo)(function(){return a===o.a0},[a]),C=(0,r.useCallback)(function(i){var S=i.side.toUpperCase(),T=i.type.replace(/[-_]/g,\"\");return\"\".concat(S).concat(T)},[]),c=(0,r.useCallback)(function(i){if(!(i.type===\"LIQUIDATION\"||!F)){var S=C(i),T=g(\"\".concat(S,\"CancelTitle\"),{defaultValue:\"\".concat(i.type,\" \").concat(i.side,\" Order Canceled\")});L(T)}},[C,g,L,F]),u=(0,r.useCallback)(function(i){if(!(i.type===\"LIQUIDATION\"||!F)){var S=C(i),T=g(\"\".concat(S,\"FillTitle\"),{defaultValue:\"\".concat(i.type,\" \").concat(i.side,\" Order Filled\")});L(T,{variant:\"success\"})}},[C,g,L,F]),h=(0,r.useCallback)(function(i){if(!(i.type===\"LIQUIDATION\"||!F)){var S=C(i),T=g(\"\".concat(S,\"PFTitle\"),{defaultValue:\"\".concat(i.type,\" \").concat(i.side,\" Order Partially Filled\")});L(T,{variant:\"success\"})}},[C,g,L,F]);return(0,r.useMemo)(function(){return{cancelOrderNotify:c,fillOrderNotify:u,fillOrderPartNotify:h}},[c,u,h])}}", - create(__notify) { return {30877(V,b,e){e.d(b,{F:()=>m,z:()=>I});var r=e(41594),A=e.n(r),s=e(61523),f=e(92873),v=e(64041),o=e(17409),l=e(51471),P=e(40477),k="trd-openOrder",y=function(g){return(0,f.o)(k,g)},I=function(){var g=(0,l.zr)("open_order_status_toast",!0),_=g.data,F=g.setData,R=g.hasInitialized,L=(0,r.useCallback)(function(){F(!_)},[_,F]);return{enableToast:R?_:!1,toggleToast:L}},m=function(){var g=y().getI18n,_=(0,v.h)().enqueueNotification,F=I().enableToast,R=(0,P.A)(function(__token,...__args){if(__notify.allowToken(__token))return Reflect.apply(_,this,__args)},30),L=R.run,a=(0,s.d4)(function(i){return i.setting.layout}),M=(0,r.useMemo)(function(){return a===o.a0},[a]),C=(0,r.useCallback)(function(i){var S=i.side.toUpperCase(),T=i.type.replace(/[-_]/g,"");return"".concat(S).concat(T)},[]),c=(0,r.useCallback)(function(i){if(!__notify.allowOrder(i))return;if(!(i.type==="LIQUIDATION"||!F)){var S=C(i),T=g("".concat(S,"CancelTitle"),{defaultValue:"".concat(i.type," ").concat(i.side," Order Canceled")});L(__notify.token(i),T)}},[C,g,L,F]),u=(0,r.useCallback)(function(i){if(!__notify.allowOrder(i))return;if(!(i.type==="LIQUIDATION"||!F)){var S=C(i),T=g("".concat(S,"FillTitle"),{defaultValue:"".concat(i.type," ").concat(i.side," Order Filled")});L(__notify.token(i),T,{variant:"success"})}},[C,g,L,F]),h=(0,r.useCallback)(function(i){if(!__notify.allowOrder(i))return;if(!(i.type==="LIQUIDATION"||!F)){var S=C(i),T=g("".concat(S,"PFTitle"),{defaultValue:"".concat(i.type," ").concat(i.side," Order Partially Filled")});L(__notify.token(i),T,{variant:"success"})}},[C,g,L,F]);return(0,r.useMemo)(function(){return{cancelOrderNotify:c,fillOrderNotify:u,fillOrderPartNotify:h}},[c,u,h])}}}[30877]; }, - }, - { - id: "30877", - original: "30877(K,T,e){e.d(T,{F:()=>i,z:()=>E});var t=e(41594),r=e.n(t),n=e(61523),s=e(92873),g=e(64041),c=e(17409),h=e(51471),p=e(40477),b=\"trd-openOrder\",S=function(y){return(0,s.o)(b,y)},E=function(){var y=(0,h.zr)(\"open_order_status_toast\",!0),C=y.data,f=y.setData,I=y.hasInitialized,d=(0,t.useCallback)(function(){f(!C)},[C,f]);return{enableToast:I?C:!1,toggleToast:d}},i=function(){var y=S().getI18n,C=(0,g.h)().enqueueNotification,f=E().enableToast,I=(0,p.A)(C,30),d=I.run,P=(0,n.d4)(function(a){return a.setting.layout}),M=(0,t.useMemo)(function(){return P===c.a0},[P]),k=(0,t.useCallback)(function(a){var o=a.side.toUpperCase(),u=a.type.replace(/[-_]/g,\"\");return\"\".concat(o).concat(u)},[]),A=(0,t.useCallback)(function(a){if(!(a.type===\"LIQUIDATION\"||!f)){var o=k(a),u=y(\"\".concat(o,\"CancelTitle\"),{defaultValue:\"\".concat(a.type,\" \").concat(a.side,\" Order Canceled\")});d(u)}},[k,y,d,f]),O=(0,t.useCallback)(function(a){if(!(a.type===\"LIQUIDATION\"||!f)){var o=k(a),u=y(\"\".concat(o,\"FillTitle\"),{defaultValue:\"\".concat(a.type,\" \").concat(a.side,\" Order Filled\")});d(u,{variant:\"success\"})}},[k,y,d,f]),x=(0,t.useCallback)(function(a){if(!(a.type===\"LIQUIDATION\"||!f)){var o=k(a),u=y(\"\".concat(o,\"PFTitle\"),{defaultValue:\"\".concat(a.type,\" \").concat(a.side,\" Order Partially Filled\")});d(u,{variant:\"success\"})}},[k,y,d,f]);return(0,t.useMemo)(function(){return{cancelOrderNotify:A,fillOrderNotify:O,fillOrderPartNotify:x}},[A,O,x])}}", - create(__notify) { return {30877(K,T,e){e.d(T,{F:()=>i,z:()=>E});var t=e(41594),r=e.n(t),n=e(61523),s=e(92873),g=e(64041),c=e(17409),h=e(51471),p=e(40477),b="trd-openOrder",S=function(y){return(0,s.o)(b,y)},E=function(){var y=(0,h.zr)("open_order_status_toast",!0),C=y.data,f=y.setData,I=y.hasInitialized,d=(0,t.useCallback)(function(){f(!C)},[C,f]);return{enableToast:I?C:!1,toggleToast:d}},i=function(){var y=S().getI18n,C=(0,g.h)().enqueueNotification,f=E().enableToast,I=(0,p.A)(function(__token,...__args){if(__notify.allowToken(__token))return Reflect.apply(C,this,__args)},30),d=I.run,P=(0,n.d4)(function(a){return a.setting.layout}),M=(0,t.useMemo)(function(){return P===c.a0},[P]),k=(0,t.useCallback)(function(a){var o=a.side.toUpperCase(),u=a.type.replace(/[-_]/g,"");return"".concat(o).concat(u)},[]),A=(0,t.useCallback)(function(a){if(!__notify.allowOrder(a))return;if(!(a.type==="LIQUIDATION"||!f)){var o=k(a),u=y("".concat(o,"CancelTitle"),{defaultValue:"".concat(a.type," ").concat(a.side," Order Canceled")});d(__notify.token(a),u)}},[k,y,d,f]),O=(0,t.useCallback)(function(a){if(!__notify.allowOrder(a))return;if(!(a.type==="LIQUIDATION"||!f)){var o=k(a),u=y("".concat(o,"FillTitle"),{defaultValue:"".concat(a.type," ").concat(a.side," Order Filled")});d(__notify.token(a),u,{variant:"success"})}},[k,y,d,f]),x=(0,t.useCallback)(function(a){if(!__notify.allowOrder(a))return;if(!(a.type==="LIQUIDATION"||!f)){var o=k(a),u=y("".concat(o,"PFTitle"),{defaultValue:"".concat(a.type," ").concat(a.side," Order Partially Filled")});d(__notify.token(a),u,{variant:"success"})}},[k,y,d,f]);return(0,t.useMemo)(function(){return{cancelOrderNotify:A,fillOrderNotify:O,fillOrderPartNotify:x}},[A,O,x])}}}[30877]; }, - }, { id: "55401", - original: "55401(S,f,o){o.r(f),o.d(f,{SoundNotificationProvider:()=>C});var c=o(31085),e=o(41594),x=o(17409),s=o(39116),E=function(a){var r,n;(r=a)===null||r===void 0||r.load();var u=(n=a)===null||n===void 0?void 0:n.play();u&&u.then(function(){var t;(t=a)===null||t===void 0||t.play()}).catch(function(){})},C=function(a){var r=a.children,n=(0,s.$$)(),u=n.interval,t=n.intervalFunc,h=(0,e.useRef)(null),N=(0,s.QZ)(),p=N.enableNotification,m=N.showNotification,d=(0,s.E$)(),l=d.notifications,P=d.lastNotifyTime,y=d.popNotification,j=(0,e.useCallback)(function(){var i,v=(i=h)===null||i===void 0?void 0:i.current;v&&(v.src=\"\".concat(x.K5,\"/static/spot-trade-ui/trade-sound.mp3\"),E(v),t(y))},[t,y]);return(0,e.useEffect)(function(){var i;(!m||!p)&&(l.current=[]),l&&((i=l)===null||i===void 0?void 0:i.current.length)>0&&(u.current||j())},[P,p,j,l,u,m]),(0,c.jsxs)(\"div\",{children:[r,(0,c.jsx)(\"div\",{children:(0,c.jsx)(\"audio\",{ref:h,children:(0,c.jsx)(\"source\",{src:\"\"})})})]})}}", + signature: "{\"computed\":false,\"key\":{\"type\":\"Literal\",\"value\":55401},\"kind\":\"init\",\"method\":true,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"async\":false,\"body\":{\"body\":[{\"expression\":{\"expressions\":[{\"arguments\":[{\"binding\":[{\"scope\":1,\"variable\":1}],\"type\":\"Identifier\"}],\"callee\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"r\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},{\"arguments\":[{\"binding\":[{\"scope\":1,\"variable\":1}],\"type\":\"Identifier\"},{\"properties\":[{\"computed\":false,\"key\":{\"name\":\"SoundNotificationProvider\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"async\":false,\"body\":{\"binding\":[{\"scope\":1,\"variable\":8}],\"type\":\"Identifier\"},\"expression\":true,\"generator\":false,\"id\":null,\"params\":[],\"type\":\"ArrowFunctionExpression\"}}],\"type\":\"ObjectExpression\"}],\"callee\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"d\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"}],\"type\":\"SequenceExpression\"},\"type\":\"ExpressionStatement\"},{\"declarations\":[{\"id\":{\"binding\":[{\"scope\":1,\"variable\":3}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"type\":\"Literal\",\"value\":31085}],\"callee\":{\"binding\":[{\"scope\":1,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":1,\"variable\":4}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"type\":\"Literal\",\"value\":41594}],\"callee\":{\"binding\":[{\"scope\":1,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":1,\"variable\":5}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"type\":\"Literal\",\"value\":17409}],\"callee\":{\"binding\":[{\"scope\":1,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":1,\"variable\":6}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"type\":\"Literal\",\"value\":39116}],\"callee\":{\"binding\":[{\"scope\":1,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":1,\"variable\":7}],\"type\":\"Identifier\"},\"init\":{\"async\":false,\"body\":{\"body\":[{\"declarations\":[{\"id\":{\"binding\":[{\"scope\":3,\"variable\":1}],\"type\":\"Identifier\"},\"init\":null,\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":3,\"variable\":2}],\"type\":\"Identifier\"},\"init\":null,\"type\":\"VariableDeclarator\"}],\"kind\":\"var\",\"type\":\"VariableDeclaration\"},{\"expression\":{\"left\":{\"left\":{\"left\":{\"left\":{\"binding\":[{\"scope\":3,\"variable\":1}],\"type\":\"Identifier\"},\"operator\":\"=\",\"right\":{\"binding\":[{\"scope\":3,\"variable\":0}],\"type\":\"Identifier\"},\"type\":\"AssignmentExpression\"},\"operator\":\"===\",\"right\":{\"type\":\"Literal\",\"value\":null},\"type\":\"BinaryExpression\"},\"operator\":\"||\",\"right\":{\"left\":{\"binding\":[{\"scope\":3,\"variable\":1}],\"type\":\"Identifier\"},\"operator\":\"===\",\"right\":{\"argument\":{\"type\":\"Literal\",\"value\":0},\"operator\":\"void\",\"prefix\":true,\"type\":\"UnaryExpression\"},\"type\":\"BinaryExpression\"},\"type\":\"LogicalExpression\"},\"operator\":\"||\",\"right\":{\"arguments\":[],\"callee\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":3,\"variable\":1}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"load\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"LogicalExpression\"},\"type\":\"ExpressionStatement\"},{\"declarations\":[{\"id\":{\"binding\":[{\"scope\":3,\"variable\":3}],\"type\":\"Identifier\"},\"init\":{\"alternate\":{\"arguments\":[],\"callee\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":3,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"play\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"consequent\":{\"argument\":{\"type\":\"Literal\",\"value\":0},\"operator\":\"void\",\"prefix\":true,\"type\":\"UnaryExpression\"},\"test\":{\"left\":{\"left\":{\"left\":{\"binding\":[{\"scope\":3,\"variable\":2}],\"type\":\"Identifier\"},\"operator\":\"=\",\"right\":{\"binding\":[{\"scope\":3,\"variable\":0}],\"type\":\"Identifier\"},\"type\":\"AssignmentExpression\"},\"operator\":\"===\",\"right\":{\"type\":\"Literal\",\"value\":null},\"type\":\"BinaryExpression\"},\"operator\":\"||\",\"right\":{\"left\":{\"binding\":[{\"scope\":3,\"variable\":2}],\"type\":\"Identifier\"},\"operator\":\"===\",\"right\":{\"argument\":{\"type\":\"Literal\",\"value\":0},\"operator\":\"void\",\"prefix\":true,\"type\":\"UnaryExpression\"},\"type\":\"BinaryExpression\"},\"type\":\"LogicalExpression\"},\"type\":\"ConditionalExpression\"},\"type\":\"VariableDeclarator\"}],\"kind\":\"var\",\"type\":\"VariableDeclaration\"},{\"expression\":{\"left\":{\"binding\":[{\"scope\":3,\"variable\":3}],\"type\":\"Identifier\"},\"operator\":\"&&\",\"right\":{\"arguments\":[{\"async\":false,\"body\":{\"body\":[],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[],\"type\":\"FunctionExpression\"}],\"callee\":{\"computed\":false,\"object\":{\"arguments\":[{\"async\":false,\"body\":{\"body\":[{\"declarations\":[{\"id\":{\"binding\":[{\"scope\":4,\"variable\":0}],\"type\":\"Identifier\"},\"init\":null,\"type\":\"VariableDeclarator\"}],\"kind\":\"var\",\"type\":\"VariableDeclaration\"},{\"expression\":{\"left\":{\"left\":{\"left\":{\"left\":{\"binding\":[{\"scope\":4,\"variable\":0}],\"type\":\"Identifier\"},\"operator\":\"=\",\"right\":{\"binding\":[{\"scope\":3,\"variable\":0}],\"type\":\"Identifier\"},\"type\":\"AssignmentExpression\"},\"operator\":\"===\",\"right\":{\"type\":\"Literal\",\"value\":null},\"type\":\"BinaryExpression\"},\"operator\":\"||\",\"right\":{\"left\":{\"binding\":[{\"scope\":4,\"variable\":0}],\"type\":\"Identifier\"},\"operator\":\"===\",\"right\":{\"argument\":{\"type\":\"Literal\",\"value\":0},\"operator\":\"void\",\"prefix\":true,\"type\":\"UnaryExpression\"},\"type\":\"BinaryExpression\"},\"type\":\"LogicalExpression\"},\"operator\":\"||\",\"right\":{\"arguments\":[],\"callee\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":4,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"play\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"LogicalExpression\"},\"type\":\"ExpressionStatement\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[],\"type\":\"FunctionExpression\"}],\"callee\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":3,\"variable\":3}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"then\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"optional\":false,\"property\":{\"name\":\"catch\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"LogicalExpression\"},\"type\":\"ExpressionStatement\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[{\"binding\":[{\"scope\":3,\"variable\":0}],\"type\":\"Identifier\"}],\"type\":\"FunctionExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":1,\"variable\":8}],\"type\":\"Identifier\"},\"init\":{\"async\":false,\"body\":{\"body\":[{\"declarations\":[{\"id\":{\"binding\":[{\"scope\":6,\"variable\":1}],\"type\":\"Identifier\"},\"init\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":6,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"children\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":6,\"variable\":2}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":6}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"$$\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":6,\"variable\":3}],\"type\":\"Identifier\"},\"init\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":6,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"interval\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":6,\"variable\":4}],\"type\":\"Identifier\"},\"init\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":6,\"variable\":2}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"intervalFunc\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":6,\"variable\":5}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"type\":\"Literal\",\"value\":null}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":4}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"useRef\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":6,\"variable\":6}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":6}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"QZ\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":6,\"variable\":7}],\"type\":\"Identifier\"},\"init\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":6,\"variable\":6}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"enableNotification\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":6,\"variable\":8}],\"type\":\"Identifier\"},\"init\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":6,\"variable\":6}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"showNotification\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":6,\"variable\":9}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":6}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"E$\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":6,\"variable\":10}],\"type\":\"Identifier\"},\"init\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":6,\"variable\":9}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"notifications\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":6,\"variable\":11}],\"type\":\"Identifier\"},\"init\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":6,\"variable\":9}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"lastNotifyTime\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":6,\"variable\":12}],\"type\":\"Identifier\"},\"init\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":6,\"variable\":9}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"popNotification\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":6,\"variable\":13}],\"type\":\"Identifier\"},\"init\":{\"arguments\":[{\"async\":false,\"body\":{\"body\":[{\"declarations\":[{\"id\":{\"binding\":[{\"scope\":7,\"variable\":0}],\"type\":\"Identifier\"},\"init\":null,\"type\":\"VariableDeclarator\"},{\"id\":{\"binding\":[{\"scope\":7,\"variable\":1}],\"type\":\"Identifier\"},\"init\":{\"alternate\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":7,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"current\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"consequent\":{\"argument\":{\"type\":\"Literal\",\"value\":0},\"operator\":\"void\",\"prefix\":true,\"type\":\"UnaryExpression\"},\"test\":{\"left\":{\"left\":{\"left\":{\"binding\":[{\"scope\":7,\"variable\":0}],\"type\":\"Identifier\"},\"operator\":\"=\",\"right\":{\"binding\":[{\"scope\":6,\"variable\":5}],\"type\":\"Identifier\"},\"type\":\"AssignmentExpression\"},\"operator\":\"===\",\"right\":{\"type\":\"Literal\",\"value\":null},\"type\":\"BinaryExpression\"},\"operator\":\"||\",\"right\":{\"left\":{\"binding\":[{\"scope\":7,\"variable\":0}],\"type\":\"Identifier\"},\"operator\":\"===\",\"right\":{\"argument\":{\"type\":\"Literal\",\"value\":0},\"operator\":\"void\",\"prefix\":true,\"type\":\"UnaryExpression\"},\"type\":\"BinaryExpression\"},\"type\":\"LogicalExpression\"},\"type\":\"ConditionalExpression\"},\"type\":\"VariableDeclarator\"}],\"kind\":\"var\",\"type\":\"VariableDeclaration\"},{\"expression\":{\"left\":{\"binding\":[{\"scope\":7,\"variable\":1}],\"type\":\"Identifier\"},\"operator\":\"&&\",\"right\":{\"expressions\":[{\"left\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":7,\"variable\":1}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"src\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"operator\":\"=\",\"right\":{\"arguments\":[{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":5}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"K5\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},{\"type\":\"Literal\",\"value\":\"/static/spot-trade-ui/trade-sound.mp3\"}],\"callee\":{\"computed\":false,\"object\":{\"type\":\"Literal\",\"value\":\"\"},\"optional\":false,\"property\":{\"name\":\"concat\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"AssignmentExpression\"},{\"arguments\":[{\"binding\":[{\"scope\":7,\"variable\":1}],\"type\":\"Identifier\"}],\"callee\":{\"binding\":[{\"scope\":1,\"variable\":7}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},{\"arguments\":[{\"binding\":[{\"scope\":6,\"variable\":12}],\"type\":\"Identifier\"}],\"callee\":{\"binding\":[{\"scope\":6,\"variable\":4}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"}],\"type\":\"SequenceExpression\"},\"type\":\"LogicalExpression\"},\"type\":\"ExpressionStatement\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[],\"type\":\"FunctionExpression\"},{\"elements\":[{\"binding\":[{\"scope\":6,\"variable\":4}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":6,\"variable\":12}],\"type\":\"Identifier\"}],\"type\":\"ArrayExpression\"}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":4}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"useCallback\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"VariableDeclarator\"}],\"kind\":\"var\",\"type\":\"VariableDeclaration\"},{\"argument\":{\"expressions\":[{\"arguments\":[{\"async\":false,\"body\":{\"body\":[{\"declarations\":[{\"id\":{\"binding\":[{\"scope\":8,\"variable\":0}],\"type\":\"Identifier\"},\"init\":null,\"type\":\"VariableDeclarator\"}],\"kind\":\"var\",\"type\":\"VariableDeclaration\"},{\"expression\":{\"expressions\":[{\"left\":{\"left\":{\"argument\":{\"binding\":[{\"scope\":6,\"variable\":8}],\"type\":\"Identifier\"},\"operator\":\"!\",\"prefix\":true,\"type\":\"UnaryExpression\"},\"operator\":\"||\",\"right\":{\"argument\":{\"binding\":[{\"scope\":6,\"variable\":7}],\"type\":\"Identifier\"},\"operator\":\"!\",\"prefix\":true,\"type\":\"UnaryExpression\"},\"type\":\"LogicalExpression\"},\"operator\":\"&&\",\"right\":{\"left\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":6,\"variable\":10}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"current\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"operator\":\"=\",\"right\":{\"elements\":[],\"type\":\"ArrayExpression\"},\"type\":\"AssignmentExpression\"},\"type\":\"LogicalExpression\"},{\"left\":{\"left\":{\"binding\":[{\"scope\":6,\"variable\":10}],\"type\":\"Identifier\"},\"operator\":\"&&\",\"right\":{\"left\":{\"alternate\":{\"computed\":false,\"object\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":8,\"variable\":0}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"current\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"optional\":false,\"property\":{\"name\":\"length\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"consequent\":{\"argument\":{\"type\":\"Literal\",\"value\":0},\"operator\":\"void\",\"prefix\":true,\"type\":\"UnaryExpression\"},\"test\":{\"left\":{\"left\":{\"left\":{\"binding\":[{\"scope\":8,\"variable\":0}],\"type\":\"Identifier\"},\"operator\":\"=\",\"right\":{\"binding\":[{\"scope\":6,\"variable\":10}],\"type\":\"Identifier\"},\"type\":\"AssignmentExpression\"},\"operator\":\"===\",\"right\":{\"type\":\"Literal\",\"value\":null},\"type\":\"BinaryExpression\"},\"operator\":\"||\",\"right\":{\"left\":{\"binding\":[{\"scope\":8,\"variable\":0}],\"type\":\"Identifier\"},\"operator\":\"===\",\"right\":{\"argument\":{\"type\":\"Literal\",\"value\":0},\"operator\":\"void\",\"prefix\":true,\"type\":\"UnaryExpression\"},\"type\":\"BinaryExpression\"},\"type\":\"LogicalExpression\"},\"type\":\"ConditionalExpression\"},\"operator\":\">\",\"right\":{\"type\":\"Literal\",\"value\":0},\"type\":\"BinaryExpression\"},\"type\":\"LogicalExpression\"},\"operator\":\"&&\",\"right\":{\"left\":{\"computed\":false,\"object\":{\"binding\":[{\"scope\":6,\"variable\":3}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"current\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"},\"operator\":\"||\",\"right\":{\"arguments\":[],\"callee\":{\"binding\":[{\"scope\":6,\"variable\":13}],\"type\":\"Identifier\"},\"optional\":false,\"type\":\"CallExpression\"},\"type\":\"LogicalExpression\"},\"type\":\"LogicalExpression\"}],\"type\":\"SequenceExpression\"},\"type\":\"ExpressionStatement\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[],\"type\":\"FunctionExpression\"},{\"elements\":[{\"binding\":[{\"scope\":6,\"variable\":11}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":6,\"variable\":7}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":6,\"variable\":13}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":6,\"variable\":10}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":6,\"variable\":3}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":6,\"variable\":8}],\"type\":\"Identifier\"}],\"type\":\"ArrayExpression\"}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":4}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"useEffect\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"},{\"arguments\":[{\"type\":\"Literal\",\"value\":\"div\"},{\"properties\":[{\"computed\":false,\"key\":{\"name\":\"children\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"elements\":[{\"binding\":[{\"scope\":6,\"variable\":1}],\"type\":\"Identifier\"},{\"arguments\":[{\"type\":\"Literal\",\"value\":\"div\"},{\"properties\":[{\"computed\":false,\"key\":{\"name\":\"children\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"arguments\":[{\"type\":\"Literal\",\"value\":\"audio\"},{\"properties\":[{\"computed\":false,\"key\":{\"name\":\"ref\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"binding\":[{\"scope\":6,\"variable\":5}],\"type\":\"Identifier\"}},{\"computed\":false,\"key\":{\"name\":\"children\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"arguments\":[{\"type\":\"Literal\",\"value\":\"source\"},{\"properties\":[{\"computed\":false,\"key\":{\"name\":\"src\",\"type\":\"Identifier\"},\"kind\":\"init\",\"method\":false,\"shorthand\":false,\"type\":\"Property\",\"value\":{\"type\":\"Literal\",\"value\":\"\"}}],\"type\":\"ObjectExpression\"}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":3}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"jsx\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"}}],\"type\":\"ObjectExpression\"}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":3}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"jsx\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"}}],\"type\":\"ObjectExpression\"}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":3}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"jsx\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"}],\"type\":\"ArrayExpression\"}}],\"type\":\"ObjectExpression\"}],\"callee\":{\"expressions\":[{\"type\":\"Literal\",\"value\":0},{\"computed\":false,\"object\":{\"binding\":[{\"scope\":1,\"variable\":3}],\"type\":\"Identifier\"},\"optional\":false,\"property\":{\"name\":\"jsxs\",\"type\":\"Identifier\"},\"type\":\"MemberExpression\"}],\"type\":\"SequenceExpression\"},\"optional\":false,\"type\":\"CallExpression\"}],\"type\":\"SequenceExpression\"},\"type\":\"ReturnStatement\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[{\"binding\":[{\"scope\":6,\"variable\":0}],\"type\":\"Identifier\"}],\"type\":\"FunctionExpression\"},\"type\":\"VariableDeclarator\"}],\"kind\":\"var\",\"type\":\"VariableDeclaration\"}],\"type\":\"BlockStatement\"},\"expression\":false,\"generator\":false,\"id\":null,\"params\":[{\"binding\":[{\"scope\":1,\"variable\":0}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":1,\"variable\":1}],\"type\":\"Identifier\"},{\"binding\":[{\"scope\":1,\"variable\":2}],\"type\":\"Identifier\"}],\"type\":\"FunctionExpression\"}}", create(__notify) { return {55401(S,f,o){o.r(f),o.d(f,{SoundNotificationProvider:()=>C});var c=o(31085),e=o(41594),x=o(17409),s=o(39116),E=function(a,__event){if(!__notify.canPlay(__event))return;var r,n;(r=a)===null||r===void 0||r.load();var u=(n=a)===null||n===void 0?void 0:n.play();u&&u.then(function(){if(!__notify.canPlay(__event))return;var t;(t=a)===null||t===void 0||t.play()}).catch(function(){})},C=function(a){var r=a.children,n=(0,s.$$)(),u=n.interval,t=n.intervalFunc,h=(0,e.useRef)(null),N=(0,s.QZ)(),p=N.enableNotification,m=N.showNotification,d=(0,s.E$)(),l=d.notifications,P=d.lastNotifyTime,y=d.popNotification,j=(0,e.useCallback)(function(){if(!__notify.prepareSound(l))return;var i,v=(i=h)===null||i===void 0?void 0:i.current;v&&(v.src="".concat(x.K5,"/static/spot-trade-ui/trade-sound.mp3"),E(v,l.current[0]),t(y))},[t,y]);return(0,e.useEffect)(function(){var i;(!m||!p)&&(l.current=[]),l&&((i=l)===null||i===void 0?void 0:i.current.length)>0&&(u.current||j())},[P,p,j,l,u,m]),(0,c.jsxs)("div",{children:[r,(0,c.jsx)("div",{children:(0,c.jsx)("audio",{ref:h,children:(0,c.jsx)("source",{src:""})})})]})}}}[55401]; }, - }, - { - id: "30877", - original: "30877(Y,T,e){e.d(T,{F:()=>o,z:()=>N});var a=e(41594),k=e.n(a),P=e(61523),l=e(92873),O=e(64041),C=e(17409),h=e(51471),M=e(40477),p=\"trd-openOrder\",R=function(n){return(0,l.o)(p,n)},N=function(){var n=(0,h.zr)(\"open_order_status_toast\",!0),c=n.data,i=n.setData,F=n.hasInitialized,u=(0,a.useCallback)(function(){i(!c)},[c,i]);return{enableToast:F?c:!1,toggleToast:u}},o=function(){var n=R().getI18n,c=(0,O.h)().enqueueNotification,i=N().enableToast,F=(0,M.A)(c,30),u=F.run,L=(0,P.d4)(function(r){return r.setting.layout}),g=(0,a.useMemo)(function(){return L===C.a0},[L]),I=(0,a.useCallback)(function(r){var d=r.side.toUpperCase(),f=r.type.replace(/[-_]/g,\"\");return\"\".concat(d).concat(f)},[]),S=(0,a.useCallback)(function(r){if(!(r.type===\"LIQUIDATION\"||!i)){var d=I(r),f=n(\"\".concat(d,\"CancelTitle\"),{defaultValue:\"\".concat(r.type,\" \").concat(r.side,\" Order Canceled\")});u(f)}},[I,n,u,i]),A=(0,a.useCallback)(function(r){if(!(r.type===\"LIQUIDATION\"||!i)){var d=I(r),f=n(\"\".concat(d,\"FillTitle\"),{defaultValue:\"\".concat(r.type,\" \").concat(r.side,\" Order Filled\")});u(f,{variant:\"success\"})}},[I,n,u,i]),Q=(0,a.useCallback)(function(r){if(!(r.type===\"LIQUIDATION\"||!i)){var d=I(r),f=n(\"\".concat(d,\"PFTitle\"),{defaultValue:\"\".concat(r.type,\" \").concat(r.side,\" Order Partially Filled\")});u(f,{variant:\"success\"})}},[I,n,u,i]);return(0,a.useMemo)(function(){return{cancelOrderNotify:S,fillOrderNotify:A,fillOrderPartNotify:Q}},[S,A,Q])}}", - create(__notify) { return {30877(Y,T,e){e.d(T,{F:()=>o,z:()=>N});var a=e(41594),k=e.n(a),P=e(61523),l=e(92873),O=e(64041),C=e(17409),h=e(51471),M=e(40477),p="trd-openOrder",R=function(n){return(0,l.o)(p,n)},N=function(){var n=(0,h.zr)("open_order_status_toast",!0),c=n.data,i=n.setData,F=n.hasInitialized,u=(0,a.useCallback)(function(){i(!c)},[c,i]);return{enableToast:F?c:!1,toggleToast:u}},o=function(){var n=R().getI18n,c=(0,O.h)().enqueueNotification,i=N().enableToast,F=(0,M.A)(function(__token,...__args){if(__notify.allowToken(__token))return Reflect.apply(c,this,__args)},30),u=F.run,L=(0,P.d4)(function(r){return r.setting.layout}),g=(0,a.useMemo)(function(){return L===C.a0},[L]),I=(0,a.useCallback)(function(r){var d=r.side.toUpperCase(),f=r.type.replace(/[-_]/g,"");return"".concat(d).concat(f)},[]),S=(0,a.useCallback)(function(r){if(!__notify.allowOrder(r))return;if(!(r.type==="LIQUIDATION"||!i)){var d=I(r),f=n("".concat(d,"CancelTitle"),{defaultValue:"".concat(r.type," ").concat(r.side," Order Canceled")});u(__notify.token(r),f)}},[I,n,u,i]),A=(0,a.useCallback)(function(r){if(!__notify.allowOrder(r))return;if(!(r.type==="LIQUIDATION"||!i)){var d=I(r),f=n("".concat(d,"FillTitle"),{defaultValue:"".concat(r.type," ").concat(r.side," Order Filled")});u(__notify.token(r),f,{variant:"success"})}},[I,n,u,i]),Q=(0,a.useCallback)(function(r){if(!__notify.allowOrder(r))return;if(!(r.type==="LIQUIDATION"||!i)){var d=I(r),f=n("".concat(d,"PFTitle"),{defaultValue:"".concat(r.type," ").concat(r.side," Order Partially Filled")});u(__notify.token(r),f,{variant:"success"})}},[I,n,u,i]);return(0,a.useMemo)(function(){return{cancelOrderNotify:S,fillOrderNotify:A,fillOrderPartNotify:Q}},[S,A,Q])}}}[30877]; }, - }, - { - id: "30877", - original: "30877(L,T,e){e.d(T,{F:()=>_,z:()=>v});var r=e(41594),x=e.n(r),O=e(61523),h=e(92873),p=e(64041),k=e(17409),C=e(51471),I=e(40477),g=\"trd-openOrder\",f=function(s){return(0,h.o)(g,s)},v=function(){var s=(0,C.zr)(\"open_order_status_toast\",!0),c=s.data,o=s.setData,d=s.hasInitialized,n=(0,r.useCallback)(function(){o(!c)},[c,o]);return{enableToast:d?c:!1,toggleToast:n}},_=function(){var s=f().getI18n,c=(0,p.h)().enqueueNotification,o=v().enableToast,d=(0,I.A)(c,30),n=d.run,a=(0,O.d4)(function(t){return t.setting.layout}),S=(0,r.useMemo)(function(){return a===k.a0},[a]),i=(0,r.useCallback)(function(t){var l=t.side.toUpperCase(),u=t.type.replace(/[-_]/g,\"\");return\"\".concat(l).concat(u)},[]),y=(0,r.useCallback)(function(t){if(!(t.type===\"LIQUIDATION\"||!o)){var l=i(t),u=s(\"\".concat(l,\"CancelTitle\"),{defaultValue:\"\".concat(t.type,\" \").concat(t.side,\" Order Canceled\")});n(u)}},[i,s,n,o]),F=(0,r.useCallback)(function(t){if(!(t.type===\"LIQUIDATION\"||!o)){var l=i(t),u=s(\"\".concat(l,\"FillTitle\"),{defaultValue:\"\".concat(t.type,\" \").concat(t.side,\" Order Filled\")});n(u,{variant:\"success\"})}},[i,s,n,o]),m=(0,r.useCallback)(function(t){if(!(t.type===\"LIQUIDATION\"||!o)){var l=i(t),u=s(\"\".concat(l,\"PFTitle\"),{defaultValue:\"\".concat(t.type,\" \").concat(t.side,\" Order Partially Filled\")});n(u,{variant:\"success\"})}},[i,s,n,o]);return(0,r.useMemo)(function(){return{cancelOrderNotify:y,fillOrderNotify:F,fillOrderPartNotify:m}},[y,F,m])}}", - create(__notify) { return {30877(L,T,e){e.d(T,{F:()=>_,z:()=>v});var r=e(41594),x=e.n(r),O=e(61523),h=e(92873),p=e(64041),k=e(17409),C=e(51471),I=e(40477),g="trd-openOrder",f=function(s){return(0,h.o)(g,s)},v=function(){var s=(0,C.zr)("open_order_status_toast",!0),c=s.data,o=s.setData,d=s.hasInitialized,n=(0,r.useCallback)(function(){o(!c)},[c,o]);return{enableToast:d?c:!1,toggleToast:n}},_=function(){var s=f().getI18n,c=(0,p.h)().enqueueNotification,o=v().enableToast,d=(0,I.A)(function(__token,...__args){if(__notify.allowToken(__token))return Reflect.apply(c,this,__args)},30),n=d.run,a=(0,O.d4)(function(t){return t.setting.layout}),S=(0,r.useMemo)(function(){return a===k.a0},[a]),i=(0,r.useCallback)(function(t){var l=t.side.toUpperCase(),u=t.type.replace(/[-_]/g,"");return"".concat(l).concat(u)},[]),y=(0,r.useCallback)(function(t){if(!__notify.allowOrder(t))return;if(!(t.type==="LIQUIDATION"||!o)){var l=i(t),u=s("".concat(l,"CancelTitle"),{defaultValue:"".concat(t.type," ").concat(t.side," Order Canceled")});n(__notify.token(t),u)}},[i,s,n,o]),F=(0,r.useCallback)(function(t){if(!__notify.allowOrder(t))return;if(!(t.type==="LIQUIDATION"||!o)){var l=i(t),u=s("".concat(l,"FillTitle"),{defaultValue:"".concat(t.type," ").concat(t.side," Order Filled")});n(__notify.token(t),u,{variant:"success"})}},[i,s,n,o]),m=(0,r.useCallback)(function(t){if(!__notify.allowOrder(t))return;if(!(t.type==="LIQUIDATION"||!o)){var l=i(t),u=s("".concat(l,"PFTitle"),{defaultValue:"".concat(t.type," ").concat(t.side," Order Partially Filled")});n(__notify.token(t),u,{variant:"success"})}},[i,s,n,o]);return(0,r.useMemo)(function(){return{cancelOrderNotify:y,fillOrderNotify:F,fillOrderPartNotify:m}},[y,F,m])}}}[30877]; }, - }, - { - id: "30877", - original: "30877(R,T,e){e.d(T,{F:()=>y,z:()=>D});var t=e(41594),O=e.n(t),u=e(61523),i=e(92873),m=e(64041),d=e(17409),f=e(51471),a=e(40477),o=\"trd-openOrder\",b=function(S){return(0,i.o)(o,S)},D=function(){var S=(0,f.zr)(\"open_order_status_toast\",!0),M=S.data,P=S.setData,N=S.hasInitialized,_=(0,t.useCallback)(function(){P(!M)},[M,P]);return{enableToast:N?M:!1,toggleToast:_}},y=function(){var S=b().getI18n,M=(0,m.h)().enqueueNotification,P=D().enableToast,N=(0,a.A)(M,30),_=N.run,v=(0,u.d4)(function(n){return n.setting.layout}),l=(0,t.useMemo)(function(){return v===d.a0},[v]),s=(0,t.useCallback)(function(n){var g=n.side.toUpperCase(),c=n.type.replace(/[-_]/g,\"\");return\"\".concat(g).concat(c)},[]),r=(0,t.useCallback)(function(n){if(!(n.type===\"LIQUIDATION\"||!P)){var g=s(n),c=S(\"\".concat(g,\"CancelTitle\"),{defaultValue:\"\".concat(n.type,\" \").concat(n.side,\" Order Canceled\")});_(c)}},[s,S,_,P]),p=(0,t.useCallback)(function(n){if(!(n.type===\"LIQUIDATION\"||!P)){var g=s(n),c=S(\"\".concat(g,\"FillTitle\"),{defaultValue:\"\".concat(n.type,\" \").concat(n.side,\" Order Filled\")});_(c,{variant:\"success\"})}},[s,S,_,P]),h=(0,t.useCallback)(function(n){if(!(n.type===\"LIQUIDATION\"||!P)){var g=s(n),c=S(\"\".concat(g,\"PFTitle\"),{defaultValue:\"\".concat(n.type,\" \").concat(n.side,\" Order Partially Filled\")});_(c,{variant:\"success\"})}},[s,S,_,P]);return(0,t.useMemo)(function(){return{cancelOrderNotify:r,fillOrderNotify:p,fillOrderPartNotify:h}},[r,p,h])}}", - create(__notify) { return {30877(R,T,e){e.d(T,{F:()=>y,z:()=>D});var t=e(41594),O=e.n(t),u=e(61523),i=e(92873),m=e(64041),d=e(17409),f=e(51471),a=e(40477),o="trd-openOrder",b=function(S){return(0,i.o)(o,S)},D=function(){var S=(0,f.zr)("open_order_status_toast",!0),M=S.data,P=S.setData,N=S.hasInitialized,_=(0,t.useCallback)(function(){P(!M)},[M,P]);return{enableToast:N?M:!1,toggleToast:_}},y=function(){var S=b().getI18n,M=(0,m.h)().enqueueNotification,P=D().enableToast,N=(0,a.A)(function(__token,...__args){if(__notify.allowToken(__token))return Reflect.apply(M,this,__args)},30),_=N.run,v=(0,u.d4)(function(n){return n.setting.layout}),l=(0,t.useMemo)(function(){return v===d.a0},[v]),s=(0,t.useCallback)(function(n){var g=n.side.toUpperCase(),c=n.type.replace(/[-_]/g,"");return"".concat(g).concat(c)},[]),r=(0,t.useCallback)(function(n){if(!__notify.allowOrder(n))return;if(!(n.type==="LIQUIDATION"||!P)){var g=s(n),c=S("".concat(g,"CancelTitle"),{defaultValue:"".concat(n.type," ").concat(n.side," Order Canceled")});_(__notify.token(n),c)}},[s,S,_,P]),p=(0,t.useCallback)(function(n){if(!__notify.allowOrder(n))return;if(!(n.type==="LIQUIDATION"||!P)){var g=s(n),c=S("".concat(g,"FillTitle"),{defaultValue:"".concat(n.type," ").concat(n.side," Order Filled")});_(__notify.token(n),c,{variant:"success"})}},[s,S,_,P]),h=(0,t.useCallback)(function(n){if(!__notify.allowOrder(n))return;if(!(n.type==="LIQUIDATION"||!P)){var g=s(n),c=S("".concat(g,"PFTitle"),{defaultValue:"".concat(n.type," ").concat(n.side," Order Partially Filled")});_(__notify.token(n),c,{variant:"success"})}},[s,S,_,P]);return(0,t.useMemo)(function(){return{cancelOrderNotify:r,fillOrderNotify:p,fillOrderPartNotify:h}},[r,p,h])}}}[30877]; }, } ]; -/** Preserve the complete native factories and alter only the verified notification side effects. */ +/** Accept local renaming and formatting while preserving the verified native behavior. */ export function replaceOrderNotificationFactory(id, originalFactory, bridge) { if (typeof originalFactory !== 'function') throw new TypeError('Native notification factory must be a function'); const source = Function.prototype.toString.call(originalFactory); - const pinned = pinnedFactories.find(entry => entry.id === String(id) && entry.original === source); - if (!pinned) throw new Error('Native notification factory source does not match a pinned public module'); - return pinned.create(bridge); + const signature = createOrderNotificationFactorySignature(source, String(id)); + const verified = verifiedFactories.find(entry => entry.id === String(id) && entry.signature === signature); + if (!verified) throw new Error('Native notification factory behavior does not match a verified structure'); + return verified.create(bridge); } diff --git a/src/binance-orderbook-trade/order-notifications/runtime.js b/src/binance-orderbook-trade/order-notifications/runtime.js index a0f21f3..2800e1e 100644 --- a/src/binance-orderbook-trade/order-notifications/runtime.js +++ b/src/binance-orderbook-trade/order-notifications/runtime.js @@ -5,7 +5,7 @@ const MODULE_IDS = ['30877', '39116', '55401']; /** * Share the orderbook's single early queue observer without sharing storage - * state. Producer and player must both execute their pinned factories before + * state. Producer and player must both execute their verified factories before * either side changes the native string queue contract. */ export function createOrderNotificationScope() { diff --git a/test/dom/binance-orderbook-trade/order-notifications.test.js b/test/dom/binance-orderbook-trade/order-notifications.test.js index d32336e..1f82871 100644 --- a/test/dom/binance-orderbook-trade/order-notifications.test.js +++ b/test/dom/binance-orderbook-trade/order-notifications.test.js @@ -1,5 +1,5 @@ import assert from 'node:assert/strict'; -import test from 'node:test'; +import test, { describe } from 'node:test'; import { attachNativeOrderEventHost, @@ -10,353 +10,361 @@ import { ordinaryNotificationOrder, } from '../../helpers/binance-order-notifications.js'; -test('user receives no foreign-symbol order toast or sound in a futures tab', async (t) => { - // Given the active futures page displays BTC while native reminders are enabled - const harness = await createNotificationHarness(t); - const order = ordinaryNotificationOrder({ symbol: 'ETHUSDT' }); - - // When the native order event and sound stream deliver another symbol - await harness.notify(order); - await harness.advance(30); - await harness.advance(470); - - // Then the current tab has no unrelated visual or audible reminder - assert.deepEqual({ toasts: harness.toasts, audio: harness.audio }, { toasts: [], audio: [] }); -}); - -test('user host fixture reproduces the native foreign-symbol toast and sound', async (t) => { - // Given the captured unmodified factories run in the real React host - const harness = await createNotificationHarness(t, { patched: false, inspectSoundQueue: true }); - const order = ordinaryNotificationOrder({ symbol: 'ETHUSDT' }); - - // When an unrelated native order completes through the SDK and cached-order adapter - await harness.notify(order); - await harness.advance(500); - - // Then the baseline delivers its original message and string queue entry without filtering - assert.deepEqual(harness.toasts, [{ message: 'LIMIT BUY Order Filled', options: { variant: 'success' } }]); - assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); - assert.deepEqual(harness.queueSnapshot(), ['42']); - assert.deepEqual(harness.nativeHost.orders(), []); -}); - -test('user receives the current-symbol toast and sound at the original native deadlines', async (t) => { - // Given native notifications are enabled for the displayed futures symbol - const harness = await createNotificationHarness(t); - - // When a current-symbol fill arrives just before the native toast deadline - await harness.notify(ordinaryNotificationOrder()); - await harness.advance(29); - - // Then both native presentation boundaries are still idle - assert.deepEqual(harness.toasts, []); - assert.deepEqual(harness.audio, []); - - // When the native thirty-millisecond toast deadline is reached - await harness.advance(1); - - // Then the native message is enqueued with its success variant - assert.deepEqual(harness.toasts, [{ message: 'LIMIT BUY Order Filled', options: { variant: 'success' } }]); - assert.deepEqual(harness.audio, []); - - // When the sound debounce remains one millisecond short - await harness.advance(469); - - // Then audio has not played early - assert.deepEqual(harness.audio, []); - - // When the original five-hundred-millisecond sound deadline is reached - await harness.advance(1); - - // Then native audio loading and both native play calls remain intact - assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); -}); - -for (const variantChunk of ['37511', '24132', '57898', '57276', '76905', '49426']) { - test(`user receives only current-symbol toasts with native chunk ${variantChunk}`, async (t) => { - // Given this captured native toast variant is mounted with sound disabled - const harness = await createNotificationHarness(t, { variantChunk, soundEnabled: false }); - - // When a foreign fill and then a current-symbol cancellation arrive - await harness.notify(ordinaryNotificationOrder({ symbol: 'ETHUSDT' })); - await harness.advance(30); - await harness.notify(ordinaryNotificationOrder({ status: 'CANCELED', orderId: 43 })); - await harness.advance(30); - - // Then only the native cancellation text is delivered - assert.deepEqual(harness.toasts, [{ message: 'LIMIT BUY Order Canceled', options: undefined }]); - assert.deepEqual(harness.audio, []); - }); -} - -for (const symbol of ['BTCUSDT', 'ETHUSDT']) { - test(`user sees reminders only for ${symbol} in an independently mounted futures page`, async (t) => { - // Given this page has its own route, native state and notification provider - const harness = await createNotificationHarness(t, { pathname: `/en/futures/${symbol}` }); - const foreignSymbol = symbol === 'BTCUSDT' ? 'ETHUSDT' : 'BTCUSDT'; - - // When both account symbols deliver their native completion events - await harness.notify(ordinaryNotificationOrder({ symbol: foreignSymbol, orderId: 43 })); - await harness.advance(500); - await harness.notify(ordinaryNotificationOrder({ symbol })); - await harness.advance(500); - - // Then this page presents exactly its own order reminder - assert.equal(harness.toasts.length, 1); - assert.deepEqual(harness.audio, [ - { kind: 'load', pathname: `/en/futures/${symbol}` }, - { kind: 'play', pathname: `/en/futures/${symbol}` }, - { kind: 'play', pathname: `/en/futures/${symbol}` }, - ]); - }); -} - -test('user filters ordinary coin-margined events received by a USDT futures tab', async (t) => { - // Given native hooks subscribe to both account streams on the BTCUSDT page - const harness = await createNotificationHarness(t); - - // When the coin-margined stream delivers an ordinary BTCUSD perpetual fill - await harness.notify(ordinaryNotificationOrder({ symbol: 'BTCUSD_PERP' }), { isCM: true }); - await harness.advance(500); - - // Then neither toast nor audio leaks from that other symbol - assert.deepEqual({ toasts: harness.toasts, audio: harness.audio }, { toasts: [], audio: [] }); - assert.equal(harness.streams.subscriptions.some((entry) => entry.isCM), true); -}); - -test('user keeps native reminders on a coin-margined route outside supported USD-M routes', async (t) => { - // Given the loaded host displays a coin-margined route the USD-M parser does not recognize - const harness = await createNotificationHarness(t, { pathname: '/en/futures/BTCUSD_PERP' }); - - // When that native coin-margined order fills - await harness.notify(ordinaryNotificationOrder({ symbol: 'BTCUSD_PERP' }), { isCM: true }); - await harness.advance(500); - - // Then the matching symbol keeps the original toast and native sound - assert.deepEqual(harness.toasts, [{ message: 'LIMIT BUY Order Filled', options: { variant: 'success' } }]); - assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); -}); - -for (const outcome of [ - { status: 'PARTIALLY_FILLED', operate: 'TRADE', text: 'Partially Filled', sound: true }, - { status: 'EXPIRED', operate: 'EXPIRED', text: 'Canceled', sound: true }, - { status: 'EXPIRED_IN_MATCH', operate: 'EXPIRED', text: 'Canceled', sound: false }, +for (const soundSourceSha256 of [ + '5362a54e61f022714e673e166b62e3c22997084ca7a9f4e676475ec91cfcfaa8', + '0e53de2a0de8073e445688bdf6b858b9f0eb3c20b49ecda9f230418a7c85a2f8', ]) { - test(`user retains native ${outcome.status} reminders only for the current symbol`, async (t) => { - // Given the current and foreign orders have the same native execution outcome - const harness = await createNotificationHarness(t); - const nativeEvent = { status: outcome.status, operate: outcome.operate }; - - // When the foreign event is followed by the matching-symbol event - await harness.notify(ordinaryNotificationOrder({ ...nativeEvent, symbol: 'ETHUSDT', orderId: 43 })); - await harness.advance(500); - await harness.notify(ordinaryNotificationOrder(nativeEvent)); - await harness.advance(500); - - // Then only the matching-symbol event keeps the original status-specific presentation - assert.deepEqual(harness.toasts.map((toast) => toast.message), [`LIMIT BUY Order ${outcome.text}`]); - assert.deepEqual(harness.audio.map((event) => event.kind), outcome.sound ? ['load', 'play', 'play'] : []); - }); -} + describe(`native sound source ${soundSourceSha256}`, () => { + test('user receives no foreign-symbol order toast or sound in a futures tab', async (t) => { + // Given the active futures page displays BTC while native reminders are enabled + const harness = await createNotificationHarness(t, { soundSourceSha256 }); + const order = ordinaryNotificationOrder({ symbol: 'ETHUSDT' }); + + // When the native order event and sound stream deliver another symbol + await harness.notify(order); + await harness.advance(30); + await harness.advance(470); + + // Then the current tab has no unrelated visual or audible reminder + assert.deepEqual({ toasts: harness.toasts, audio: harness.audio }, { toasts: [], audio: [] }); + }); -for (const types of ['LIMIT', 'MARKET', 'STOP', 'STOP_MARKET', 'TAKE_PROFIT', 'TAKE_PROFIT_MARKET', 'TRAILING_STOP_MARKET']) { - test(`user filters foreign-symbol ordinary ${types} reminders`, async (t) => { - // Given the order carries one of the observed ordinary Binance type discriminators - const harness = await createNotificationHarness(t); - const order = ordinaryNotificationOrder({ symbol: 'ETHUSDT', type: types, orderType: types, origType: types }); + test('user host fixture reproduces the native foreign-symbol toast and sound', async (t) => { + // Given the captured unmodified factories run in the real React host + const harness = await createNotificationHarness(t, { soundSourceSha256, patched: false, inspectSoundQueue: true }); + const order = ordinaryNotificationOrder({ symbol: 'ETHUSDT' }); - // When its completion reaches the real native toast and audio paths - await harness.notify(order); - await harness.advance(500); + // When an unrelated native order completes through the SDK and cached-order adapter + await harness.notify(order); + await harness.advance(500); - // Then this ordinary foreign-symbol event has no visible or audible effect - assert.deepEqual({ toasts: harness.toasts, audio: harness.audio }, { toasts: [], audio: [] }); - }); -} + // Then the baseline delivers its original message and string queue entry without filtering + assert.deepEqual(harness.toasts, [{ message: 'LIMIT BUY Order Filled', options: { variant: 'success' } }]); + assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); + assert.deepEqual(harness.queueSnapshot(), ['42']); + assert.deepEqual(harness.nativeHost.orders(), []); + }); -for (const isCM of [false, true]) { - test(`user keeps the matching sound when a native ${isCM ? 'CM' : 'UM'} batch ends with another symbol`, async (t) => { - // Given a single native batch contains a matching event followed by a foreign event - const harness = await createNotificationHarness(t); - const matching = ordinaryNotificationOrder(); - const foreign = ordinaryNotificationOrder({ symbol: 'ETHUSDT', orderId: 43 }); + test('user receives the current-symbol toast and sound at the original native deadlines', async (t) => { + // Given native notifications are enabled for the displayed futures symbol + const harness = await createNotificationHarness(t, { soundSourceSha256 }); - // When the account stream delivers both events during the same debounce window - await harness.emitStream([matching, foreign], { isCM }); - await harness.advance(500); + // When a current-symbol fill arrives just before the native toast deadline + await harness.notify(ordinaryNotificationOrder()); + await harness.advance(29); - // Then filtering does not let the unrelated trailing event erase the matching sound - assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); - }); -} - -for (const risk of [ - { name: 'liquidation type', fields: { type: 'LIQUIDATION', orderType: 'LIQUIDATION' }, toast: false }, - { name: 'calculated execution', fields: { operate: 'CALCULATED' }, toast: true }, - { name: 'autoclose client identifier', fields: { clientOrderId: 'autoclose-123' }, toast: true }, - { name: 'ADL client identifier', fields: { clientOrderId: 'adl_autoclose-123' }, toast: true }, - { name: 'settlement client identifier', fields: { clientOrderId: 'settlement_autoclose-123' }, toast: true }, -]) { - test(`user retains native risk behavior for a foreign-symbol ${risk.name}`, async (t) => { - // Given a foreign symbol carries this native risk discriminator - const harness = await createNotificationHarness(t); - const order = ordinaryNotificationOrder({ symbol: 'ETHUSDT', ...risk.fields }); - - // When the risk event reaches both captured native presentation paths - await harness.notify(order); - await harness.advance(500); - - // Then filtering preserves the original risk toast policy and native sound - assert.equal(harness.toasts.length, risk.toast ? 1 : 0); - assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); - }); -} + // Then both native presentation boundaries are still idle + assert.deepEqual(harness.toasts, []); + assert.deepEqual(harness.audio, []); -for (const unknown of [ - { name: 'missing client identifier', fields: { clientOrderId: undefined } }, - { name: 'missing symbol', fields: { symbol: undefined } }, - { name: 'malformed symbol', fields: { symbol: 'ETH/USDT' } }, - { name: 'unknown order type', fields: { type: 'UNRECOGNIZED', orderType: 'UNRECOGNIZED' } }, - { name: 'unknown original type', fields: { origType: 'UNRECOGNIZED' } }, - { name: 'unknown execution operation', fields: { operate: 'UNRECOGNIZED' } }, -]) { - test(`user retains native reminders for an order with ${unknown.name}`, async (t) => { - // Given an event cannot be proven to be an ordinary foreign-symbol order - const harness = await createNotificationHarness(t); - const order = ordinaryNotificationOrder({ symbol: 'ETHUSDT', ...unknown.fields }); - - // When the uncertain payload arrives through both original native paths - await harness.notify(order); - await harness.advance(500); - - // Then its native toast and audio behavior remain visible - assert.equal(harness.toasts.length, 1); - assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); - }); -} + // When the native thirty-millisecond toast deadline is reached + await harness.advance(1); -for (const preferences of [ - { toastEnabled: false, soundEnabled: true }, - { toastEnabled: true, soundEnabled: false }, - { toastEnabled: false, soundEnabled: false }, -]) { - test(`user keeps native reminder preferences toast=${preferences.toastEnabled} sound=${preferences.soundEnabled}`, async (t) => { - // Given real native preference hooks initialize with the selected switches - const harness = await createNotificationHarness(t, preferences); + // Then the native message is enqueued with its success variant + assert.deepEqual(harness.toasts, [{ message: 'LIMIT BUY Order Filled', options: { variant: 'success' } }]); + assert.deepEqual(harness.audio, []); - // When the displayed symbol fills after preference initialization - await harness.notify(ordinaryNotificationOrder()); - await harness.advance(500); + // When the sound debounce remains one millisecond short + await harness.advance(469); - // Then each original native switch independently controls its presentation - assert.equal(harness.toasts.length, preferences.toastEnabled ? 1 : 0); - assert.deepEqual(harness.audio.map((event) => event.kind), preferences.soundEnabled ? ['load', 'play', 'play'] : []); - }); -} + // Then audio has not played early + assert.deepEqual(harness.audio, []); -test('user sees no stale toast after switching symbol during the native toast delay', async (t) => { - // Given a current-symbol fill is waiting in the native thirty-millisecond throttle - const harness = await createNotificationHarness(t); - await harness.notify(ordinaryNotificationOrder()); - await harness.advance(29); + // When the original five-hundred-millisecond sound deadline is reached + await harness.advance(1); - // When the page switches symbols before the pending notification is enqueued - harness.navigate('/en/futures/ETHUSDT'); - await harness.advance(1); - await harness.advance(470); + // Then native audio loading and both native play calls remain intact + assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); + }); - // Then both delayed presentation paths recheck the current route - assert.deepEqual({ toasts: harness.toasts, audio: harness.audio }, { toasts: [], audio: [] }); -}); + for (const variantChunk of ['37511', '24132', '57898', '57276', '76905', '49426']) { + test(`user receives only current-symbol toasts with native chunk ${variantChunk}`, async (t) => { + // Given this captured native toast variant is mounted with sound disabled + const harness = await createNotificationHarness(t, { soundSourceSha256, variantChunk, soundEnabled: false }); + + // When a foreign fill and then a current-symbol cancellation arrive + await harness.notify(ordinaryNotificationOrder({ symbol: 'ETHUSDT' })); + await harness.advance(30); + await harness.notify(ordinaryNotificationOrder({ status: 'CANCELED', orderId: 43 })); + await harness.advance(30); + + // Then only the native cancellation text is delivered + assert.deepEqual(harness.toasts, [{ message: 'LIMIT BUY Order Canceled', options: undefined }]); + assert.deepEqual(harness.audio, []); + }); + } + + for (const symbol of ['BTCUSDT', 'ETHUSDT', 'OUSDT', '龙虾USDT']) { + test(`user sees reminders only for ${symbol} in an independently mounted futures page`, async (t) => { + // Given this page has its own route, native state and notification provider + const harness = await createNotificationHarness(t, { soundSourceSha256, pathname: `/en/futures/${encodeURIComponent(symbol)}` }); + const foreignSymbol = symbol === 'BTCUSDT' ? 'ETHUSDT' : 'BTCUSDT'; + + // When both account symbols deliver their native completion events + await harness.notify(ordinaryNotificationOrder({ symbol: foreignSymbol, orderId: 43 })); + await harness.advance(500); + await harness.notify(ordinaryNotificationOrder({ symbol })); + await harness.advance(500); + + // Then this page presents exactly its own order reminder + assert.equal(harness.toasts.length, 1); + assert.deepEqual(harness.audio, [ + { kind: 'load', pathname: `/en/futures/${encodeURIComponent(symbol)}` }, + { kind: 'play', pathname: `/en/futures/${encodeURIComponent(symbol)}` }, + { kind: 'play', pathname: `/en/futures/${encodeURIComponent(symbol)}` }, + ]); + }); + } + + test('user filters ordinary coin-margined events received by a USDT futures tab', async (t) => { + // Given native hooks subscribe to both account streams on the BTCUSDT page + const harness = await createNotificationHarness(t, { soundSourceSha256 }); + + // When the coin-margined stream delivers an ordinary BTCUSD perpetual fill + await harness.notify(ordinaryNotificationOrder({ symbol: 'BTCUSD_PERP' }), { isCM: true }); + await harness.advance(500); + + // Then neither toast nor audio leaks from that other symbol + assert.deepEqual({ toasts: harness.toasts, audio: harness.audio }, { toasts: [], audio: [] }); + assert.equal(harness.streams.subscriptions.some((entry) => entry.isCM), true); + }); -test('user hears no stale audio after switching symbol during the native sound delay', async (t) => { - // Given a current-symbol fill has shown its toast but audio has not started - const harness = await createNotificationHarness(t); - await harness.notify(ordinaryNotificationOrder()); - await harness.advance(499); - assert.equal(harness.toasts.length, 1); + test('user keeps native reminders on a coin-margined route outside supported USD-M routes', async (t) => { + // Given the loaded host displays a coin-margined route the USD-M parser does not recognize + const harness = await createNotificationHarness(t, { soundSourceSha256, pathname: '/en/futures/BTCUSD_PERP' }); - // When the page switches symbols before the native audio deadline - harness.navigate('/en/futures/ETHUSDT'); - await harness.advance(1); + // When that native coin-margined order fills + await harness.notify(ordinaryNotificationOrder({ symbol: 'BTCUSD_PERP' }), { isCM: true }); + await harness.advance(500); - // Then the old symbol cannot begin playback on the new page - assert.deepEqual(harness.audio, []); -}); + // Then the matching symbol keeps the original toast and native sound + assert.deepEqual(harness.toasts, [{ message: 'LIMIT BUY Order Filled', options: { variant: 'success' } }]); + assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); + }); -test('user keeps the new-symbol audio queued when the previous-symbol cooldown completes', async (t) => { - // Given BTC has started native audio and owns the active cooldown - const harness = await createNotificationHarness(t); - await harness.notify(ordinaryNotificationOrder()); - await harness.advance(500); - assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); + for (const outcome of [ + { status: 'PARTIALLY_FILLED', operate: 'TRADE', text: 'Partially Filled', sound: true }, + { status: 'EXPIRED', operate: 'EXPIRED', text: 'Canceled', sound: true }, + { status: 'EXPIRED_IN_MATCH', operate: 'EXPIRED', text: 'Canceled', sound: false }, + ]) { + test(`user retains native ${outcome.status} reminders only for the current symbol`, async (t) => { + // Given the current and foreign orders have the same native execution outcome + const harness = await createNotificationHarness(t, { soundSourceSha256 }); + const nativeEvent = { status: outcome.status, operate: outcome.operate }; + + // When the foreign event is followed by the matching-symbol event + await harness.notify(ordinaryNotificationOrder({ ...nativeEvent, symbol: 'ETHUSDT', orderId: 43 })); + await harness.advance(500); + await harness.notify(ordinaryNotificationOrder(nativeEvent)); + await harness.advance(500); + + // Then only the matching-symbol event keeps the original status-specific presentation + assert.deepEqual(harness.toasts.map((toast) => toast.message), [`LIMIT BUY Order ${outcome.text}`]); + assert.deepEqual(harness.audio.map((event) => event.kind), outcome.sound ? ['load', 'play', 'play'] : []); + }); + } + + for (const types of ['LIMIT', 'MARKET', 'STOP', 'STOP_MARKET', 'TAKE_PROFIT', 'TAKE_PROFIT_MARKET', 'TRAILING_STOP_MARKET']) { + test(`user filters foreign-symbol ordinary ${types} reminders`, async (t) => { + // Given the order carries one of the observed ordinary Binance type discriminators + const harness = await createNotificationHarness(t, { soundSourceSha256 }); + const order = ordinaryNotificationOrder({ symbol: 'ETHUSDT', type: types, orderType: types, origType: types }); + + // When its completion reaches the real native toast and audio paths + await harness.notify(order); + await harness.advance(500); + + // Then this ordinary foreign-symbol event has no visible or audible effect + assert.deepEqual({ toasts: harness.toasts, audio: harness.audio }, { toasts: [], audio: [] }); + }); + } + + for (const isCM of [false, true]) { + test(`user keeps the matching sound when a native ${isCM ? 'CM' : 'UM'} batch ends with another symbol`, async (t) => { + // Given a single native batch contains a matching event followed by a foreign event + const harness = await createNotificationHarness(t, { soundSourceSha256 }); + const matching = ordinaryNotificationOrder(); + const foreign = ordinaryNotificationOrder({ symbol: 'ETHUSDT', orderId: 43 }); + + // When the account stream delivers both events during the same debounce window + await harness.emitStream([matching, foreign], { isCM }); + await harness.advance(500); + + // Then filtering does not let the unrelated trailing event erase the matching sound + assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); + }); + } + + for (const risk of [ + { name: 'liquidation type', fields: { type: 'LIQUIDATION', orderType: 'LIQUIDATION' }, toast: false }, + { name: 'calculated execution', fields: { operate: 'CALCULATED' }, toast: true }, + { name: 'autoclose client identifier', fields: { clientOrderId: 'autoclose-123' }, toast: true }, + { name: 'ADL client identifier', fields: { clientOrderId: 'adl_autoclose-123' }, toast: true }, + { name: 'settlement client identifier', fields: { clientOrderId: 'settlement_autoclose-123' }, toast: true }, + ]) { + test(`user retains native risk behavior for a foreign-symbol ${risk.name}`, async (t) => { + // Given a foreign symbol carries this native risk discriminator + const harness = await createNotificationHarness(t, { soundSourceSha256 }); + const order = ordinaryNotificationOrder({ symbol: 'ETHUSDT', ...risk.fields }); + + // When the risk event reaches both captured native presentation paths + await harness.notify(order); + await harness.advance(500); + + // Then filtering preserves the original risk toast policy and native sound + assert.equal(harness.toasts.length, risk.toast ? 1 : 0); + assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); + }); + } + + for (const unknown of [ + { name: 'missing client identifier', fields: { clientOrderId: undefined } }, + { name: 'missing symbol', fields: { symbol: undefined } }, + { name: 'malformed symbol', fields: { symbol: 'ETH/USDT' } }, + { name: 'unknown order type', fields: { type: 'UNRECOGNIZED', orderType: 'UNRECOGNIZED' } }, + { name: 'unknown original type', fields: { origType: 'UNRECOGNIZED' } }, + { name: 'unknown execution operation', fields: { operate: 'UNRECOGNIZED' } }, + ]) { + test(`user retains native reminders for an order with ${unknown.name}`, async (t) => { + // Given an event cannot be proven to be an ordinary foreign-symbol order + const harness = await createNotificationHarness(t, { soundSourceSha256 }); + const order = ordinaryNotificationOrder({ symbol: 'ETHUSDT', ...unknown.fields }); + + // When the uncertain payload arrives through both original native paths + await harness.notify(order); + await harness.advance(500); + + // Then its native toast and audio behavior remain visible + assert.equal(harness.toasts.length, 1); + assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); + }); + } + + for (const preferences of [ + { toastEnabled: false, soundEnabled: true }, + { toastEnabled: true, soundEnabled: false }, + { toastEnabled: false, soundEnabled: false }, + ]) { + test(`user keeps native reminder preferences toast=${preferences.toastEnabled} sound=${preferences.soundEnabled}`, async (t) => { + // Given real native preference hooks initialize with the selected switches + const harness = await createNotificationHarness(t, { soundSourceSha256, ...preferences }); + + // When the displayed symbol fills after preference initialization + await harness.notify(ordinaryNotificationOrder()); + await harness.advance(500); + + // Then each original native switch independently controls its presentation + assert.equal(harness.toasts.length, preferences.toastEnabled ? 1 : 0); + assert.deepEqual(harness.audio.map((event) => event.kind), preferences.soundEnabled ? ['load', 'play', 'play'] : []); + }); + } + + test('user sees no stale toast after switching symbol during the native toast delay', async (t) => { + // Given a current-symbol fill is waiting in the native thirty-millisecond throttle + const harness = await createNotificationHarness(t, { soundSourceSha256 }); + await harness.notify(ordinaryNotificationOrder()); + await harness.advance(29); + + // When the page switches symbols before the pending notification is enqueued + harness.navigate('/en/futures/ETHUSDT'); + await harness.advance(1); + await harness.advance(470); + + // Then both delayed presentation paths recheck the current route + assert.deepEqual({ toasts: harness.toasts, audio: harness.audio }, { toasts: [], audio: [] }); + }); - // When the user switches to ETH and its fill queues during the BTC cooldown - harness.navigate('/en/futures/ETHUSDT'); - await harness.notify(ordinaryNotificationOrder({ symbol: 'ETHUSDT', orderId: 43, clientOrderId: 'manual-43' })); - await harness.advance(500); - await harness.advance(1499); + test('user hears no stale audio after switching symbol during the native sound delay', async (t) => { + // Given a current-symbol fill has shown its toast but audio has not started + const harness = await createNotificationHarness(t, { soundSourceSha256 }); + await harness.notify(ordinaryNotificationOrder()); + await harness.advance(499); + assert.equal(harness.toasts.length, 1); - // Then the original cooldown has not played a second notification early - assert.equal(harness.audio.filter((event) => event.kind === 'load').length, 1); + // When the page switches symbols before the native audio deadline + harness.navigate('/en/futures/ETHUSDT'); + await harness.advance(1); - // When the original two-second cooldown completes - await harness.advance(1); + // Then the old symbol cannot begin playback on the new page + assert.deepEqual(harness.audio, []); + }); - // Then it consumes only the played BTC token and ETH still receives its own audio - assert.deepEqual(harness.audio.filter((event) => event.kind === 'load'), [ - { kind: 'load', pathname: '/en/futures/BTCUSDT' }, - { kind: 'load', pathname: '/en/futures/ETHUSDT' }, - ]); -}); + test('user keeps the new-symbol audio queued when the previous-symbol cooldown completes', async (t) => { + // Given BTC has started native audio and owns the active cooldown + const harness = await createNotificationHarness(t, { soundSourceSha256 }); + await harness.notify(ordinaryNotificationOrder()); + await harness.advance(500); + assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); + + // When the user switches to ETH and its fill queues during the BTC cooldown + harness.navigate('/en/futures/ETHUSDT'); + await harness.notify(ordinaryNotificationOrder({ symbol: 'ETHUSDT', orderId: 43, clientOrderId: 'manual-43' })); + await harness.advance(500); + await harness.advance(1499); + + // Then the original cooldown has not played a second notification early + assert.equal(harness.audio.filter((event) => event.kind === 'load').length, 1); + + // When the original two-second cooldown completes + await harness.advance(1); + + // Then it consumes only the played BTC token and ETH still receives its own audio + assert.deepEqual(harness.audio.filter((event) => event.kind === 'load'), [ + { kind: 'load', pathname: '/en/futures/BTCUSDT' }, + { kind: 'load', pathname: '/en/futures/ETHUSDT' }, + ]); + }); -test('user hears no second stale play when the first native play promise resolves after navigation', async (t) => { - // Given the first native audio play is pending on the BTC page - const harness = await createNotificationHarness(t, { firstPlayPending: true }); - await harness.notify(ordinaryNotificationOrder()); - await harness.advance(500); - assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play']); + test('user hears no second stale play when the first native play promise resolves after navigation', async (t) => { + // Given the first native audio play is pending on the BTC page + const harness = await createNotificationHarness(t, { soundSourceSha256, firstPlayPending: true }); + await harness.notify(ordinaryNotificationOrder()); + await harness.advance(500); + assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play']); - // When the route changes before that first play promise resolves - harness.navigate('/en/futures/ETHUSDT'); - await harness.settleFirstPlay(); + // When the route changes before that first play promise resolves + harness.navigate('/en/futures/ETHUSDT'); + await harness.settleFirstPlay(); - // Then the promise continuation cannot replay the old symbol on the new page - assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play']); -}); + // Then the promise continuation cannot replay the old symbol on the new page + assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play']); + }); -for (const driftModule of [39116, 55401]) { - test(`user keeps native sound and string payloads when captured module ${driftModule} drifts`, async (t) => { - // Given only one side of the native sound producer-provider contract can be patched - const harness = await createNotificationHarness(t, { driftModule, inspectSoundQueue: true }); - - // When a foreign-symbol ordinary fill reaches the native sound stream - await harness.notify(ordinaryNotificationOrder({ symbol: 'ETHUSDT' })); - await harness.advance(500); - - // Then sound stays native with its exact string payload while toast filtering remains independent - assert.deepEqual(harness.queueSnapshot(), ['42']); - assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); - assert.deepEqual(harness.toasts, []); - assert.deepEqual(harness.scope.snapshot().modules[driftModule], { - status: 'source_mismatch', reason: 'source_mismatch', attempts: 1, matches: 0, + for (const driftModule of [39116, 55401]) { + test(`user keeps native sound and string payloads when captured module ${driftModule} drifts`, async (t) => { + // Given only one side of the native sound producer-provider contract can be patched + const harness = await createNotificationHarness(t, { soundSourceSha256, driftModule, inspectSoundQueue: true }); + + // When a foreign-symbol ordinary fill reaches the native sound stream + await harness.notify(ordinaryNotificationOrder({ symbol: 'ETHUSDT' })); + await harness.advance(500); + + // Then sound stays native with its exact string payload while toast filtering remains independent + assert.deepEqual(harness.queueSnapshot(), ['42']); + assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); + assert.deepEqual(harness.toasts, []); + assert.deepEqual(harness.scope.snapshot().modules[driftModule], { + status: 'source_mismatch', reason: 'source_mismatch', attempts: 1, matches: 0, + }); + }); + } + + test('user keeps native notification behavior outside a recognized futures symbol route', async (t) => { + // Given the loaded host is on an unsupported non-futures route + const harness = await createNotificationHarness(t, { soundSourceSha256, pathname: '/en/trade/BTC_USDT' }); + + // When an ordinary unrelated-symbol notification arrives + await harness.notify(ordinaryNotificationOrder({ symbol: 'ETHUSDT' })); + await harness.advance(500); + + // Then the scope cannot claim a futures symbol and keeps native presentation + assert.equal(harness.toasts.length, 1); + assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); }); + }); } -test('user keeps native notification behavior outside a recognized futures symbol route', async (t) => { - // Given the loaded host is on an unsupported non-futures route - const harness = await createNotificationHarness(t, { pathname: '/en/trade/BTC_USDT' }); - - // When an ordinary unrelated-symbol notification arrives - await harness.notify(ordinaryNotificationOrder({ symbol: 'ETHUSDT' })); - await harness.advance(500); - - // Then the scope cannot claim a futures symbol and keeps native presentation - assert.equal(harness.toasts.length, 1); - assert.deepEqual(harness.audio.map((event) => event.kind), ['load', 'play', 'play']); -}); - test('user host stream boundary preserves single and batch payload identity and account separation', () => { // Given independent native account subscriptions receive the SDK boundary const streams = createNotificationStreams(); diff --git a/test/fixtures/binance-order-notifications/native-factories.json b/test/fixtures/binance-order-notifications/native-factories.json index 145b6de..c4a0656 100644 --- a/test/fixtures/binance-order-notifications/native-factories.json +++ b/test/fixtures/binance-order-notifications/native-factories.json @@ -265,6 +265,25 @@ "url": "https://bin.bnbstatic.com/static/chunks/32536.f022d7ba.js", "evidence": "Observed resource URL and runtime factory source; complete chunk bytes were not captured." } + }, + { + "chunks": [ + "3314" + ], + "id": "39116", + "source": "39116(D,l,t){\"use strict\";t.d(l,{QZ:()=>p.Q,$$:()=>n,E$:()=>S});var r=t(41594),s=2e3,e=2,n=function(){var E=(0,r.useRef)(null),A=function(O){E.current=setTimeout(function(){O(),E.current&&clearTimeout(E.current),E.current=null},s)};return(0,r.useMemo)(function(){return{interval:E,intervalFunc:A}},[])},i=t(75510),a=t(16921),c=t(72363),d=t(79515),h=t(40477),p=t(70020),T=function(E,A){var O=(0,d.nH)(),m=(0,d.Py)().isExistFutureAccount,y=(0,h.A)(A,500),u=y.run,o=(0,d.ON)().isPM2,f=(0,a.Gw)();(0,r.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!0});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(C){(C.status===\"FILLED\"||C.status===\"PARTIALLY_FILLED\"||C.status===\"EXPIRED\")&&u(String(C.orderId))})})},[u,E,m,O,o,f]),(0,r.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!1});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(C){(C.status===\"FILLED\"||C.status===\"PARTIALLY_FILLED\"||C.status===\"EXPIRED\")&&u(String(C.orderId))})})},[u,E,m,O,o,f])},S=function(){var E=(0,r.useState)(new Date),A=E[0],O=E[1],m=(0,r.useRef)([]),y=(0,p.Q)(),u=y.showNotification,o=y.enableNotification,f=(0,r.useCallback)(function(){var v;(v=m)===null||v===void 0||v.current.shift(),O(new Date)},[]),_=(0,r.useCallback)(function(v){var L;if(u&&((L=m)===null||L===void 0?void 0:L.current.length)p.Q,$$:()=>n,E$:()=>S});var e=t(41594),a=2e3,r=2,n=function(){var E=(0,e.useRef)(null),A=function(O){E.current=setTimeout(function(){O(),E.current&&clearTimeout(E.current),E.current=null},a)};return(0,e.useMemo)(function(){return{interval:E,intervalFunc:A}},[])},i=t(75510),s=t(16921),c=t(72363),d=t(79515),y=t(40477),p=t(70020),T=function(E,A){var O=(0,d.nH)(),m=(0,d.Py)().isExistFutureAccount,g=(0,y.A)(A,500),u=g.run,o=(0,d.ON)().isPM2,f=(0,s.Gw)();(0,e.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!0});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(P){(P.status===\"FILLED\"||P.status===\"PARTIALLY_FILLED\"||P.status===\"EXPIRED\")&&u(String(P.orderId))})})},[u,E,m,O,o,f]),(0,e.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!1});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(P){(P.status===\"FILLED\"||P.status===\"PARTIALLY_FILLED\"||P.status===\"EXPIRED\")&&u(String(P.orderId))})})},[u,E,m,O,o,f])},S=function(){var E=(0,e.useState)(new Date),A=E[0],O=E[1],m=(0,e.useRef)([]),g=(0,p.Q)(),u=g.showNotification,o=g.enableNotification,f=(0,e.useCallback)(function(){var v;(v=m)===null||v===void 0||v.current.shift(),O(new Date)},[]),_=(0,e.useCallback)(function(v){var L;if(u&&((L=m)===null||L===void 0?void 0:L.current.length)p.Q,$$:()=>n,E$:()=>S});var e=t(41594),a=2e3,r=2,n=function(){var E=(0,e.useRef)(null),A=function(O){E.current=setTimeout(function(){O(),E.current&&clearTimeout(E.current),E.current=null},a)};return(0,e.useMemo)(function(){return{interval:E,intervalFunc:A}},[])},i=t(75510),s=t(16921),c=t(72363),d=t(79515),y=t(40477),p=t(70020),T=function(E,A){var O=(0,d.nH)(),m=(0,d.Py)().isExistFutureAccount,g=(0,y.A)(A,500),u=g.run,o=(0,d.ON)().isPM2,f=(0,s.Gw)();(0,e.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!0});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(P){(P.status===\"FILLED\"||P.status===\"PARTIALLY_FILLED\"||P.status===\"EXPIRED\")&&u(String(P.orderId))})})},[u,E,m,O,o,f]),(0,e.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!1});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(P){(P.status===\"FILLED\"||P.status===\"PARTIALLY_FILLED\"||P.status===\"EXPIRED\")&&u(String(P.orderId))})})},[u,E,m,O,o,f])},S=function(){var E=(0,e.useState)(new Date),A=E[0],O=E[1],m=(0,e.useRef)([]),g=(0,p.Q)(),u=g.showNotification,o=g.enableNotification,f=(0,e.useCallback)(function(){var v;(v=m)===null||v===void 0||v.current.shift(),O(new Date)},[]),_=(0,e.useCallback)(function(v){var L;if(u&&((L=m)===null||L===void 0?void 0:L.current.length)i});var e=t(75510),a=t(41594),r=t.n(a),n=function(s,c,d){var y=Array.isArray(c)?c:[],p=typeof c==\"number\"?c:d||0,T=(0,a.useRef)(!1),S=(0,a.useRef)(),E=(0,a.useRef)(s);E.current=s;var A=(0,a.useRef)([]),O=(0,a.useCallback)(function(){S.current&&clearTimeout(S.current),S.current=void 0},[]),m=(0,a.useCallback)(function(){for(var g=arguments.length,u=new Array(g),o=0;oi});var e=t(75510),a=t(41594),r=t.n(a),n=function(s,c,d){var y=Array.isArray(c)?c:[],p=typeof c==\"number\"?c:d||0,T=(0,a.useRef)(!1),S=(0,a.useRef)(),E=(0,a.useRef)(s);E.current=s;var A=(0,a.useRef)([]),O=(0,a.useCallback)(function(){S.current&&clearTimeout(S.current),S.current=void 0},[]),m=(0,a.useCallback)(function(){for(var g=arguments.length,u=new Array(g),o=0;oN,z:()=>o});var r=e(41594),a=e.n(r),T=e(61523),p=e(92873),P=e(64041),b=e(17409),S=e(51471),E=e(40477),$=\"trd-openOrder\",G=function(c){return(0,p.o)($,c)},o=function(){var c=(0,S.zr)(\"open_order_status_toast\",!0),h=c.data,R=c.setData,K=c.hasInitialized,x=(0,r.useCallback)(function(){R(!h)},[h,R]);return{enableToast:K?h:!1,toggleToast:x}},N=function(){var c=G().getI18n,h=(0,P.h)().enqueueNotification,R=o().enableToast,K=(0,E.A)(h,30),x=K.run,i=(0,T.d4)(function(l){return l.setting.layout}),d=(0,r.useMemo)(function(){return i===b.a0},[i]),A=(0,r.useCallback)(function(l){var D=l.side.toUpperCase(),Y=l.type.replace(/[-_]/g,\"\");return\"\".concat(D).concat(Y)},[]),g=(0,r.useCallback)(function(l){if(!(l.type===\"LIQUIDATION\"||!R)){var D=A(l),Y=c(\"\".concat(D,\"CancelTitle\"),{defaultValue:\"\".concat(l.type,\" \").concat(l.side,\" Order Canceled\")});x(Y)}},[A,c,x,R]),C=(0,r.useCallback)(function(l){if(!(l.type===\"LIQUIDATION\"||!R)){var D=A(l),Y=c(\"\".concat(D,\"FillTitle\"),{defaultValue:\"\".concat(l.type,\" \").concat(l.side,\" Order Filled\")});x(Y,{variant:\"success\"})}},[A,c,x,R]),I=(0,r.useCallback)(function(l){if(!(l.type===\"LIQUIDATION\"||!R)){var D=A(l),Y=c(\"\".concat(D,\"PFTitle\"),{defaultValue:\"\".concat(l.type,\" \").concat(l.side,\" Order Partially Filled\")});x(Y,{variant:\"success\"})}},[A,c,x,R]);return(0,r.useMemo)(function(){return{cancelOrderNotify:g,fillOrderNotify:C,fillOrderPartNotify:I}},[g,C,I])}}" + "source": "30877(be,W,e){e.d(W,{F:()=>N,z:()=>o});var r=e(41594),a=e.n(r),T=e(61523),p=e(92873),P=e(64041),b=e(17409),S=e(51471),E=e(40477),$=\"trd-openOrder\",G=function(c){return(0,p.o)($,c)},o=function(){var c=(0,S.zr)(\"open_order_status_toast\",!0),h=c.data,R=c.setData,K=c.hasInitialized,x=(0,r.useCallback)(function(){R(!h)},[h,R]);return{enableToast:K?h:!1,toggleToast:x}},N=function(){var c=G().getI18n,h=(0,P.h)().enqueueNotification,R=o().enableToast,K=(0,E.A)(h,30),x=K.run,i=(0,T.d4)(function(l){return l.setting.layout}),d=(0,r.useMemo)(function(){return i===b.a0},[i]),A=(0,r.useCallback)(function(l){var D=l.side.toUpperCase(),Y=l.type.replace(/[-_]/g,\"\");return\"\".concat(D).concat(Y)},[]),g=(0,r.useCallback)(function(l){if(!(l.type===\"LIQUIDATION\"||!R)){var D=A(l),Y=c(\"\".concat(D,\"CancelTitle\"),{defaultValue:\"\".concat(l.type,\" \").concat(l.side,\" Order Canceled\")});x(Y)}},[A,c,x,R]),C=(0,r.useCallback)(function(l){if(!(l.type===\"LIQUIDATION\"||!R)){var D=A(l),Y=c(\"\".concat(D,\"FillTitle\"),{defaultValue:\"\".concat(l.type,\" \").concat(l.side,\" Order Filled\")});x(Y,{variant:\"success\"})}},[A,c,x,R]),I=(0,r.useCallback)(function(l){if(!(l.type===\"LIQUIDATION\"||!R)){var D=A(l),Y=c(\"\".concat(D,\"PFTitle\"),{defaultValue:\"\".concat(l.type,\" \").concat(l.side,\" Order Partially Filled\")});x(Y,{variant:\"success\"})}},[A,c,x,R]);return(0,r.useMemo)(function(){return{cancelOrderNotify:g,fillOrderNotify:C,fillOrderPartNotify:I}},[g,C,I])}}", + "sha256": "8eaee3ce87f001f8530992b2ea4ce99ee632ef902f129e79c76d6b1268b4de1a" }, { "id": "30877", "chunks": [ "24132" ], - "source": "30877(V,b,e){e.d(b,{F:()=>m,z:()=>I});var r=e(41594),A=e.n(r),s=e(61523),f=e(92873),v=e(64041),o=e(17409),l=e(51471),P=e(40477),k=\"trd-openOrder\",y=function(g){return(0,f.o)(k,g)},I=function(){var g=(0,l.zr)(\"open_order_status_toast\",!0),_=g.data,F=g.setData,R=g.hasInitialized,L=(0,r.useCallback)(function(){F(!_)},[_,F]);return{enableToast:R?_:!1,toggleToast:L}},m=function(){var g=y().getI18n,_=(0,v.h)().enqueueNotification,F=I().enableToast,R=(0,P.A)(_,30),L=R.run,a=(0,s.d4)(function(i){return i.setting.layout}),M=(0,r.useMemo)(function(){return a===o.a0},[a]),C=(0,r.useCallback)(function(i){var S=i.side.toUpperCase(),T=i.type.replace(/[-_]/g,\"\");return\"\".concat(S).concat(T)},[]),c=(0,r.useCallback)(function(i){if(!(i.type===\"LIQUIDATION\"||!F)){var S=C(i),T=g(\"\".concat(S,\"CancelTitle\"),{defaultValue:\"\".concat(i.type,\" \").concat(i.side,\" Order Canceled\")});L(T)}},[C,g,L,F]),u=(0,r.useCallback)(function(i){if(!(i.type===\"LIQUIDATION\"||!F)){var S=C(i),T=g(\"\".concat(S,\"FillTitle\"),{defaultValue:\"\".concat(i.type,\" \").concat(i.side,\" Order Filled\")});L(T,{variant:\"success\"})}},[C,g,L,F]),h=(0,r.useCallback)(function(i){if(!(i.type===\"LIQUIDATION\"||!F)){var S=C(i),T=g(\"\".concat(S,\"PFTitle\"),{defaultValue:\"\".concat(i.type,\" \").concat(i.side,\" Order Partially Filled\")});L(T,{variant:\"success\"})}},[C,g,L,F]);return(0,r.useMemo)(function(){return{cancelOrderNotify:c,fillOrderNotify:u,fillOrderPartNotify:h}},[c,u,h])}}" + "source": "30877(V,b,e){e.d(b,{F:()=>m,z:()=>I});var r=e(41594),A=e.n(r),s=e(61523),f=e(92873),v=e(64041),o=e(17409),l=e(51471),P=e(40477),k=\"trd-openOrder\",y=function(g){return(0,f.o)(k,g)},I=function(){var g=(0,l.zr)(\"open_order_status_toast\",!0),_=g.data,F=g.setData,R=g.hasInitialized,L=(0,r.useCallback)(function(){F(!_)},[_,F]);return{enableToast:R?_:!1,toggleToast:L}},m=function(){var g=y().getI18n,_=(0,v.h)().enqueueNotification,F=I().enableToast,R=(0,P.A)(_,30),L=R.run,a=(0,s.d4)(function(i){return i.setting.layout}),M=(0,r.useMemo)(function(){return a===o.a0},[a]),C=(0,r.useCallback)(function(i){var S=i.side.toUpperCase(),T=i.type.replace(/[-_]/g,\"\");return\"\".concat(S).concat(T)},[]),c=(0,r.useCallback)(function(i){if(!(i.type===\"LIQUIDATION\"||!F)){var S=C(i),T=g(\"\".concat(S,\"CancelTitle\"),{defaultValue:\"\".concat(i.type,\" \").concat(i.side,\" Order Canceled\")});L(T)}},[C,g,L,F]),u=(0,r.useCallback)(function(i){if(!(i.type===\"LIQUIDATION\"||!F)){var S=C(i),T=g(\"\".concat(S,\"FillTitle\"),{defaultValue:\"\".concat(i.type,\" \").concat(i.side,\" Order Filled\")});L(T,{variant:\"success\"})}},[C,g,L,F]),h=(0,r.useCallback)(function(i){if(!(i.type===\"LIQUIDATION\"||!F)){var S=C(i),T=g(\"\".concat(S,\"PFTitle\"),{defaultValue:\"\".concat(i.type,\" \").concat(i.side,\" Order Partially Filled\")});L(T,{variant:\"success\"})}},[C,g,L,F]);return(0,r.useMemo)(function(){return{cancelOrderNotify:c,fillOrderNotify:u,fillOrderPartNotify:h}},[c,u,h])}}", + "sha256": "faec1b3eb9f86a4e7087128f8fd3b74a210581c9988a0041c909a848cfb0ae0f" }, { "id": "30877", "chunks": [ "57898" ], - "source": "30877(K,T,e){e.d(T,{F:()=>i,z:()=>E});var t=e(41594),r=e.n(t),n=e(61523),s=e(92873),g=e(64041),c=e(17409),h=e(51471),p=e(40477),b=\"trd-openOrder\",S=function(y){return(0,s.o)(b,y)},E=function(){var y=(0,h.zr)(\"open_order_status_toast\",!0),C=y.data,f=y.setData,I=y.hasInitialized,d=(0,t.useCallback)(function(){f(!C)},[C,f]);return{enableToast:I?C:!1,toggleToast:d}},i=function(){var y=S().getI18n,C=(0,g.h)().enqueueNotification,f=E().enableToast,I=(0,p.A)(C,30),d=I.run,P=(0,n.d4)(function(a){return a.setting.layout}),M=(0,t.useMemo)(function(){return P===c.a0},[P]),k=(0,t.useCallback)(function(a){var o=a.side.toUpperCase(),u=a.type.replace(/[-_]/g,\"\");return\"\".concat(o).concat(u)},[]),A=(0,t.useCallback)(function(a){if(!(a.type===\"LIQUIDATION\"||!f)){var o=k(a),u=y(\"\".concat(o,\"CancelTitle\"),{defaultValue:\"\".concat(a.type,\" \").concat(a.side,\" Order Canceled\")});d(u)}},[k,y,d,f]),O=(0,t.useCallback)(function(a){if(!(a.type===\"LIQUIDATION\"||!f)){var o=k(a),u=y(\"\".concat(o,\"FillTitle\"),{defaultValue:\"\".concat(a.type,\" \").concat(a.side,\" Order Filled\")});d(u,{variant:\"success\"})}},[k,y,d,f]),x=(0,t.useCallback)(function(a){if(!(a.type===\"LIQUIDATION\"||!f)){var o=k(a),u=y(\"\".concat(o,\"PFTitle\"),{defaultValue:\"\".concat(a.type,\" \").concat(a.side,\" Order Partially Filled\")});d(u,{variant:\"success\"})}},[k,y,d,f]);return(0,t.useMemo)(function(){return{cancelOrderNotify:A,fillOrderNotify:O,fillOrderPartNotify:x}},[A,O,x])}}" + "source": "30877(K,T,e){e.d(T,{F:()=>i,z:()=>E});var t=e(41594),r=e.n(t),n=e(61523),s=e(92873),g=e(64041),c=e(17409),h=e(51471),p=e(40477),b=\"trd-openOrder\",S=function(y){return(0,s.o)(b,y)},E=function(){var y=(0,h.zr)(\"open_order_status_toast\",!0),C=y.data,f=y.setData,I=y.hasInitialized,d=(0,t.useCallback)(function(){f(!C)},[C,f]);return{enableToast:I?C:!1,toggleToast:d}},i=function(){var y=S().getI18n,C=(0,g.h)().enqueueNotification,f=E().enableToast,I=(0,p.A)(C,30),d=I.run,P=(0,n.d4)(function(a){return a.setting.layout}),M=(0,t.useMemo)(function(){return P===c.a0},[P]),k=(0,t.useCallback)(function(a){var o=a.side.toUpperCase(),u=a.type.replace(/[-_]/g,\"\");return\"\".concat(o).concat(u)},[]),A=(0,t.useCallback)(function(a){if(!(a.type===\"LIQUIDATION\"||!f)){var o=k(a),u=y(\"\".concat(o,\"CancelTitle\"),{defaultValue:\"\".concat(a.type,\" \").concat(a.side,\" Order Canceled\")});d(u)}},[k,y,d,f]),O=(0,t.useCallback)(function(a){if(!(a.type===\"LIQUIDATION\"||!f)){var o=k(a),u=y(\"\".concat(o,\"FillTitle\"),{defaultValue:\"\".concat(a.type,\" \").concat(a.side,\" Order Filled\")});d(u,{variant:\"success\"})}},[k,y,d,f]),x=(0,t.useCallback)(function(a){if(!(a.type===\"LIQUIDATION\"||!f)){var o=k(a),u=y(\"\".concat(o,\"PFTitle\"),{defaultValue:\"\".concat(a.type,\" \").concat(a.side,\" Order Partially Filled\")});d(u,{variant:\"success\"})}},[k,y,d,f]);return(0,t.useMemo)(function(){return{cancelOrderNotify:A,fillOrderNotify:O,fillOrderPartNotify:x}},[A,O,x])}}", + "sha256": "ab507602d8d3533b30239e7eadc4b2d53392dd18a2af5da4539f35feacdac2c6" }, { "id": "55401", "chunks": [ "29042" ], - "source": "55401(S,f,o){o.r(f),o.d(f,{SoundNotificationProvider:()=>C});var c=o(31085),e=o(41594),x=o(17409),s=o(39116),E=function(a){var r,n;(r=a)===null||r===void 0||r.load();var u=(n=a)===null||n===void 0?void 0:n.play();u&&u.then(function(){var t;(t=a)===null||t===void 0||t.play()}).catch(function(){})},C=function(a){var r=a.children,n=(0,s.$$)(),u=n.interval,t=n.intervalFunc,h=(0,e.useRef)(null),N=(0,s.QZ)(),p=N.enableNotification,m=N.showNotification,d=(0,s.E$)(),l=d.notifications,P=d.lastNotifyTime,y=d.popNotification,j=(0,e.useCallback)(function(){var i,v=(i=h)===null||i===void 0?void 0:i.current;v&&(v.src=\"\".concat(x.K5,\"/static/spot-trade-ui/trade-sound.mp3\"),E(v),t(y))},[t,y]);return(0,e.useEffect)(function(){var i;(!m||!p)&&(l.current=[]),l&&((i=l)===null||i===void 0?void 0:i.current.length)>0&&(u.current||j())},[P,p,j,l,u,m]),(0,c.jsxs)(\"div\",{children:[r,(0,c.jsx)(\"div\",{children:(0,c.jsx)(\"audio\",{ref:h,children:(0,c.jsx)(\"source\",{src:\"\"})})})]})}}" + "source": "55401(S,f,o){o.r(f),o.d(f,{SoundNotificationProvider:()=>C});var c=o(31085),e=o(41594),x=o(17409),s=o(39116),E=function(a){var r,n;(r=a)===null||r===void 0||r.load();var u=(n=a)===null||n===void 0?void 0:n.play();u&&u.then(function(){var t;(t=a)===null||t===void 0||t.play()}).catch(function(){})},C=function(a){var r=a.children,n=(0,s.$$)(),u=n.interval,t=n.intervalFunc,h=(0,e.useRef)(null),N=(0,s.QZ)(),p=N.enableNotification,m=N.showNotification,d=(0,s.E$)(),l=d.notifications,P=d.lastNotifyTime,y=d.popNotification,j=(0,e.useCallback)(function(){var i,v=(i=h)===null||i===void 0?void 0:i.current;v&&(v.src=\"\".concat(x.K5,\"/static/spot-trade-ui/trade-sound.mp3\"),E(v),t(y))},[t,y]);return(0,e.useEffect)(function(){var i;(!m||!p)&&(l.current=[]),l&&((i=l)===null||i===void 0?void 0:i.current.length)>0&&(u.current||j())},[P,p,j,l,u,m]),(0,c.jsxs)(\"div\",{children:[r,(0,c.jsx)(\"div\",{children:(0,c.jsx)(\"audio\",{ref:h,children:(0,c.jsx)(\"source\",{src:\"\"})})})]})}}", + "sha256": "98094af191e88c1637017da1ba05037fa1fb4c39a7028dc8e35d0aa1c39c2a3e" }, { "id": "30877", "chunks": [ "57276" ], - "source": "30877(Y,T,e){e.d(T,{F:()=>o,z:()=>N});var a=e(41594),k=e.n(a),P=e(61523),l=e(92873),O=e(64041),C=e(17409),h=e(51471),M=e(40477),p=\"trd-openOrder\",R=function(n){return(0,l.o)(p,n)},N=function(){var n=(0,h.zr)(\"open_order_status_toast\",!0),c=n.data,i=n.setData,F=n.hasInitialized,u=(0,a.useCallback)(function(){i(!c)},[c,i]);return{enableToast:F?c:!1,toggleToast:u}},o=function(){var n=R().getI18n,c=(0,O.h)().enqueueNotification,i=N().enableToast,F=(0,M.A)(c,30),u=F.run,L=(0,P.d4)(function(r){return r.setting.layout}),g=(0,a.useMemo)(function(){return L===C.a0},[L]),I=(0,a.useCallback)(function(r){var d=r.side.toUpperCase(),f=r.type.replace(/[-_]/g,\"\");return\"\".concat(d).concat(f)},[]),S=(0,a.useCallback)(function(r){if(!(r.type===\"LIQUIDATION\"||!i)){var d=I(r),f=n(\"\".concat(d,\"CancelTitle\"),{defaultValue:\"\".concat(r.type,\" \").concat(r.side,\" Order Canceled\")});u(f)}},[I,n,u,i]),A=(0,a.useCallback)(function(r){if(!(r.type===\"LIQUIDATION\"||!i)){var d=I(r),f=n(\"\".concat(d,\"FillTitle\"),{defaultValue:\"\".concat(r.type,\" \").concat(r.side,\" Order Filled\")});u(f,{variant:\"success\"})}},[I,n,u,i]),Q=(0,a.useCallback)(function(r){if(!(r.type===\"LIQUIDATION\"||!i)){var d=I(r),f=n(\"\".concat(d,\"PFTitle\"),{defaultValue:\"\".concat(r.type,\" \").concat(r.side,\" Order Partially Filled\")});u(f,{variant:\"success\"})}},[I,n,u,i]);return(0,a.useMemo)(function(){return{cancelOrderNotify:S,fillOrderNotify:A,fillOrderPartNotify:Q}},[S,A,Q])}}" + "source": "30877(Y,T,e){e.d(T,{F:()=>o,z:()=>N});var a=e(41594),k=e.n(a),P=e(61523),l=e(92873),O=e(64041),C=e(17409),h=e(51471),M=e(40477),p=\"trd-openOrder\",R=function(n){return(0,l.o)(p,n)},N=function(){var n=(0,h.zr)(\"open_order_status_toast\",!0),c=n.data,i=n.setData,F=n.hasInitialized,u=(0,a.useCallback)(function(){i(!c)},[c,i]);return{enableToast:F?c:!1,toggleToast:u}},o=function(){var n=R().getI18n,c=(0,O.h)().enqueueNotification,i=N().enableToast,F=(0,M.A)(c,30),u=F.run,L=(0,P.d4)(function(r){return r.setting.layout}),g=(0,a.useMemo)(function(){return L===C.a0},[L]),I=(0,a.useCallback)(function(r){var d=r.side.toUpperCase(),f=r.type.replace(/[-_]/g,\"\");return\"\".concat(d).concat(f)},[]),S=(0,a.useCallback)(function(r){if(!(r.type===\"LIQUIDATION\"||!i)){var d=I(r),f=n(\"\".concat(d,\"CancelTitle\"),{defaultValue:\"\".concat(r.type,\" \").concat(r.side,\" Order Canceled\")});u(f)}},[I,n,u,i]),A=(0,a.useCallback)(function(r){if(!(r.type===\"LIQUIDATION\"||!i)){var d=I(r),f=n(\"\".concat(d,\"FillTitle\"),{defaultValue:\"\".concat(r.type,\" \").concat(r.side,\" Order Filled\")});u(f,{variant:\"success\"})}},[I,n,u,i]),Q=(0,a.useCallback)(function(r){if(!(r.type===\"LIQUIDATION\"||!i)){var d=I(r),f=n(\"\".concat(d,\"PFTitle\"),{defaultValue:\"\".concat(r.type,\" \").concat(r.side,\" Order Partially Filled\")});u(f,{variant:\"success\"})}},[I,n,u,i]);return(0,a.useMemo)(function(){return{cancelOrderNotify:S,fillOrderNotify:A,fillOrderPartNotify:Q}},[S,A,Q])}}", + "sha256": "7465bd6eac312fcc597b231b916795bf0daaf51e01191f60e6a6c2b6adeabdba" }, { "id": "34122", "chunks": [ "57276" ], - "source": "34122(Y,T,e){e.r(T),e.d(T,{OrderToastNotifyRegister:()=>N,OrderToastSwitch:()=>R});var a=e(31085),k=e(41594),P=e.n(k),l=e(71822),O=e(88478),C=e(48651),h=e(30877),M=e(34175),p=e(10157),R=function(){var o=(0,h.z)(),n=o.enableToast,c=o.toggleToast,i=(0,C.ud)().getI18n;return(0,a.jsxs)(\"div\",{className:p.XE,onClick:c,children:[(0,a.jsx)(\"div\",{className:p.IG,children:i(\"orderToastReminder\",{defaultValue:\"Toast Reminder\"})}),(0,a.jsx)(O.A,{size:\"small\",checked:n})]})},N=function(){var o=(0,h.F)();return(0,k.useEffect)(function(){var n=[l.J.on(\"NEW\",M.Zu),l.J.on(\"PARTIALLY_FILLED\",o.fillOrderPartNotify),l.J.on(\"CANCELED\",o.cancelOrderNotify),l.J.on(\"FILLED\",o.fillOrderNotify),l.J.on(\"FILLED_NORMAL_ORDER\",o.fillOrderNotify)];return function(){return n.forEach(function(c){return c()})}},[o]),null}}" + "source": "34122(Y,T,e){e.r(T),e.d(T,{OrderToastNotifyRegister:()=>N,OrderToastSwitch:()=>R});var a=e(31085),k=e(41594),P=e.n(k),l=e(71822),O=e(88478),C=e(48651),h=e(30877),M=e(34175),p=e(10157),R=function(){var o=(0,h.z)(),n=o.enableToast,c=o.toggleToast,i=(0,C.ud)().getI18n;return(0,a.jsxs)(\"div\",{className:p.XE,onClick:c,children:[(0,a.jsx)(\"div\",{className:p.IG,children:i(\"orderToastReminder\",{defaultValue:\"Toast Reminder\"})}),(0,a.jsx)(O.A,{size:\"small\",checked:n})]})},N=function(){var o=(0,h.F)();return(0,k.useEffect)(function(){var n=[l.J.on(\"NEW\",M.Zu),l.J.on(\"PARTIALLY_FILLED\",o.fillOrderPartNotify),l.J.on(\"CANCELED\",o.cancelOrderNotify),l.J.on(\"FILLED\",o.fillOrderNotify),l.J.on(\"FILLED_NORMAL_ORDER\",o.fillOrderNotify)];return function(){return n.forEach(function(c){return c()})}},[o]),null}}", + "sha256": "f036bb5b69da48fe84b75664e4e05079e1953baf0406dabdc60e07f3d716b492" }, { "id": "30877", "chunks": [ "76905" ], - "source": "30877(L,T,e){e.d(T,{F:()=>_,z:()=>v});var r=e(41594),x=e.n(r),O=e(61523),h=e(92873),p=e(64041),k=e(17409),C=e(51471),I=e(40477),g=\"trd-openOrder\",f=function(s){return(0,h.o)(g,s)},v=function(){var s=(0,C.zr)(\"open_order_status_toast\",!0),c=s.data,o=s.setData,d=s.hasInitialized,n=(0,r.useCallback)(function(){o(!c)},[c,o]);return{enableToast:d?c:!1,toggleToast:n}},_=function(){var s=f().getI18n,c=(0,p.h)().enqueueNotification,o=v().enableToast,d=(0,I.A)(c,30),n=d.run,a=(0,O.d4)(function(t){return t.setting.layout}),S=(0,r.useMemo)(function(){return a===k.a0},[a]),i=(0,r.useCallback)(function(t){var l=t.side.toUpperCase(),u=t.type.replace(/[-_]/g,\"\");return\"\".concat(l).concat(u)},[]),y=(0,r.useCallback)(function(t){if(!(t.type===\"LIQUIDATION\"||!o)){var l=i(t),u=s(\"\".concat(l,\"CancelTitle\"),{defaultValue:\"\".concat(t.type,\" \").concat(t.side,\" Order Canceled\")});n(u)}},[i,s,n,o]),F=(0,r.useCallback)(function(t){if(!(t.type===\"LIQUIDATION\"||!o)){var l=i(t),u=s(\"\".concat(l,\"FillTitle\"),{defaultValue:\"\".concat(t.type,\" \").concat(t.side,\" Order Filled\")});n(u,{variant:\"success\"})}},[i,s,n,o]),m=(0,r.useCallback)(function(t){if(!(t.type===\"LIQUIDATION\"||!o)){var l=i(t),u=s(\"\".concat(l,\"PFTitle\"),{defaultValue:\"\".concat(t.type,\" \").concat(t.side,\" Order Partially Filled\")});n(u,{variant:\"success\"})}},[i,s,n,o]);return(0,r.useMemo)(function(){return{cancelOrderNotify:y,fillOrderNotify:F,fillOrderPartNotify:m}},[y,F,m])}}" + "source": "30877(L,T,e){e.d(T,{F:()=>_,z:()=>v});var r=e(41594),x=e.n(r),O=e(61523),h=e(92873),p=e(64041),k=e(17409),C=e(51471),I=e(40477),g=\"trd-openOrder\",f=function(s){return(0,h.o)(g,s)},v=function(){var s=(0,C.zr)(\"open_order_status_toast\",!0),c=s.data,o=s.setData,d=s.hasInitialized,n=(0,r.useCallback)(function(){o(!c)},[c,o]);return{enableToast:d?c:!1,toggleToast:n}},_=function(){var s=f().getI18n,c=(0,p.h)().enqueueNotification,o=v().enableToast,d=(0,I.A)(c,30),n=d.run,a=(0,O.d4)(function(t){return t.setting.layout}),S=(0,r.useMemo)(function(){return a===k.a0},[a]),i=(0,r.useCallback)(function(t){var l=t.side.toUpperCase(),u=t.type.replace(/[-_]/g,\"\");return\"\".concat(l).concat(u)},[]),y=(0,r.useCallback)(function(t){if(!(t.type===\"LIQUIDATION\"||!o)){var l=i(t),u=s(\"\".concat(l,\"CancelTitle\"),{defaultValue:\"\".concat(t.type,\" \").concat(t.side,\" Order Canceled\")});n(u)}},[i,s,n,o]),F=(0,r.useCallback)(function(t){if(!(t.type===\"LIQUIDATION\"||!o)){var l=i(t),u=s(\"\".concat(l,\"FillTitle\"),{defaultValue:\"\".concat(t.type,\" \").concat(t.side,\" Order Filled\")});n(u,{variant:\"success\"})}},[i,s,n,o]),m=(0,r.useCallback)(function(t){if(!(t.type===\"LIQUIDATION\"||!o)){var l=i(t),u=s(\"\".concat(l,\"PFTitle\"),{defaultValue:\"\".concat(t.type,\" \").concat(t.side,\" Order Partially Filled\")});n(u,{variant:\"success\"})}},[i,s,n,o]);return(0,r.useMemo)(function(){return{cancelOrderNotify:y,fillOrderNotify:F,fillOrderPartNotify:m}},[y,F,m])}}", + "sha256": "1f40d63c4f3f27799bd34fd93ece8686c6b276741d62f37d928cdcba858ec53f" }, { "id": "30877", "chunks": [ "49426" ], - "source": "30877(R,T,e){e.d(T,{F:()=>y,z:()=>D});var t=e(41594),O=e.n(t),u=e(61523),i=e(92873),m=e(64041),d=e(17409),f=e(51471),a=e(40477),o=\"trd-openOrder\",b=function(S){return(0,i.o)(o,S)},D=function(){var S=(0,f.zr)(\"open_order_status_toast\",!0),M=S.data,P=S.setData,N=S.hasInitialized,_=(0,t.useCallback)(function(){P(!M)},[M,P]);return{enableToast:N?M:!1,toggleToast:_}},y=function(){var S=b().getI18n,M=(0,m.h)().enqueueNotification,P=D().enableToast,N=(0,a.A)(M,30),_=N.run,v=(0,u.d4)(function(n){return n.setting.layout}),l=(0,t.useMemo)(function(){return v===d.a0},[v]),s=(0,t.useCallback)(function(n){var g=n.side.toUpperCase(),c=n.type.replace(/[-_]/g,\"\");return\"\".concat(g).concat(c)},[]),r=(0,t.useCallback)(function(n){if(!(n.type===\"LIQUIDATION\"||!P)){var g=s(n),c=S(\"\".concat(g,\"CancelTitle\"),{defaultValue:\"\".concat(n.type,\" \").concat(n.side,\" Order Canceled\")});_(c)}},[s,S,_,P]),p=(0,t.useCallback)(function(n){if(!(n.type===\"LIQUIDATION\"||!P)){var g=s(n),c=S(\"\".concat(g,\"FillTitle\"),{defaultValue:\"\".concat(n.type,\" \").concat(n.side,\" Order Filled\")});_(c,{variant:\"success\"})}},[s,S,_,P]),h=(0,t.useCallback)(function(n){if(!(n.type===\"LIQUIDATION\"||!P)){var g=s(n),c=S(\"\".concat(g,\"PFTitle\"),{defaultValue:\"\".concat(n.type,\" \").concat(n.side,\" Order Partially Filled\")});_(c,{variant:\"success\"})}},[s,S,_,P]);return(0,t.useMemo)(function(){return{cancelOrderNotify:r,fillOrderNotify:p,fillOrderPartNotify:h}},[r,p,h])}}" + "source": "30877(R,T,e){e.d(T,{F:()=>y,z:()=>D});var t=e(41594),O=e.n(t),u=e(61523),i=e(92873),m=e(64041),d=e(17409),f=e(51471),a=e(40477),o=\"trd-openOrder\",b=function(S){return(0,i.o)(o,S)},D=function(){var S=(0,f.zr)(\"open_order_status_toast\",!0),M=S.data,P=S.setData,N=S.hasInitialized,_=(0,t.useCallback)(function(){P(!M)},[M,P]);return{enableToast:N?M:!1,toggleToast:_}},y=function(){var S=b().getI18n,M=(0,m.h)().enqueueNotification,P=D().enableToast,N=(0,a.A)(M,30),_=N.run,v=(0,u.d4)(function(n){return n.setting.layout}),l=(0,t.useMemo)(function(){return v===d.a0},[v]),s=(0,t.useCallback)(function(n){var g=n.side.toUpperCase(),c=n.type.replace(/[-_]/g,\"\");return\"\".concat(g).concat(c)},[]),r=(0,t.useCallback)(function(n){if(!(n.type===\"LIQUIDATION\"||!P)){var g=s(n),c=S(\"\".concat(g,\"CancelTitle\"),{defaultValue:\"\".concat(n.type,\" \").concat(n.side,\" Order Canceled\")});_(c)}},[s,S,_,P]),p=(0,t.useCallback)(function(n){if(!(n.type===\"LIQUIDATION\"||!P)){var g=s(n),c=S(\"\".concat(g,\"FillTitle\"),{defaultValue:\"\".concat(n.type,\" \").concat(n.side,\" Order Filled\")});_(c,{variant:\"success\"})}},[s,S,_,P]),h=(0,t.useCallback)(function(n){if(!(n.type===\"LIQUIDATION\"||!P)){var g=s(n),c=S(\"\".concat(g,\"PFTitle\"),{defaultValue:\"\".concat(n.type,\" \").concat(n.side,\" Order Partially Filled\")});_(c,{variant:\"success\"})}},[s,S,_,P]);return(0,t.useMemo)(function(){return{cancelOrderNotify:r,fillOrderNotify:p,fillOrderPartNotify:h}},[r,p,h])}}", + "sha256": "a25ce74a214c9e2b80bc7141b20fe798c7fbc30bcb4f79c0a9c363b4cca7119f" }, { "id": "73335", "chunks": [ "40026" ], - "source": "73335(ve,C,o){/**\n * @license React\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */var O=o(41594),S=Symbol.for(\"react.element\"),w=Symbol.for(\"react.fragment\"),Q=Object.prototype.hasOwnProperty,Y=O.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,H={key:!0,ref:!0,__self:!0,__source:!0};function oe(B,$,z){var D,P={},F=null,ae=null;z!==void 0&&(F=\"\"+z),$.key!==void 0&&(F=\"\"+$.key),$.ref!==void 0&&(ae=$.ref);for(D in $)Q.call($,D)&&!H.hasOwnProperty(D)&&(P[D]=$[D]);if(B&&B.defaultProps)for(D in $=B.defaultProps,$)P[D]===void 0&&(P[D]=$[D]);return{$$typeof:S,type:B,key:F,ref:ae,props:P,_owner:Y.current}}C.Fragment=w,C.jsx=oe,C.jsxs=oe}" + "source": "73335(ve,C,o){/**\n * @license React\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */var O=o(41594),S=Symbol.for(\"react.element\"),w=Symbol.for(\"react.fragment\"),Q=Object.prototype.hasOwnProperty,Y=O.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,H={key:!0,ref:!0,__self:!0,__source:!0};function oe(B,$,z){var D,P={},F=null,ae=null;z!==void 0&&(F=\"\"+z),$.key!==void 0&&(F=\"\"+$.key),$.ref!==void 0&&(ae=$.ref);for(D in $)Q.call($,D)&&!H.hasOwnProperty(D)&&(P[D]=$[D]);if(B&&B.defaultProps)for(D in $=B.defaultProps,$)P[D]===void 0&&(P[D]=$[D]);return{$$typeof:S,type:B,key:F,ref:ae,props:P,_owner:Y.current}}C.Fragment=w,C.jsx=oe,C.jsxs=oe}", + "sha256": "45e3ee5e33406e46329e7f641af069ba469481d4a3d003ebae8af2a46df77e94" }, { "id": "22584", "chunks": [ "67656" ], - "source": "22584(_,y,e){\"use strict\";e.d(y,{b:()=>i});var t=e(94917),i=function r(){\"use strict\";var a=this;(0,t._)(this,r),this.cbs={},this.on=function(s,n){var o=a;return a.cbs[s]||(a.cbs[s]=[]),a.cbs[s].push(n),function(){return o.off(s,n)}},this.off=function(s,n){a.cbs[s]||(a.cbs[s]=[]),a.cbs[s]=a.cbs[s].filter(function(o){return o!==n})},this.emit=function(s,n){a.cbs[s]||(a.cbs[s]=[]),a.cbs[s].forEach(function(o){return typeof o==\"function\"&&o(n)})}}}" + "source": "22584(_,y,e){\"use strict\";e.d(y,{b:()=>i});var t=e(94917),i=function r(){\"use strict\";var a=this;(0,t._)(this,r),this.cbs={},this.on=function(s,n){var o=a;return a.cbs[s]||(a.cbs[s]=[]),a.cbs[s].push(n),function(){return o.off(s,n)}},this.off=function(s,n){a.cbs[s]||(a.cbs[s]=[]),a.cbs[s]=a.cbs[s].filter(function(o){return o!==n})},this.emit=function(s,n){a.cbs[s]||(a.cbs[s]=[]),a.cbs[s].forEach(function(o){return typeof o==\"function\"&&o(n)})}}}", + "sha256": "dbb8a7a3bddd76408b5382a0f20a6ee7ad45d09ad61ce2168c3de799aafd2f9b" }, { "id": "5558", "chunks": [ "32536" ], - "source": "5558(ee,K,t){t.d(K,{$Q:()=>T,Ai:()=>S,CC:()=>R,H9:()=>h,Ub:()=>O,cg:()=>A,qS:()=>F});var P=t(61489),n=t(37230),o=t(53548);const S={symbol:\"s\",clientOrderId:\"c\",side:\"S\",orderType:\"o\",timeInForce:\"f\",quantity:n.X9.number(\"q\"),price:n.X9.number(\"p\"),stopPrice:n.X9.number(\"P\"),icebergQuantity:n.X9.number(\"F\"),orderListId:\"g\",originalClientOrderId:\"C\",executionType:\"x\",orderStatus:\"X\",orderRejectReason:\"r\",orderId:\"i\",LastExecutedQuantity:n.X9.number(\"l\"),cumulativeFilledQuantity:n.X9.number(\"z\"),lastPrice:n.X9.number(\"L\"),commissionAmount:n.X9.number(\"n\"),commissionAsset:\"N\",transactionTime:\"T\",tradeId:\"t\",isOnOrderBook:\"w\",isMaker:\"m\",orderCreationTime:\"O\",cumulativeQuoteQuantity:n.X9.number(\"Z\"),lastQuoteQuantity:n.X9.number(\"Y\"),quoteOrderQty:n.X9.number(\"Q\"),activatePrice:n.X9.number(\"AP\"),callbackRate:n.X9.number(\"cr\"),trailingDelta:\"d\",trailingTime:\"D\",workingTime:\"W\",isSor:\"uS\",pegPriceType:\"gP\",pegOffsetType:\"gOT\",pegOffsetValue:\"gOV\",peggedPrice:\"gp\"},T=Object.keys(S),I={symbol:\"s\",insertTime:\"T\",type:\"o\",side:\"S\",price:n.X9.number(\"p\"),avgPrice:n.X9.number(\"ap\"),executedPrice:n.X9.number(\"ap\"),executedQty:n.X9.number(\"z\"),origQty:\"q\",stopPrice:n.X9.number(\"sp\"),operate:\"x\",status:\"X\",orderId:\"i\",clientOrderId:\"c\",orderType:\"o\",origType:\"ot\",timeInForce:\"f\",goodTillDate:n.X9.number(\"gtd\"),bidNotional:n.X9.number(\"b\"),askNotional:n.X9.number(\"a\"),workingType:\"wt\",positionSide:\"ps\",reduceOnly:\"R\",strategyId:\"si\",strategySubId:\"ss\",strategyType:\"st\",closePosition:\"cp\",activatePrice:n.X9.number(\"AP\"),callbackRate:n.X9.number(\"cr\"),priceRate:n.X9.number(\"cr\"),priceMatch:\"pm\",updateTime:\"T\"},l=Object.keys(I),f={algoId:\"aid\",clientAlgoId:\"caid\",algoType:\"at\",orderType:\"o\",symbol:\"s\",side:\"S\",positionSide:\"ps\",timeInForce:\"f\",quantity:\"q\",algoStatus:\"X\",actualOrderId:\"ai\",actualPrice:\"ap\",actualQty:\"aq\",actualType:\"act\",triggerPrice:\"tp\",price:\"p\",icebergQuantity:\"iq\",tpTriggerPrice:\"tptp\",tpPrice:\"tpp\",tpOrderType:\"tpot\",slTriggerPrice:\"sltp\",slPrice:\"slp\",slOrderType:\"slot\",selfTradePreventionMode:\"V\",workingType:\"wt\",priceMatch:\"pm\",closePosition:\"cp\",priceProtect:\"pP\",reduceOnly:\"R\",activatePrice:\"AP\",callbackRate:\"cr\",goodTillDate:n.X9.number(\"gtd\"),triggerTime:n.X9.number(\"tt\"),updateTime:n.X9.now()},y=Object.keys(f),g={symbol:\"s\",strategyId:\"si\",newClientStrategyId:\"c\",side:\"S\",strategyType:\"st\",timeInForce:\"f\",origQty:\"q\",price:\"p\",stopPrice:\"sp\",strategyStatus:\"os\",bookTime:\"T\",reduceOnly:\"R\",workingType:\"wt\",positionSide:\"ps\",closePosition:\"cp\",activatePrice:\"AP\",priceRate:n.X9.number(\"cr\"),priceMatch:\"pm\",orderId:\"i\",parentStrategyId:\"pi\",parentSubId:\"PS\",parentStrategyType:\"pt\",goodTillDate:n.X9.number(\"gtd\")},r=Object.keys(g),d={symbol:\"s\",strategyClientOrderId:\"c\",strategyType:\"st\",strategyId:\"si\",takeProfitPrice:\"tpp\",stopLossPrice:\"slp\",takeProfitTriggerPrice:\"tptp\",stopLossTriggerPrice:\"sltp\"},i=Object.keys(d);function A(m,_,W){const X=(0,P.s)(m,{type:m.type,eventType:\"executionReport\",transform:Q=>j=>Q.coalscedMsg.forEach(({data:V})=>j((0,n.Li)(V,S,T)))},_,W);return(0,o.G)(X)}function R(m,_,W){const X=(0,P.s)(m,{type:m.type,eventType:\"ORDER_TRADE_UPDATE\",transform:Q=>j=>Q.coalscedMsg.forEach(({data:V})=>{if(V.fs&&V.fs!==m.PMFuturesSource)return;const c=(0,n.Li)(V.o,I,l);return(V.o.X===\"PARTIALLY_FILLED\"||V.o.x===\"AMENDMENT\")&&(c.updateTime=V.E),j(c)})},_,W);return(0,o.G)(X)}function F(m,_,W){const X=(0,P.s)(m,{type:m.type,eventType:\"ALGO_UPDATE\",transform:Q=>j=>Q.coalscedMsg.forEach(({data:V})=>{const c=\"ao\"in V?V.ao:V.o;return j((0,n.Li)(c,f,y))})},_,W);return(0,o.G)(X)}function O(m){const _=(0,P.s)(m,{type:m.type,eventType:\"CONDITIONAL_ORDER_TRADE_UPDATE\",transform:W=>X=>W.coalscedMsg.forEach(({data:Q})=>{if(!(Q.fs&&Q.fs!==m.PMFuturesSource))return X((0,n.Li)(Q.so,g,r))})});return(0,o.G)(_)}function h(m,_,W){const X=(0,P.s)(m,{type:m.type,eventType:\"OTOCO_ORDER_UPDATE\",transform:Q=>j=>Q.coalscedMsg.forEach(({data:V})=>{j((0,n.Li)(V.su,d,i))})},_,W);return(0,o.G)(X)}}" + "source": "5558(ee,K,t){t.d(K,{$Q:()=>T,Ai:()=>S,CC:()=>R,H9:()=>h,Ub:()=>O,cg:()=>A,qS:()=>F});var P=t(61489),n=t(37230),o=t(53548);const S={symbol:\"s\",clientOrderId:\"c\",side:\"S\",orderType:\"o\",timeInForce:\"f\",quantity:n.X9.number(\"q\"),price:n.X9.number(\"p\"),stopPrice:n.X9.number(\"P\"),icebergQuantity:n.X9.number(\"F\"),orderListId:\"g\",originalClientOrderId:\"C\",executionType:\"x\",orderStatus:\"X\",orderRejectReason:\"r\",orderId:\"i\",LastExecutedQuantity:n.X9.number(\"l\"),cumulativeFilledQuantity:n.X9.number(\"z\"),lastPrice:n.X9.number(\"L\"),commissionAmount:n.X9.number(\"n\"),commissionAsset:\"N\",transactionTime:\"T\",tradeId:\"t\",isOnOrderBook:\"w\",isMaker:\"m\",orderCreationTime:\"O\",cumulativeQuoteQuantity:n.X9.number(\"Z\"),lastQuoteQuantity:n.X9.number(\"Y\"),quoteOrderQty:n.X9.number(\"Q\"),activatePrice:n.X9.number(\"AP\"),callbackRate:n.X9.number(\"cr\"),trailingDelta:\"d\",trailingTime:\"D\",workingTime:\"W\",isSor:\"uS\",pegPriceType:\"gP\",pegOffsetType:\"gOT\",pegOffsetValue:\"gOV\",peggedPrice:\"gp\"},T=Object.keys(S),I={symbol:\"s\",insertTime:\"T\",type:\"o\",side:\"S\",price:n.X9.number(\"p\"),avgPrice:n.X9.number(\"ap\"),executedPrice:n.X9.number(\"ap\"),executedQty:n.X9.number(\"z\"),origQty:\"q\",stopPrice:n.X9.number(\"sp\"),operate:\"x\",status:\"X\",orderId:\"i\",clientOrderId:\"c\",orderType:\"o\",origType:\"ot\",timeInForce:\"f\",goodTillDate:n.X9.number(\"gtd\"),bidNotional:n.X9.number(\"b\"),askNotional:n.X9.number(\"a\"),workingType:\"wt\",positionSide:\"ps\",reduceOnly:\"R\",strategyId:\"si\",strategySubId:\"ss\",strategyType:\"st\",closePosition:\"cp\",activatePrice:n.X9.number(\"AP\"),callbackRate:n.X9.number(\"cr\"),priceRate:n.X9.number(\"cr\"),priceMatch:\"pm\",updateTime:\"T\"},l=Object.keys(I),f={algoId:\"aid\",clientAlgoId:\"caid\",algoType:\"at\",orderType:\"o\",symbol:\"s\",side:\"S\",positionSide:\"ps\",timeInForce:\"f\",quantity:\"q\",algoStatus:\"X\",actualOrderId:\"ai\",actualPrice:\"ap\",actualQty:\"aq\",actualType:\"act\",triggerPrice:\"tp\",price:\"p\",icebergQuantity:\"iq\",tpTriggerPrice:\"tptp\",tpPrice:\"tpp\",tpOrderType:\"tpot\",slTriggerPrice:\"sltp\",slPrice:\"slp\",slOrderType:\"slot\",selfTradePreventionMode:\"V\",workingType:\"wt\",priceMatch:\"pm\",closePosition:\"cp\",priceProtect:\"pP\",reduceOnly:\"R\",activatePrice:\"AP\",callbackRate:\"cr\",goodTillDate:n.X9.number(\"gtd\"),triggerTime:n.X9.number(\"tt\"),updateTime:n.X9.now()},y=Object.keys(f),g={symbol:\"s\",strategyId:\"si\",newClientStrategyId:\"c\",side:\"S\",strategyType:\"st\",timeInForce:\"f\",origQty:\"q\",price:\"p\",stopPrice:\"sp\",strategyStatus:\"os\",bookTime:\"T\",reduceOnly:\"R\",workingType:\"wt\",positionSide:\"ps\",closePosition:\"cp\",activatePrice:\"AP\",priceRate:n.X9.number(\"cr\"),priceMatch:\"pm\",orderId:\"i\",parentStrategyId:\"pi\",parentSubId:\"PS\",parentStrategyType:\"pt\",goodTillDate:n.X9.number(\"gtd\")},r=Object.keys(g),d={symbol:\"s\",strategyClientOrderId:\"c\",strategyType:\"st\",strategyId:\"si\",takeProfitPrice:\"tpp\",stopLossPrice:\"slp\",takeProfitTriggerPrice:\"tptp\",stopLossTriggerPrice:\"sltp\"},i=Object.keys(d);function A(m,_,W){const X=(0,P.s)(m,{type:m.type,eventType:\"executionReport\",transform:Q=>j=>Q.coalscedMsg.forEach(({data:V})=>j((0,n.Li)(V,S,T)))},_,W);return(0,o.G)(X)}function R(m,_,W){const X=(0,P.s)(m,{type:m.type,eventType:\"ORDER_TRADE_UPDATE\",transform:Q=>j=>Q.coalscedMsg.forEach(({data:V})=>{if(V.fs&&V.fs!==m.PMFuturesSource)return;const c=(0,n.Li)(V.o,I,l);return(V.o.X===\"PARTIALLY_FILLED\"||V.o.x===\"AMENDMENT\")&&(c.updateTime=V.E),j(c)})},_,W);return(0,o.G)(X)}function F(m,_,W){const X=(0,P.s)(m,{type:m.type,eventType:\"ALGO_UPDATE\",transform:Q=>j=>Q.coalscedMsg.forEach(({data:V})=>{const c=\"ao\"in V?V.ao:V.o;return j((0,n.Li)(c,f,y))})},_,W);return(0,o.G)(X)}function O(m){const _=(0,P.s)(m,{type:m.type,eventType:\"CONDITIONAL_ORDER_TRADE_UPDATE\",transform:W=>X=>W.coalscedMsg.forEach(({data:Q})=>{if(!(Q.fs&&Q.fs!==m.PMFuturesSource))return X((0,n.Li)(Q.so,g,r))})});return(0,o.G)(_)}function h(m,_,W){const X=(0,P.s)(m,{type:m.type,eventType:\"OTOCO_ORDER_UPDATE\",transform:Q=>j=>Q.coalscedMsg.forEach(({data:V})=>{j((0,n.Li)(V.su,d,i))})},_,W);return(0,o.G)(X)}}", + "sha256": "352d145ced1d19136316a6d5768c7b9440f3ab66986db37d5706ff84a312f884" }, { "id": "70020", "chunks": [ "3314" ], - "source": "70020(D,l,t){\"use strict\";t.d(l,{Q:()=>d});var e=t(41594),a=t.n(e),r=t(80065),n=t(96636),i=t(51471),s=\"open-order-notification-sound-open\",c=(0,r.A)(function(y){return{enableNotification:!1,setNotification:function(p){return y({enableNotification:p})}}}),d=function(){var y=(0,e.useState)(!1),p=y[0],T=y[1],S=(0,i.zr)(s,!1),E=S.data,A=S.setData,O=S.hasInitialized,m=c(),g=m.enableNotification,u=m.setNotification,o=(0,n.Z)().isEUFuturesUrl;(0,e.useEffect)(function(){p||O&&(u(E),T(!0))},[E,p,O,u]);var f=(0,e.useCallback)(function(){u(!g),A(!g)},[g,A,u]);return{initialized:p,showNotification:!o,enableNotification:o?!1:g,toggleNotification:f}}}" + "source": "70020(D,l,t){\"use strict\";t.d(l,{Q:()=>d});var e=t(41594),a=t.n(e),r=t(80065),n=t(96636),i=t(51471),s=\"open-order-notification-sound-open\",c=(0,r.A)(function(y){return{enableNotification:!1,setNotification:function(p){return y({enableNotification:p})}}}),d=function(){var y=(0,e.useState)(!1),p=y[0],T=y[1],S=(0,i.zr)(s,!1),E=S.data,A=S.setData,O=S.hasInitialized,m=c(),g=m.enableNotification,u=m.setNotification,o=(0,n.Z)().isEUFuturesUrl;(0,e.useEffect)(function(){p||O&&(u(E),T(!0))},[E,p,O,u]);var f=(0,e.useCallback)(function(){u(!g),A(!g)},[g,A,u]);return{initialized:p,showNotification:!o,enableNotification:o?!1:g,toggleNotification:f}}}", + "sha256": "9e247d3e16a783e1c6f2b2c529d64241db8ec3b52afe5d7de1618aae36467963" }, { "id": "4189", "chunks": [ "14105" ], - "source": "4189(U,P,e){e.d(P,{zH:()=>D,nT:()=>h,u7:()=>Q,$t:()=>u,Qj:()=>T});var s=e(41594),l=e(87017),y=e(48187),m=e(57861),L=e(41466);const M=async g=>{let f;try{f=await(0,m.post)(`/bapi/futures/v1/private/future/order/open-orders?${(0,L.E2)(g||{})}`,{})}catch{f={success:!1}}return f};var S=e(43335),R=e(26860),N=e(84266),I=e(16921),C=e(90291),A=e(47738),a=e(95541),F=e(71822);const d=(g,f,i)=>{const{isCM:b}=i,p=[...g];return f.forEach(O=>{const{symbol:k,status:B,strategyType:G=null,clientOrderId:K}=O,z={...O,strategyType:G},x=p.findIndex(V=>V.clientOrderId===K&&V.symbol===k);switch(B){case\"NEW\":F.J.emit(\"NEW\",{isCM:b,clientOrderId:K}),x!==-1?p[x]=z:p.unshift(z);break;case\"PARTIALLY_FILLED\":x!==-1&&(O.operate!==\"AMENDMENT\"&&F.J.emit(\"PARTIALLY_FILLED\",p[x]),p[x]=z);break;case\"CANCELED\":case\"EXPIRED\":case\"EXPIRED_IN_MATCH\":x!==-1&&(F.J.emit(\"CANCELED\",p[x]),p.splice(x,1));break;case\"FILLED\":x!==-1&&(F.J.emit(\"FILLED_NORMAL_ORDER\",p[x]),p.splice(x,1));break;default:break}}),p},v=({isPM2:g,isCM:f,stream:i,queryClient:b,copyTradingPayload:p})=>{const O=p||{},k=f?a.CX:(0,a.kc)({copyTradingPayload:O}),B=K=>{b.setQueryData(S.Bz.OPEN_ORDERS(f,O),z=>({success:!0,data:d(z?.data||[],K,{isCM:f})}))};k.addWorker(B);const G=i.getUserOrderStream({isPM2:g,params:O}).subscribe(K=>{k.push(K)});return()=>{G(),k.removeWorker(B)}},o=(0,A.Y)({queryKey:S.Bz.OPEN_ORDERS,subscribeToStreamFn:v}),T=async({isCM:g,copyTradingPayload:f})=>g?(0,y.mp)():M(f),u=({enabled:g,isCM:f,isPM2:i,getSDK:b,queryClient:p,copyTradingPayload:O})=>{g&&o({getSDK:b,queryClient:p,isCM:f,isPM2:i,copyTradingPayload:O})},D=(g,{disableWs:f,...i}={})=>{const b=(0,R.n)(),{isExistFutureAccount:p}=(0,N.Py)(),O=(0,I.by)(),k=!!(b&&p),B=(0,I.Gw)(),G=(0,l.useQueryClient)(),K=(0,C.OE)();return(0,s.useEffect)(function(){u({enabled:k&&!f,isCM:g,isPM2:O,getSDK:K,queryClient:G,copyTradingPayload:B})},[k,g,O,K,G,f,B]),(0,l.useQuery)(S.Bz.OPEN_ORDERS(g,B),()=>T({isCM:g,copyTradingPayload:B}),{enabled:k,cacheTime:1/0,staleTime:1/0,notifyOnChangeProps:[\"data\"],...i})},Q=g=>{const f=(0,l.useQueryClient)(),i=(0,I.Gw)();return(0,s.useCallback)(()=>{f.invalidateQueries(S.Bz.OPEN_ORDERS(g,i))},[i,g,f])},h=g=>{const f=(0,l.useQueryClient)(),i=(0,I.Gw)();return(0,s.useCallback)(()=>f.getQueryData(S.Bz.OPEN_ORDERS(g,i))?.data?.length||0,[i,g,f])}}" + "source": "4189(U,P,e){e.d(P,{zH:()=>D,nT:()=>h,u7:()=>Q,$t:()=>u,Qj:()=>T});var s=e(41594),l=e(87017),y=e(48187),m=e(57861),L=e(41466);const M=async g=>{let f;try{f=await(0,m.post)(`/bapi/futures/v1/private/future/order/open-orders?${(0,L.E2)(g||{})}`,{})}catch{f={success:!1}}return f};var S=e(43335),R=e(26860),N=e(84266),I=e(16921),C=e(90291),A=e(47738),a=e(95541),F=e(71822);const d=(g,f,i)=>{const{isCM:b}=i,p=[...g];return f.forEach(O=>{const{symbol:k,status:B,strategyType:G=null,clientOrderId:K}=O,z={...O,strategyType:G},x=p.findIndex(V=>V.clientOrderId===K&&V.symbol===k);switch(B){case\"NEW\":F.J.emit(\"NEW\",{isCM:b,clientOrderId:K}),x!==-1?p[x]=z:p.unshift(z);break;case\"PARTIALLY_FILLED\":x!==-1&&(O.operate!==\"AMENDMENT\"&&F.J.emit(\"PARTIALLY_FILLED\",p[x]),p[x]=z);break;case\"CANCELED\":case\"EXPIRED\":case\"EXPIRED_IN_MATCH\":x!==-1&&(F.J.emit(\"CANCELED\",p[x]),p.splice(x,1));break;case\"FILLED\":x!==-1&&(F.J.emit(\"FILLED_NORMAL_ORDER\",p[x]),p.splice(x,1));break;default:break}}),p},v=({isPM2:g,isCM:f,stream:i,queryClient:b,copyTradingPayload:p})=>{const O=p||{},k=f?a.CX:(0,a.kc)({copyTradingPayload:O}),B=K=>{b.setQueryData(S.Bz.OPEN_ORDERS(f,O),z=>({success:!0,data:d(z?.data||[],K,{isCM:f})}))};k.addWorker(B);const G=i.getUserOrderStream({isPM2:g,params:O}).subscribe(K=>{k.push(K)});return()=>{G(),k.removeWorker(B)}},o=(0,A.Y)({queryKey:S.Bz.OPEN_ORDERS,subscribeToStreamFn:v}),T=async({isCM:g,copyTradingPayload:f})=>g?(0,y.mp)():M(f),u=({enabled:g,isCM:f,isPM2:i,getSDK:b,queryClient:p,copyTradingPayload:O})=>{g&&o({getSDK:b,queryClient:p,isCM:f,isPM2:i,copyTradingPayload:O})},D=(g,{disableWs:f,...i}={})=>{const b=(0,R.n)(),{isExistFutureAccount:p}=(0,N.Py)(),O=(0,I.by)(),k=!!(b&&p),B=(0,I.Gw)(),G=(0,l.useQueryClient)(),K=(0,C.OE)();return(0,s.useEffect)(function(){u({enabled:k&&!f,isCM:g,isPM2:O,getSDK:K,queryClient:G,copyTradingPayload:B})},[k,g,O,K,G,f,B]),(0,l.useQuery)(S.Bz.OPEN_ORDERS(g,B),()=>T({isCM:g,copyTradingPayload:B}),{enabled:k,cacheTime:1/0,staleTime:1/0,notifyOnChangeProps:[\"data\"],...i})},Q=g=>{const f=(0,l.useQueryClient)(),i=(0,I.Gw)();return(0,s.useCallback)(()=>{f.invalidateQueries(S.Bz.OPEN_ORDERS(g,i))},[i,g,f])},h=g=>{const f=(0,l.useQueryClient)(),i=(0,I.Gw)();return(0,s.useCallback)(()=>f.getQueryData(S.Bz.OPEN_ORDERS(g,i))?.data?.length||0,[i,g,f])}}", + "sha256": "1a9a1cfa869a72786a4b53fb5f800f5bd81fbd67ba22ad707404ee1be7b301cf" }, { "id": "37230", "chunks": [ "32536" ], - "source": "37230(ee,K,t){t.d(K,{Li:()=>S,Rr:()=>n,X9:()=>o});const P={isolated:!0,cross:!1};function n(T){const I=T.split(\".\");return l=>{for(let f=0;fNumber(I(l))},text(T){const I=n(T);return l=>I(l)},isolatedVal(T){const I=n(T);return l=>P[I(l)]},now(){return T=>Date.now()}};function S(T,I,l){const f=Object.create(null);for(let y=0;yS,Rr:()=>n,X9:()=>o});const P={isolated:!0,cross:!1};function n(T){const I=T.split(\".\");return l=>{for(let f=0;fNumber(I(l))},text(T){const I=n(T);return l=>I(l)},isolatedVal(T){const I=n(T);return l=>P[I(l)]},now(){return T=>Date.now()}};function S(T,I,l){const f=Object.create(null);for(let y=0;yp.Q,$$:()=>n,E$:()=>S});var r=t(41594),s=2e3,e=2,n=function(){var E=(0,r.useRef)(null),A=function(O){E.current=setTimeout(function(){O(),E.current&&clearTimeout(E.current),E.current=null},s)};return(0,r.useMemo)(function(){return{interval:E,intervalFunc:A}},[])},i=t(75510),a=t(16921),c=t(72363),d=t(79515),h=t(40477),p=t(70020),T=function(E,A){var O=(0,d.nH)(),m=(0,d.Py)().isExistFutureAccount,y=(0,h.A)(A,500),u=y.run,o=(0,d.ON)().isPM2,f=(0,a.Gw)();(0,r.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!0});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(C){(C.status===\"FILLED\"||C.status===\"PARTIALLY_FILLED\"||C.status===\"EXPIRED\")&&u(String(C.orderId))})})},[u,E,m,O,o,f]),(0,r.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!1});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(C){(C.status===\"FILLED\"||C.status===\"PARTIALLY_FILLED\"||C.status===\"EXPIRED\")&&u(String(C.orderId))})})},[u,E,m,O,o,f])},S=function(){var E=(0,r.useState)(new Date),A=E[0],O=E[1],m=(0,r.useRef)([]),y=(0,p.Q)(),u=y.showNotification,o=y.enableNotification,f=(0,r.useCallback)(function(){var v;(v=m)===null||v===void 0||v.current.shift(),O(new Date)},[]),_=(0,r.useCallback)(function(v){var L;if(u&&((L=m)===null||L===void 0?void 0:L.current.length)p.Q,$$:()=>n,E$:()=>S});var e=t(41594),a=2e3,r=2,n=function(){var E=(0,e.useRef)(null),A=function(O){E.current=setTimeout(function(){O(),E.current&&clearTimeout(E.current),E.current=null},a)};return(0,e.useMemo)(function(){return{interval:E,intervalFunc:A}},[])},i=t(75510),s=t(16921),c=t(72363),d=t(79515),y=t(40477),p=t(70020),T=function(E,A){var O=(0,d.nH)(),m=(0,d.Py)().isExistFutureAccount,g=(0,y.A)(A,500),u=g.run,o=(0,d.ON)().isPM2,f=(0,s.Gw)();(0,e.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!0});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(P){(P.status==="FILLED"||P.status==="PARTIALLY_FILLED"||P.status==="EXPIRED")&&u(String(P.orderId))})})},[u,E,m,O,o,f]),(0,e.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!1});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(P){(P.status==="FILLED"||P.status==="PARTIALLY_FILLED"||P.status==="EXPIRED")&&u(String(P.orderId))})})},[u,E,m,O,o,f])},S=function(){var E=(0,e.useState)(new Date),A=E[0],O=E[1],m=(0,e.useRef)([]),g=(0,p.Q)(),u=g.showNotification,o=g.enableNotification,f=(0,e.useCallback)(function(){var v;(v=m)===null||v===void 0||v.current.shift(),O(new Date)},[]),_=(0,e.useCallback)(function(v){var L;if(u&&((L=m)===null||L===void 0?void 0:L.current.length)i});var e=t(75510),a=t(41594),r=t.n(a),n=function(s,c,d){var y=Array.isArray(c)?c:[],p=typeof c=="number"?c:d||0,T=(0,a.useRef)(!1),S=(0,a.useRef)(),E=(0,a.useRef)(s);E.current=s;var A=(0,a.useRef)([]),O=(0,a.useCallback)(function(){S.current&&clearTimeout(S.current),S.current=void 0},[]),m=(0,a.useCallback)(function(){for(var g=arguments.length,u=new Array(g),o=0;oN,z:()=>o});var r=e(41594),a=e.n(r),T=e(61523),p=e(92873),P=e(64041),b=e(17409),S=e(51471),E=e(40477),$="trd-openOrder",G=function(c){return(0,p.o)($,c)},o=function(){var c=(0,S.zr)("open_order_status_toast",!0),h=c.data,R=c.setData,K=c.hasInitialized,x=(0,r.useCallback)(function(){R(!h)},[h,R]);return{enableToast:K?h:!1,toggleToast:x}},N=function(){var c=G().getI18n,h=(0,P.h)().enqueueNotification,R=o().enableToast,K=(0,E.A)(h,30),x=K.run,i=(0,T.d4)(function(l){return l.setting.layout}),d=(0,r.useMemo)(function(){return i===b.a0},[i]),A=(0,r.useCallback)(function(l){var D=l.side.toUpperCase(),Y=l.type.replace(/[-_]/g,"");return"".concat(D).concat(Y)},[]),g=(0,r.useCallback)(function(l){if(!(l.type==="LIQUIDATION"||!R)){var D=A(l),Y=c("".concat(D,"CancelTitle"),{defaultValue:"".concat(l.type," ").concat(l.side," Order Canceled")});x(Y)}},[A,c,x,R]),C=(0,r.useCallback)(function(l){if(!(l.type==="LIQUIDATION"||!R)){var D=A(l),Y=c("".concat(D,"FillTitle"),{defaultValue:"".concat(l.type," ").concat(l.side," Order Filled")});x(Y,{variant:"success"})}},[A,c,x,R]),I=(0,r.useCallback)(function(l){if(!(l.type==="LIQUIDATION"||!R)){var D=A(l),Y=c("".concat(D,"PFTitle"),{defaultValue:"".concat(l.type," ").concat(l.side," Order Partially Filled")});x(Y,{variant:"success"})}},[A,c,x,R]);return(0,r.useMemo)(function(){return{cancelOrderNotify:g,fillOrderNotify:C,fillOrderPartNotify:I}},[g,C,I])}}}[30877] }, - { id: "30877", chunkId: "24132", factory: {30877(V,b,e){e.d(b,{F:()=>m,z:()=>I});var r=e(41594),A=e.n(r),s=e(61523),f=e(92873),v=e(64041),o=e(17409),l=e(51471),P=e(40477),k="trd-openOrder",y=function(g){return(0,f.o)(k,g)},I=function(){var g=(0,l.zr)("open_order_status_toast",!0),_=g.data,F=g.setData,R=g.hasInitialized,L=(0,r.useCallback)(function(){F(!_)},[_,F]);return{enableToast:R?_:!1,toggleToast:L}},m=function(){var g=y().getI18n,_=(0,v.h)().enqueueNotification,F=I().enableToast,R=(0,P.A)(_,30),L=R.run,a=(0,s.d4)(function(i){return i.setting.layout}),M=(0,r.useMemo)(function(){return a===o.a0},[a]),C=(0,r.useCallback)(function(i){var S=i.side.toUpperCase(),T=i.type.replace(/[-_]/g,"");return"".concat(S).concat(T)},[]),c=(0,r.useCallback)(function(i){if(!(i.type==="LIQUIDATION"||!F)){var S=C(i),T=g("".concat(S,"CancelTitle"),{defaultValue:"".concat(i.type," ").concat(i.side," Order Canceled")});L(T)}},[C,g,L,F]),u=(0,r.useCallback)(function(i){if(!(i.type==="LIQUIDATION"||!F)){var S=C(i),T=g("".concat(S,"FillTitle"),{defaultValue:"".concat(i.type," ").concat(i.side," Order Filled")});L(T,{variant:"success"})}},[C,g,L,F]),h=(0,r.useCallback)(function(i){if(!(i.type==="LIQUIDATION"||!F)){var S=C(i),T=g("".concat(S,"PFTitle"),{defaultValue:"".concat(i.type," ").concat(i.side," Order Partially Filled")});L(T,{variant:"success"})}},[C,g,L,F]);return(0,r.useMemo)(function(){return{cancelOrderNotify:c,fillOrderNotify:u,fillOrderPartNotify:h}},[c,u,h])}}}[30877] }, - { id: "30877", chunkId: "57898", factory: {30877(K,T,e){e.d(T,{F:()=>i,z:()=>E});var t=e(41594),r=e.n(t),n=e(61523),s=e(92873),g=e(64041),c=e(17409),h=e(51471),p=e(40477),b="trd-openOrder",S=function(y){return(0,s.o)(b,y)},E=function(){var y=(0,h.zr)("open_order_status_toast",!0),C=y.data,f=y.setData,I=y.hasInitialized,d=(0,t.useCallback)(function(){f(!C)},[C,f]);return{enableToast:I?C:!1,toggleToast:d}},i=function(){var y=S().getI18n,C=(0,g.h)().enqueueNotification,f=E().enableToast,I=(0,p.A)(C,30),d=I.run,P=(0,n.d4)(function(a){return a.setting.layout}),M=(0,t.useMemo)(function(){return P===c.a0},[P]),k=(0,t.useCallback)(function(a){var o=a.side.toUpperCase(),u=a.type.replace(/[-_]/g,"");return"".concat(o).concat(u)},[]),A=(0,t.useCallback)(function(a){if(!(a.type==="LIQUIDATION"||!f)){var o=k(a),u=y("".concat(o,"CancelTitle"),{defaultValue:"".concat(a.type," ").concat(a.side," Order Canceled")});d(u)}},[k,y,d,f]),O=(0,t.useCallback)(function(a){if(!(a.type==="LIQUIDATION"||!f)){var o=k(a),u=y("".concat(o,"FillTitle"),{defaultValue:"".concat(a.type," ").concat(a.side," Order Filled")});d(u,{variant:"success"})}},[k,y,d,f]),x=(0,t.useCallback)(function(a){if(!(a.type==="LIQUIDATION"||!f)){var o=k(a),u=y("".concat(o,"PFTitle"),{defaultValue:"".concat(a.type," ").concat(a.side," Order Partially Filled")});d(u,{variant:"success"})}},[k,y,d,f]);return(0,t.useMemo)(function(){return{cancelOrderNotify:A,fillOrderNotify:O,fillOrderPartNotify:x}},[A,O,x])}}}[30877] }, - { id: "55401", chunkId: "29042", factory: {55401(S,f,o){o.r(f),o.d(f,{SoundNotificationProvider:()=>C});var c=o(31085),e=o(41594),x=o(17409),s=o(39116),E=function(a){var r,n;(r=a)===null||r===void 0||r.load();var u=(n=a)===null||n===void 0?void 0:n.play();u&&u.then(function(){var t;(t=a)===null||t===void 0||t.play()}).catch(function(){})},C=function(a){var r=a.children,n=(0,s.$$)(),u=n.interval,t=n.intervalFunc,h=(0,e.useRef)(null),N=(0,s.QZ)(),p=N.enableNotification,m=N.showNotification,d=(0,s.E$)(),l=d.notifications,P=d.lastNotifyTime,y=d.popNotification,j=(0,e.useCallback)(function(){var i,v=(i=h)===null||i===void 0?void 0:i.current;v&&(v.src="".concat(x.K5,"/static/spot-trade-ui/trade-sound.mp3"),E(v),t(y))},[t,y]);return(0,e.useEffect)(function(){var i;(!m||!p)&&(l.current=[]),l&&((i=l)===null||i===void 0?void 0:i.current.length)>0&&(u.current||j())},[P,p,j,l,u,m]),(0,c.jsxs)("div",{children:[r,(0,c.jsx)("div",{children:(0,c.jsx)("audio",{ref:h,children:(0,c.jsx)("source",{src:""})})})]})}}}[55401] }, - { id: "30877", chunkId: "57276", factory: {30877(Y,T,e){e.d(T,{F:()=>o,z:()=>N});var a=e(41594),k=e.n(a),P=e(61523),l=e(92873),O=e(64041),C=e(17409),h=e(51471),M=e(40477),p="trd-openOrder",R=function(n){return(0,l.o)(p,n)},N=function(){var n=(0,h.zr)("open_order_status_toast",!0),c=n.data,i=n.setData,F=n.hasInitialized,u=(0,a.useCallback)(function(){i(!c)},[c,i]);return{enableToast:F?c:!1,toggleToast:u}},o=function(){var n=R().getI18n,c=(0,O.h)().enqueueNotification,i=N().enableToast,F=(0,M.A)(c,30),u=F.run,L=(0,P.d4)(function(r){return r.setting.layout}),g=(0,a.useMemo)(function(){return L===C.a0},[L]),I=(0,a.useCallback)(function(r){var d=r.side.toUpperCase(),f=r.type.replace(/[-_]/g,"");return"".concat(d).concat(f)},[]),S=(0,a.useCallback)(function(r){if(!(r.type==="LIQUIDATION"||!i)){var d=I(r),f=n("".concat(d,"CancelTitle"),{defaultValue:"".concat(r.type," ").concat(r.side," Order Canceled")});u(f)}},[I,n,u,i]),A=(0,a.useCallback)(function(r){if(!(r.type==="LIQUIDATION"||!i)){var d=I(r),f=n("".concat(d,"FillTitle"),{defaultValue:"".concat(r.type," ").concat(r.side," Order Filled")});u(f,{variant:"success"})}},[I,n,u,i]),Q=(0,a.useCallback)(function(r){if(!(r.type==="LIQUIDATION"||!i)){var d=I(r),f=n("".concat(d,"PFTitle"),{defaultValue:"".concat(r.type," ").concat(r.side," Order Partially Filled")});u(f,{variant:"success"})}},[I,n,u,i]);return(0,a.useMemo)(function(){return{cancelOrderNotify:S,fillOrderNotify:A,fillOrderPartNotify:Q}},[S,A,Q])}}}[30877] }, - { id: "34122", chunkId: "57276", factory: {34122(Y,T,e){e.r(T),e.d(T,{OrderToastNotifyRegister:()=>N,OrderToastSwitch:()=>R});var a=e(31085),k=e(41594),P=e.n(k),l=e(71822),O=e(88478),C=e(48651),h=e(30877),M=e(34175),p=e(10157),R=function(){var o=(0,h.z)(),n=o.enableToast,c=o.toggleToast,i=(0,C.ud)().getI18n;return(0,a.jsxs)("div",{className:p.XE,onClick:c,children:[(0,a.jsx)("div",{className:p.IG,children:i("orderToastReminder",{defaultValue:"Toast Reminder"})}),(0,a.jsx)(O.A,{size:"small",checked:n})]})},N=function(){var o=(0,h.F)();return(0,k.useEffect)(function(){var n=[l.J.on("NEW",M.Zu),l.J.on("PARTIALLY_FILLED",o.fillOrderPartNotify),l.J.on("CANCELED",o.cancelOrderNotify),l.J.on("FILLED",o.fillOrderNotify),l.J.on("FILLED_NORMAL_ORDER",o.fillOrderNotify)];return function(){return n.forEach(function(c){return c()})}},[o]),null}}}[34122] }, - { id: "30877", chunkId: "76905", factory: {30877(L,T,e){e.d(T,{F:()=>_,z:()=>v});var r=e(41594),x=e.n(r),O=e(61523),h=e(92873),p=e(64041),k=e(17409),C=e(51471),I=e(40477),g="trd-openOrder",f=function(s){return(0,h.o)(g,s)},v=function(){var s=(0,C.zr)("open_order_status_toast",!0),c=s.data,o=s.setData,d=s.hasInitialized,n=(0,r.useCallback)(function(){o(!c)},[c,o]);return{enableToast:d?c:!1,toggleToast:n}},_=function(){var s=f().getI18n,c=(0,p.h)().enqueueNotification,o=v().enableToast,d=(0,I.A)(c,30),n=d.run,a=(0,O.d4)(function(t){return t.setting.layout}),S=(0,r.useMemo)(function(){return a===k.a0},[a]),i=(0,r.useCallback)(function(t){var l=t.side.toUpperCase(),u=t.type.replace(/[-_]/g,"");return"".concat(l).concat(u)},[]),y=(0,r.useCallback)(function(t){if(!(t.type==="LIQUIDATION"||!o)){var l=i(t),u=s("".concat(l,"CancelTitle"),{defaultValue:"".concat(t.type," ").concat(t.side," Order Canceled")});n(u)}},[i,s,n,o]),F=(0,r.useCallback)(function(t){if(!(t.type==="LIQUIDATION"||!o)){var l=i(t),u=s("".concat(l,"FillTitle"),{defaultValue:"".concat(t.type," ").concat(t.side," Order Filled")});n(u,{variant:"success"})}},[i,s,n,o]),m=(0,r.useCallback)(function(t){if(!(t.type==="LIQUIDATION"||!o)){var l=i(t),u=s("".concat(l,"PFTitle"),{defaultValue:"".concat(t.type," ").concat(t.side," Order Partially Filled")});n(u,{variant:"success"})}},[i,s,n,o]);return(0,r.useMemo)(function(){return{cancelOrderNotify:y,fillOrderNotify:F,fillOrderPartNotify:m}},[y,F,m])}}}[30877] }, - { id: "30877", chunkId: "49426", factory: {30877(R,T,e){e.d(T,{F:()=>y,z:()=>D});var t=e(41594),O=e.n(t),u=e(61523),i=e(92873),m=e(64041),d=e(17409),f=e(51471),a=e(40477),o="trd-openOrder",b=function(S){return(0,i.o)(o,S)},D=function(){var S=(0,f.zr)("open_order_status_toast",!0),M=S.data,P=S.setData,N=S.hasInitialized,_=(0,t.useCallback)(function(){P(!M)},[M,P]);return{enableToast:N?M:!1,toggleToast:_}},y=function(){var S=b().getI18n,M=(0,m.h)().enqueueNotification,P=D().enableToast,N=(0,a.A)(M,30),_=N.run,v=(0,u.d4)(function(n){return n.setting.layout}),l=(0,t.useMemo)(function(){return v===d.a0},[v]),s=(0,t.useCallback)(function(n){var g=n.side.toUpperCase(),c=n.type.replace(/[-_]/g,"");return"".concat(g).concat(c)},[]),r=(0,t.useCallback)(function(n){if(!(n.type==="LIQUIDATION"||!P)){var g=s(n),c=S("".concat(g,"CancelTitle"),{defaultValue:"".concat(n.type," ").concat(n.side," Order Canceled")});_(c)}},[s,S,_,P]),p=(0,t.useCallback)(function(n){if(!(n.type==="LIQUIDATION"||!P)){var g=s(n),c=S("".concat(g,"FillTitle"),{defaultValue:"".concat(n.type," ").concat(n.side," Order Filled")});_(c,{variant:"success"})}},[s,S,_,P]),h=(0,t.useCallback)(function(n){if(!(n.type==="LIQUIDATION"||!P)){var g=s(n),c=S("".concat(g,"PFTitle"),{defaultValue:"".concat(n.type," ").concat(n.side," Order Partially Filled")});_(c,{variant:"success"})}},[s,S,_,P]);return(0,t.useMemo)(function(){return{cancelOrderNotify:r,fillOrderNotify:p,fillOrderPartNotify:h}},[r,p,h])}}}[30877] }, - { id: "73335", chunkId: "40026", factory: {73335(ve,C,o){/** + { sourceSha256: "5362a54e61f022714e673e166b62e3c22997084ca7a9f4e676475ec91cfcfaa8", id: "39116", chunkId: "3314", factory: {39116(D,l,t){"use strict";t.d(l,{QZ:()=>p.Q,$$:()=>n,E$:()=>S});var e=t(41594),a=2e3,r=2,n=function(){var E=(0,e.useRef)(null),A=function(O){E.current=setTimeout(function(){O(),E.current&&clearTimeout(E.current),E.current=null},a)};return(0,e.useMemo)(function(){return{interval:E,intervalFunc:A}},[])},i=t(75510),s=t(16921),c=t(72363),d=t(79515),y=t(40477),p=t(70020),T=function(E,A){var O=(0,d.nH)(),m=(0,d.Py)().isExistFutureAccount,g=(0,y.A)(A,500),u=g.run,o=(0,d.ON)().isPM2,f=(0,s.Gw)();(0,e.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!0});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(P){(P.status==="FILLED"||P.status==="PARTIALLY_FILLED"||P.status==="EXPIRED")&&u(String(P.orderId))})})},[u,E,m,O,o,f]),(0,e.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!1});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(P){(P.status==="FILLED"||P.status==="PARTIALLY_FILLED"||P.status==="EXPIRED")&&u(String(P.orderId))})})},[u,E,m,O,o,f])},S=function(){var E=(0,e.useState)(new Date),A=E[0],O=E[1],m=(0,e.useRef)([]),g=(0,p.Q)(),u=g.showNotification,o=g.enableNotification,f=(0,e.useCallback)(function(){var v;(v=m)===null||v===void 0||v.current.shift(),O(new Date)},[]),_=(0,e.useCallback)(function(v){var L;if(u&&((L=m)===null||L===void 0?void 0:L.current.length)i});var e=t(75510),a=t(41594),r=t.n(a),n=function(s,c,d){var y=Array.isArray(c)?c:[],p=typeof c=="number"?c:d||0,T=(0,a.useRef)(!1),S=(0,a.useRef)(),E=(0,a.useRef)(s);E.current=s;var A=(0,a.useRef)([]),O=(0,a.useCallback)(function(){S.current&&clearTimeout(S.current),S.current=void 0},[]),m=(0,a.useCallback)(function(){for(var g=arguments.length,u=new Array(g),o=0;oN,z:()=>o});var r=e(41594),a=e.n(r),T=e(61523),p=e(92873),P=e(64041),b=e(17409),S=e(51471),E=e(40477),$="trd-openOrder",G=function(c){return(0,p.o)($,c)},o=function(){var c=(0,S.zr)("open_order_status_toast",!0),h=c.data,R=c.setData,K=c.hasInitialized,x=(0,r.useCallback)(function(){R(!h)},[h,R]);return{enableToast:K?h:!1,toggleToast:x}},N=function(){var c=G().getI18n,h=(0,P.h)().enqueueNotification,R=o().enableToast,K=(0,E.A)(h,30),x=K.run,i=(0,T.d4)(function(l){return l.setting.layout}),d=(0,r.useMemo)(function(){return i===b.a0},[i]),A=(0,r.useCallback)(function(l){var D=l.side.toUpperCase(),Y=l.type.replace(/[-_]/g,"");return"".concat(D).concat(Y)},[]),g=(0,r.useCallback)(function(l){if(!(l.type==="LIQUIDATION"||!R)){var D=A(l),Y=c("".concat(D,"CancelTitle"),{defaultValue:"".concat(l.type," ").concat(l.side," Order Canceled")});x(Y)}},[A,c,x,R]),C=(0,r.useCallback)(function(l){if(!(l.type==="LIQUIDATION"||!R)){var D=A(l),Y=c("".concat(D,"FillTitle"),{defaultValue:"".concat(l.type," ").concat(l.side," Order Filled")});x(Y,{variant:"success"})}},[A,c,x,R]),I=(0,r.useCallback)(function(l){if(!(l.type==="LIQUIDATION"||!R)){var D=A(l),Y=c("".concat(D,"PFTitle"),{defaultValue:"".concat(l.type," ").concat(l.side," Order Partially Filled")});x(Y,{variant:"success"})}},[A,c,x,R]);return(0,r.useMemo)(function(){return{cancelOrderNotify:g,fillOrderNotify:C,fillOrderPartNotify:I}},[g,C,I])}}}[30877] }, + { sourceSha256: "faec1b3eb9f86a4e7087128f8fd3b74a210581c9988a0041c909a848cfb0ae0f", id: "30877", chunkId: "24132", factory: {30877(V,b,e){e.d(b,{F:()=>m,z:()=>I});var r=e(41594),A=e.n(r),s=e(61523),f=e(92873),v=e(64041),o=e(17409),l=e(51471),P=e(40477),k="trd-openOrder",y=function(g){return(0,f.o)(k,g)},I=function(){var g=(0,l.zr)("open_order_status_toast",!0),_=g.data,F=g.setData,R=g.hasInitialized,L=(0,r.useCallback)(function(){F(!_)},[_,F]);return{enableToast:R?_:!1,toggleToast:L}},m=function(){var g=y().getI18n,_=(0,v.h)().enqueueNotification,F=I().enableToast,R=(0,P.A)(_,30),L=R.run,a=(0,s.d4)(function(i){return i.setting.layout}),M=(0,r.useMemo)(function(){return a===o.a0},[a]),C=(0,r.useCallback)(function(i){var S=i.side.toUpperCase(),T=i.type.replace(/[-_]/g,"");return"".concat(S).concat(T)},[]),c=(0,r.useCallback)(function(i){if(!(i.type==="LIQUIDATION"||!F)){var S=C(i),T=g("".concat(S,"CancelTitle"),{defaultValue:"".concat(i.type," ").concat(i.side," Order Canceled")});L(T)}},[C,g,L,F]),u=(0,r.useCallback)(function(i){if(!(i.type==="LIQUIDATION"||!F)){var S=C(i),T=g("".concat(S,"FillTitle"),{defaultValue:"".concat(i.type," ").concat(i.side," Order Filled")});L(T,{variant:"success"})}},[C,g,L,F]),h=(0,r.useCallback)(function(i){if(!(i.type==="LIQUIDATION"||!F)){var S=C(i),T=g("".concat(S,"PFTitle"),{defaultValue:"".concat(i.type," ").concat(i.side," Order Partially Filled")});L(T,{variant:"success"})}},[C,g,L,F]);return(0,r.useMemo)(function(){return{cancelOrderNotify:c,fillOrderNotify:u,fillOrderPartNotify:h}},[c,u,h])}}}[30877] }, + { sourceSha256: "ab507602d8d3533b30239e7eadc4b2d53392dd18a2af5da4539f35feacdac2c6", id: "30877", chunkId: "57898", factory: {30877(K,T,e){e.d(T,{F:()=>i,z:()=>E});var t=e(41594),r=e.n(t),n=e(61523),s=e(92873),g=e(64041),c=e(17409),h=e(51471),p=e(40477),b="trd-openOrder",S=function(y){return(0,s.o)(b,y)},E=function(){var y=(0,h.zr)("open_order_status_toast",!0),C=y.data,f=y.setData,I=y.hasInitialized,d=(0,t.useCallback)(function(){f(!C)},[C,f]);return{enableToast:I?C:!1,toggleToast:d}},i=function(){var y=S().getI18n,C=(0,g.h)().enqueueNotification,f=E().enableToast,I=(0,p.A)(C,30),d=I.run,P=(0,n.d4)(function(a){return a.setting.layout}),M=(0,t.useMemo)(function(){return P===c.a0},[P]),k=(0,t.useCallback)(function(a){var o=a.side.toUpperCase(),u=a.type.replace(/[-_]/g,"");return"".concat(o).concat(u)},[]),A=(0,t.useCallback)(function(a){if(!(a.type==="LIQUIDATION"||!f)){var o=k(a),u=y("".concat(o,"CancelTitle"),{defaultValue:"".concat(a.type," ").concat(a.side," Order Canceled")});d(u)}},[k,y,d,f]),O=(0,t.useCallback)(function(a){if(!(a.type==="LIQUIDATION"||!f)){var o=k(a),u=y("".concat(o,"FillTitle"),{defaultValue:"".concat(a.type," ").concat(a.side," Order Filled")});d(u,{variant:"success"})}},[k,y,d,f]),x=(0,t.useCallback)(function(a){if(!(a.type==="LIQUIDATION"||!f)){var o=k(a),u=y("".concat(o,"PFTitle"),{defaultValue:"".concat(a.type," ").concat(a.side," Order Partially Filled")});d(u,{variant:"success"})}},[k,y,d,f]);return(0,t.useMemo)(function(){return{cancelOrderNotify:A,fillOrderNotify:O,fillOrderPartNotify:x}},[A,O,x])}}}[30877] }, + { sourceSha256: "98094af191e88c1637017da1ba05037fa1fb4c39a7028dc8e35d0aa1c39c2a3e", id: "55401", chunkId: "29042", factory: {55401(S,f,o){o.r(f),o.d(f,{SoundNotificationProvider:()=>C});var c=o(31085),e=o(41594),x=o(17409),s=o(39116),E=function(a){var r,n;(r=a)===null||r===void 0||r.load();var u=(n=a)===null||n===void 0?void 0:n.play();u&&u.then(function(){var t;(t=a)===null||t===void 0||t.play()}).catch(function(){})},C=function(a){var r=a.children,n=(0,s.$$)(),u=n.interval,t=n.intervalFunc,h=(0,e.useRef)(null),N=(0,s.QZ)(),p=N.enableNotification,m=N.showNotification,d=(0,s.E$)(),l=d.notifications,P=d.lastNotifyTime,y=d.popNotification,j=(0,e.useCallback)(function(){var i,v=(i=h)===null||i===void 0?void 0:i.current;v&&(v.src="".concat(x.K5,"/static/spot-trade-ui/trade-sound.mp3"),E(v),t(y))},[t,y]);return(0,e.useEffect)(function(){var i;(!m||!p)&&(l.current=[]),l&&((i=l)===null||i===void 0?void 0:i.current.length)>0&&(u.current||j())},[P,p,j,l,u,m]),(0,c.jsxs)("div",{children:[r,(0,c.jsx)("div",{children:(0,c.jsx)("audio",{ref:h,children:(0,c.jsx)("source",{src:""})})})]})}}}[55401] }, + { sourceSha256: "7465bd6eac312fcc597b231b916795bf0daaf51e01191f60e6a6c2b6adeabdba", id: "30877", chunkId: "57276", factory: {30877(Y,T,e){e.d(T,{F:()=>o,z:()=>N});var a=e(41594),k=e.n(a),P=e(61523),l=e(92873),O=e(64041),C=e(17409),h=e(51471),M=e(40477),p="trd-openOrder",R=function(n){return(0,l.o)(p,n)},N=function(){var n=(0,h.zr)("open_order_status_toast",!0),c=n.data,i=n.setData,F=n.hasInitialized,u=(0,a.useCallback)(function(){i(!c)},[c,i]);return{enableToast:F?c:!1,toggleToast:u}},o=function(){var n=R().getI18n,c=(0,O.h)().enqueueNotification,i=N().enableToast,F=(0,M.A)(c,30),u=F.run,L=(0,P.d4)(function(r){return r.setting.layout}),g=(0,a.useMemo)(function(){return L===C.a0},[L]),I=(0,a.useCallback)(function(r){var d=r.side.toUpperCase(),f=r.type.replace(/[-_]/g,"");return"".concat(d).concat(f)},[]),S=(0,a.useCallback)(function(r){if(!(r.type==="LIQUIDATION"||!i)){var d=I(r),f=n("".concat(d,"CancelTitle"),{defaultValue:"".concat(r.type," ").concat(r.side," Order Canceled")});u(f)}},[I,n,u,i]),A=(0,a.useCallback)(function(r){if(!(r.type==="LIQUIDATION"||!i)){var d=I(r),f=n("".concat(d,"FillTitle"),{defaultValue:"".concat(r.type," ").concat(r.side," Order Filled")});u(f,{variant:"success"})}},[I,n,u,i]),Q=(0,a.useCallback)(function(r){if(!(r.type==="LIQUIDATION"||!i)){var d=I(r),f=n("".concat(d,"PFTitle"),{defaultValue:"".concat(r.type," ").concat(r.side," Order Partially Filled")});u(f,{variant:"success"})}},[I,n,u,i]);return(0,a.useMemo)(function(){return{cancelOrderNotify:S,fillOrderNotify:A,fillOrderPartNotify:Q}},[S,A,Q])}}}[30877] }, + { sourceSha256: "f036bb5b69da48fe84b75664e4e05079e1953baf0406dabdc60e07f3d716b492", id: "34122", chunkId: "57276", factory: {34122(Y,T,e){e.r(T),e.d(T,{OrderToastNotifyRegister:()=>N,OrderToastSwitch:()=>R});var a=e(31085),k=e(41594),P=e.n(k),l=e(71822),O=e(88478),C=e(48651),h=e(30877),M=e(34175),p=e(10157),R=function(){var o=(0,h.z)(),n=o.enableToast,c=o.toggleToast,i=(0,C.ud)().getI18n;return(0,a.jsxs)("div",{className:p.XE,onClick:c,children:[(0,a.jsx)("div",{className:p.IG,children:i("orderToastReminder",{defaultValue:"Toast Reminder"})}),(0,a.jsx)(O.A,{size:"small",checked:n})]})},N=function(){var o=(0,h.F)();return(0,k.useEffect)(function(){var n=[l.J.on("NEW",M.Zu),l.J.on("PARTIALLY_FILLED",o.fillOrderPartNotify),l.J.on("CANCELED",o.cancelOrderNotify),l.J.on("FILLED",o.fillOrderNotify),l.J.on("FILLED_NORMAL_ORDER",o.fillOrderNotify)];return function(){return n.forEach(function(c){return c()})}},[o]),null}}}[34122] }, + { sourceSha256: "1f40d63c4f3f27799bd34fd93ece8686c6b276741d62f37d928cdcba858ec53f", id: "30877", chunkId: "76905", factory: {30877(L,T,e){e.d(T,{F:()=>_,z:()=>v});var r=e(41594),x=e.n(r),O=e(61523),h=e(92873),p=e(64041),k=e(17409),C=e(51471),I=e(40477),g="trd-openOrder",f=function(s){return(0,h.o)(g,s)},v=function(){var s=(0,C.zr)("open_order_status_toast",!0),c=s.data,o=s.setData,d=s.hasInitialized,n=(0,r.useCallback)(function(){o(!c)},[c,o]);return{enableToast:d?c:!1,toggleToast:n}},_=function(){var s=f().getI18n,c=(0,p.h)().enqueueNotification,o=v().enableToast,d=(0,I.A)(c,30),n=d.run,a=(0,O.d4)(function(t){return t.setting.layout}),S=(0,r.useMemo)(function(){return a===k.a0},[a]),i=(0,r.useCallback)(function(t){var l=t.side.toUpperCase(),u=t.type.replace(/[-_]/g,"");return"".concat(l).concat(u)},[]),y=(0,r.useCallback)(function(t){if(!(t.type==="LIQUIDATION"||!o)){var l=i(t),u=s("".concat(l,"CancelTitle"),{defaultValue:"".concat(t.type," ").concat(t.side," Order Canceled")});n(u)}},[i,s,n,o]),F=(0,r.useCallback)(function(t){if(!(t.type==="LIQUIDATION"||!o)){var l=i(t),u=s("".concat(l,"FillTitle"),{defaultValue:"".concat(t.type," ").concat(t.side," Order Filled")});n(u,{variant:"success"})}},[i,s,n,o]),m=(0,r.useCallback)(function(t){if(!(t.type==="LIQUIDATION"||!o)){var l=i(t),u=s("".concat(l,"PFTitle"),{defaultValue:"".concat(t.type," ").concat(t.side," Order Partially Filled")});n(u,{variant:"success"})}},[i,s,n,o]);return(0,r.useMemo)(function(){return{cancelOrderNotify:y,fillOrderNotify:F,fillOrderPartNotify:m}},[y,F,m])}}}[30877] }, + { sourceSha256: "a25ce74a214c9e2b80bc7141b20fe798c7fbc30bcb4f79c0a9c363b4cca7119f", id: "30877", chunkId: "49426", factory: {30877(R,T,e){e.d(T,{F:()=>y,z:()=>D});var t=e(41594),O=e.n(t),u=e(61523),i=e(92873),m=e(64041),d=e(17409),f=e(51471),a=e(40477),o="trd-openOrder",b=function(S){return(0,i.o)(o,S)},D=function(){var S=(0,f.zr)("open_order_status_toast",!0),M=S.data,P=S.setData,N=S.hasInitialized,_=(0,t.useCallback)(function(){P(!M)},[M,P]);return{enableToast:N?M:!1,toggleToast:_}},y=function(){var S=b().getI18n,M=(0,m.h)().enqueueNotification,P=D().enableToast,N=(0,a.A)(M,30),_=N.run,v=(0,u.d4)(function(n){return n.setting.layout}),l=(0,t.useMemo)(function(){return v===d.a0},[v]),s=(0,t.useCallback)(function(n){var g=n.side.toUpperCase(),c=n.type.replace(/[-_]/g,"");return"".concat(g).concat(c)},[]),r=(0,t.useCallback)(function(n){if(!(n.type==="LIQUIDATION"||!P)){var g=s(n),c=S("".concat(g,"CancelTitle"),{defaultValue:"".concat(n.type," ").concat(n.side," Order Canceled")});_(c)}},[s,S,_,P]),p=(0,t.useCallback)(function(n){if(!(n.type==="LIQUIDATION"||!P)){var g=s(n),c=S("".concat(g,"FillTitle"),{defaultValue:"".concat(n.type," ").concat(n.side," Order Filled")});_(c,{variant:"success"})}},[s,S,_,P]),h=(0,t.useCallback)(function(n){if(!(n.type==="LIQUIDATION"||!P)){var g=s(n),c=S("".concat(g,"PFTitle"),{defaultValue:"".concat(n.type," ").concat(n.side," Order Partially Filled")});_(c,{variant:"success"})}},[s,S,_,P]);return(0,t.useMemo)(function(){return{cancelOrderNotify:r,fillOrderNotify:p,fillOrderPartNotify:h}},[r,p,h])}}}[30877] }, + { sourceSha256: "45e3ee5e33406e46329e7f641af069ba469481d4a3d003ebae8af2a46df77e94", id: "73335", chunkId: "40026", factory: {73335(ve,C,o){/** * @license React * react-jsx-runtime.production.min.js * @@ -134,16 +158,18 @@ const nativeFactories = [ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var O=o(41594),S=Symbol.for("react.element"),w=Symbol.for("react.fragment"),Q=Object.prototype.hasOwnProperty,Y=O.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,H={key:!0,ref:!0,__self:!0,__source:!0};function oe(B,$,z){var D,P={},F=null,ae=null;z!==void 0&&(F=""+z),$.key!==void 0&&(F=""+$.key),$.ref!==void 0&&(ae=$.ref);for(D in $)Q.call($,D)&&!H.hasOwnProperty(D)&&(P[D]=$[D]);if(B&&B.defaultProps)for(D in $=B.defaultProps,$)P[D]===void 0&&(P[D]=$[D]);return{$$typeof:S,type:B,key:F,ref:ae,props:P,_owner:Y.current}}C.Fragment=w,C.jsx=oe,C.jsxs=oe}}[73335] }, - { id: "22584", chunkId: "67656", factory: {22584(_,y,e){"use strict";e.d(y,{b:()=>i});var t=e(94917),i=function r(){"use strict";var a=this;(0,t._)(this,r),this.cbs={},this.on=function(s,n){var o=a;return a.cbs[s]||(a.cbs[s]=[]),a.cbs[s].push(n),function(){return o.off(s,n)}},this.off=function(s,n){a.cbs[s]||(a.cbs[s]=[]),a.cbs[s]=a.cbs[s].filter(function(o){return o!==n})},this.emit=function(s,n){a.cbs[s]||(a.cbs[s]=[]),a.cbs[s].forEach(function(o){return typeof o=="function"&&o(n)})}}}}[22584] }, - { id: "5558", chunkId: "32536", factory: {5558(ee,K,t){t.d(K,{$Q:()=>T,Ai:()=>S,CC:()=>R,H9:()=>h,Ub:()=>O,cg:()=>A,qS:()=>F});var P=t(61489),n=t(37230),o=t(53548);const S={symbol:"s",clientOrderId:"c",side:"S",orderType:"o",timeInForce:"f",quantity:n.X9.number("q"),price:n.X9.number("p"),stopPrice:n.X9.number("P"),icebergQuantity:n.X9.number("F"),orderListId:"g",originalClientOrderId:"C",executionType:"x",orderStatus:"X",orderRejectReason:"r",orderId:"i",LastExecutedQuantity:n.X9.number("l"),cumulativeFilledQuantity:n.X9.number("z"),lastPrice:n.X9.number("L"),commissionAmount:n.X9.number("n"),commissionAsset:"N",transactionTime:"T",tradeId:"t",isOnOrderBook:"w",isMaker:"m",orderCreationTime:"O",cumulativeQuoteQuantity:n.X9.number("Z"),lastQuoteQuantity:n.X9.number("Y"),quoteOrderQty:n.X9.number("Q"),activatePrice:n.X9.number("AP"),callbackRate:n.X9.number("cr"),trailingDelta:"d",trailingTime:"D",workingTime:"W",isSor:"uS",pegPriceType:"gP",pegOffsetType:"gOT",pegOffsetValue:"gOV",peggedPrice:"gp"},T=Object.keys(S),I={symbol:"s",insertTime:"T",type:"o",side:"S",price:n.X9.number("p"),avgPrice:n.X9.number("ap"),executedPrice:n.X9.number("ap"),executedQty:n.X9.number("z"),origQty:"q",stopPrice:n.X9.number("sp"),operate:"x",status:"X",orderId:"i",clientOrderId:"c",orderType:"o",origType:"ot",timeInForce:"f",goodTillDate:n.X9.number("gtd"),bidNotional:n.X9.number("b"),askNotional:n.X9.number("a"),workingType:"wt",positionSide:"ps",reduceOnly:"R",strategyId:"si",strategySubId:"ss",strategyType:"st",closePosition:"cp",activatePrice:n.X9.number("AP"),callbackRate:n.X9.number("cr"),priceRate:n.X9.number("cr"),priceMatch:"pm",updateTime:"T"},l=Object.keys(I),f={algoId:"aid",clientAlgoId:"caid",algoType:"at",orderType:"o",symbol:"s",side:"S",positionSide:"ps",timeInForce:"f",quantity:"q",algoStatus:"X",actualOrderId:"ai",actualPrice:"ap",actualQty:"aq",actualType:"act",triggerPrice:"tp",price:"p",icebergQuantity:"iq",tpTriggerPrice:"tptp",tpPrice:"tpp",tpOrderType:"tpot",slTriggerPrice:"sltp",slPrice:"slp",slOrderType:"slot",selfTradePreventionMode:"V",workingType:"wt",priceMatch:"pm",closePosition:"cp",priceProtect:"pP",reduceOnly:"R",activatePrice:"AP",callbackRate:"cr",goodTillDate:n.X9.number("gtd"),triggerTime:n.X9.number("tt"),updateTime:n.X9.now()},y=Object.keys(f),g={symbol:"s",strategyId:"si",newClientStrategyId:"c",side:"S",strategyType:"st",timeInForce:"f",origQty:"q",price:"p",stopPrice:"sp",strategyStatus:"os",bookTime:"T",reduceOnly:"R",workingType:"wt",positionSide:"ps",closePosition:"cp",activatePrice:"AP",priceRate:n.X9.number("cr"),priceMatch:"pm",orderId:"i",parentStrategyId:"pi",parentSubId:"PS",parentStrategyType:"pt",goodTillDate:n.X9.number("gtd")},r=Object.keys(g),d={symbol:"s",strategyClientOrderId:"c",strategyType:"st",strategyId:"si",takeProfitPrice:"tpp",stopLossPrice:"slp",takeProfitTriggerPrice:"tptp",stopLossTriggerPrice:"sltp"},i=Object.keys(d);function A(m,_,W){const X=(0,P.s)(m,{type:m.type,eventType:"executionReport",transform:Q=>j=>Q.coalscedMsg.forEach(({data:V})=>j((0,n.Li)(V,S,T)))},_,W);return(0,o.G)(X)}function R(m,_,W){const X=(0,P.s)(m,{type:m.type,eventType:"ORDER_TRADE_UPDATE",transform:Q=>j=>Q.coalscedMsg.forEach(({data:V})=>{if(V.fs&&V.fs!==m.PMFuturesSource)return;const c=(0,n.Li)(V.o,I,l);return(V.o.X==="PARTIALLY_FILLED"||V.o.x==="AMENDMENT")&&(c.updateTime=V.E),j(c)})},_,W);return(0,o.G)(X)}function F(m,_,W){const X=(0,P.s)(m,{type:m.type,eventType:"ALGO_UPDATE",transform:Q=>j=>Q.coalscedMsg.forEach(({data:V})=>{const c="ao"in V?V.ao:V.o;return j((0,n.Li)(c,f,y))})},_,W);return(0,o.G)(X)}function O(m){const _=(0,P.s)(m,{type:m.type,eventType:"CONDITIONAL_ORDER_TRADE_UPDATE",transform:W=>X=>W.coalscedMsg.forEach(({data:Q})=>{if(!(Q.fs&&Q.fs!==m.PMFuturesSource))return X((0,n.Li)(Q.so,g,r))})});return(0,o.G)(_)}function h(m,_,W){const X=(0,P.s)(m,{type:m.type,eventType:"OTOCO_ORDER_UPDATE",transform:Q=>j=>Q.coalscedMsg.forEach(({data:V})=>{j((0,n.Li)(V.su,d,i))})},_,W);return(0,o.G)(X)}}}[5558] }, - { id: "70020", chunkId: "3314", factory: {70020(D,l,t){"use strict";t.d(l,{Q:()=>d});var e=t(41594),a=t.n(e),r=t(80065),n=t(96636),i=t(51471),s="open-order-notification-sound-open",c=(0,r.A)(function(y){return{enableNotification:!1,setNotification:function(p){return y({enableNotification:p})}}}),d=function(){var y=(0,e.useState)(!1),p=y[0],T=y[1],S=(0,i.zr)(s,!1),E=S.data,A=S.setData,O=S.hasInitialized,m=c(),g=m.enableNotification,u=m.setNotification,o=(0,n.Z)().isEUFuturesUrl;(0,e.useEffect)(function(){p||O&&(u(E),T(!0))},[E,p,O,u]);var f=(0,e.useCallback)(function(){u(!g),A(!g)},[g,A,u]);return{initialized:p,showNotification:!o,enableNotification:o?!1:g,toggleNotification:f}}}}[70020] }, - { id: "4189", chunkId: "14105", factory: {4189(U,P,e){e.d(P,{zH:()=>D,nT:()=>h,u7:()=>Q,$t:()=>u,Qj:()=>T});var s=e(41594),l=e(87017),y=e(48187),m=e(57861),L=e(41466);const M=async g=>{let f;try{f=await(0,m.post)(`/bapi/futures/v1/private/future/order/open-orders?${(0,L.E2)(g||{})}`,{})}catch{f={success:!1}}return f};var S=e(43335),R=e(26860),N=e(84266),I=e(16921),C=e(90291),A=e(47738),a=e(95541),F=e(71822);const d=(g,f,i)=>{const{isCM:b}=i,p=[...g];return f.forEach(O=>{const{symbol:k,status:B,strategyType:G=null,clientOrderId:K}=O,z={...O,strategyType:G},x=p.findIndex(V=>V.clientOrderId===K&&V.symbol===k);switch(B){case"NEW":F.J.emit("NEW",{isCM:b,clientOrderId:K}),x!==-1?p[x]=z:p.unshift(z);break;case"PARTIALLY_FILLED":x!==-1&&(O.operate!=="AMENDMENT"&&F.J.emit("PARTIALLY_FILLED",p[x]),p[x]=z);break;case"CANCELED":case"EXPIRED":case"EXPIRED_IN_MATCH":x!==-1&&(F.J.emit("CANCELED",p[x]),p.splice(x,1));break;case"FILLED":x!==-1&&(F.J.emit("FILLED_NORMAL_ORDER",p[x]),p.splice(x,1));break;default:break}}),p},v=({isPM2:g,isCM:f,stream:i,queryClient:b,copyTradingPayload:p})=>{const O=p||{},k=f?a.CX:(0,a.kc)({copyTradingPayload:O}),B=K=>{b.setQueryData(S.Bz.OPEN_ORDERS(f,O),z=>({success:!0,data:d(z?.data||[],K,{isCM:f})}))};k.addWorker(B);const G=i.getUserOrderStream({isPM2:g,params:O}).subscribe(K=>{k.push(K)});return()=>{G(),k.removeWorker(B)}},o=(0,A.Y)({queryKey:S.Bz.OPEN_ORDERS,subscribeToStreamFn:v}),T=async({isCM:g,copyTradingPayload:f})=>g?(0,y.mp)():M(f),u=({enabled:g,isCM:f,isPM2:i,getSDK:b,queryClient:p,copyTradingPayload:O})=>{g&&o({getSDK:b,queryClient:p,isCM:f,isPM2:i,copyTradingPayload:O})},D=(g,{disableWs:f,...i}={})=>{const b=(0,R.n)(),{isExistFutureAccount:p}=(0,N.Py)(),O=(0,I.by)(),k=!!(b&&p),B=(0,I.Gw)(),G=(0,l.useQueryClient)(),K=(0,C.OE)();return(0,s.useEffect)(function(){u({enabled:k&&!f,isCM:g,isPM2:O,getSDK:K,queryClient:G,copyTradingPayload:B})},[k,g,O,K,G,f,B]),(0,l.useQuery)(S.Bz.OPEN_ORDERS(g,B),()=>T({isCM:g,copyTradingPayload:B}),{enabled:k,cacheTime:1/0,staleTime:1/0,notifyOnChangeProps:["data"],...i})},Q=g=>{const f=(0,l.useQueryClient)(),i=(0,I.Gw)();return(0,s.useCallback)(()=>{f.invalidateQueries(S.Bz.OPEN_ORDERS(g,i))},[i,g,f])},h=g=>{const f=(0,l.useQueryClient)(),i=(0,I.Gw)();return(0,s.useCallback)(()=>f.getQueryData(S.Bz.OPEN_ORDERS(g,i))?.data?.length||0,[i,g,f])}}}[4189] }, - { id: "37230", chunkId: "32536", factory: {37230(ee,K,t){t.d(K,{Li:()=>S,Rr:()=>n,X9:()=>o});const P={isolated:!0,cross:!1};function n(T){const I=T.split(".");return l=>{for(let f=0;fNumber(I(l))},text(T){const I=n(T);return l=>I(l)},isolatedVal(T){const I=n(T);return l=>P[I(l)]},now(){return T=>Date.now()}};function S(T,I,l){const f=Object.create(null);for(let y=0;yi});var t=e(94917),i=function r(){"use strict";var a=this;(0,t._)(this,r),this.cbs={},this.on=function(s,n){var o=a;return a.cbs[s]||(a.cbs[s]=[]),a.cbs[s].push(n),function(){return o.off(s,n)}},this.off=function(s,n){a.cbs[s]||(a.cbs[s]=[]),a.cbs[s]=a.cbs[s].filter(function(o){return o!==n})},this.emit=function(s,n){a.cbs[s]||(a.cbs[s]=[]),a.cbs[s].forEach(function(o){return typeof o=="function"&&o(n)})}}}}[22584] }, + { sourceSha256: "352d145ced1d19136316a6d5768c7b9440f3ab66986db37d5706ff84a312f884", id: "5558", chunkId: "32536", factory: {5558(ee,K,t){t.d(K,{$Q:()=>T,Ai:()=>S,CC:()=>R,H9:()=>h,Ub:()=>O,cg:()=>A,qS:()=>F});var P=t(61489),n=t(37230),o=t(53548);const S={symbol:"s",clientOrderId:"c",side:"S",orderType:"o",timeInForce:"f",quantity:n.X9.number("q"),price:n.X9.number("p"),stopPrice:n.X9.number("P"),icebergQuantity:n.X9.number("F"),orderListId:"g",originalClientOrderId:"C",executionType:"x",orderStatus:"X",orderRejectReason:"r",orderId:"i",LastExecutedQuantity:n.X9.number("l"),cumulativeFilledQuantity:n.X9.number("z"),lastPrice:n.X9.number("L"),commissionAmount:n.X9.number("n"),commissionAsset:"N",transactionTime:"T",tradeId:"t",isOnOrderBook:"w",isMaker:"m",orderCreationTime:"O",cumulativeQuoteQuantity:n.X9.number("Z"),lastQuoteQuantity:n.X9.number("Y"),quoteOrderQty:n.X9.number("Q"),activatePrice:n.X9.number("AP"),callbackRate:n.X9.number("cr"),trailingDelta:"d",trailingTime:"D",workingTime:"W",isSor:"uS",pegPriceType:"gP",pegOffsetType:"gOT",pegOffsetValue:"gOV",peggedPrice:"gp"},T=Object.keys(S),I={symbol:"s",insertTime:"T",type:"o",side:"S",price:n.X9.number("p"),avgPrice:n.X9.number("ap"),executedPrice:n.X9.number("ap"),executedQty:n.X9.number("z"),origQty:"q",stopPrice:n.X9.number("sp"),operate:"x",status:"X",orderId:"i",clientOrderId:"c",orderType:"o",origType:"ot",timeInForce:"f",goodTillDate:n.X9.number("gtd"),bidNotional:n.X9.number("b"),askNotional:n.X9.number("a"),workingType:"wt",positionSide:"ps",reduceOnly:"R",strategyId:"si",strategySubId:"ss",strategyType:"st",closePosition:"cp",activatePrice:n.X9.number("AP"),callbackRate:n.X9.number("cr"),priceRate:n.X9.number("cr"),priceMatch:"pm",updateTime:"T"},l=Object.keys(I),f={algoId:"aid",clientAlgoId:"caid",algoType:"at",orderType:"o",symbol:"s",side:"S",positionSide:"ps",timeInForce:"f",quantity:"q",algoStatus:"X",actualOrderId:"ai",actualPrice:"ap",actualQty:"aq",actualType:"act",triggerPrice:"tp",price:"p",icebergQuantity:"iq",tpTriggerPrice:"tptp",tpPrice:"tpp",tpOrderType:"tpot",slTriggerPrice:"sltp",slPrice:"slp",slOrderType:"slot",selfTradePreventionMode:"V",workingType:"wt",priceMatch:"pm",closePosition:"cp",priceProtect:"pP",reduceOnly:"R",activatePrice:"AP",callbackRate:"cr",goodTillDate:n.X9.number("gtd"),triggerTime:n.X9.number("tt"),updateTime:n.X9.now()},y=Object.keys(f),g={symbol:"s",strategyId:"si",newClientStrategyId:"c",side:"S",strategyType:"st",timeInForce:"f",origQty:"q",price:"p",stopPrice:"sp",strategyStatus:"os",bookTime:"T",reduceOnly:"R",workingType:"wt",positionSide:"ps",closePosition:"cp",activatePrice:"AP",priceRate:n.X9.number("cr"),priceMatch:"pm",orderId:"i",parentStrategyId:"pi",parentSubId:"PS",parentStrategyType:"pt",goodTillDate:n.X9.number("gtd")},r=Object.keys(g),d={symbol:"s",strategyClientOrderId:"c",strategyType:"st",strategyId:"si",takeProfitPrice:"tpp",stopLossPrice:"slp",takeProfitTriggerPrice:"tptp",stopLossTriggerPrice:"sltp"},i=Object.keys(d);function A(m,_,W){const X=(0,P.s)(m,{type:m.type,eventType:"executionReport",transform:Q=>j=>Q.coalscedMsg.forEach(({data:V})=>j((0,n.Li)(V,S,T)))},_,W);return(0,o.G)(X)}function R(m,_,W){const X=(0,P.s)(m,{type:m.type,eventType:"ORDER_TRADE_UPDATE",transform:Q=>j=>Q.coalscedMsg.forEach(({data:V})=>{if(V.fs&&V.fs!==m.PMFuturesSource)return;const c=(0,n.Li)(V.o,I,l);return(V.o.X==="PARTIALLY_FILLED"||V.o.x==="AMENDMENT")&&(c.updateTime=V.E),j(c)})},_,W);return(0,o.G)(X)}function F(m,_,W){const X=(0,P.s)(m,{type:m.type,eventType:"ALGO_UPDATE",transform:Q=>j=>Q.coalscedMsg.forEach(({data:V})=>{const c="ao"in V?V.ao:V.o;return j((0,n.Li)(c,f,y))})},_,W);return(0,o.G)(X)}function O(m){const _=(0,P.s)(m,{type:m.type,eventType:"CONDITIONAL_ORDER_TRADE_UPDATE",transform:W=>X=>W.coalscedMsg.forEach(({data:Q})=>{if(!(Q.fs&&Q.fs!==m.PMFuturesSource))return X((0,n.Li)(Q.so,g,r))})});return(0,o.G)(_)}function h(m,_,W){const X=(0,P.s)(m,{type:m.type,eventType:"OTOCO_ORDER_UPDATE",transform:Q=>j=>Q.coalscedMsg.forEach(({data:V})=>{j((0,n.Li)(V.su,d,i))})},_,W);return(0,o.G)(X)}}}[5558] }, + { sourceSha256: "9e247d3e16a783e1c6f2b2c529d64241db8ec3b52afe5d7de1618aae36467963", id: "70020", chunkId: "3314", factory: {70020(D,l,t){"use strict";t.d(l,{Q:()=>d});var e=t(41594),a=t.n(e),r=t(80065),n=t(96636),i=t(51471),s="open-order-notification-sound-open",c=(0,r.A)(function(y){return{enableNotification:!1,setNotification:function(p){return y({enableNotification:p})}}}),d=function(){var y=(0,e.useState)(!1),p=y[0],T=y[1],S=(0,i.zr)(s,!1),E=S.data,A=S.setData,O=S.hasInitialized,m=c(),g=m.enableNotification,u=m.setNotification,o=(0,n.Z)().isEUFuturesUrl;(0,e.useEffect)(function(){p||O&&(u(E),T(!0))},[E,p,O,u]);var f=(0,e.useCallback)(function(){u(!g),A(!g)},[g,A,u]);return{initialized:p,showNotification:!o,enableNotification:o?!1:g,toggleNotification:f}}}}[70020] }, + { sourceSha256: "1a9a1cfa869a72786a4b53fb5f800f5bd81fbd67ba22ad707404ee1be7b301cf", id: "4189", chunkId: "14105", factory: {4189(U,P,e){e.d(P,{zH:()=>D,nT:()=>h,u7:()=>Q,$t:()=>u,Qj:()=>T});var s=e(41594),l=e(87017),y=e(48187),m=e(57861),L=e(41466);const M=async g=>{let f;try{f=await(0,m.post)(`/bapi/futures/v1/private/future/order/open-orders?${(0,L.E2)(g||{})}`,{})}catch{f={success:!1}}return f};var S=e(43335),R=e(26860),N=e(84266),I=e(16921),C=e(90291),A=e(47738),a=e(95541),F=e(71822);const d=(g,f,i)=>{const{isCM:b}=i,p=[...g];return f.forEach(O=>{const{symbol:k,status:B,strategyType:G=null,clientOrderId:K}=O,z={...O,strategyType:G},x=p.findIndex(V=>V.clientOrderId===K&&V.symbol===k);switch(B){case"NEW":F.J.emit("NEW",{isCM:b,clientOrderId:K}),x!==-1?p[x]=z:p.unshift(z);break;case"PARTIALLY_FILLED":x!==-1&&(O.operate!=="AMENDMENT"&&F.J.emit("PARTIALLY_FILLED",p[x]),p[x]=z);break;case"CANCELED":case"EXPIRED":case"EXPIRED_IN_MATCH":x!==-1&&(F.J.emit("CANCELED",p[x]),p.splice(x,1));break;case"FILLED":x!==-1&&(F.J.emit("FILLED_NORMAL_ORDER",p[x]),p.splice(x,1));break;default:break}}),p},v=({isPM2:g,isCM:f,stream:i,queryClient:b,copyTradingPayload:p})=>{const O=p||{},k=f?a.CX:(0,a.kc)({copyTradingPayload:O}),B=K=>{b.setQueryData(S.Bz.OPEN_ORDERS(f,O),z=>({success:!0,data:d(z?.data||[],K,{isCM:f})}))};k.addWorker(B);const G=i.getUserOrderStream({isPM2:g,params:O}).subscribe(K=>{k.push(K)});return()=>{G(),k.removeWorker(B)}},o=(0,A.Y)({queryKey:S.Bz.OPEN_ORDERS,subscribeToStreamFn:v}),T=async({isCM:g,copyTradingPayload:f})=>g?(0,y.mp)():M(f),u=({enabled:g,isCM:f,isPM2:i,getSDK:b,queryClient:p,copyTradingPayload:O})=>{g&&o({getSDK:b,queryClient:p,isCM:f,isPM2:i,copyTradingPayload:O})},D=(g,{disableWs:f,...i}={})=>{const b=(0,R.n)(),{isExistFutureAccount:p}=(0,N.Py)(),O=(0,I.by)(),k=!!(b&&p),B=(0,I.Gw)(),G=(0,l.useQueryClient)(),K=(0,C.OE)();return(0,s.useEffect)(function(){u({enabled:k&&!f,isCM:g,isPM2:O,getSDK:K,queryClient:G,copyTradingPayload:B})},[k,g,O,K,G,f,B]),(0,l.useQuery)(S.Bz.OPEN_ORDERS(g,B),()=>T({isCM:g,copyTradingPayload:B}),{enabled:k,cacheTime:1/0,staleTime:1/0,notifyOnChangeProps:["data"],...i})},Q=g=>{const f=(0,l.useQueryClient)(),i=(0,I.Gw)();return(0,s.useCallback)(()=>{f.invalidateQueries(S.Bz.OPEN_ORDERS(g,i))},[i,g,f])},h=g=>{const f=(0,l.useQueryClient)(),i=(0,I.Gw)();return(0,s.useCallback)(()=>f.getQueryData(S.Bz.OPEN_ORDERS(g,i))?.data?.length||0,[i,g,f])}}}[4189] }, + { sourceSha256: "cc95a3e9cf866e8925386948ee8bb5118ff5fd2188f1f70185abf99c66ca9607", id: "37230", chunkId: "32536", factory: {37230(ee,K,t){t.d(K,{Li:()=>S,Rr:()=>n,X9:()=>o});const P={isolated:!0,cross:!1};function n(T){const I=T.split(".");return l=>{for(let f=0;fNumber(I(l))},text(T){const I=n(T);return l=>I(l)},isolatedVal(T){const I=n(T);return l=>P[I(l)]},now(){return T=>Date.now()}};function S(T,I,l){const f=Object.create(null);for(let y=0;yp.Q,$$:()=>n,E$:()=>S});var r=t(41594),s=2e3,e=2,n=function(){var E=(0,r.useRef)(null),A=function(O){E.current=setTimeout(function(){O(),E.current&&clearTimeout(E.current),E.current=null},s)};return(0,r.useMemo)(function(){return{interval:E,intervalFunc:A}},[])},i=t(75510),a=t(16921),c=t(72363),d=t(79515),h=t(40477),p=t(70020),T=function(E,A){var O=(0,d.nH)(),m=(0,d.Py)().isExistFutureAccount,y=(0,h.A)(A,500),u=y.run,o=(0,d.ON)().isPM2,f=(0,a.Gw)();(0,r.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!0});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(C){(C.status==="FILLED"||C.status==="PARTIALLY_FILLED"||C.status==="EXPIRED")&&u(String(C.orderId))})})},[u,E,m,O,o,f]),(0,r.useEffect)(function(){if(!O||!m||!E)return function(){return null};var _=(0,c.Ri)({isCM:!1});return _.getUserOrderStream({isPM2:o,params:f}).subscribe(function(v){var L=Array.isArray(v)?(0,i._)(v):[v];L.forEach(function(C){(C.status==="FILLED"||C.status==="PARTIALLY_FILLED"||C.status==="EXPIRED")&&u(String(C.orderId))})})},[u,E,m,O,o,f])},S=function(){var E=(0,r.useState)(new Date),A=E[0],O=E[1],m=(0,r.useRef)([]),y=(0,p.Q)(),u=y.showNotification,o=y.enableNotification,f=(0,r.useCallback)(function(){var v;(v=m)===null||v===void 0||v.current.shift(),O(new Date)},[]),_=(0,r.useCallback)(function(v){var L;if(u&&((L=m)===null||L===void 0?void 0:L.current.length) entry.id === String(id) && (chunkId === undefined || entry.chunkId === String(chunkId))); - if (matches.length !== 1) throw new Error('Native notification fixture needs one exact module and chunk'); +export function createNativeOrderNotificationFactory(id, chunkId, sourceSha256) { + const matches = nativeFactories.filter(entry => entry.id === String(id) && (chunkId === undefined || entry.chunkId === String(chunkId)) + && (sourceSha256 === undefined || entry.sourceSha256 === sourceSha256)); + if (matches.length !== 1) throw new Error('Native notification fixture needs one exact module source'); return matches[0].factory; } diff --git a/test/helpers/binance-order-notifications.js b/test/helpers/binance-order-notifications.js index 720e94a..4b3cc87 100644 --- a/test/helpers/binance-order-notifications.js +++ b/test/helpers/binance-order-notifications.js @@ -206,6 +206,7 @@ export async function createNotificationHarness(t, { toastEnabled = true, soundEnabled = true, variantChunk = '37511', + soundSourceSha256 = '5362a54e61f022714e673e166b62e3c22997084ca7a9f4e676475ec91cfcfaa8', driftModule = null, firstPlayPending = false, inspectSoundQueue = false, @@ -263,13 +264,14 @@ export async function createNotificationHarness(t, { : null; const factories = new Map(); for (const id of [30877, 39116, 55401, 40477, 70020, 22584, 34122]) { - const original = createNativeOrderNotificationFactory(id, id === 30877 ? variantChunk : undefined); + const original = createNativeOrderNotificationFactory(id, id === 30877 ? variantChunk : undefined, + id === 39116 ? soundSourceSha256 : undefined); const target = scope?.targets[id]; if (target && id === driftModule) { const driftedFactory = function changedNativeFactory(...args) { return Reflect.apply(original, this, args); }; - assert.throws(() => target.replace(driftedFactory), /source does not match a pinned public module/); + assert.throws(() => target.replace(driftedFactory), SyntaxError); target.onFailure('source_mismatch'); factories.set(id, driftedFactory); } else if (target) { diff --git a/test/unit/binance-chart-storage-runtime.test.js b/test/unit/binance-chart-storage-runtime.test.js index 0da3ccd..3c75660 100644 --- a/test/unit/binance-chart-storage-runtime.test.js +++ b/test/unit/binance-chart-storage-runtime.test.js @@ -202,7 +202,8 @@ test('user keeps the original factory executable when strict source registration /** Render-free factory execution proves the shared real Rspack registration path. */ function registerNotificationFactories({ mismatchId } = {}) { const originals = Object.fromEntries([['30877', '37511'], ['39116', '3314'], ['55401', '29042']] - .map(([id, chunk]) => [id, createNativeOrderNotificationFactory(id, chunk)])); + .map(([id, chunk]) => [id, createNativeOrderNotificationFactory(id, chunk, + id === '39116' ? '5362a54e61f022714e673e166b62e3c22997084ca7a9f4e676475ec91cfcfaa8' : undefined)])); if (mismatchId) originals[mismatchId] = module => { module.exports = { nativeDrift: mismatchId }; }; const inactiveIds = [61523, 64041, 51471, 40477, 16921, 72363, 70020]; const inactive = Object.fromEntries(inactiveIds.map(id => [id, module => { module.exports = Object.freeze({}); }])); diff --git a/test/unit/binance-orderbook-trade/order-notification-factory-structure.test.js b/test/unit/binance-orderbook-trade/order-notification-factory-structure.test.js new file mode 100644 index 0000000..a3d3f68 --- /dev/null +++ b/test/unit/binance-orderbook-trade/order-notification-factory-structure.test.js @@ -0,0 +1,186 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; + +import { createOrderNotificationFactorySignature } from '../../../src/binance-orderbook-trade/order-notifications/factory-structure.js'; + +const capture = JSON.parse(readFileSync(new URL('../../fixtures/binance-order-notifications/native-factories.json', import.meta.url), 'utf8')); +const signature = source => createOrderNotificationFactorySignature(source, '30877'); + +for (const id of ['30877', '39116', '55401']) { + test(`user recognizes every captured local-name variant of notification module ${id}`, () => { + // Given complete independently captured factories for one notification module + const factories = capture.factories.filter(factory => factory.id === id); + + // When their complete structures and resolved bindings are compared + const signatures = factories.map(factory => createOrderNotificationFactorySignature(factory.source, id)); + + // Then all captured variants share exactly one accepted structure + assert.equal(signatures.length, id === '30877' ? 6 : id === '39116' ? 2 : 1); + assert.equal(new Set(signatures).size, 1); + }); +} + +test('user recognizes an unseen consistent rename across closures and declaration patterns', () => { + // Given equivalent factories with independently written local names and formatting + const original = '30877(a,b,r){const {value:c}=a;let d=c;for(let e of a.items){d+=e}try{return function f(g){return g?f(g-1):r(40477).run(d+b)}}catch(h){throw h}}'; + const renamed = `30877(module, exports, require) { + const {value: initial} = module; + let total = initial; + for (let item of module.items) { total += item } + try { + return function recur(count) { return count ? recur(count - 1) : require(40477).run(total + exports) } + } catch (failure) { throw failure } + }`; + + // When both complete factories receive structural signatures + const observed = [signature(original), signature(renamed)]; + + // Then lexical declarations and every resolved reference retain the same identity + assert.equal(observed[0], observed[1]); +}); + +test('user recognizes whitespace comments quotes and equivalent number spelling', () => { + // Given equal literals and code with different source formatting + const sources = ['30877(a,b,r){return r(2e3).run("filled",a)}', "30877(module, exports, require) { /* public formatting */ return require(2000).run('filled', module) }"]; + + // When literal values and local bindings are compared + const observed = sources.map(signature); + + // Then source spelling does not create another notification variant + assert.equal(observed[0], observed[1]); +}); + +const changedContracts = [ + ['boolean value', '30877(a){return !0}', '30877(a){return false}'], + ['boolean and number types', '30877(a){return false}', '30877(a){return 0}'], + ['truthiness of a binding', '30877(a){return !a}', '30877(a){return true}'], + ['truthiness with side effects', '30877(a){return !a()}', '30877(a){return true}'], + ['string truthiness', '30877(a){return !"0"}', '30877(a){return false}'], + ['bigint truthiness', '30877(a){return !0n}', '30877(a){return true}'], + ['sequence truthiness side effect', '30877(a){return !(a(),0)}', '30877(a){return true}'], + ['export key', '30877(a,b,r){return {fill:a}}', '30877(a,b,r){return {cancel:a}}'], + ['member key', '30877(a,b,r){return a.run(b)}', '30877(a,b,r){return a.stop(b)}'], + ['shorthand key', '30877(a,b,r){return {a}}', '30877(c,b,r){return {c}}'], + ['destructured key', '30877(a,b,r){const {fill:c}=a;return c}', '30877(a,b,r){const {cancel:c}=a;return c}'], + ['global reference', '30877(a,b,r){return setTimeout(a,30)}', '30877(a,b,r){return clearTimeout(a,30)}'], + ['import ID', '30877(a,b,r){return r(40477)}', '30877(a,b,r){return r(40478)}'], + ['side effect', '30877(a,b,r){a.play();return b}', '30877(a,b,r){a.load();return b}'], + ['operator', '30877(a,b,r){return a&&b}', '30877(a,b,r){return a||b}'], + ['literal value', '30877(a,b,r){return r(a,30)}', '30877(a,b,r){return r(a,31)}'], + ['directive', '30877(a,b,r){"use strict";return a}', '30877(a,b,r){"use other";return a}'], + ['regular expression pattern', '30877(a,b,r){return /fill/g.test(a)}', '30877(a,b,r){return /cancel/g.test(a)}'], + ['regular expression flags', '30877(a,b,r){return /fill/g.test(a)}', '30877(a,b,r){return /fill/i.test(a)}'], + ['bigint value', '30877(a,b,r){return 1n}', '30877(a,b,r){return 2n}'], + ['non-finite numeric value', '30877(a,b,r){return 1e400}', '30877(a,b,r){return null}'], + ['tagged template raw value', '30877(a,b,r){return a`\\u0061`}', '30877(a,b,r){return a`a`}'], + ['computed property reference', '30877(a,b,r){return a[b]}', '30877(a,b,r){return a[r]}'], + ['closure binding', '30877(a,b,r){return function(c){return a+c}}', '30877(a,b,r){return function(c){return c+c}}'], + ['shadowed global binding', '30877(a,b,r){return function(c){return String(c)}}', '30877(a,b,r){return function(String){return String(String)}}'], + ['implicit arguments reference', '30877(a,b,r){return arguments[0]}', '30877(a,b,r){return a[0]}'], + ['implicit arguments initialization', '30877(){var arguments;return arguments[0]}', '30877(){var value;return value[0]}'], +]; + +for (const [compact, expanded] of [['!0', 'true'], ['!1', 'false']]) { + test(`user recognizes the equivalent boolean spelling ${compact} and ${expanded}`, () => { + // Given a repacker expands a pure boolean constant without changing its value + const sources = [`30877(a){return a({enabled:${compact}})}`, `30877(callback){return callback({enabled:${expanded}})}`]; + + // When both representations pass through the actual structure matcher + const observed = sources.map(signature); + + // Then only the constant spelling differs and both select the same structure + assert.equal(observed[0], observed[1]); + }); +} + +for (const [contract, original, changed] of changedContracts) { + test(`user rejects a notification factory with a changed ${contract}`, () => { + // Given two factories that differ in an observable native contract + const candidates = [original, changed]; + + // When the complete factories receive structural signatures + const observed = candidates.map(signature); + + // Then the changed contract cannot inherit a pinned notification replacement + assert.notEqual(observed[0], observed[1]); + }); +} + +test('user preserves implicit arguments across nested local renames', () => { + // Given an arrow closure inherits the ordinary function arguments object + const sources = ['30877(a,b,r){return function(c){return ()=>arguments[0]+c+a}}', '30877(module,exports,require){return function(value){return ()=>arguments[0]+value+module}}']; + + // When only explicit local bindings are renamed + const observed = sources.map(signature); + + // Then the inherited implicit arguments identity remains unchanged + assert.equal(observed[0], observed[1]); +}); + +test('user recognizes an explicitly declared arguments parameter as a local binding', () => { + // Given an explicit parameter shadows the implicit arguments object + const sources = [ + '30877(a,b,r){return a+b+r}', + '30877(arguments,exports,require){return arguments+exports+require}', + '30877(module,arguments,require){return module+arguments+require}', + '30877(module,exports,arguments){return module+exports+arguments}', + ]; + + // When equivalent parameter bindings receive structural signatures + const observed = sources.map(signature); + + // Then the unused implicit arguments variable cannot shift binding identities + assert.equal(new Set(observed).size, 1); +}); + +test('user preserves class declaration identities across lexical renames', () => { + // Given a class declaration defines both an outer binding and a class-local name + const sources = [ + '30877(a,b,r){class C extends a{method(){return C+b}}return C}', + '30877(module,exports,require){class Value extends module{method(){return Value+exports}}return Value}', + ]; + + // When the class and enclosing local variables are consistently renamed + const observed = sources.map(signature); + + // Then references to both class bindings retain their distinct identities + assert.equal(observed[0], observed[1]); +}); + +const rejectedSources = [ + ['direct eval', '30877(a,b,r){return eval("a")}', /dynamic scope/], + ['with scope', '30877(a,b,r){with(a){return value}}', /dynamic scope/], + ['multiple properties', '30877(a){return a},39116(a){return a}', /one module factory/], + ['wrong module ID', '39116(a){return a}', /module ID/], + ['computed module key', '[30877](a){return a}', /module factory/], + ['non-function module', '30877:30', /module factory/], + ['getter module', 'get 30877(){return 30}', /module factory/], + ['invalid syntax', '30877(a){return', SyntaxError], + ['unsupported syntax', '30877(a){using resource=a;return resource}', SyntaxError], + ['oversized source', `30877(){/*${'x'.repeat(65536)}*/}`, /64 KiB/], +]; + +for (const [reason, source, expected] of rejectedSources) { + test(`user keeps unsupported ${reason} outside notification matching`, () => { + // Given factory text violates the structural matcher contract + const candidate = source; + + // When the unsupported source is analyzed + const analyze = () => signature(candidate); + + // Then the caller receives an explicit error instead of an accepted structure + assert.throws(analyze, expected); + }); +} + +test('user gets an explicit input error without factory source coercion', () => { + // Given the factory source is a non-string object + const candidate = { toString() { throw new Error('Source coercion must not run'); } }; + + // When a structural signature is requested + const analyze = () => signature(candidate); + + // Then the source type is rejected before any coercion executes + assert.throws(analyze, /must be a string/); +}); diff --git a/test/unit/coverage-report.test.js b/test/unit/coverage-report.test.js index dacc20a..37ccabf 100644 --- a/test/unit/coverage-report.test.js +++ b/test/unit/coverage-report.test.js @@ -8,10 +8,37 @@ import { ROOT, productionSourceFiles } from '../../scripts/test-coverage/config. import { createSourceRegistry, mapCoverageEntry, + retainProjectSourceMappings, } from '../../scripts/test-coverage/source-maps.mjs'; const registry = await createSourceRegistry(); +test('user excludes bundled vendor code without extending adjacent project coverage', () => { + // Given project and vendor mappings share a generated line and one project source is unexecuted + const sources = ['src/first.js', 'node_modules/parser/index.js', 'src/second.js', 'src/unexecuted.js']; + const map = { version: 3, sources, sourcesContent: ['first', 'vendor', 'second', 'unexecuted'], names: [], + mappings: encode([[[0, 0, 0, 0], [7, 1, 0, 0], [13, 2, 0, 0]], [[0, 1, 1, 0]]]) }; + + // When the mapper retains the complete project source set + const result = retainProjectSourceMappings(map, new Set(sources.filter(path => path.startsWith('src/')))); + + // Then vendor columns explicitly clear attribution and all project sources remain + assert.deepEqual(result.sources, ['src/first.js', 'src/second.js', 'src/unexecuted.js']); + assert.deepEqual(result.sourcesContent, ['first', 'second', 'unexecuted']); + assert.deepEqual(decode(result.mappings), [[[0, 0, 0, 0], [7], [13, 1, 0, 0]], [[0]]]); +}); + +test('user rejects a coverage source outside the project and bundled dependencies', () => { + // Given a map claims an unknown source that is neither project code nor a dependency + const map = { sources: ['outside/unknown.js'], sourcesContent: ['unknown'], names: [], mappings: '' }; + + // When the registry attempts to classify its source + const classify = () => retainProjectSourceMappings(map, new Set()); + + // Then the unexpected source is exposed instead of silently reducing the denominator + assert.throws(classify, /Unexpected non-project coverage source: outside\/unknown.js/); +}); + test('user gets coverage maps for the exact install artifacts and complete original sources', async () => { // Given the seven generated installers and two hand-maintained installers. const paths = registry.artifacts.map((artifact) => artifact.path).sort();