muthuk1 commited on
Commit
f56a29b
·
verified ·
1 Parent(s): 3a3247c

Convert OpenMAIC from Next.js to React (Vite)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .env.example +192 -0
  2. .gitattributes +27 -0
  3. .gitignore +24 -0
  4. README.md +138 -0
  5. index.html +14 -0
  6. package-lock.json +0 -0
  7. package.json +107 -0
  8. packages/mathml2omml/.gitignore +3 -0
  9. packages/mathml2omml/LICENSE +165 -0
  10. packages/mathml2omml/dist/index.cjs +2509 -0
  11. packages/mathml2omml/dist/index.cjs.map +0 -0
  12. packages/mathml2omml/dist/index.d.ts +40 -0
  13. packages/mathml2omml/dist/index.js +2507 -0
  14. packages/mathml2omml/dist/index.js.map +0 -0
  15. packages/mathml2omml/node_modules/.bin/baseline-browser-mapping +2 -0
  16. packages/mathml2omml/node_modules/.bin/biome +98 -0
  17. packages/mathml2omml/node_modules/.bin/browserslist +156 -0
  18. packages/mathml2omml/node_modules/.bin/create-jest +8 -0
  19. packages/mathml2omml/node_modules/.bin/esparse +139 -0
  20. packages/mathml2omml/node_modules/.bin/esvalidate +236 -0
  21. packages/mathml2omml/node_modules/.bin/husky +26 -0
  22. packages/mathml2omml/node_modules/.bin/import-local-fixture +7 -0
  23. packages/mathml2omml/node_modules/.bin/jest +13 -0
  24. packages/mathml2omml/node_modules/.bin/js-yaml +132 -0
  25. packages/mathml2omml/node_modules/.bin/jsesc +148 -0
  26. packages/mathml2omml/node_modules/.bin/json5 +152 -0
  27. packages/mathml2omml/node_modules/.bin/lint-staged +164 -0
  28. packages/mathml2omml/node_modules/.bin/node-which +52 -0
  29. packages/mathml2omml/node_modules/.bin/parser +15 -0
  30. packages/mathml2omml/node_modules/.bin/pidtree +128 -0
  31. packages/mathml2omml/node_modules/.bin/resolve +50 -0
  32. packages/mathml2omml/node_modules/.bin/rollup +1912 -0
  33. packages/mathml2omml/node_modules/.bin/semver +174 -0
  34. packages/mathml2omml/node_modules/.bin/update-browserslist-db +42 -0
  35. packages/mathml2omml/node_modules/.bin/yaml +11 -0
  36. packages/mathml2omml/node_modules/.package-lock.json +0 -0
  37. packages/mathml2omml/node_modules/@babel/code-frame/LICENSE +22 -0
  38. packages/mathml2omml/node_modules/@babel/code-frame/README.md +19 -0
  39. packages/mathml2omml/node_modules/@babel/code-frame/lib/index.js +217 -0
  40. packages/mathml2omml/node_modules/@babel/code-frame/lib/index.js.map +1 -0
  41. packages/mathml2omml/node_modules/@babel/code-frame/package.json +32 -0
  42. packages/mathml2omml/node_modules/@babel/compat-data/LICENSE +22 -0
  43. packages/mathml2omml/node_modules/@babel/compat-data/README.md +19 -0
  44. packages/mathml2omml/node_modules/@babel/compat-data/corejs2-built-ins.js +2 -0
  45. packages/mathml2omml/node_modules/@babel/compat-data/corejs3-shipped-proposals.js +2 -0
  46. packages/mathml2omml/node_modules/@babel/compat-data/data/corejs2-built-ins.json +2106 -0
  47. packages/mathml2omml/node_modules/@babel/compat-data/data/corejs3-shipped-proposals.json +5 -0
  48. packages/mathml2omml/node_modules/@babel/compat-data/data/native-modules.json +18 -0
  49. packages/mathml2omml/node_modules/@babel/compat-data/data/overlapping-plugins.json +35 -0
  50. packages/mathml2omml/node_modules/@babel/compat-data/data/plugin-bugfixes.json +203 -0
.env.example ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # =============================================================================
2
+ # OpenMAIC Environment Variables
3
+ # Copy this file to .env.local and fill in the values you need.
4
+ # All variables are optional — only configure the providers you want to use.
5
+ # You can also use server-providers.yml for configuration (see docs).
6
+ # =============================================================================
7
+
8
+ # --- LLM Providers -----------------------------------------------------------
9
+ # Format: {PROVIDER}_API_KEY, {PROVIDER}_BASE_URL (optional), {PROVIDER}_MODELS (optional, comma-separated)
10
+
11
+ OPENAI_API_KEY=
12
+ OPENAI_BASE_URL=
13
+ OPENAI_MODELS=
14
+
15
+ ANTHROPIC_API_KEY=
16
+ ANTHROPIC_BASE_URL=
17
+ ANTHROPIC_MODELS=
18
+
19
+ GOOGLE_API_KEY=
20
+ GOOGLE_BASE_URL=
21
+ GOOGLE_MODELS=
22
+
23
+ DEEPSEEK_API_KEY=
24
+ DEEPSEEK_BASE_URL=
25
+ # Example: deepseek-v4-pro,deepseek-v4-flash
26
+ DEEPSEEK_MODELS=
27
+
28
+ QWEN_API_KEY=
29
+ QWEN_BASE_URL=
30
+ QWEN_MODELS=
31
+
32
+ KIMI_API_KEY=
33
+ KIMI_BASE_URL=
34
+ KIMI_MODELS=
35
+
36
+ MINIMAX_API_KEY=
37
+ # MiniMax Anthropic-compatible endpoint for the built-in Anthropic SDK integration
38
+ MINIMAX_BASE_URL=https://api.minimaxi.com/anthropic/v1
39
+ # Example: MiniMax-M2.7-highspeed,MiniMax-M2.7,MiniMax-M2.5-highspeed,MiniMax-M2.5
40
+ MINIMAX_MODELS=
41
+
42
+ GLM_API_KEY=
43
+ GLM_BASE_URL=
44
+ GLM_MODELS=
45
+
46
+ SILICONFLOW_API_KEY=
47
+ SILICONFLOW_BASE_URL=
48
+ SILICONFLOW_MODELS=
49
+
50
+ DOUBAO_API_KEY=
51
+ DOUBAO_BASE_URL=
52
+ DOUBAO_MODELS=
53
+
54
+ OPENROUTER_API_KEY=
55
+ OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
56
+ # Example: deepseek/deepseek-v4-pro,deepseek/deepseek-v4-flash
57
+ OPENROUTER_MODELS=
58
+
59
+ GROK_API_KEY=
60
+ GROK_BASE_URL=
61
+ GROK_MODELS=
62
+
63
+ TENCENT_API_KEY=
64
+ # Tencent TokenHub OpenAI-compatible endpoint. Hy3 is a model ID, not an env prefix.
65
+ # TENCENT_HUNYUAN_* is also accepted as an alias.
66
+ TENCENT_BASE_URL=https://tokenhub.tencentmaas.com/v1
67
+ # Example: hy3-preview,hunyuan-2.0-thinking-20251109,hunyuan-2.0-instruct-20251111
68
+ TENCENT_MODELS=
69
+
70
+ XIAOMI_API_KEY=
71
+ # MIMO_* is also accepted as an alias.
72
+ XIAOMI_BASE_URL=https://api.xiaomimimo.com/v1
73
+ # Example: mimo-v2.5-pro,mimo-v2.5
74
+ XIAOMI_MODELS=
75
+
76
+ # --- Ollama (Local Models) ---------------------------------------------------
77
+ # No API key needed. Configure BASE_URL here (server-side) so it bypasses SSRF
78
+ # protection automatically. Client-supplied localhost URLs are blocked in production.
79
+ # OLLAMA_BASE_URL=http://localhost:11434/v1
80
+ # OLLAMA_MODELS=llama3.3,llama3.2,qwen2.5,mistral,gemma3
81
+
82
+ # --- TTS (Text-to-Speech) ----------------------------------------------------
83
+
84
+ TTS_OPENAI_API_KEY=
85
+ TTS_OPENAI_BASE_URL=
86
+
87
+ TTS_AZURE_API_KEY=
88
+ TTS_AZURE_BASE_URL=
89
+
90
+ TTS_GLM_API_KEY=
91
+ TTS_GLM_BASE_URL=
92
+
93
+ TTS_QWEN_API_KEY=
94
+ TTS_QWEN_BASE_URL=
95
+
96
+ TTS_MINIMAX_API_KEY=
97
+ # MiniMax TTS endpoint (speech-2.8 / 2.6 / 02 / 01 series)
98
+ TTS_MINIMAX_BASE_URL=https://api.minimaxi.com
99
+ TTS_ELEVENLABS_API_KEY=
100
+ TTS_ELEVENLABS_BASE_URL=
101
+
102
+ # --- ASR (Automatic Speech Recognition) --------------------------------------
103
+
104
+ ASR_OPENAI_API_KEY=
105
+ ASR_OPENAI_BASE_URL=
106
+
107
+ ASR_QWEN_API_KEY=
108
+ ASR_QWEN_BASE_URL=
109
+
110
+ # --- PDF Processing -----------------------------------------------------------
111
+
112
+ PDF_UNPDF_API_KEY=
113
+ PDF_UNPDF_BASE_URL=
114
+
115
+ PDF_MINERU_API_KEY=
116
+ PDF_MINERU_BASE_URL=
117
+
118
+ # --- Image Generation ---------------------------------------------------------
119
+
120
+ IMAGE_OPENAI_API_KEY=
121
+ IMAGE_OPENAI_BASE_URL=https://api.openai.com/v1
122
+
123
+ IMAGE_SEEDREAM_API_KEY=
124
+ IMAGE_SEEDREAM_BASE_URL=
125
+
126
+ IMAGE_QWEN_IMAGE_API_KEY=
127
+ IMAGE_QWEN_IMAGE_BASE_URL=
128
+
129
+ IMAGE_NANO_BANANA_API_KEY=
130
+ IMAGE_NANO_BANANA_BASE_URL=
131
+
132
+ IMAGE_MINIMAX_API_KEY=
133
+ # Example models: image-01, image-01-live
134
+ IMAGE_MINIMAX_BASE_URL=https://api.minimaxi.com
135
+
136
+ IMAGE_GROK_API_KEY=
137
+ IMAGE_GROK_BASE_URL=
138
+
139
+ # --- Video Generation ---------------------------------------------------------
140
+
141
+ VIDEO_SEEDANCE_API_KEY=
142
+ VIDEO_SEEDANCE_BASE_URL=
143
+
144
+ VIDEO_KLING_API_KEY=
145
+ VIDEO_KLING_BASE_URL=
146
+
147
+ VIDEO_VEO_API_KEY=
148
+ VIDEO_VEO_BASE_URL=
149
+
150
+ VIDEO_SORA_API_KEY=
151
+ VIDEO_SORA_BASE_URL=
152
+
153
+ VIDEO_MINIMAX_API_KEY=
154
+ # Example models: MiniMax-Hailuo-2.3, MiniMax-Hailuo-2.3-Fast, MiniMax-Hailuo-02
155
+ VIDEO_MINIMAX_BASE_URL=https://api.minimaxi.com
156
+
157
+ VIDEO_GROK_API_KEY=
158
+ VIDEO_GROK_BASE_URL=
159
+
160
+ # --- Web Search ---------------------------------------------------------------
161
+ # Note: Grok (xAI) web search is available via chat completions + search tools,
162
+ # not as a standalone search API. Use Grok LLM provider with search_parameters
163
+ # in chat requests. See: https://docs.x.ai/docs/guides/tools/search-tools
164
+
165
+ TAVILY_API_KEY=
166
+
167
+ # --- Proxy (optional) --------------------------------------------------------
168
+
169
+ # HTTP_PROXY=
170
+ # HTTPS_PROXY=
171
+
172
+ # --- Misc ---------------------------------------------------------------------
173
+
174
+ # Optional server-side default model for API routes like /api/generate-classroom
175
+ # Example: anthropic:claude-3-5-haiku-20241022 or google:gemini-3-flash-preview
176
+ # OpenAI example: openai:gpt-5.5
177
+ # MiniMax example: minimax:MiniMax-M2.7-highspeed
178
+ DEFAULT_MODEL=
179
+
180
+ # LOG_LEVEL=info
181
+ # LOG_FORMAT=pretty
182
+ # LLM_THINKING_DISABLED=false
183
+
184
+ # --- Local/Self-hosted Deployment ---------------------------------------------
185
+ # Set to "true" to allow private/local network URLs (e.g. localhost, 192.168.x.x).
186
+ # Required for self-hosted models like Ollama. Do NOT enable on public deployments.
187
+ # ALLOW_LOCAL_NETWORKS=true
188
+
189
+ # --- Access Control -----------------------------------------------------------
190
+ # Set a password to restrict site access. When set, users must enter this code
191
+ # before using the app. Leave empty or remove to disable access control.
192
+ # ACCESS_CODE=your-secret-code
.gitattributes CHANGED
@@ -33,3 +33,30 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ packages/mathml2omml/node_modules/@biomejs/cli-linux-x64/biome filter=lfs diff=lfs merge=lfs -text
37
+ packages/mathml2omml/node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text
38
+ packages/pptxgenjs/node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text
39
+ public/avatars/teacher.png filter=lfs diff=lfs merge=lfs -text
40
+ public/logo-horizontal.png filter=lfs diff=lfs merge=lfs -text
41
+ src/assets/avalon.gif filter=lfs diff=lfs merge=lfs -text
42
+ src/assets/banner.png filter=lfs diff=lfs merge=lfs -text
43
+ src/assets/deepseek.gif filter=lfs diff=lfs merge=lfs -text
44
+ src/assets/discussion.gif filter=lfs diff=lfs merge=lfs -text
45
+ src/assets/feishu-qrcode.png filter=lfs diff=lfs merge=lfs -text
46
+ src/assets/interactive.gif filter=lfs diff=lfs merge=lfs -text
47
+ src/assets/interactive_mode/3D_interactive.gif filter=lfs diff=lfs merge=lfs -text
48
+ src/assets/interactive_mode/code_interactive.gif filter=lfs diff=lfs merge=lfs -text
49
+ src/assets/interactive_mode/desktop_interactive.png filter=lfs diff=lfs merge=lfs -text
50
+ src/assets/interactive_mode/game_interactive.gif filter=lfs diff=lfs merge=lfs -text
51
+ src/assets/interactive_mode/ipad_interactive.png filter=lfs diff=lfs merge=lfs -text
52
+ src/assets/interactive_mode/mindmap_interactive.gif filter=lfs diff=lfs merge=lfs -text
53
+ src/assets/interactive_mode/phone_interactive.png filter=lfs diff=lfs merge=lfs -text
54
+ src/assets/interactive_mode/simulation_interactive.gif filter=lfs diff=lfs merge=lfs -text
55
+ src/assets/interactive_mode/teacher_action_interative.gif filter=lfs diff=lfs merge=lfs -text
56
+ src/assets/logo-horizontal.png filter=lfs diff=lfs merge=lfs -text
57
+ src/assets/openclaw-feishu-demo.gif filter=lfs diff=lfs merge=lfs -text
58
+ src/assets/pbl.gif filter=lfs diff=lfs merge=lfs -text
59
+ src/assets/python.gif filter=lfs diff=lfs merge=lfs -text
60
+ src/assets/quiz.gif filter=lfs diff=lfs merge=lfs -text
61
+ src/assets/slides.gif filter=lfs diff=lfs merge=lfs -text
62
+ src/assets/zhipu-minimax.gif filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ *.local
14
+
15
+ # Editor directories and files
16
+ .vscode/*
17
+ !.vscode/extensions.json
18
+ .idea
19
+ .DS_Store
20
+ *.suo
21
+ *.ntvs*
22
+ *.njsproj
23
+ *.sln
24
+ *.sw?
README.md ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # OpenMAIC-React
2
+
3
+ A full conversion of [OpenMAIC](https://github.com/THU-MAIC/OpenMAIC) from **Next.js** to **React (Vite)**.
4
+
5
+ OpenMAIC is the open-source AI interactive classroom — upload a PDF to instantly generate an immersive, multi-agent learning experience.
6
+
7
+ ## What Changed (Next.js → React)
8
+
9
+ | Feature | Next.js (Original) | React + Vite (This Repo) |
10
+ |---|---|---|
11
+ | **Framework** | Next.js 16 | React 19 + Vite 6 |
12
+ | **Routing** | App Router (`app/` directory) | React Router DOM v7 |
13
+ | **Pages** | `app/page.tsx`, `app/classroom/[id]/page.tsx` | `src/pages/` with lazy loading |
14
+ | **Layout** | `app/layout.tsx` | `src/App.tsx` with `<BrowserRouter>` |
15
+ | **API Routes** | `app/api/*/route.ts` | `src/api-routes/` (for separate Express backend) |
16
+ | **`'use client'`** | Required for client components | Removed (all components are client-side) |
17
+ | **Navigation** | `useRouter` from `next/navigation` | `useNavigate` from `react-router-dom` |
18
+ | **Route Params** | `useParams` from `next/navigation` | `useParams` from `react-router-dom` |
19
+ | **Fonts** | `next/font/local` | `@fontsource-variable/inter` CSS import |
20
+ | **Themes** | Custom `ThemeProvider` (no `next-themes`) | Same custom `ThemeProvider` |
21
+ | **CSS** | Tailwind CSS v4 + PostCSS | Tailwind CSS v4 + PostCSS (identical) |
22
+ | **Env Variables** | `process.env.*` | `import.meta.env.VITE_*` |
23
+ | **Middleware** | Next.js middleware | Kept in `src/api-routes/` for backend |
24
+ | **Build** | `next build` | `vite build` |
25
+
26
+ ## Routes
27
+
28
+ | Path | Component | Description |
29
+ |---|---|---|
30
+ | `/` | `HomePage` | Landing page with classroom list and generation form |
31
+ | `/classroom/:id` | `ClassroomPage` | Interactive classroom view |
32
+ | `/generation-preview` | `GenerationPreviewPage` | Live generation preview with step visualization |
33
+ | `/eval/whiteboard` | `WhiteboardEvalPage` | Whiteboard evaluation tool |
34
+
35
+ ## Project Structure
36
+
37
+ ```
38
+ src/
39
+ ├── main.tsx # Entry point
40
+ ├── App.tsx # Root component with Router + Providers
41
+ ├── globals.css # Global styles (Tailwind v4)
42
+ ├── pages/ # Page components (lazy loaded)
43
+ │ ├── HomePage.tsx
44
+ │ ├── ClassroomPage.tsx
45
+ │ ├── generation-preview/
46
+ │ └── eval/
47
+ ├── components/ # Shared UI components (200+ files)
48
+ │ ├── ui/ # shadcn/ui components
49
+ │ ├── ai-elements/ # AI interaction components
50
+ │ ├── agent/ # Agent management
51
+ │ ├── chat/ # Chat interface
52
+ │ ├── canvas/ # Canvas drawing
53
+ │ ├── whiteboard/ # Whiteboard
54
+ │ └── ...
55
+ ├── lib/ # Utilities, hooks, stores, types
56
+ │ ├── hooks/ # React hooks (theme, i18n, etc.)
57
+ │ ├── store/ # Zustand stores
58
+ │ ├── i18n/ # Internationalization (5 languages)
59
+ │ ├── types/ # TypeScript types
60
+ │ ├── ai/ # AI/LLM utilities
61
+ │ ├── audio/ # TTS/ASR
62
+ │ └── ...
63
+ ├── api-routes/ # Server-side API routes (for Express backend)
64
+ packages/
65
+ ├── mathml2omml/ # MathML to OMML converter
66
+ └── pptxgenjs/ # PowerPoint generation
67
+ ```
68
+
69
+ ## Getting Started
70
+
71
+ ### Prerequisites
72
+ - Node.js >= 20.9.0
73
+ - npm or pnpm
74
+
75
+ ### Install & Run
76
+
77
+ ```bash
78
+ # Install dependencies
79
+ npm install --legacy-peer-deps
80
+
81
+ # Build workspace packages
82
+ cd packages/mathml2omml && npm install && npm run build && cd ../..
83
+ cd packages/pptxgenjs && npm install && npm run build && cd ../..
84
+
85
+ # Start development server
86
+ npm run dev
87
+
88
+ # Build for production
89
+ npm run build
90
+
91
+ # Preview production build
92
+ npm run preview
93
+ ```
94
+
95
+ ### Environment Variables
96
+
97
+ Copy `.env.example` and configure with your API keys. In Vite, client-side env vars must be prefixed with `VITE_`:
98
+
99
+ ```bash
100
+ cp .env.example .env
101
+ ```
102
+
103
+ ### API Backend
104
+
105
+ The API routes from the original Next.js project are preserved in `src/api-routes/` for reference. To use them, set up a separate Express/Fastify backend and configure the Vite dev server proxy in `vite.config.ts`:
106
+
107
+ ```ts
108
+ server: {
109
+ proxy: {
110
+ '/api': {
111
+ target: 'http://localhost:3001',
112
+ changeOrigin: true,
113
+ },
114
+ },
115
+ },
116
+ ```
117
+
118
+ ## Tech Stack
119
+
120
+ - **React 19** + **Vite 6** — Fast builds, HMR
121
+ - **React Router DOM v7** — Client-side routing
122
+ - **Tailwind CSS v4** — Utility-first CSS
123
+ - **Zustand** — State management
124
+ - **shadcn/ui** — Radix-based component library
125
+ - **AI SDK** — Multi-provider LLM integration
126
+ - **i18next** — Internationalization (zh-CN, en-US, ja-JP, ru-RU, ar-SA)
127
+ - **Motion** (Framer Motion) — Animations
128
+ - **ProseMirror** — Rich text editing
129
+ - **Dexie** — IndexedDB wrapper
130
+ - **ECharts** — Data visualization
131
+
132
+ ## Credits
133
+
134
+ Based on [OpenMAIC](https://github.com/THU-MAIC/OpenMAIC) by THU-MAIC.
135
+
136
+ ## License
137
+
138
+ AGPL-3.0 (same as original)
index.html ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en" class="">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" href="/favicon.ico" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>OpenMAIC</title>
8
+ <meta name="description" content="The open-source AI interactive classroom. Upload a PDF to instantly generate an immersive, multi-agent learning experience." />
9
+ </head>
10
+ <body class="antialiased" style="font-family: var(--font-sans), system-ui, sans-serif;">
11
+ <div id="root"></div>
12
+ <script type="module" src="/src/main.tsx"></script>
13
+ </body>
14
+ </html>
package-lock.json ADDED
The diff for this file is too large to render. See raw diff
 
package.json ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "openmaic-react",
3
+ "private": true,
4
+ "version": "0.2.1",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview",
10
+ "lint": "eslint ."
11
+ },
12
+ "dependencies": {
13
+ "@ai-sdk/anthropic": "^3.0.71",
14
+ "@ai-sdk/google": "^3.0.64",
15
+ "@ai-sdk/openai": "^3.0.53",
16
+ "@ai-sdk/react": "^3.0.170",
17
+ "@base-ui/react": "^1.1.0",
18
+ "@copilotkit/backend": "^0.37.0",
19
+ "@copilotkit/runtime": "^1.51.2",
20
+ "@fontsource-variable/inter": "^5.2.8",
21
+ "@langchain/core": "^1.1.16",
22
+ "@langchain/langgraph": "^1.1.1",
23
+ "@modelcontextprotocol/sdk": "^1.27.1",
24
+ "@radix-ui/react-checkbox": "^1.3.3",
25
+ "@radix-ui/react-popover": "^1.1.15",
26
+ "@radix-ui/react-slider": "^1.3.6",
27
+ "@radix-ui/react-switch": "^1.2.6",
28
+ "@radix-ui/react-use-controllable-state": "^1.2.2",
29
+ "@types/js-yaml": "^4.0.9",
30
+ "@xyflow/react": "^12.10.0",
31
+ "ai": "^6.0.168",
32
+ "animate.css": "^4.1.1",
33
+ "class-variance-authority": "^0.7.1",
34
+ "clsx": "^2.1.1",
35
+ "cmdk": "^1.1.1",
36
+ "copilotkit": "^0.0.58",
37
+ "dexie": "^4.2.1",
38
+ "echarts": "^6.0.0",
39
+ "embla-carousel-react": "^8.6.0",
40
+ "file-saver": "^2.0.5",
41
+ "geist": "^1.7.0",
42
+ "i18next": "^26.0.1",
43
+ "i18next-resources-to-backend": "^1.2.1",
44
+ "immer": "^11.1.3",
45
+ "js-yaml": "^4.1.1",
46
+ "jsonrepair": "^3.13.2",
47
+ "jszip": "^3.10.1",
48
+ "katex": "^0.16.33",
49
+ "lodash": "^4.17.21",
50
+ "lucide-react": "^0.562.0",
51
+ "mathml2omml": "file:packages/mathml2omml",
52
+ "mitt": "^3.0.1",
53
+ "motion": "^12.27.5",
54
+ "nanoid": "^5.1.6",
55
+ "openai": "^4.104.0",
56
+ "partial-json": "^0.1.7",
57
+ "pptxgenjs": "file:packages/pptxgenjs",
58
+ "pptxtojson": "^1.11.0",
59
+ "prosemirror-commands": "^1.7.1",
60
+ "prosemirror-dropcursor": "^1.8.2",
61
+ "prosemirror-gapcursor": "^1.4.0",
62
+ "prosemirror-history": "^1.5.0",
63
+ "prosemirror-inputrules": "^1.5.1",
64
+ "prosemirror-keymap": "^1.2.3",
65
+ "prosemirror-model": "^1.25.4",
66
+ "prosemirror-schema-basic": "^1.2.4",
67
+ "prosemirror-schema-list": "^1.5.1",
68
+ "prosemirror-state": "^1.4.4",
69
+ "prosemirror-view": "^1.41.5",
70
+ "radix-ui": "^1.4.3",
71
+ "react": "^19.2.3",
72
+ "react-dom": "^19.2.3",
73
+ "react-i18next": "^17.0.1",
74
+ "react-router-dom": "^7.6.0",
75
+ "shadcn": "^3.6.3",
76
+ "shiki": "^3.21.0",
77
+ "sonner": "^2.0.7",
78
+ "streamdown": "^2.1.0",
79
+ "svg-arc-to-cubic-bezier": "^3.2.0",
80
+ "svg-pathdata": "^8.0.0",
81
+ "tailwind-merge": "^3.4.0",
82
+ "temml": "^0.13.1",
83
+ "tinycolor2": "^1.6.0",
84
+ "tokenlens": "^1.3.1",
85
+ "tw-animate-css": "^1.4.0",
86
+ "undici": "^7.22.0",
87
+ "unpdf": "^1.4.0",
88
+ "use-stick-to-bottom": "^1.1.1",
89
+ "zod": "^4.3.5",
90
+ "zustand": "^5.0.10"
91
+ },
92
+ "devDependencies": {
93
+ "@tailwindcss/postcss": "^4",
94
+ "@types/file-saver": "^2.0.7",
95
+ "@types/katex": "^0.16.8",
96
+ "@types/lodash": "^4.17.23",
97
+ "@types/node": "^20",
98
+ "@types/react": "^19",
99
+ "@types/react-dom": "^19",
100
+ "@types/tinycolor2": "^1.4.6",
101
+ "@vitejs/plugin-react": "^4.4.0",
102
+ "eslint": "^9",
103
+ "tailwindcss": "^4",
104
+ "typescript": "~5.8.0",
105
+ "vite": "^6.3.0"
106
+ }
107
+ }
packages/mathml2omml/.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ node_modules/
2
+ dist/
3
+ package-lock.json
packages/mathml2omml/LICENSE ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
packages/mathml2omml/dist/index.cjs ADDED
@@ -0,0 +1,2509 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+
3
+ // Generated using scripts/write-decode-map.ts
4
+ const xmlDecodeTree = /* #__PURE__ */ new Uint16Array(
5
+ // prettier-ignore
6
+ /* #__PURE__ */ "\u0200aglq\t\x15\x18\x1b\u026d\x0f\0\0\x12p;\u4026os;\u4027t;\u403et;\u403cuot;\u4022"
7
+ .split("")
8
+ .map((c) => c.charCodeAt(0)));
9
+
10
+ // Adapted from https://github.com/mathiasbynens/he/blob/36afe179392226cf1b6ccdb16ebbb7a5a844d93a/src/he.js#L106-L134
11
+ var _a;
12
+ const decodeMap = new Map([
13
+ [0, 65533],
14
+ // C1 Unicode control character reference replacements
15
+ [128, 8364],
16
+ [130, 8218],
17
+ [131, 402],
18
+ [132, 8222],
19
+ [133, 8230],
20
+ [134, 8224],
21
+ [135, 8225],
22
+ [136, 710],
23
+ [137, 8240],
24
+ [138, 352],
25
+ [139, 8249],
26
+ [140, 338],
27
+ [142, 381],
28
+ [145, 8216],
29
+ [146, 8217],
30
+ [147, 8220],
31
+ [148, 8221],
32
+ [149, 8226],
33
+ [150, 8211],
34
+ [151, 8212],
35
+ [152, 732],
36
+ [153, 8482],
37
+ [154, 353],
38
+ [155, 8250],
39
+ [156, 339],
40
+ [158, 382],
41
+ [159, 376],
42
+ ]);
43
+ /**
44
+ * Polyfill for `String.fromCodePoint`. It is used to create a string from a Unicode code point.
45
+ */
46
+ const fromCodePoint =
47
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, n/no-unsupported-features/es-builtins
48
+ (_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : function (codePoint) {
49
+ let output = "";
50
+ if (codePoint > 65535) {
51
+ codePoint -= 65536;
52
+ output += String.fromCharCode(((codePoint >>> 10) & 1023) | 55296);
53
+ codePoint = 56320 | (codePoint & 1023);
54
+ }
55
+ output += String.fromCharCode(codePoint);
56
+ return output;
57
+ };
58
+ /**
59
+ * Replace the given code point with a replacement character if it is a
60
+ * surrogate or is outside the valid range. Otherwise return the code
61
+ * point unchanged.
62
+ */
63
+ function replaceCodePoint(codePoint) {
64
+ var _a;
65
+ if ((codePoint >= 55296 && codePoint <= 57343) ||
66
+ codePoint > 1114111) {
67
+ return 65533;
68
+ }
69
+ return (_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint;
70
+ }
71
+
72
+ var CharCodes;
73
+ (function (CharCodes) {
74
+ CharCodes[CharCodes["NUM"] = 35] = "NUM";
75
+ CharCodes[CharCodes["SEMI"] = 59] = "SEMI";
76
+ CharCodes[CharCodes["EQUALS"] = 61] = "EQUALS";
77
+ CharCodes[CharCodes["ZERO"] = 48] = "ZERO";
78
+ CharCodes[CharCodes["NINE"] = 57] = "NINE";
79
+ CharCodes[CharCodes["LOWER_A"] = 97] = "LOWER_A";
80
+ CharCodes[CharCodes["LOWER_F"] = 102] = "LOWER_F";
81
+ CharCodes[CharCodes["LOWER_X"] = 120] = "LOWER_X";
82
+ CharCodes[CharCodes["LOWER_Z"] = 122] = "LOWER_Z";
83
+ CharCodes[CharCodes["UPPER_A"] = 65] = "UPPER_A";
84
+ CharCodes[CharCodes["UPPER_F"] = 70] = "UPPER_F";
85
+ CharCodes[CharCodes["UPPER_Z"] = 90] = "UPPER_Z";
86
+ })(CharCodes || (CharCodes = {}));
87
+ /** Bit that needs to be set to convert an upper case ASCII character to lower case */
88
+ const TO_LOWER_BIT = 32;
89
+ var BinTrieFlags;
90
+ (function (BinTrieFlags) {
91
+ BinTrieFlags[BinTrieFlags["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
92
+ BinTrieFlags[BinTrieFlags["BRANCH_LENGTH"] = 16256] = "BRANCH_LENGTH";
93
+ BinTrieFlags[BinTrieFlags["JUMP_TABLE"] = 127] = "JUMP_TABLE";
94
+ })(BinTrieFlags || (BinTrieFlags = {}));
95
+ function isNumber(code) {
96
+ return code >= CharCodes.ZERO && code <= CharCodes.NINE;
97
+ }
98
+ function isHexadecimalCharacter(code) {
99
+ return ((code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_F) ||
100
+ (code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_F));
101
+ }
102
+ function isAsciiAlphaNumeric(code) {
103
+ return ((code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_Z) ||
104
+ (code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_Z) ||
105
+ isNumber(code));
106
+ }
107
+ /**
108
+ * Checks if the given character is a valid end character for an entity in an attribute.
109
+ *
110
+ * Attribute values that aren't terminated properly aren't parsed, and shouldn't lead to a parser error.
111
+ * See the example in https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state
112
+ */
113
+ function isEntityInAttributeInvalidEnd(code) {
114
+ return code === CharCodes.EQUALS || isAsciiAlphaNumeric(code);
115
+ }
116
+ var EntityDecoderState;
117
+ (function (EntityDecoderState) {
118
+ EntityDecoderState[EntityDecoderState["EntityStart"] = 0] = "EntityStart";
119
+ EntityDecoderState[EntityDecoderState["NumericStart"] = 1] = "NumericStart";
120
+ EntityDecoderState[EntityDecoderState["NumericDecimal"] = 2] = "NumericDecimal";
121
+ EntityDecoderState[EntityDecoderState["NumericHex"] = 3] = "NumericHex";
122
+ EntityDecoderState[EntityDecoderState["NamedEntity"] = 4] = "NamedEntity";
123
+ })(EntityDecoderState || (EntityDecoderState = {}));
124
+ var DecodingMode;
125
+ (function (DecodingMode) {
126
+ /** Entities in text nodes that can end with any character. */
127
+ DecodingMode[DecodingMode["Legacy"] = 0] = "Legacy";
128
+ /** Only allow entities terminated with a semicolon. */
129
+ DecodingMode[DecodingMode["Strict"] = 1] = "Strict";
130
+ /** Entities in attributes have limitations on ending characters. */
131
+ DecodingMode[DecodingMode["Attribute"] = 2] = "Attribute";
132
+ })(DecodingMode || (DecodingMode = {}));
133
+ /**
134
+ * Token decoder with support of writing partial entities.
135
+ */
136
+ class EntityDecoder {
137
+ constructor(
138
+ /** The tree used to decode entities. */
139
+ decodeTree,
140
+ /**
141
+ * The function that is called when a codepoint is decoded.
142
+ *
143
+ * For multi-byte named entities, this will be called multiple times,
144
+ * with the second codepoint, and the same `consumed` value.
145
+ *
146
+ * @param codepoint The decoded codepoint.
147
+ * @param consumed The number of bytes consumed by the decoder.
148
+ */
149
+ emitCodePoint,
150
+ /** An object that is used to produce errors. */
151
+ errors) {
152
+ this.decodeTree = decodeTree;
153
+ this.emitCodePoint = emitCodePoint;
154
+ this.errors = errors;
155
+ /** The current state of the decoder. */
156
+ this.state = EntityDecoderState.EntityStart;
157
+ /** Characters that were consumed while parsing an entity. */
158
+ this.consumed = 1;
159
+ /**
160
+ * The result of the entity.
161
+ *
162
+ * Either the result index of a numeric entity, or the codepoint of a
163
+ * numeric entity.
164
+ */
165
+ this.result = 0;
166
+ /** The current index in the decode tree. */
167
+ this.treeIndex = 0;
168
+ /** The number of characters that were consumed in excess. */
169
+ this.excess = 1;
170
+ /** The mode in which the decoder is operating. */
171
+ this.decodeMode = DecodingMode.Strict;
172
+ }
173
+ /** Resets the instance to make it reusable. */
174
+ startEntity(decodeMode) {
175
+ this.decodeMode = decodeMode;
176
+ this.state = EntityDecoderState.EntityStart;
177
+ this.result = 0;
178
+ this.treeIndex = 0;
179
+ this.excess = 1;
180
+ this.consumed = 1;
181
+ }
182
+ /**
183
+ * Write an entity to the decoder. This can be called multiple times with partial entities.
184
+ * If the entity is incomplete, the decoder will return -1.
185
+ *
186
+ * Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the
187
+ * entity is incomplete, and resume when the next string is written.
188
+ *
189
+ * @param input The string containing the entity (or a continuation of the entity).
190
+ * @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
191
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
192
+ */
193
+ write(input, offset) {
194
+ switch (this.state) {
195
+ case EntityDecoderState.EntityStart: {
196
+ if (input.charCodeAt(offset) === CharCodes.NUM) {
197
+ this.state = EntityDecoderState.NumericStart;
198
+ this.consumed += 1;
199
+ return this.stateNumericStart(input, offset + 1);
200
+ }
201
+ this.state = EntityDecoderState.NamedEntity;
202
+ return this.stateNamedEntity(input, offset);
203
+ }
204
+ case EntityDecoderState.NumericStart: {
205
+ return this.stateNumericStart(input, offset);
206
+ }
207
+ case EntityDecoderState.NumericDecimal: {
208
+ return this.stateNumericDecimal(input, offset);
209
+ }
210
+ case EntityDecoderState.NumericHex: {
211
+ return this.stateNumericHex(input, offset);
212
+ }
213
+ case EntityDecoderState.NamedEntity: {
214
+ return this.stateNamedEntity(input, offset);
215
+ }
216
+ }
217
+ }
218
+ /**
219
+ * Switches between the numeric decimal and hexadecimal states.
220
+ *
221
+ * Equivalent to the `Numeric character reference state` in the HTML spec.
222
+ *
223
+ * @param input The string containing the entity (or a continuation of the entity).
224
+ * @param offset The current offset.
225
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
226
+ */
227
+ stateNumericStart(input, offset) {
228
+ if (offset >= input.length) {
229
+ return -1;
230
+ }
231
+ if ((input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
232
+ this.state = EntityDecoderState.NumericHex;
233
+ this.consumed += 1;
234
+ return this.stateNumericHex(input, offset + 1);
235
+ }
236
+ this.state = EntityDecoderState.NumericDecimal;
237
+ return this.stateNumericDecimal(input, offset);
238
+ }
239
+ addToNumericResult(input, start, end, base) {
240
+ if (start !== end) {
241
+ const digitCount = end - start;
242
+ this.result =
243
+ this.result * Math.pow(base, digitCount) +
244
+ Number.parseInt(input.substr(start, digitCount), base);
245
+ this.consumed += digitCount;
246
+ }
247
+ }
248
+ /**
249
+ * Parses a hexadecimal numeric entity.
250
+ *
251
+ * Equivalent to the `Hexademical character reference state` in the HTML spec.
252
+ *
253
+ * @param input The string containing the entity (or a continuation of the entity).
254
+ * @param offset The current offset.
255
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
256
+ */
257
+ stateNumericHex(input, offset) {
258
+ const startIndex = offset;
259
+ while (offset < input.length) {
260
+ const char = input.charCodeAt(offset);
261
+ if (isNumber(char) || isHexadecimalCharacter(char)) {
262
+ offset += 1;
263
+ }
264
+ else {
265
+ this.addToNumericResult(input, startIndex, offset, 16);
266
+ return this.emitNumericEntity(char, 3);
267
+ }
268
+ }
269
+ this.addToNumericResult(input, startIndex, offset, 16);
270
+ return -1;
271
+ }
272
+ /**
273
+ * Parses a decimal numeric entity.
274
+ *
275
+ * Equivalent to the `Decimal character reference state` in the HTML spec.
276
+ *
277
+ * @param input The string containing the entity (or a continuation of the entity).
278
+ * @param offset The current offset.
279
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
280
+ */
281
+ stateNumericDecimal(input, offset) {
282
+ const startIndex = offset;
283
+ while (offset < input.length) {
284
+ const char = input.charCodeAt(offset);
285
+ if (isNumber(char)) {
286
+ offset += 1;
287
+ }
288
+ else {
289
+ this.addToNumericResult(input, startIndex, offset, 10);
290
+ return this.emitNumericEntity(char, 2);
291
+ }
292
+ }
293
+ this.addToNumericResult(input, startIndex, offset, 10);
294
+ return -1;
295
+ }
296
+ /**
297
+ * Validate and emit a numeric entity.
298
+ *
299
+ * Implements the logic from the `Hexademical character reference start
300
+ * state` and `Numeric character reference end state` in the HTML spec.
301
+ *
302
+ * @param lastCp The last code point of the entity. Used to see if the
303
+ * entity was terminated with a semicolon.
304
+ * @param expectedLength The minimum number of characters that should be
305
+ * consumed. Used to validate that at least one digit
306
+ * was consumed.
307
+ * @returns The number of characters that were consumed.
308
+ */
309
+ emitNumericEntity(lastCp, expectedLength) {
310
+ var _a;
311
+ // Ensure we consumed at least one digit.
312
+ if (this.consumed <= expectedLength) {
313
+ (_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);
314
+ return 0;
315
+ }
316
+ // Figure out if this is a legit end of the entity
317
+ if (lastCp === CharCodes.SEMI) {
318
+ this.consumed += 1;
319
+ }
320
+ else if (this.decodeMode === DecodingMode.Strict) {
321
+ return 0;
322
+ }
323
+ this.emitCodePoint(replaceCodePoint(this.result), this.consumed);
324
+ if (this.errors) {
325
+ if (lastCp !== CharCodes.SEMI) {
326
+ this.errors.missingSemicolonAfterCharacterReference();
327
+ }
328
+ this.errors.validateNumericCharacterReference(this.result);
329
+ }
330
+ return this.consumed;
331
+ }
332
+ /**
333
+ * Parses a named entity.
334
+ *
335
+ * Equivalent to the `Named character reference state` in the HTML spec.
336
+ *
337
+ * @param input The string containing the entity (or a continuation of the entity).
338
+ * @param offset The current offset.
339
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
340
+ */
341
+ stateNamedEntity(input, offset) {
342
+ const { decodeTree } = this;
343
+ let current = decodeTree[this.treeIndex];
344
+ // The mask is the number of bytes of the value, including the current byte.
345
+ let valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
346
+ for (; offset < input.length; offset++, this.excess++) {
347
+ const char = input.charCodeAt(offset);
348
+ this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char);
349
+ if (this.treeIndex < 0) {
350
+ return this.result === 0 ||
351
+ // If we are parsing an attribute
352
+ (this.decodeMode === DecodingMode.Attribute &&
353
+ // We shouldn't have consumed any characters after the entity,
354
+ (valueLength === 0 ||
355
+ // And there should be no invalid characters.
356
+ isEntityInAttributeInvalidEnd(char)))
357
+ ? 0
358
+ : this.emitNotTerminatedNamedEntity();
359
+ }
360
+ current = decodeTree[this.treeIndex];
361
+ valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
362
+ // If the branch is a value, store it and continue
363
+ if (valueLength !== 0) {
364
+ // If the entity is terminated by a semicolon, we are done.
365
+ if (char === CharCodes.SEMI) {
366
+ return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);
367
+ }
368
+ // If we encounter a non-terminated (legacy) entity while parsing strictly, then ignore it.
369
+ if (this.decodeMode !== DecodingMode.Strict) {
370
+ this.result = this.treeIndex;
371
+ this.consumed += this.excess;
372
+ this.excess = 0;
373
+ }
374
+ }
375
+ }
376
+ return -1;
377
+ }
378
+ /**
379
+ * Emit a named entity that was not terminated with a semicolon.
380
+ *
381
+ * @returns The number of characters consumed.
382
+ */
383
+ emitNotTerminatedNamedEntity() {
384
+ var _a;
385
+ const { result, decodeTree } = this;
386
+ const valueLength = (decodeTree[result] & BinTrieFlags.VALUE_LENGTH) >> 14;
387
+ this.emitNamedEntityData(result, valueLength, this.consumed);
388
+ (_a = this.errors) === null || _a === void 0 ? void 0 : _a.missingSemicolonAfterCharacterReference();
389
+ return this.consumed;
390
+ }
391
+ /**
392
+ * Emit a named entity.
393
+ *
394
+ * @param result The index of the entity in the decode tree.
395
+ * @param valueLength The number of bytes in the entity.
396
+ * @param consumed The number of characters consumed.
397
+ *
398
+ * @returns The number of characters consumed.
399
+ */
400
+ emitNamedEntityData(result, valueLength, consumed) {
401
+ const { decodeTree } = this;
402
+ this.emitCodePoint(valueLength === 1
403
+ ? decodeTree[result] & ~BinTrieFlags.VALUE_LENGTH
404
+ : decodeTree[result + 1], consumed);
405
+ if (valueLength === 3) {
406
+ // For multi-byte values, we need to emit the second byte.
407
+ this.emitCodePoint(decodeTree[result + 2], consumed);
408
+ }
409
+ return consumed;
410
+ }
411
+ /**
412
+ * Signal to the parser that the end of the input was reached.
413
+ *
414
+ * Remaining data will be emitted and relevant errors will be produced.
415
+ *
416
+ * @returns The number of characters consumed.
417
+ */
418
+ end() {
419
+ var _a;
420
+ switch (this.state) {
421
+ case EntityDecoderState.NamedEntity: {
422
+ // Emit a named entity if we have one.
423
+ return this.result !== 0 &&
424
+ (this.decodeMode !== DecodingMode.Attribute ||
425
+ this.result === this.treeIndex)
426
+ ? this.emitNotTerminatedNamedEntity()
427
+ : 0;
428
+ }
429
+ // Otherwise, emit a numeric entity if we have one.
430
+ case EntityDecoderState.NumericDecimal: {
431
+ return this.emitNumericEntity(0, 2);
432
+ }
433
+ case EntityDecoderState.NumericHex: {
434
+ return this.emitNumericEntity(0, 3);
435
+ }
436
+ case EntityDecoderState.NumericStart: {
437
+ (_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);
438
+ return 0;
439
+ }
440
+ case EntityDecoderState.EntityStart: {
441
+ // Return 0 if we have no entity.
442
+ return 0;
443
+ }
444
+ }
445
+ }
446
+ }
447
+ /**
448
+ * Creates a function that decodes entities in a string.
449
+ *
450
+ * @param decodeTree The decode tree.
451
+ * @returns A function that decodes entities in a string.
452
+ */
453
+ function getDecoder(decodeTree) {
454
+ let returnValue = "";
455
+ const decoder = new EntityDecoder(decodeTree, (data) => (returnValue += fromCodePoint(data)));
456
+ return function decodeWithTrie(input, decodeMode) {
457
+ let lastIndex = 0;
458
+ let offset = 0;
459
+ while ((offset = input.indexOf("&", offset)) >= 0) {
460
+ returnValue += input.slice(lastIndex, offset);
461
+ decoder.startEntity(decodeMode);
462
+ const length = decoder.write(input,
463
+ // Skip the "&"
464
+ offset + 1);
465
+ if (length < 0) {
466
+ lastIndex = offset + decoder.end();
467
+ break;
468
+ }
469
+ lastIndex = offset + length;
470
+ // If `length` is 0, skip the current `&` and continue.
471
+ offset = length === 0 ? lastIndex + 1 : lastIndex;
472
+ }
473
+ const result = returnValue + input.slice(lastIndex);
474
+ // Make sure we don't keep a reference to the final string.
475
+ returnValue = "";
476
+ return result;
477
+ };
478
+ }
479
+ /**
480
+ * Determines the branch of the current node that is taken given the current
481
+ * character. This function is used to traverse the trie.
482
+ *
483
+ * @param decodeTree The trie.
484
+ * @param current The current node.
485
+ * @param nodeIdx The index right after the current node and its value.
486
+ * @param char The current character.
487
+ * @returns The index of the next node, or -1 if no branch is taken.
488
+ */
489
+ function determineBranch(decodeTree, current, nodeIndex, char) {
490
+ const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
491
+ const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
492
+ // Case 1: Single branch encoded in jump offset
493
+ if (branchCount === 0) {
494
+ return jumpOffset !== 0 && char === jumpOffset ? nodeIndex : -1;
495
+ }
496
+ // Case 2: Multiple branches encoded in jump table
497
+ if (jumpOffset) {
498
+ const value = char - jumpOffset;
499
+ return value < 0 || value >= branchCount
500
+ ? -1
501
+ : decodeTree[nodeIndex + value] - 1;
502
+ }
503
+ // Case 3: Multiple branches encoded in dictionary
504
+ // Binary search for the character.
505
+ let lo = nodeIndex;
506
+ let hi = lo + branchCount - 1;
507
+ while (lo <= hi) {
508
+ const mid = (lo + hi) >>> 1;
509
+ const midValue = decodeTree[mid];
510
+ if (midValue < char) {
511
+ lo = mid + 1;
512
+ }
513
+ else if (midValue > char) {
514
+ hi = mid - 1;
515
+ }
516
+ else {
517
+ return decodeTree[mid + branchCount];
518
+ }
519
+ }
520
+ return -1;
521
+ }
522
+ const xmlDecoder = /* #__PURE__ */ getDecoder(xmlDecodeTree);
523
+ /**
524
+ * Decodes an XML string, requiring all entities to be terminated by a semicolon.
525
+ *
526
+ * @param xmlString The string to decode.
527
+ * @returns The decoded string.
528
+ */
529
+ function decodeXML(xmlString) {
530
+ return xmlDecoder(xmlString, DecodingMode.Strict);
531
+ }
532
+
533
+ const attrRE = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;
534
+
535
+ function stringify$1(tag) {
536
+ const res = {
537
+ type: 'tag',
538
+ name: '',
539
+ voidElement: false,
540
+ attribs: {},
541
+ children: []
542
+ };
543
+
544
+ const tagMatch = tag.match(/<\/?([^\s]+?)[/\s>]/);
545
+ if (tagMatch) {
546
+ res.name = tagMatch[1];
547
+ if (tag.charAt(tag.length - 2) === '/') {
548
+ res.voidElement = true;
549
+ }
550
+
551
+ // handle comment tag
552
+ if (res.name.startsWith('!--')) {
553
+ const endIndex = tag.indexOf('-->');
554
+ return {
555
+ type: 'comment',
556
+ comment: endIndex !== -1 ? tag.slice(4, endIndex) : ''
557
+ }
558
+ }
559
+ }
560
+
561
+ const reg = new RegExp(attrRE);
562
+ let result = null;
563
+ for (;;) {
564
+ result = reg.exec(tag);
565
+
566
+ if (result === null) {
567
+ break
568
+ }
569
+
570
+ if (!result[0].trim()) {
571
+ continue
572
+ }
573
+
574
+ if (result[1]) {
575
+ const attr = result[1].trim();
576
+ let arr = [attr, ''];
577
+
578
+ if (attr.indexOf('=') > -1) {
579
+ arr = attr.split('=');
580
+ }
581
+
582
+ res.attribs[arr[0]] = arr[1];
583
+ reg.lastIndex--;
584
+ } else if (result[2]) {
585
+ res.attribs[result[2]] = result[3].trim().substring(1, result[3].length - 1);
586
+ }
587
+ }
588
+
589
+ return res
590
+ }
591
+
592
+ const tagRE = /<[a-zA-Z0-9\-!/](?:"[^"]*"|'[^']*'|[^'">])*>/g;
593
+ const whitespaceRE = /^\s*$/;
594
+
595
+ const textContainerNames = ['mtext', 'mi', 'mn', 'mo', 'ms'];
596
+
597
+ function parse(html, options = {}) {
598
+ const result = [];
599
+ const arr = [];
600
+ let current;
601
+ let level = -1;
602
+
603
+ html.replace(tagRE, (tag, index) => {
604
+ const isOpen = tag.charAt(1) !== '/';
605
+ const isComment = tag.startsWith('<!--');
606
+ const start = index + tag.length;
607
+ const nextChar = html.charAt(start);
608
+ let parent;
609
+
610
+ if (isComment) {
611
+ const comment = stringify$1(tag);
612
+
613
+ // if we're at root, push new base node
614
+ if (level < 0) {
615
+ result.push(comment);
616
+ return result
617
+ }
618
+ parent = arr[level];
619
+ parent.children.push(comment);
620
+ return result
621
+ }
622
+
623
+ if (isOpen) {
624
+ level++;
625
+
626
+ current = stringify$1(tag);
627
+ if (current.type === 'tag' && options.components?.[current.name]) {
628
+ current.type = 'component';
629
+ }
630
+
631
+ if (
632
+ textContainerNames.includes(current.name) &&
633
+ !current.voidElement &&
634
+ nextChar &&
635
+ nextChar !== '<'
636
+ ) {
637
+ const data = html.slice(start, html.indexOf('<', start)).trim();
638
+ current.children.push({
639
+ type: 'text',
640
+ data: options.disableDecode ? data : decodeXML(data)
641
+ });
642
+ }
643
+
644
+ // if we're at root, push new base node
645
+ if (level === 0) {
646
+ result.push(current);
647
+ }
648
+
649
+ parent = arr[level - 1];
650
+
651
+ if (parent) {
652
+ parent.children.push(current);
653
+ }
654
+
655
+ arr[level] = current;
656
+ }
657
+
658
+ if (!isOpen || current.voidElement) {
659
+ if (level > -1 && (current.voidElement || current.name === tag.slice(2, -1))) {
660
+ level--;
661
+ // move current up a level to match the end tag
662
+ current = level === -1 ? result : arr[level];
663
+ }
664
+ if (
665
+ level > -1 &&
666
+ textContainerNames.includes[arr[level].name] &&
667
+ nextChar !== '<' &&
668
+ nextChar
669
+ ) {
670
+ // trailing text node
671
+ parent = arr[level].children;
672
+
673
+ // calculate correct end of the content slice in case there's
674
+ // no tag after the text node.
675
+ const end = html.indexOf('<', start);
676
+ let data = html.slice(start, end === -1 ? undefined : end);
677
+ // if a node is nothing but whitespace, collapse it as the spec states:
678
+ // https://www.w3.org/TR/html4/struct/text.html#h-9.1
679
+ if (whitespaceRE.test(data)) {
680
+ data = ' ';
681
+ }
682
+ // don't add whitespace-only text nodes if they would be trailing text nodes
683
+ // or if they would be leading whitespace-only text nodes:
684
+ // * end > -1 indicates this is not a trailing text node
685
+ // * leading node is when level is -1 and parent has length 0
686
+ if ((end > -1 && level + parent.length >= 0) || data !== ' ') {
687
+ parent.push({
688
+ type: 'text',
689
+ data: options.disableDecode ? data : decodeXML(data)
690
+ });
691
+ }
692
+ }
693
+ }
694
+ });
695
+
696
+ return result
697
+ }
698
+
699
+ function attrString(attribs) {
700
+ const buff = [];
701
+ for (const key in attribs) {
702
+ buff.push(`${key}="${attribs[key]}"`);
703
+ }
704
+ if (!buff.length) {
705
+ return ''
706
+ }
707
+ return ` ${buff.join(' ')}`
708
+ }
709
+
710
+ function escapeXmlText(str) {
711
+ return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
712
+ }
713
+
714
+ function stringify(buff, doc) {
715
+ switch (doc.type) {
716
+ case 'text':
717
+ return buff + escapeXmlText(doc.data)
718
+ case 'tag': {
719
+ const voidElement =
720
+ doc.voidElement || (!doc.children.length && doc.attribs['xml:space'] !== 'preserve');
721
+ buff += `<${doc.name}${doc.attribs ? attrString(doc.attribs) : ''}${voidElement ? '/>' : '>'}`;
722
+ if (voidElement) {
723
+ return buff
724
+ }
725
+ return `${buff + doc.children.reduce(stringify, '')}</${doc.name}>`
726
+ }
727
+ case 'comment':
728
+ buff += `<!--${doc.comment}-->`;
729
+ return buff
730
+ }
731
+ }
732
+
733
+ function stringifyDoc(doc) {
734
+ return doc.reduce((token, rootEl) => token + stringify('', rootEl), '')
735
+ }
736
+
737
+ function math(element, targetParent, previousSibling, nextSibling, ancestors) {
738
+ targetParent.name = 'm:oMath';
739
+ targetParent.attribs = {
740
+ 'xmlns:m': 'http://schemas.openxmlformats.org/officeDocument/2006/math',
741
+ 'xmlns:w': 'http://schemas.openxmlformats.org/wordprocessingml/2006/main'
742
+ };
743
+ targetParent.type = 'tag';
744
+ targetParent.children = [];
745
+ return targetParent
746
+ }
747
+
748
+ function semantics(element, targetParent, previousSibling, nextSibling, ancestors) {
749
+ // Ignore as default behavior
750
+ return targetParent
751
+ }
752
+
753
+ function menclose(element, targetParent, previousSibling, nextSibling, ancestors) {
754
+ const type = element.attribs?.notation?.split(' ')[0] || 'longdiv';
755
+
756
+ const targetElement = {
757
+ type: 'tag',
758
+ name: 'm:e',
759
+ attribs: {},
760
+ children: []
761
+ };
762
+
763
+ if (type === 'longdiv') {
764
+ targetParent.children.push({
765
+ type: 'tag',
766
+ name: 'm:rad',
767
+ attribs: {},
768
+ children: [
769
+ {
770
+ type: 'tag',
771
+ name: 'm:radPr',
772
+ attribs: {},
773
+ children: [{ type: 'tag', name: 'm:degHide', attribs: { 'm:val': 'on' }, children: [] }]
774
+ },
775
+ { type: 'tag', name: 'm:deg', attribs: {}, children: [] },
776
+ targetElement
777
+ ]
778
+ });
779
+ } else {
780
+ const hide = {
781
+ t: { type: 'tag', name: 'm:hideTop', attribs: { 'm:val': 'on' }, children: [] },
782
+ b: { type: 'tag', name: 'm:hideBot', attribs: { 'm:val': 'on' }, children: [] },
783
+ l: { type: 'tag', name: 'm:hideLeft', attribs: { 'm:val': 'on' }, children: [] },
784
+ r: { type: 'tag', name: 'm:hideRight', attribs: { 'm:val': 'on' }, children: [] }
785
+ };
786
+ const borderBoxPr = { type: 'tag', name: 'm:borderBoxPr', attribs: {}, children: [] };
787
+
788
+ const containerElement = {
789
+ type: 'tag',
790
+ name: 'm:borderBox',
791
+ attribs: {},
792
+ children: []
793
+ };
794
+ switch (type) {
795
+ case 'actuarial':
796
+ case 'radical':
797
+ case 'box':
798
+ containerElement.children = [targetElement];
799
+ break
800
+ case 'left':
801
+ case 'roundedbox':
802
+ borderBoxPr.children = [hide.t, hide.b, hide.r];
803
+ containerElement.children = [borderBoxPr, targetElement];
804
+ break
805
+ case 'right':
806
+ case 'circle':
807
+ borderBoxPr.children = [hide.t, hide.b, hide.l];
808
+ containerElement.children = [borderBoxPr, targetElement];
809
+ break
810
+ case 'top':
811
+ borderBoxPr.children = [hide.b, hide.l, hide.r];
812
+ containerElement.children = [borderBoxPr, targetElement];
813
+ break
814
+ case 'bottom':
815
+ borderBoxPr.children = [hide.t, hide.l, hide.r];
816
+ containerElement.children = [borderBoxPr, targetElement];
817
+ break
818
+ case 'updiagonalstrike':
819
+ borderBoxPr.children = [
820
+ hide.t,
821
+ hide.b,
822
+ hide.l,
823
+ hide.r,
824
+ { type: 'tag', name: 'm:strikeBLTR', attribs: { 'm:val': 'on' }, children: [] }
825
+ ];
826
+ containerElement.children = [borderBoxPr, targetElement];
827
+ break
828
+ case 'downdiagonalstrike':
829
+ borderBoxPr.children = [
830
+ hide.t,
831
+ hide.b,
832
+ hide.l,
833
+ hide.r,
834
+ { type: 'tag', name: 'm:strikeTLBR', attribs: { 'm:val': 'on' }, children: [] }
835
+ ];
836
+ containerElement.children = [borderBoxPr, targetElement];
837
+ break
838
+ case 'verticalstrike':
839
+ borderBoxPr.children = [
840
+ hide.t,
841
+ hide.b,
842
+ hide.l,
843
+ hide.r,
844
+ { type: 'tag', name: 'm:strikeV', attribs: { 'm:val': 'on' }, children: [] }
845
+ ];
846
+ containerElement.children = [borderBoxPr, targetElement];
847
+ break
848
+ case 'horizontalstrike':
849
+ borderBoxPr.children = [
850
+ hide.t,
851
+ hide.b,
852
+ hide.l,
853
+ hide.r,
854
+ { type: 'tag', name: 'm:strikeH', attribs: { 'm:val': 'on' }, children: [] }
855
+ ];
856
+ containerElement.children = [borderBoxPr, targetElement];
857
+ break
858
+ default:
859
+ borderBoxPr.children = [hide.t, hide.b, hide.l, hide.r];
860
+ containerElement.children = [borderBoxPr, targetElement];
861
+ break
862
+ }
863
+ targetParent.children.push(containerElement);
864
+ }
865
+ return targetElement
866
+ }
867
+
868
+ function mfrac(element, targetParent, previousSibling, nextSibling, ancestors) {
869
+ if (element.children.length !== 2) {
870
+ // treat as mrow
871
+ return targetParent
872
+ }
873
+
874
+ const numerator = element.children[0];
875
+ const denumerator = element.children[1];
876
+ const numeratorTarget = {
877
+ name: 'm:num',
878
+ type: 'tag',
879
+ attribs: {},
880
+ children: []
881
+ };
882
+ const denumeratorTarget = {
883
+ name: 'm:den',
884
+ type: 'tag',
885
+ attribs: {},
886
+ children: []
887
+ };
888
+ ancestors = [...ancestors];
889
+ ancestors.unshift(element);
890
+ walker(numerator, numeratorTarget, false, false, ancestors);
891
+ walker(denumerator, denumeratorTarget, false, false, ancestors);
892
+ const lt = element.attribs?.linethickness;
893
+ const fracType = (lt === '0' || lt === '0px' || lt === '0em' || lt === '0pt') ? 'noBar' : 'bar';
894
+ targetParent.children.push({
895
+ type: 'tag',
896
+ name: 'm:f',
897
+ attribs: {},
898
+ children: [
899
+ {
900
+ type: 'tag',
901
+ name: 'm:fPr',
902
+ attribs: {},
903
+ children: [
904
+ {
905
+ type: 'tag',
906
+ name: 'm:type',
907
+ attribs: {
908
+ 'm:val': fracType
909
+ },
910
+ children: []
911
+ }
912
+ ]
913
+ },
914
+ numeratorTarget,
915
+ denumeratorTarget
916
+ ]
917
+ });
918
+ // Don't iterate over children in the usual way.
919
+ }
920
+
921
+ function mglyph(element, targetParent, previousSibling, nextSibling, ancestors) {
922
+ // No support in omml. Output alt text.
923
+ if (element.attribs?.alt) {
924
+ targetParent.children.push({
925
+ type: 'text',
926
+ data: element.attribs.alt
927
+ });
928
+ }
929
+ }
930
+
931
+ function mmultiscripts(element, targetParent, previousSibling, nextSibling, ancestors) {
932
+ if (element.children.length === 0) {
933
+ // Don't use
934
+ return
935
+ }
936
+
937
+ const base = element.children[0];
938
+ const postSubs = [];
939
+ const postSupers = [];
940
+ const preSubs = [];
941
+ const preSupers = [];
942
+ const children = element.children.slice(1);
943
+ let dividerFound = false;
944
+ children.forEach((child, index) => {
945
+ if (child.name === 'mprescripts') {
946
+ dividerFound = true;
947
+ } else if (child.name !== 'none') {
948
+ if (index % 2) {
949
+ if (dividerFound) {
950
+ preSubs.push(child);
951
+ } else {
952
+ postSupers.push(child);
953
+ }
954
+ } else {
955
+ if (dividerFound) {
956
+ preSupers.push(child);
957
+ } else {
958
+ postSubs.push(child);
959
+ }
960
+ }
961
+ }
962
+ });
963
+ ancestors = [...ancestors];
964
+ ancestors.unshift(element);
965
+ const tempTarget = {
966
+ children: []
967
+ };
968
+ walker(base, tempTarget, false, false, ancestors);
969
+ let topTarget = tempTarget.children[0];
970
+
971
+ if (postSubs.length || postSupers.length) {
972
+ const subscriptTarget = {
973
+ name: 'm:sub',
974
+ type: 'tag',
975
+ attribs: {},
976
+ children: []
977
+ };
978
+ postSubs.forEach((subscript) => walker(subscript, subscriptTarget, false, false, ancestors));
979
+
980
+ const superscriptTarget = {
981
+ name: 'm:sup',
982
+ type: 'tag',
983
+ attribs: {},
984
+ children: []
985
+ };
986
+
987
+ postSupers.forEach((superscript) =>
988
+ walker(superscript, superscriptTarget, false, false, ancestors)
989
+ );
990
+
991
+ const topPostTarget = {
992
+ type: 'tag',
993
+ attribs: {},
994
+ children: [
995
+ {
996
+ type: 'tag',
997
+ name: 'm:e',
998
+ attribs: {},
999
+ children: [topTarget]
1000
+ }
1001
+ ]
1002
+ };
1003
+ if (postSubs.length && postSupers.length) {
1004
+ topPostTarget.name = 'm:sSubSup';
1005
+ topPostTarget.children.push(subscriptTarget);
1006
+ topPostTarget.children.push(superscriptTarget);
1007
+ } else if (postSubs.length) {
1008
+ topPostTarget.name = 'm:sSub';
1009
+ topPostTarget.children.push(subscriptTarget);
1010
+ } else {
1011
+ topPostTarget.name = 'm:sSup';
1012
+ topPostTarget.children.push(superscriptTarget);
1013
+ }
1014
+ topTarget = topPostTarget;
1015
+ }
1016
+
1017
+ if (preSubs.length || preSupers.length) {
1018
+ const preSubscriptTarget = {
1019
+ name: 'm:sub',
1020
+ type: 'tag',
1021
+ attribs: {},
1022
+ children: []
1023
+ };
1024
+ preSubs.forEach((subscript) => walker(subscript, preSubscriptTarget, false, false, ancestors));
1025
+
1026
+ const preSuperscriptTarget = {
1027
+ name: 'm:sup',
1028
+ type: 'tag',
1029
+ attribs: {},
1030
+ children: []
1031
+ };
1032
+
1033
+ preSupers.forEach((superscript) =>
1034
+ walker(superscript, preSuperscriptTarget, false, false, ancestors)
1035
+ );
1036
+ const topPreTarget = {
1037
+ name: 'm:sPre',
1038
+ type: 'tag',
1039
+ attribs: {},
1040
+ children: [
1041
+ {
1042
+ name: 'm:e',
1043
+ type: 'tag',
1044
+ attribs: {},
1045
+ children: [topTarget]
1046
+ },
1047
+ preSubscriptTarget,
1048
+ preSuperscriptTarget
1049
+ ]
1050
+ };
1051
+ topTarget = topPreTarget;
1052
+ }
1053
+ targetParent.children.push(topTarget);
1054
+ // Don't iterate over children in the usual way.
1055
+ }
1056
+
1057
+ function mrow(element, targetParent, previousSibling, nextSibling, ancestors) {
1058
+ // Detect fence pattern: <mo fence="true">OPEN ... <mo fence="true">CLOSE
1059
+ // Convert to OMML <m:d> delimiter (e.g. binomial, \left(\right))
1060
+ const children = element.children || [];
1061
+ if (children.length >= 2) {
1062
+ const first = children[0];
1063
+ const last = children[children.length - 1];
1064
+ if (first?.name === 'mo' && first?.attribs?.fence === 'true' &&
1065
+ last?.name === 'mo' && last?.attribs?.fence === 'true') {
1066
+ const begChar = first.children?.[0]?.data || '(';
1067
+ const endChar = last.children?.[0]?.data || ')';
1068
+ const dNode = {
1069
+ type: 'tag', name: 'm:d', attribs: {}, children: [
1070
+ { type: 'tag', name: 'm:dPr', attribs: {}, children: [
1071
+ { type: 'tag', name: 'm:begChr', attribs: { 'm:val': begChar }, children: [] },
1072
+ { type: 'tag', name: 'm:endChr', attribs: { 'm:val': endChar }, children: [] },
1073
+ { type: 'tag', name: 'm:ctrlPr', attribs: {}, children: [] }
1074
+ ]},
1075
+ { type: 'tag', name: 'm:e', attribs: {}, children: [] }
1076
+ ]
1077
+ };
1078
+ targetParent.children.push(dNode);
1079
+ // Mark fence operators so the walker child loop skips them
1080
+ first.skipInWalker = true;
1081
+ last.skipInWalker = true;
1082
+ // Return <m:e> as target — inner children go here
1083
+ return dNode.children[1]
1084
+ }
1085
+ }
1086
+ // isNary redirect is now handled in walker's child loop
1087
+ return targetParent
1088
+ }
1089
+
1090
+ function mspace(element, targetParent, previousSibling, nextSibling, ancestors) {
1091
+ targetParent.children.push({
1092
+ name: 'm:r',
1093
+ type: 'tag',
1094
+ attribs: {},
1095
+ children: [
1096
+ {
1097
+ name: 'm:t',
1098
+ type: 'tag',
1099
+ attribs: {
1100
+ 'xml:space': 'preserve'
1101
+ },
1102
+ children: [
1103
+ {
1104
+ type: 'text',
1105
+ data: ' '
1106
+ }
1107
+ ]
1108
+ }
1109
+ ]
1110
+ });
1111
+ }
1112
+
1113
+ function msqrt(element, targetParent, previousSibling, nextSibling, ancestors) {
1114
+ const targetElement = {
1115
+ name: 'm:e',
1116
+ type: 'tag',
1117
+ attribs: {},
1118
+ children: []
1119
+ };
1120
+ targetParent.children.push({
1121
+ name: 'm:rad',
1122
+ type: 'tag',
1123
+ attribs: {},
1124
+ children: [
1125
+ {
1126
+ name: 'm:radPr',
1127
+ type: 'tag',
1128
+ attribs: {},
1129
+ children: [
1130
+ {
1131
+ name: 'm:degHide',
1132
+ type: 'tag',
1133
+ attribs: {
1134
+ 'm:val': 'on'
1135
+ },
1136
+ children: []
1137
+ }
1138
+ ]
1139
+ },
1140
+ {
1141
+ name: 'm:deg',
1142
+ type: 'tag',
1143
+ attribs: {},
1144
+ children: []
1145
+ },
1146
+ targetElement
1147
+ ]
1148
+ });
1149
+ return targetElement
1150
+ }
1151
+
1152
+ function mstyle(element, targetParent, previousSibling, nextSibling, ancestors) {
1153
+ // Ignore as default behavior
1154
+ return targetParent
1155
+ }
1156
+
1157
+ function getTextContent(node, trim = true) {
1158
+ let returnString = '';
1159
+ if (node.type === 'text') {
1160
+ let text = node.data.replace(/[\u2062]|[\u200B]/g, '');
1161
+ if (trim) {
1162
+ text = text.trim();
1163
+ }
1164
+ returnString += text;
1165
+ } else if (node.children) {
1166
+ node.children.forEach((subNode) => {
1167
+ returnString += getTextContent(subNode, trim);
1168
+ });
1169
+ }
1170
+ return returnString
1171
+ }
1172
+
1173
+ const NARY_REGEXP = /^[\u220f-\u2211]|[\u2229-\u2233]|[\u22c0-\u22c3]$/;
1174
+ const GROW_REGEXP = /^\u220f|\u2211|[\u2229-\u222b]|\u222e|\u222f|\u2232|\u2233|[\u22c0-\u22c3]$/;
1175
+
1176
+ function getNary(node) {
1177
+ // Check if node contains only a nary operator.
1178
+ const text = getTextContent(node);
1179
+ if (NARY_REGEXP.test(text)) {
1180
+ return text
1181
+ }
1182
+ return false
1183
+ }
1184
+
1185
+ function getNaryTarget(naryChar, element, type, subHide = false, supHide = false) {
1186
+ const stretchy = element.attribs?.stretchy;
1187
+ const grow =
1188
+ stretchy === 'true' ? '1' : stretchy === 'false' ? '0' : GROW_REGEXP.test(naryChar) ? '1' : '0';
1189
+ return {
1190
+ type: 'tag',
1191
+ name: 'm:nary',
1192
+ attribs: {},
1193
+ children: [
1194
+ {
1195
+ type: 'tag',
1196
+ name: 'm:naryPr',
1197
+ attribs: {},
1198
+ children: [
1199
+ { type: 'tag', name: 'm:chr', attribs: { 'm:val': naryChar }, children: [] },
1200
+ { type: 'tag', name: 'm:limLoc', attribs: { 'm:val': type }, children: [] },
1201
+ { type: 'tag', name: 'm:grow', attribs: { 'm:val': grow }, children: [] },
1202
+ {
1203
+ type: 'tag',
1204
+ name: 'm:subHide',
1205
+ attribs: { 'm:val': subHide ? 'on' : 'off' },
1206
+ children: []
1207
+ },
1208
+ {
1209
+ type: 'tag',
1210
+ name: 'm:supHide',
1211
+ attribs: { 'm:val': supHide ? 'on' : 'off' },
1212
+ children: []
1213
+ }
1214
+ ]
1215
+ }
1216
+ ]
1217
+ }
1218
+ }
1219
+
1220
+ function addScriptlevel(target, ancestors) {
1221
+ const scriptlevel = ancestors.find((ancestor) => ancestor.attribs?.scriptlevel)?.attribs
1222
+ ?.scriptlevel;
1223
+ if (['0', '1', '2'].includes(scriptlevel)) {
1224
+ target.children.unshift({
1225
+ type: 'tag',
1226
+ name: 'm:argPr',
1227
+ attribs: {},
1228
+ children: [
1229
+ {
1230
+ type: 'tag',
1231
+ name: 'm:scrLvl',
1232
+ attribs: { 'm:val': scriptlevel },
1233
+ children: []
1234
+ }
1235
+ ]
1236
+ });
1237
+ }
1238
+ }
1239
+
1240
+ function msub(element, targetParent, previousSibling, nextSibling, ancestors) {
1241
+ // Subscript
1242
+ if (element.children.length !== 2) {
1243
+ // treat as mrow
1244
+ return targetParent
1245
+ }
1246
+ ancestors = [...ancestors];
1247
+ ancestors.unshift(element);
1248
+ const base = element.children[0];
1249
+ const subscript = element.children[1];
1250
+
1251
+ let topTarget;
1252
+ //
1253
+ // m:nAry
1254
+ //
1255
+ // Conditions:
1256
+ // 1. base text must be nary operator
1257
+ // 2. no accents
1258
+ const naryChar = getNary(base);
1259
+ if (
1260
+ naryChar &&
1261
+ element.attribs?.accent?.toLowerCase() !== 'true' &&
1262
+ element.attribs?.accentunder?.toLowerCase() !== 'true'
1263
+ ) {
1264
+ topTarget = getNaryTarget(naryChar, element, 'subSup', false, true);
1265
+ element.isNary = true;
1266
+ } else {
1267
+ // Check for empty base → prescript pattern (LaTeX {}_{sub}X)
1268
+ const isEmptyBase = base.name === 'mrow' && (!base.children || base.children.length === 0);
1269
+
1270
+ if (isEmptyBase) {
1271
+ topTarget = {
1272
+ type: 'tag',
1273
+ name: 'm:sPre',
1274
+ attribs: {},
1275
+ children: [
1276
+ {
1277
+ type: 'tag',
1278
+ name: 'm:sPrePr',
1279
+ attribs: {},
1280
+ children: [
1281
+ {
1282
+ type: 'tag',
1283
+ name: 'm:ctrlPr',
1284
+ attribs: {},
1285
+ children: []
1286
+ }
1287
+ ]
1288
+ }
1289
+ ]
1290
+ };
1291
+ element.isPrescript = true;
1292
+ } else {
1293
+ const baseTarget = {
1294
+ name: 'm:e',
1295
+ type: 'tag',
1296
+ attribs: {},
1297
+ children: []
1298
+ };
1299
+ walker(base, baseTarget, false, false, ancestors);
1300
+ topTarget = {
1301
+ type: 'tag',
1302
+ name: 'm:sSub',
1303
+ attribs: {},
1304
+ children: [
1305
+ {
1306
+ type: 'tag',
1307
+ name: 'm:sSubPr',
1308
+ attribs: {},
1309
+ children: [
1310
+ {
1311
+ type: 'tag',
1312
+ name: 'm:ctrlPr',
1313
+ attribs: {},
1314
+ children: []
1315
+ }
1316
+ ]
1317
+ },
1318
+ baseTarget
1319
+ ]
1320
+ };
1321
+ }
1322
+ }
1323
+
1324
+ const subscriptTarget = {
1325
+ name: 'm:sub',
1326
+ type: 'tag',
1327
+ attribs: {},
1328
+ children: []
1329
+ };
1330
+
1331
+ walker(subscript, subscriptTarget, false, false, ancestors);
1332
+ topTarget.children.push(subscriptTarget);
1333
+ if (element.isNary) {
1334
+ topTarget.children.push({ type: 'tag', name: 'm:sup', attribs: {}, children: [] });
1335
+ topTarget.children.push({ type: 'tag', name: 'm:e', attribs: {}, children: [] });
1336
+ }
1337
+ // For prescript, add empty m:sup and m:e (base filled by walker redirect)
1338
+ if (element.isPrescript) {
1339
+ topTarget.children.push({ type: 'tag', name: 'm:sup', attribs: {}, children: [] });
1340
+ topTarget.children.push({ type: 'tag', name: 'm:e', attribs: {}, children: [] });
1341
+ }
1342
+ targetParent.children.push(topTarget);
1343
+ // Don't iterate over children in the usual way.
1344
+ }
1345
+
1346
+ function msubsup(element, targetParent, previousSibling, nextSibling, ancestors) {
1347
+ // Sub + superscript
1348
+ if (element.children.length !== 3) {
1349
+ // treat as mrow
1350
+ return targetParent
1351
+ }
1352
+
1353
+ ancestors = [...ancestors];
1354
+ ancestors.unshift(element);
1355
+
1356
+ const base = element.children[0];
1357
+ const subscript = element.children[1];
1358
+ const superscript = element.children[2];
1359
+
1360
+ let topTarget;
1361
+ //
1362
+ // m:nAry
1363
+ //
1364
+ // Conditions:
1365
+ // 1. base text must be nary operator
1366
+ // 2. no accents
1367
+ const naryChar = getNary(base);
1368
+ if (
1369
+ naryChar &&
1370
+ element.attribs?.accent?.toLowerCase() !== 'true' &&
1371
+ element.attribs?.accentunder?.toLowerCase() !== 'true'
1372
+ ) {
1373
+ topTarget = getNaryTarget(naryChar, element, 'subSup');
1374
+ element.isNary = true;
1375
+ } else {
1376
+ // Check for empty base → prescript pattern (LaTeX {}^{sup}_{sub}X)
1377
+ const isEmptyBase = base.name === 'mrow' && (!base.children || base.children.length === 0);
1378
+
1379
+ if (isEmptyBase) {
1380
+ topTarget = {
1381
+ type: 'tag',
1382
+ name: 'm:sPre',
1383
+ attribs: {},
1384
+ children: [
1385
+ {
1386
+ type: 'tag',
1387
+ name: 'm:sPrePr',
1388
+ attribs: {},
1389
+ children: [
1390
+ {
1391
+ type: 'tag',
1392
+ name: 'm:ctrlPr',
1393
+ attribs: {},
1394
+ children: []
1395
+ }
1396
+ ]
1397
+ }
1398
+ ]
1399
+ };
1400
+ element.isPrescript = true;
1401
+ } else {
1402
+ // Regular m:sSubSup
1403
+ const baseTarget = {
1404
+ name: 'm:e',
1405
+ type: 'tag',
1406
+ attribs: {},
1407
+ children: []
1408
+ };
1409
+
1410
+ walker(base, baseTarget, false, false, ancestors);
1411
+ topTarget = {
1412
+ type: 'tag',
1413
+ name: 'm:sSubSup',
1414
+ attribs: {},
1415
+ children: [
1416
+ {
1417
+ type: 'tag',
1418
+ name: 'm:sSubSupPr',
1419
+ attribs: {},
1420
+ children: [
1421
+ {
1422
+ type: 'tag',
1423
+ name: 'm:ctrlPr',
1424
+ attribs: {},
1425
+ children: []
1426
+ }
1427
+ ]
1428
+ },
1429
+ baseTarget
1430
+ ]
1431
+ };
1432
+ }
1433
+ }
1434
+
1435
+ const subscriptTarget = {
1436
+ name: 'm:sub',
1437
+ type: 'tag',
1438
+ attribs: {},
1439
+ children: []
1440
+ };
1441
+ const superscriptTarget = {
1442
+ name: 'm:sup',
1443
+ type: 'tag',
1444
+ attribs: {},
1445
+ children: []
1446
+ };
1447
+ walker(subscript, subscriptTarget, false, false, ancestors);
1448
+ walker(superscript, superscriptTarget, false, false, ancestors);
1449
+ topTarget.children.push(subscriptTarget);
1450
+ topTarget.children.push(superscriptTarget);
1451
+ if (element.isNary) {
1452
+ topTarget.children.push({ type: 'tag', name: 'm:e', attribs: {}, children: [] });
1453
+ }
1454
+ if (element.isPrescript) {
1455
+ topTarget.children.push({ type: 'tag', name: 'm:e', attribs: {}, children: [] });
1456
+ }
1457
+ targetParent.children.push(topTarget);
1458
+ // Don't iterate over children in the usual way.
1459
+ }
1460
+
1461
+ function msup(element, targetParent, previousSibling, nextSibling, ancestors) {
1462
+ // Superscript
1463
+ if (element.children.length !== 2) {
1464
+ // treat as mrow
1465
+ return targetParent
1466
+ }
1467
+ ancestors = [...ancestors];
1468
+ ancestors.unshift(element);
1469
+ const base = element.children[0];
1470
+ const superscript = element.children[1];
1471
+
1472
+ let topTarget;
1473
+ //
1474
+ // m:nAry
1475
+ //
1476
+ // Conditions:
1477
+ // 1. base text must be nary operator
1478
+ // 2. no accents
1479
+ const naryChar = getNary(base);
1480
+ if (
1481
+ naryChar &&
1482
+ element.attribs?.accent?.toLowerCase() !== 'true' &&
1483
+ element.attribs?.accentunder?.toLowerCase() !== 'true'
1484
+ ) {
1485
+ topTarget = getNaryTarget(naryChar, element, 'subSup', true);
1486
+ element.isNary = true;
1487
+ topTarget.children.push({ type: 'tag', name: 'm:sub' });
1488
+ } else {
1489
+ // Check for empty base → prescript pattern (LaTeX {}^{sup}X)
1490
+ const isEmptyBase = base.name === 'mrow' && (!base.children || base.children.length === 0);
1491
+
1492
+ if (isEmptyBase) {
1493
+ topTarget = {
1494
+ type: 'tag',
1495
+ name: 'm:sPre',
1496
+ attribs: {},
1497
+ children: [
1498
+ {
1499
+ type: 'tag',
1500
+ name: 'm:sPrePr',
1501
+ attribs: {},
1502
+ children: [
1503
+ {
1504
+ type: 'tag',
1505
+ name: 'm:ctrlPr',
1506
+ attribs: {},
1507
+ children: []
1508
+ }
1509
+ ]
1510
+ }
1511
+ ]
1512
+ };
1513
+ element.isPrescript = true;
1514
+ } else {
1515
+ const baseTarget = {
1516
+ name: 'm:e',
1517
+ type: 'tag',
1518
+ attribs: {},
1519
+ children: []
1520
+ };
1521
+ walker(base, baseTarget, false, false, ancestors);
1522
+
1523
+ topTarget = {
1524
+ type: 'tag',
1525
+ name: 'm:sSup',
1526
+ attribs: {},
1527
+ children: [
1528
+ {
1529
+ type: 'tag',
1530
+ name: 'm:sSupPr',
1531
+ attribs: {},
1532
+ children: [
1533
+ {
1534
+ type: 'tag',
1535
+ name: 'm:ctrlPr',
1536
+ attribs: {},
1537
+ children: []
1538
+ }
1539
+ ]
1540
+ },
1541
+ baseTarget
1542
+ ]
1543
+ };
1544
+ }
1545
+ }
1546
+
1547
+ const superscriptTarget = {
1548
+ name: 'm:sup',
1549
+ type: 'tag',
1550
+ attribs: {},
1551
+ children: []
1552
+ };
1553
+
1554
+ walker(superscript, superscriptTarget, false, false, ancestors);
1555
+
1556
+ // For prescript, also add an empty m:sub
1557
+ if (element.isPrescript) {
1558
+ topTarget.children.push({ type: 'tag', name: 'm:sub', attribs: {}, children: [] });
1559
+ }
1560
+ topTarget.children.push(superscriptTarget);
1561
+ if (element.isNary) {
1562
+ topTarget.children.push({ type: 'tag', name: 'm:e', attribs: {}, children: [] });
1563
+ }
1564
+ if (element.isPrescript) {
1565
+ topTarget.children.push({ type: 'tag', name: 'm:e', attribs: {}, children: [] });
1566
+ }
1567
+ targetParent.children.push(topTarget);
1568
+ // Don't iterate over children in the usual way.
1569
+ }
1570
+
1571
+ function mtable(element, targetParent, previousSibling, nextSibling, ancestors) {
1572
+ const cellsPerRowCount = Math.max(...element.children.map((row) => row.children.length));
1573
+ const targetElement = {
1574
+ name: 'm:m',
1575
+ type: 'tag',
1576
+ attribs: {},
1577
+ children: [
1578
+ {
1579
+ name: 'm:mPr',
1580
+ type: 'tag',
1581
+ attribs: {},
1582
+ children: [
1583
+ {
1584
+ name: 'm:baseJc',
1585
+ type: 'tag',
1586
+ attribs: {
1587
+ 'm:val': 'center'
1588
+ },
1589
+ children: []
1590
+ },
1591
+ {
1592
+ name: 'm:plcHide',
1593
+ type: 'tag',
1594
+ attribs: {
1595
+ 'm:val': 'on'
1596
+ },
1597
+ children: []
1598
+ },
1599
+ {
1600
+ name: 'm:mcs',
1601
+ type: 'tag',
1602
+ attribs: {},
1603
+ children: [
1604
+ {
1605
+ name: 'm:mc',
1606
+ type: 'tag',
1607
+ attribs: {},
1608
+ children: [
1609
+ {
1610
+ name: 'm:mcPr',
1611
+ type: 'tag',
1612
+ attribs: {},
1613
+ children: [
1614
+ {
1615
+ name: 'm:count',
1616
+ type: 'tag',
1617
+ attribs: {
1618
+ 'm:val': cellsPerRowCount.toString()
1619
+ },
1620
+ children: []
1621
+ },
1622
+ {
1623
+ name: 'm:mcJc',
1624
+ type: 'tag',
1625
+ attribs: {
1626
+ 'm:val': 'center'
1627
+ },
1628
+ children: []
1629
+ }
1630
+ ]
1631
+ }
1632
+ ]
1633
+ }
1634
+ ]
1635
+ }
1636
+ ]
1637
+ }
1638
+ ]
1639
+ };
1640
+ targetParent.children.push(targetElement);
1641
+ return targetElement
1642
+ }
1643
+
1644
+ function mtd(element, targetParent, previousSibling, nextSibling, ancestors) {
1645
+ // table cell
1646
+ const targetElement = {
1647
+ name: 'm:e',
1648
+ type: 'tag',
1649
+ attribs: {},
1650
+ children: []
1651
+ };
1652
+ targetParent.children.push(targetElement);
1653
+ return targetElement
1654
+ }
1655
+
1656
+ function mtr(element, targetParent, previousSibling, nextSibling, ancestors) {
1657
+ // table row
1658
+ const targetElement = {
1659
+ name: 'm:mr',
1660
+ type: 'tag',
1661
+ attribs: {},
1662
+ children: []
1663
+ };
1664
+ targetParent.children.push(targetElement);
1665
+ return targetElement
1666
+ }
1667
+
1668
+ function munderover(element, targetParent, previousSibling, nextSibling, ancestors) {
1669
+ // Munderover
1670
+ if (element.children.length !== 3) {
1671
+ // treat as mrow
1672
+ return targetParent
1673
+ }
1674
+
1675
+ ancestors = [...ancestors];
1676
+ ancestors.unshift(element);
1677
+
1678
+ const base = element.children[0];
1679
+ const underscript = element.children[1];
1680
+ const overscript = element.children[2];
1681
+
1682
+ //
1683
+ // m:nAry
1684
+ //
1685
+ // Conditions:
1686
+ // 1. base text must be nary operator
1687
+ // 2. no accents
1688
+ const naryChar = getNary(base);
1689
+ if (
1690
+ naryChar &&
1691
+ element.attributes?.accent?.toLowerCase() !== 'true' &&
1692
+ element.attributes?.accentunder?.toLowerCase() !== 'true'
1693
+ ) {
1694
+ const topTarget = getNaryTarget(naryChar, element, 'undOvr');
1695
+ element.isNary = true;
1696
+ const subscriptTarget = {
1697
+ name: 'm:sub',
1698
+ type: 'tag',
1699
+ attribs: {},
1700
+ children: []
1701
+ };
1702
+ const superscriptTarget = {
1703
+ name: 'm:sup',
1704
+ type: 'tag',
1705
+ attribs: {},
1706
+ children: []
1707
+ };
1708
+ walker(underscript, subscriptTarget, false, false, ancestors);
1709
+ walker(overscript, superscriptTarget, false, false, ancestors);
1710
+ topTarget.children.push(subscriptTarget);
1711
+ topTarget.children.push(superscriptTarget);
1712
+ topTarget.children.push({ type: 'tag', name: 'm:e', attribs: {}, children: [] });
1713
+ targetParent.children.push(topTarget);
1714
+ return
1715
+ }
1716
+
1717
+ // Fallback: m:limUpp()m:limlow
1718
+
1719
+ const baseTarget = {
1720
+ name: 'm:e',
1721
+ type: 'tag',
1722
+ attribs: {},
1723
+ children: []
1724
+ };
1725
+
1726
+ walker(base, baseTarget, false, false, ancestors);
1727
+
1728
+ const underscriptTarget = {
1729
+ name: 'm:lim',
1730
+ type: 'tag',
1731
+ attribs: {},
1732
+ children: []
1733
+ };
1734
+ const overscriptTarget = {
1735
+ name: 'm:lim',
1736
+ type: 'tag',
1737
+ attribs: {},
1738
+ children: []
1739
+ };
1740
+
1741
+ walker(underscript, underscriptTarget, false, false, ancestors);
1742
+ walker(overscript, overscriptTarget, false, false, ancestors);
1743
+ targetParent.children.push({
1744
+ type: 'tag',
1745
+ name: 'm:limUpp',
1746
+ attribs: {},
1747
+ children: [
1748
+ {
1749
+ type: 'tag',
1750
+ name: 'm:e',
1751
+ attribs: {},
1752
+ children: [
1753
+ {
1754
+ type: 'tag',
1755
+ name: 'm:limLow',
1756
+ attribs: {},
1757
+ children: [baseTarget, underscriptTarget]
1758
+ }
1759
+ ]
1760
+ },
1761
+ overscriptTarget
1762
+ ]
1763
+ });
1764
+ // Don't iterate over children in the usual way.
1765
+ }
1766
+
1767
+ function getStyle(element, ancestors, previousStyle = {}) {
1768
+ const elAttributes = element.attribs || {};
1769
+ const color =
1770
+ elAttributes.mathcolor ||
1771
+ ancestors.find(
1772
+ (element) => element.name === 'mstyle' && element.attribs && element.attribs.color
1773
+ )?.attribs.color ||
1774
+ '';
1775
+ // const minsize = parseFloat(elAttributes.scriptminsize || ancestors.find(element => element.name === 'mstyle' && element.attribs && element.attribs.scriptminsize)?.attribs.scriptminsize || '8pt')
1776
+ // const sizemultiplier = parseFloat(elAttributes.scriptsizemultiplier || ancestors.find(element => element.name === 'mstyle' && element.attribs && element.attribs.scriptsizemultiplier)?.attribs.scriptsizemultiplier || '0.71')
1777
+ const size =
1778
+ elAttributes.mathsize ||
1779
+ ancestors.find(
1780
+ (element) => element.name === 'mstyle' && element.attribs && element.attribs.mathsize
1781
+ )?.attribs.mathsize ||
1782
+ '';
1783
+ const scriptlevel =
1784
+ elAttributes.scriptlevel ||
1785
+ ancestors.find(
1786
+ (element) => element.name === 'mstyle' && element.attribs && element.attribs.scriptlevel
1787
+ )?.attribs.scriptlevel ||
1788
+ '';
1789
+ const background =
1790
+ elAttributes.mathbackground ||
1791
+ ancestors.find(
1792
+ (element) => element.name === 'mstyle' && element.attribs && element.attribs.mathbackground
1793
+ )?.attribs.mathbackground ||
1794
+ '';
1795
+ let variant =
1796
+ elAttributes.mathvariant ||
1797
+ ancestors.find(
1798
+ (element) => element.name === 'mstyle' && element.attribs && element.attribs.mathvariant
1799
+ )?.attribs.mathvariant ||
1800
+ '';
1801
+ if (variant === 'b-i') {
1802
+ variant = 'bold-italic';
1803
+ }
1804
+ const fontweight =
1805
+ elAttributes.fontweight ||
1806
+ ancestors.find(
1807
+ (element) => element.name === 'mstyle' && element.attribs && element.attribs.fontweight
1808
+ )?.attribs.fontweight ||
1809
+ '';
1810
+ if (fontweight === 'bold' && !['bold', 'bold-italic'].includes(variant)) {
1811
+ if (variant.includes('italic')) {
1812
+ variant = 'bold-italic';
1813
+ } else {
1814
+ variant = 'bold';
1815
+ }
1816
+ } else if (fontweight === 'normal' && ['bold', 'bold-italic'].includes(variant)) {
1817
+ if (variant.includes('italic')) {
1818
+ variant = 'italic';
1819
+ } else {
1820
+ variant = '';
1821
+ }
1822
+ }
1823
+ const fontstyle =
1824
+ elAttributes.fontstyle ||
1825
+ ancestors.find(
1826
+ (element) => element.name === 'mstyle' && element.attribs && element.attribs.fontstyle
1827
+ )?.attribs.fontstyle ||
1828
+ '';
1829
+ if (fontstyle === 'italic' && !['italic', 'bold-italic'].includes(variant)) {
1830
+ if (variant.includes('bold')) {
1831
+ variant = 'bold-italic';
1832
+ } else {
1833
+ variant = 'italic';
1834
+ }
1835
+ } else if (fontstyle === 'normal' && ['italic', 'bold-italic'].includes(variant)) {
1836
+ if (variant.includes('bold')) {
1837
+ variant = 'bold';
1838
+ } else {
1839
+ variant = '';
1840
+ }
1841
+ }
1842
+ // Override variant for some types
1843
+ if (!elAttributes.mathvariant) {
1844
+ const textContent = getTextContent(element);
1845
+ if (
1846
+ previousStyle.variant === '' &&
1847
+ ((element.name === 'mi' && textContent.length > 1) ||
1848
+ (element.name === 'mn' && !/^\d+\.\d+$/.test(textContent)))
1849
+ ) {
1850
+ variant = '';
1851
+ } else if (
1852
+ ['mi', 'mn', 'mo'].includes(element.name) &&
1853
+ ['italic', 'bold-italic'].includes(previousStyle.variant)
1854
+ ) {
1855
+ if (fontweight === 'bold') {
1856
+ variant = 'bold-italic';
1857
+ } else {
1858
+ variant = 'italic';
1859
+ }
1860
+ }
1861
+ }
1862
+
1863
+ return {
1864
+ color,
1865
+ variant,
1866
+ size,
1867
+ scriptlevel,
1868
+ background,
1869
+ fontstyle
1870
+ }
1871
+ }
1872
+
1873
+ const STYLES = {
1874
+ bold: 'b',
1875
+ italic: 'i',
1876
+ 'bold-italic': 'bi'
1877
+ };
1878
+
1879
+ function textContainer(element, targetParent, previousSibling, nextSibling, ancestors, textType) {
1880
+ // isNary redirect is now handled in walker's child loop
1881
+
1882
+ const hasMglyphChild = element.children?.find((element) => element.name === 'mglyph');
1883
+ const style = getStyle(element, ancestors, previousSibling?.style);
1884
+ element.style = style; // Add it to element to make it comparable
1885
+ element.hasMglyphChild = hasMglyphChild;
1886
+ const styleSame =
1887
+ Object.keys(style).every((key) => {
1888
+ const previousStyle = previousSibling?.style;
1889
+ return previousStyle && style[key] === previousStyle[key]
1890
+ }) && previousSibling?.hasMglyphChild === hasMglyphChild;
1891
+ const sameGroup = // Only group mtexts or mi, mn, mo with oneanother.
1892
+ textType === previousSibling?.name ||
1893
+ (['mi', 'mn', 'mo'].includes(textType) && ['mi', 'mn', 'mo'].includes(previousSibling?.name));
1894
+ let targetElement;
1895
+ const lastChild = targetParent.children[targetParent.children.length - 1];
1896
+ if (sameGroup && styleSame && !hasMglyphChild && lastChild?.name === 'm:r') {
1897
+ targetElement = lastChild.children[lastChild.children.length - 1];
1898
+ } else {
1899
+ const rElement = {
1900
+ name: 'm:r',
1901
+ type: 'tag',
1902
+ attribs: {},
1903
+ children: []
1904
+ };
1905
+
1906
+ if (style.variant) {
1907
+ const wrPr = {
1908
+ name: 'w:rPr',
1909
+ type: 'tag',
1910
+ attribs: {},
1911
+ children: []
1912
+ };
1913
+ if (style.variant.includes('bold')) {
1914
+ wrPr.children.push({ name: 'w:b', type: 'tag', attribs: {}, children: [] });
1915
+ }
1916
+ if (style.variant.includes('italic')) {
1917
+ wrPr.children.push({ name: 'w:i', type: 'tag', attribs: {}, children: [] });
1918
+ }
1919
+ rElement.children.push(wrPr);
1920
+ const mrPr = {
1921
+ name: 'm:rPr',
1922
+ type: 'tag',
1923
+ attribs: {},
1924
+ children: [
1925
+ {
1926
+ name: 'm:nor',
1927
+ type: 'tag',
1928
+ attribs: {},
1929
+ children: []
1930
+ }
1931
+ ]
1932
+ };
1933
+ if (style.variant !== 'italic') {
1934
+ mrPr.children.push({
1935
+ name: 'm:sty',
1936
+ type: 'tag',
1937
+ attribs: {
1938
+ 'm:val': STYLES[style.variant]
1939
+ },
1940
+ children: []
1941
+ });
1942
+ }
1943
+ rElement.children.push(mrPr);
1944
+ } else if (hasMglyphChild || textType === 'mtext') {
1945
+ rElement.children.push({
1946
+ name: 'm:rPr',
1947
+ type: 'tag',
1948
+ attribs: {},
1949
+ children: [
1950
+ {
1951
+ name: 'm:nor',
1952
+ type: 'tag',
1953
+ attribs: {},
1954
+ children: []
1955
+ }
1956
+ ]
1957
+ });
1958
+ } else if (style.fontstyle === 'normal' || (textType === 'ms' && style.fontstyle === '')) {
1959
+ rElement.children.push({
1960
+ name: 'm:rPr',
1961
+ type: 'tag',
1962
+ attribs: {},
1963
+ children: [
1964
+ {
1965
+ name: 'm:sty',
1966
+ type: 'tag',
1967
+ attribs: { 'm:val': 'p' },
1968
+ children: []
1969
+ }
1970
+ ]
1971
+ });
1972
+ }
1973
+
1974
+ targetElement = {
1975
+ name: 'm:t',
1976
+ type: 'tag',
1977
+ attribs: {
1978
+ 'xml:space': 'preserve'
1979
+ },
1980
+ children: []
1981
+ };
1982
+ rElement.children.push(targetElement);
1983
+ targetParent.children.push(rElement);
1984
+ }
1985
+ return targetElement
1986
+ }
1987
+
1988
+ function mtext(element, targetParent, previousSibling, nextSibling, ancestors) {
1989
+ return textContainer(element, targetParent, previousSibling, nextSibling, ancestors, 'mtext')
1990
+ }
1991
+
1992
+ function mi(element, targetParent, previousSibling, nextSibling, ancestors) {
1993
+ return textContainer(element, targetParent, previousSibling, nextSibling, ancestors, 'mi')
1994
+ }
1995
+
1996
+ function mn(element, targetParent, previousSibling, nextSibling, ancestors) {
1997
+ return textContainer(element, targetParent, previousSibling, nextSibling, ancestors, 'mn')
1998
+ }
1999
+
2000
+ function mo(element, targetParent, previousSibling, nextSibling, ancestors) {
2001
+ return textContainer(element, targetParent, previousSibling, nextSibling, ancestors, 'mo')
2002
+ }
2003
+
2004
+ function ms(element, targetParent, previousSibling, nextSibling, ancestors) {
2005
+ return textContainer(element, targetParent, previousSibling, nextSibling, ancestors, 'ms')
2006
+ }
2007
+
2008
+ const UPPER_COMBINATION = {
2009
+ '\u2190': '\u20D6', // arrow left
2010
+ '\u27F5': '\u20D6', // arrow left, long
2011
+ '\u2192': '\u20D7', // arrow right
2012
+ '\u27F6': '\u20D7', // arrow right, long
2013
+ '\u00B4': '\u0301', // accute
2014
+ '\u02DD': '\u030B', // accute, double
2015
+ '\u02D8': '\u0306', // breve
2016
+ ˇ: '\u030C', // caron
2017
+ '\u00B8': '\u0312', // cedilla
2018
+ '\u005E': '\u0302', // circumflex accent
2019
+ '\u00A8': '\u0308', // diaresis
2020
+ '\u02D9': '\u0307', // dot above
2021
+ '\u0060': '\u0300', // grave accent
2022
+ '\u002D': '\u0305', // hyphen -> overline
2023
+ '\u00AF': '\u0305', // macron
2024
+ '\u2212': '\u0305', // minus -> overline
2025
+ '\u002E': '\u0307', // period -> dot above
2026
+ '\u007E': '\u0303', // tilde
2027
+ '\u02DC': '\u0303' // small tilde
2028
+ };
2029
+
2030
+ function underOrOver(element, targetParent, previousSibling, nextSibling, ancestors, direction) {
2031
+ // Munder/Mover
2032
+
2033
+ if (element.children.length !== 2) {
2034
+ // treat as mrow
2035
+ return targetParent
2036
+ }
2037
+
2038
+ ancestors = [...ancestors];
2039
+ ancestors.unshift(element);
2040
+
2041
+ const base = element.children[0];
2042
+ const script = element.children[1];
2043
+
2044
+ // Munder/Mover can be translated to ooml in different ways.
2045
+
2046
+ // First we check for m:nAry.
2047
+ //
2048
+ // m:nAry
2049
+ //
2050
+ // Conditions:
2051
+ // 1. base text must be nary operator
2052
+ // 2. no accents
2053
+ const naryChar = getNary(base);
2054
+
2055
+ if (
2056
+ naryChar &&
2057
+ element.attribs?.accent?.toLowerCase() !== 'true' &&
2058
+ element.attribs?.accentunder?.toLowerCase() !== 'true'
2059
+ ) {
2060
+ const topTarget = getNaryTarget(
2061
+ naryChar,
2062
+ element,
2063
+ 'undOvr',
2064
+ direction === 'over',
2065
+ direction === 'under'
2066
+ );
2067
+ element.isNary = true;
2068
+
2069
+ const subscriptTarget = {
2070
+ name: 'm:sub',
2071
+ type: 'tag',
2072
+ attribs: {},
2073
+ children: []
2074
+ };
2075
+ const superscriptTarget = {
2076
+ name: 'm:sup',
2077
+ type: 'tag',
2078
+ attribs: {},
2079
+ children: []
2080
+ };
2081
+ walker(
2082
+ script,
2083
+ direction === 'under' ? subscriptTarget : superscriptTarget,
2084
+ false,
2085
+ false,
2086
+ ancestors
2087
+ );
2088
+ topTarget.children.push(subscriptTarget);
2089
+ topTarget.children.push(superscriptTarget);
2090
+ topTarget.children.push({ type: 'tag', name: 'm:e', attribs: {}, children: [] });
2091
+ targetParent.children.push(topTarget);
2092
+ return
2093
+ }
2094
+
2095
+ const scriptText = getTextContent(script);
2096
+
2097
+ const baseTarget = {
2098
+ name: 'm:e',
2099
+ type: 'tag',
2100
+ attribs: {},
2101
+ children: []
2102
+ };
2103
+ walker(base, baseTarget, false, false, ancestors);
2104
+
2105
+ //
2106
+ // m:bar
2107
+ //
2108
+ // Then we check whether it should be an m:bar.
2109
+ // This happens if:
2110
+ // 1. The script text is a single character that corresponds to
2111
+ // \u0332/\u005F (underbar) or \u0305/\u00AF (overbar)
2112
+ // 2. The type of the script element is mo.
2113
+ if (
2114
+ (direction === 'under' && script.name === 'mo' && ['\u0332', '\u005F'].includes(scriptText)) ||
2115
+ (direction === 'over' && script.name === 'mo' && ['\u0305', '\u00AF'].includes(scriptText))
2116
+ ) {
2117
+ // m:bar
2118
+ targetParent.children.push({
2119
+ type: 'tag',
2120
+ name: 'm:bar',
2121
+ attribs: {},
2122
+ children: [
2123
+ {
2124
+ type: 'tag',
2125
+ name: 'm:barPr',
2126
+ attribs: {},
2127
+ children: [
2128
+ {
2129
+ type: 'tag',
2130
+ name: 'm:pos',
2131
+ attribs: {
2132
+ 'm:val': direction === 'under' ? 'bot' : 'top'
2133
+ },
2134
+ children: []
2135
+ }
2136
+ ]
2137
+ },
2138
+ {
2139
+ type: 'tag',
2140
+ name: 'm:e',
2141
+ attribs: {},
2142
+ children: [
2143
+ {
2144
+ type: 'tag',
2145
+ name: direction === 'under' ? 'm:sSub' : 'm:sSup',
2146
+ attribs: {},
2147
+ children: [
2148
+ {
2149
+ type: 'tag',
2150
+ name: direction === 'under' ? 'm:sSubPr' : 'm:sSupPr',
2151
+ attribs: {},
2152
+ children: [{ type: 'tag', name: 'm:ctrlPr', attribs: {}, children: [] }]
2153
+ },
2154
+ baseTarget,
2155
+ { type: 'tag', name: 'm:sub', attribs: {}, children: [] }
2156
+ ]
2157
+ }
2158
+ ]
2159
+ }
2160
+ ]
2161
+ });
2162
+ return
2163
+ }
2164
+
2165
+ // m:acc
2166
+ //
2167
+ // Next we try to see if it is an m:acc. This is the case if:
2168
+ // 1. The scriptText is 0-1 characters long.
2169
+ // 2. The script is an mo-element
2170
+ // 3. The accent is set.
2171
+ if (
2172
+ (direction === 'under' &&
2173
+ element.attribs?.accentunder?.toLowerCase() === 'true' &&
2174
+ script.name === 'mo' &&
2175
+ scriptText.length < 2) ||
2176
+ (direction === 'over' &&
2177
+ element.attribs?.accent?.toLowerCase() === 'true' &&
2178
+ script.name === 'mo' &&
2179
+ scriptText.length < 2)
2180
+ ) {
2181
+ // m:acc
2182
+ targetParent.children.push({
2183
+ type: 'tag',
2184
+ name: 'm:acc',
2185
+ attribs: {},
2186
+ children: [
2187
+ {
2188
+ type: 'tag',
2189
+ name: 'm:accPr',
2190
+ attribs: {},
2191
+ children: [
2192
+ {
2193
+ type: 'tag',
2194
+ name: 'm:chr',
2195
+ attribs: {
2196
+ 'm:val': UPPER_COMBINATION[scriptText] || scriptText
2197
+ },
2198
+ children: []
2199
+ }
2200
+ ]
2201
+ },
2202
+ baseTarget
2203
+ ]
2204
+ });
2205
+ return
2206
+ }
2207
+ // m:groupChr
2208
+ //
2209
+ // Now we try m:groupChr. Conditions are:
2210
+ // 1. Base is an 'mrow' and script is an 'mo'.
2211
+ // 2. Script length is 1.
2212
+ // 3. No accent
2213
+ if (
2214
+ element.attribs?.accent?.toLowerCase() !== 'true' &&
2215
+ element.attribs?.accentunder?.toLowerCase() !== 'true' &&
2216
+ script.name === 'mo' &&
2217
+ base.name === 'mrow' &&
2218
+ scriptText.length === 1
2219
+ ) {
2220
+ targetParent.children.push({
2221
+ type: 'tag',
2222
+ name: 'm:groupChr',
2223
+ attribs: {},
2224
+ children: [
2225
+ {
2226
+ type: 'tag',
2227
+ name: 'm:groupChrPr',
2228
+ attribs: {},
2229
+ children: [
2230
+ {
2231
+ type: 'tag',
2232
+ name: 'm:chr',
2233
+ attribs: {
2234
+ 'm:val': scriptText,
2235
+ 'm:pos': direction === 'under' ? 'bot' : 'top'
2236
+ },
2237
+ children: []
2238
+ }
2239
+ ]
2240
+ },
2241
+ baseTarget
2242
+ ]
2243
+ });
2244
+ return
2245
+ }
2246
+ // Fallback: m:lim
2247
+
2248
+ const scriptTarget = {
2249
+ name: 'm:lim',
2250
+ type: 'tag',
2251
+ attribs: {},
2252
+ children: []
2253
+ };
2254
+
2255
+ walker(script, scriptTarget, false, false, ancestors);
2256
+ targetParent.children.push({
2257
+ type: 'tag',
2258
+ name: direction === 'under' ? 'm:limLow' : 'm:limUpp',
2259
+ attribs: {},
2260
+ children: [baseTarget, scriptTarget]
2261
+ });
2262
+ // Don't iterate over children in the usual way.
2263
+ }
2264
+
2265
+ function munder(element, targetParent, previousSibling, nextSibling, ancestors) {
2266
+ return underOrOver(element, targetParent, previousSibling, nextSibling, ancestors, 'under')
2267
+ }
2268
+
2269
+ function mover(element, targetParent, previousSibling, nextSibling, ancestors) {
2270
+ return underOrOver(element, targetParent, previousSibling, nextSibling, ancestors, 'over')
2271
+ }
2272
+
2273
+ function mroot(element, targetParent, previousSibling, nextSibling, ancestors) {
2274
+ // Root
2275
+ if (element.children.length !== 2) {
2276
+ // treat as mrow
2277
+ return targetParent
2278
+ }
2279
+ ancestors = [...ancestors];
2280
+ ancestors.unshift(element);
2281
+ const base = element.children[0];
2282
+ const root = element.children[1];
2283
+
2284
+ const baseTarget = {
2285
+ type: 'tag',
2286
+ name: 'm:e',
2287
+ attribs: {},
2288
+ children: []
2289
+ };
2290
+ walker(base, baseTarget, false, false, ancestors);
2291
+
2292
+ const rootTarget = {
2293
+ type: 'tag',
2294
+ name: 'm:deg',
2295
+ attribs: {},
2296
+ children: []
2297
+ };
2298
+ walker(root, rootTarget, false, false, ancestors);
2299
+
2300
+ const rootText = getTextContent(root);
2301
+
2302
+ targetParent.children.push({
2303
+ type: 'tag',
2304
+ name: 'm:rad',
2305
+ attribs: {},
2306
+ children: [
2307
+ {
2308
+ type: 'tag',
2309
+ name: 'm:radPr',
2310
+ attribs: {},
2311
+ children: [
2312
+ {
2313
+ type: 'tag',
2314
+ name: 'm:degHide',
2315
+ attribs: { 'm:val': rootText.length ? 'off' : 'on' },
2316
+ children: []
2317
+ }
2318
+ ]
2319
+ },
2320
+ rootTarget,
2321
+ baseTarget
2322
+ ]
2323
+ });
2324
+ }
2325
+
2326
+ function text(element, targetParent, previousSibling, nextSibling, ancestors) {
2327
+ let text = element.data.replace(/[\u2062]|[\u200B]/g, '');
2328
+ if (ancestors.find((element) => ['mi', 'mn', 'mo'].includes(element.name))) {
2329
+ text = text.replace(/\s/g, '');
2330
+ } else {
2331
+ const ms = ancestors.find((element) => element.name === 'ms');
2332
+ if (ms) {
2333
+ text = (ms.attribs?.lquote || '"') + text + (ms.attribs?.rquote || '"');
2334
+ }
2335
+ }
2336
+ if (text.length) {
2337
+ if (
2338
+ targetParent.children.length &&
2339
+ targetParent.children[targetParent.children.length - 1].type === 'text'
2340
+ ) {
2341
+ targetParent.children[targetParent.children.length - 1].data += text;
2342
+ } else {
2343
+ targetParent.children.push({
2344
+ type: 'text',
2345
+ data: text
2346
+ });
2347
+ }
2348
+ }
2349
+ return targetParent
2350
+ }
2351
+
2352
+ var mathmlHandlers = /*#__PURE__*/Object.freeze({
2353
+ __proto__: null,
2354
+ math: math,
2355
+ menclose: menclose,
2356
+ mfrac: mfrac,
2357
+ mglyph: mglyph,
2358
+ mi: mi,
2359
+ mmultiscripts: mmultiscripts,
2360
+ mn: mn,
2361
+ mo: mo,
2362
+ mover: mover,
2363
+ mroot: mroot,
2364
+ mrow: mrow,
2365
+ ms: ms,
2366
+ mspace: mspace,
2367
+ msqrt: msqrt,
2368
+ mstyle: mstyle,
2369
+ msub: msub,
2370
+ msubsup: msubsup,
2371
+ msup: msup,
2372
+ mtable: mtable,
2373
+ mtd: mtd,
2374
+ mtext: mtext,
2375
+ mtr: mtr,
2376
+ munder: munder,
2377
+ munderover: munderover,
2378
+ semantics: semantics,
2379
+ text: text
2380
+ });
2381
+
2382
+ function walker(
2383
+ element,
2384
+ targetParent,
2385
+ previousSibling = false,
2386
+ nextSibling = false,
2387
+ ancestors = []
2388
+ ) {
2389
+ if (
2390
+ !previousSibling &&
2391
+ ['m:deg', 'm:den', 'm:e', 'm:fName', 'm:lim', 'm:num', 'm:sub', 'm:sup'].includes(
2392
+ targetParent.name
2393
+ )
2394
+ ) {
2395
+ // We are walking through the first element within one of the
2396
+ // elements where an <m:argPr> might occur. The <m:argPr> can specify
2397
+ // the scriptlevel, but it only makes sense if there is some content.
2398
+ // The fact that we are here means that there is at least one content item.
2399
+ // So we will check whether to add the m:rPr.
2400
+ // For possible parent types, see
2401
+ // https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.math.argumentproperties?view=openxml-2.8.1#remarks
2402
+ addScriptlevel(targetParent, ancestors);
2403
+ }
2404
+ let targetElement;
2405
+ const nameOrType = element.name || element.type;
2406
+ if (mathmlHandlers[nameOrType]) {
2407
+ targetElement = mathmlHandlers[nameOrType](
2408
+ element,
2409
+ targetParent,
2410
+ previousSibling,
2411
+ nextSibling,
2412
+ ancestors
2413
+ );
2414
+ } else {
2415
+ if (nameOrType && nameOrType !== 'root') {
2416
+ console.warn(`Type not supported: ${nameOrType}`);
2417
+ }
2418
+
2419
+ targetElement = targetParent;
2420
+ }
2421
+
2422
+ if (!targetElement) {
2423
+ // Target element hasn't been assigned, so don't handle children.
2424
+ return
2425
+ }
2426
+ if (element.children?.length) {
2427
+ ancestors = [...ancestors];
2428
+ ancestors.unshift(element);
2429
+ // Track nary body redirect: after a nary operator, redirect subsequent
2430
+ // siblings into its <m:e> until a relational operator (=, <, >, etc.) is
2431
+ // encountered. Chains through nested nary operators (e.g. double
2432
+ // integrals ∫∫).
2433
+ let naryBodyTarget = null;
2434
+ // Track prescript redirect: after a msubsup with empty base (e.g.
2435
+ // {}^{14}_{6}C), redirect the next sibling into <m:sPre>'s <m:e>.
2436
+ let prescriptTarget = null;
2437
+ for (let i = 0; i < element.children.length; i++) {
2438
+ const child = element.children[i];
2439
+ if (child.skipInWalker) continue
2440
+
2441
+ // A relational/separator <mo> or <mtext> stops the nary redirect so
2442
+ // that content after the operand stays outside the nary body.
2443
+ // Examples: ∑ aᵢ = S → operand is aᵢ (stopped by =)
2444
+ // ∑ aᵢ, bⱼ → operand is aᵢ (stopped by ,)
2445
+ // ∑ aᵢ \text{ for } i → operand is aᵢ (stopped by mtext)
2446
+ if (naryBodyTarget) {
2447
+ if (child.name === 'mo') {
2448
+ const txt = child.children?.[0]?.data;
2449
+ if (txt && /^[=<>≤≥≠≈≡∼≲≳≪≫∈∉⊂⊃⊆⊇⊄⊅≺≻⪯⪰∝≅≃≍≎∥⊥⊢⊣⊨⊩,;:∣]$/.test(txt)) {
2450
+ naryBodyTarget = null;
2451
+ }
2452
+ } else if (child.name === 'mtext') {
2453
+ naryBodyTarget = null;
2454
+ }
2455
+ }
2456
+
2457
+ const effectiveTarget = prescriptTarget || naryBodyTarget || targetElement;
2458
+ walker(
2459
+ child,
2460
+ effectiveTarget,
2461
+ element.children[i - 1],
2462
+ element.children[i + 1],
2463
+ ancestors
2464
+ );
2465
+ if (child.isNary) {
2466
+ // Chain into the new nary's <m:e>
2467
+ const naryNode = effectiveTarget.children[effectiveTarget.children.length - 1];
2468
+ naryBodyTarget = naryNode.children[naryNode.children.length - 1];
2469
+ }
2470
+ if (child.isPrescript) {
2471
+ // Redirect next sibling into <m:sPre>'s <m:e>
2472
+ const preNode = effectiveTarget.children[effectiveTarget.children.length - 1];
2473
+ prescriptTarget = preNode.children[preNode.children.length - 1];
2474
+ } else if (prescriptTarget) {
2475
+ // One element consumed; stop prescript redirect
2476
+ prescriptTarget = null;
2477
+ }
2478
+ }
2479
+ }
2480
+ }
2481
+
2482
+ class MML2OMML {
2483
+ constructor(mmlString, options = {}) {
2484
+ this.inString = mmlString;
2485
+ this.inXML = parse(mmlString, options);
2486
+ this.outXML = false;
2487
+ this.outString = false;
2488
+ }
2489
+
2490
+ run() {
2491
+ const outXML = {};
2492
+ walker({ children: this.inXML, type: 'root' }, outXML);
2493
+ this.outXML = outXML;
2494
+ }
2495
+
2496
+ getResult() {
2497
+ this.outString = stringifyDoc([this.outXML]);
2498
+ return this.outString
2499
+ }
2500
+ }
2501
+
2502
+ const mml2omml = (mmlString, options) => {
2503
+ const converter = new MML2OMML(mmlString, options);
2504
+ converter.run();
2505
+ return converter.getResult()
2506
+ };
2507
+
2508
+ exports.mml2omml = mml2omml;
2509
+ //# sourceMappingURL=index.cjs.map
packages/mathml2omml/dist/index.cjs.map ADDED
The diff for this file is too large to render. See raw diff
 
packages/mathml2omml/dist/index.d.ts ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export interface MML2OMMLOptions {
2
+ /**
3
+ * Whether to disable XML decoding of input
4
+ */
5
+ disableDecode?: boolean
6
+ }
7
+
8
+ /**
9
+ * Convert MathML to Office Open XML Math (OMML) format
10
+ *
11
+ * @param mmlString - MathML string to convert
12
+ * @param options - Optional configuration options
13
+ * @returns OMML string
14
+ */
15
+ export function mml2omml(mmlString: string, options?: MML2OMMLOptions): string
16
+
17
+ /**
18
+ * MML2OMML class for converting MathML to OMML
19
+ */
20
+ export class MML2OMML {
21
+ /**
22
+ * Construct a new MML2OMML converter
23
+ *
24
+ * @param mmlString - MathML string to convert
25
+ * @param options - Optional configuration options
26
+ */
27
+ constructor(mmlString: string, options?: MML2OMMLOptions)
28
+
29
+ /**
30
+ * Run the conversion process
31
+ */
32
+ run(): void
33
+
34
+ /**
35
+ * Get the resulting OMML as a string
36
+ *
37
+ * @returns OMML string
38
+ */
39
+ getResult(): string
40
+ }
packages/mathml2omml/dist/index.js ADDED
@@ -0,0 +1,2507 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Generated using scripts/write-decode-map.ts
2
+ const xmlDecodeTree = /* #__PURE__ */ new Uint16Array(
3
+ // prettier-ignore
4
+ /* #__PURE__ */ "\u0200aglq\t\x15\x18\x1b\u026d\x0f\0\0\x12p;\u4026os;\u4027t;\u403et;\u403cuot;\u4022"
5
+ .split("")
6
+ .map((c) => c.charCodeAt(0)));
7
+
8
+ // Adapted from https://github.com/mathiasbynens/he/blob/36afe179392226cf1b6ccdb16ebbb7a5a844d93a/src/he.js#L106-L134
9
+ var _a;
10
+ const decodeMap = new Map([
11
+ [0, 65533],
12
+ // C1 Unicode control character reference replacements
13
+ [128, 8364],
14
+ [130, 8218],
15
+ [131, 402],
16
+ [132, 8222],
17
+ [133, 8230],
18
+ [134, 8224],
19
+ [135, 8225],
20
+ [136, 710],
21
+ [137, 8240],
22
+ [138, 352],
23
+ [139, 8249],
24
+ [140, 338],
25
+ [142, 381],
26
+ [145, 8216],
27
+ [146, 8217],
28
+ [147, 8220],
29
+ [148, 8221],
30
+ [149, 8226],
31
+ [150, 8211],
32
+ [151, 8212],
33
+ [152, 732],
34
+ [153, 8482],
35
+ [154, 353],
36
+ [155, 8250],
37
+ [156, 339],
38
+ [158, 382],
39
+ [159, 376],
40
+ ]);
41
+ /**
42
+ * Polyfill for `String.fromCodePoint`. It is used to create a string from a Unicode code point.
43
+ */
44
+ const fromCodePoint =
45
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, n/no-unsupported-features/es-builtins
46
+ (_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : function (codePoint) {
47
+ let output = "";
48
+ if (codePoint > 65535) {
49
+ codePoint -= 65536;
50
+ output += String.fromCharCode(((codePoint >>> 10) & 1023) | 55296);
51
+ codePoint = 56320 | (codePoint & 1023);
52
+ }
53
+ output += String.fromCharCode(codePoint);
54
+ return output;
55
+ };
56
+ /**
57
+ * Replace the given code point with a replacement character if it is a
58
+ * surrogate or is outside the valid range. Otherwise return the code
59
+ * point unchanged.
60
+ */
61
+ function replaceCodePoint(codePoint) {
62
+ var _a;
63
+ if ((codePoint >= 55296 && codePoint <= 57343) ||
64
+ codePoint > 1114111) {
65
+ return 65533;
66
+ }
67
+ return (_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint;
68
+ }
69
+
70
+ var CharCodes;
71
+ (function (CharCodes) {
72
+ CharCodes[CharCodes["NUM"] = 35] = "NUM";
73
+ CharCodes[CharCodes["SEMI"] = 59] = "SEMI";
74
+ CharCodes[CharCodes["EQUALS"] = 61] = "EQUALS";
75
+ CharCodes[CharCodes["ZERO"] = 48] = "ZERO";
76
+ CharCodes[CharCodes["NINE"] = 57] = "NINE";
77
+ CharCodes[CharCodes["LOWER_A"] = 97] = "LOWER_A";
78
+ CharCodes[CharCodes["LOWER_F"] = 102] = "LOWER_F";
79
+ CharCodes[CharCodes["LOWER_X"] = 120] = "LOWER_X";
80
+ CharCodes[CharCodes["LOWER_Z"] = 122] = "LOWER_Z";
81
+ CharCodes[CharCodes["UPPER_A"] = 65] = "UPPER_A";
82
+ CharCodes[CharCodes["UPPER_F"] = 70] = "UPPER_F";
83
+ CharCodes[CharCodes["UPPER_Z"] = 90] = "UPPER_Z";
84
+ })(CharCodes || (CharCodes = {}));
85
+ /** Bit that needs to be set to convert an upper case ASCII character to lower case */
86
+ const TO_LOWER_BIT = 32;
87
+ var BinTrieFlags;
88
+ (function (BinTrieFlags) {
89
+ BinTrieFlags[BinTrieFlags["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
90
+ BinTrieFlags[BinTrieFlags["BRANCH_LENGTH"] = 16256] = "BRANCH_LENGTH";
91
+ BinTrieFlags[BinTrieFlags["JUMP_TABLE"] = 127] = "JUMP_TABLE";
92
+ })(BinTrieFlags || (BinTrieFlags = {}));
93
+ function isNumber(code) {
94
+ return code >= CharCodes.ZERO && code <= CharCodes.NINE;
95
+ }
96
+ function isHexadecimalCharacter(code) {
97
+ return ((code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_F) ||
98
+ (code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_F));
99
+ }
100
+ function isAsciiAlphaNumeric(code) {
101
+ return ((code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_Z) ||
102
+ (code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_Z) ||
103
+ isNumber(code));
104
+ }
105
+ /**
106
+ * Checks if the given character is a valid end character for an entity in an attribute.
107
+ *
108
+ * Attribute values that aren't terminated properly aren't parsed, and shouldn't lead to a parser error.
109
+ * See the example in https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state
110
+ */
111
+ function isEntityInAttributeInvalidEnd(code) {
112
+ return code === CharCodes.EQUALS || isAsciiAlphaNumeric(code);
113
+ }
114
+ var EntityDecoderState;
115
+ (function (EntityDecoderState) {
116
+ EntityDecoderState[EntityDecoderState["EntityStart"] = 0] = "EntityStart";
117
+ EntityDecoderState[EntityDecoderState["NumericStart"] = 1] = "NumericStart";
118
+ EntityDecoderState[EntityDecoderState["NumericDecimal"] = 2] = "NumericDecimal";
119
+ EntityDecoderState[EntityDecoderState["NumericHex"] = 3] = "NumericHex";
120
+ EntityDecoderState[EntityDecoderState["NamedEntity"] = 4] = "NamedEntity";
121
+ })(EntityDecoderState || (EntityDecoderState = {}));
122
+ var DecodingMode;
123
+ (function (DecodingMode) {
124
+ /** Entities in text nodes that can end with any character. */
125
+ DecodingMode[DecodingMode["Legacy"] = 0] = "Legacy";
126
+ /** Only allow entities terminated with a semicolon. */
127
+ DecodingMode[DecodingMode["Strict"] = 1] = "Strict";
128
+ /** Entities in attributes have limitations on ending characters. */
129
+ DecodingMode[DecodingMode["Attribute"] = 2] = "Attribute";
130
+ })(DecodingMode || (DecodingMode = {}));
131
+ /**
132
+ * Token decoder with support of writing partial entities.
133
+ */
134
+ class EntityDecoder {
135
+ constructor(
136
+ /** The tree used to decode entities. */
137
+ decodeTree,
138
+ /**
139
+ * The function that is called when a codepoint is decoded.
140
+ *
141
+ * For multi-byte named entities, this will be called multiple times,
142
+ * with the second codepoint, and the same `consumed` value.
143
+ *
144
+ * @param codepoint The decoded codepoint.
145
+ * @param consumed The number of bytes consumed by the decoder.
146
+ */
147
+ emitCodePoint,
148
+ /** An object that is used to produce errors. */
149
+ errors) {
150
+ this.decodeTree = decodeTree;
151
+ this.emitCodePoint = emitCodePoint;
152
+ this.errors = errors;
153
+ /** The current state of the decoder. */
154
+ this.state = EntityDecoderState.EntityStart;
155
+ /** Characters that were consumed while parsing an entity. */
156
+ this.consumed = 1;
157
+ /**
158
+ * The result of the entity.
159
+ *
160
+ * Either the result index of a numeric entity, or the codepoint of a
161
+ * numeric entity.
162
+ */
163
+ this.result = 0;
164
+ /** The current index in the decode tree. */
165
+ this.treeIndex = 0;
166
+ /** The number of characters that were consumed in excess. */
167
+ this.excess = 1;
168
+ /** The mode in which the decoder is operating. */
169
+ this.decodeMode = DecodingMode.Strict;
170
+ }
171
+ /** Resets the instance to make it reusable. */
172
+ startEntity(decodeMode) {
173
+ this.decodeMode = decodeMode;
174
+ this.state = EntityDecoderState.EntityStart;
175
+ this.result = 0;
176
+ this.treeIndex = 0;
177
+ this.excess = 1;
178
+ this.consumed = 1;
179
+ }
180
+ /**
181
+ * Write an entity to the decoder. This can be called multiple times with partial entities.
182
+ * If the entity is incomplete, the decoder will return -1.
183
+ *
184
+ * Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the
185
+ * entity is incomplete, and resume when the next string is written.
186
+ *
187
+ * @param input The string containing the entity (or a continuation of the entity).
188
+ * @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
189
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
190
+ */
191
+ write(input, offset) {
192
+ switch (this.state) {
193
+ case EntityDecoderState.EntityStart: {
194
+ if (input.charCodeAt(offset) === CharCodes.NUM) {
195
+ this.state = EntityDecoderState.NumericStart;
196
+ this.consumed += 1;
197
+ return this.stateNumericStart(input, offset + 1);
198
+ }
199
+ this.state = EntityDecoderState.NamedEntity;
200
+ return this.stateNamedEntity(input, offset);
201
+ }
202
+ case EntityDecoderState.NumericStart: {
203
+ return this.stateNumericStart(input, offset);
204
+ }
205
+ case EntityDecoderState.NumericDecimal: {
206
+ return this.stateNumericDecimal(input, offset);
207
+ }
208
+ case EntityDecoderState.NumericHex: {
209
+ return this.stateNumericHex(input, offset);
210
+ }
211
+ case EntityDecoderState.NamedEntity: {
212
+ return this.stateNamedEntity(input, offset);
213
+ }
214
+ }
215
+ }
216
+ /**
217
+ * Switches between the numeric decimal and hexadecimal states.
218
+ *
219
+ * Equivalent to the `Numeric character reference state` in the HTML spec.
220
+ *
221
+ * @param input The string containing the entity (or a continuation of the entity).
222
+ * @param offset The current offset.
223
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
224
+ */
225
+ stateNumericStart(input, offset) {
226
+ if (offset >= input.length) {
227
+ return -1;
228
+ }
229
+ if ((input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
230
+ this.state = EntityDecoderState.NumericHex;
231
+ this.consumed += 1;
232
+ return this.stateNumericHex(input, offset + 1);
233
+ }
234
+ this.state = EntityDecoderState.NumericDecimal;
235
+ return this.stateNumericDecimal(input, offset);
236
+ }
237
+ addToNumericResult(input, start, end, base) {
238
+ if (start !== end) {
239
+ const digitCount = end - start;
240
+ this.result =
241
+ this.result * Math.pow(base, digitCount) +
242
+ Number.parseInt(input.substr(start, digitCount), base);
243
+ this.consumed += digitCount;
244
+ }
245
+ }
246
+ /**
247
+ * Parses a hexadecimal numeric entity.
248
+ *
249
+ * Equivalent to the `Hexademical character reference state` in the HTML spec.
250
+ *
251
+ * @param input The string containing the entity (or a continuation of the entity).
252
+ * @param offset The current offset.
253
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
254
+ */
255
+ stateNumericHex(input, offset) {
256
+ const startIndex = offset;
257
+ while (offset < input.length) {
258
+ const char = input.charCodeAt(offset);
259
+ if (isNumber(char) || isHexadecimalCharacter(char)) {
260
+ offset += 1;
261
+ }
262
+ else {
263
+ this.addToNumericResult(input, startIndex, offset, 16);
264
+ return this.emitNumericEntity(char, 3);
265
+ }
266
+ }
267
+ this.addToNumericResult(input, startIndex, offset, 16);
268
+ return -1;
269
+ }
270
+ /**
271
+ * Parses a decimal numeric entity.
272
+ *
273
+ * Equivalent to the `Decimal character reference state` in the HTML spec.
274
+ *
275
+ * @param input The string containing the entity (or a continuation of the entity).
276
+ * @param offset The current offset.
277
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
278
+ */
279
+ stateNumericDecimal(input, offset) {
280
+ const startIndex = offset;
281
+ while (offset < input.length) {
282
+ const char = input.charCodeAt(offset);
283
+ if (isNumber(char)) {
284
+ offset += 1;
285
+ }
286
+ else {
287
+ this.addToNumericResult(input, startIndex, offset, 10);
288
+ return this.emitNumericEntity(char, 2);
289
+ }
290
+ }
291
+ this.addToNumericResult(input, startIndex, offset, 10);
292
+ return -1;
293
+ }
294
+ /**
295
+ * Validate and emit a numeric entity.
296
+ *
297
+ * Implements the logic from the `Hexademical character reference start
298
+ * state` and `Numeric character reference end state` in the HTML spec.
299
+ *
300
+ * @param lastCp The last code point of the entity. Used to see if the
301
+ * entity was terminated with a semicolon.
302
+ * @param expectedLength The minimum number of characters that should be
303
+ * consumed. Used to validate that at least one digit
304
+ * was consumed.
305
+ * @returns The number of characters that were consumed.
306
+ */
307
+ emitNumericEntity(lastCp, expectedLength) {
308
+ var _a;
309
+ // Ensure we consumed at least one digit.
310
+ if (this.consumed <= expectedLength) {
311
+ (_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);
312
+ return 0;
313
+ }
314
+ // Figure out if this is a legit end of the entity
315
+ if (lastCp === CharCodes.SEMI) {
316
+ this.consumed += 1;
317
+ }
318
+ else if (this.decodeMode === DecodingMode.Strict) {
319
+ return 0;
320
+ }
321
+ this.emitCodePoint(replaceCodePoint(this.result), this.consumed);
322
+ if (this.errors) {
323
+ if (lastCp !== CharCodes.SEMI) {
324
+ this.errors.missingSemicolonAfterCharacterReference();
325
+ }
326
+ this.errors.validateNumericCharacterReference(this.result);
327
+ }
328
+ return this.consumed;
329
+ }
330
+ /**
331
+ * Parses a named entity.
332
+ *
333
+ * Equivalent to the `Named character reference state` in the HTML spec.
334
+ *
335
+ * @param input The string containing the entity (or a continuation of the entity).
336
+ * @param offset The current offset.
337
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
338
+ */
339
+ stateNamedEntity(input, offset) {
340
+ const { decodeTree } = this;
341
+ let current = decodeTree[this.treeIndex];
342
+ // The mask is the number of bytes of the value, including the current byte.
343
+ let valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
344
+ for (; offset < input.length; offset++, this.excess++) {
345
+ const char = input.charCodeAt(offset);
346
+ this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char);
347
+ if (this.treeIndex < 0) {
348
+ return this.result === 0 ||
349
+ // If we are parsing an attribute
350
+ (this.decodeMode === DecodingMode.Attribute &&
351
+ // We shouldn't have consumed any characters after the entity,
352
+ (valueLength === 0 ||
353
+ // And there should be no invalid characters.
354
+ isEntityInAttributeInvalidEnd(char)))
355
+ ? 0
356
+ : this.emitNotTerminatedNamedEntity();
357
+ }
358
+ current = decodeTree[this.treeIndex];
359
+ valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
360
+ // If the branch is a value, store it and continue
361
+ if (valueLength !== 0) {
362
+ // If the entity is terminated by a semicolon, we are done.
363
+ if (char === CharCodes.SEMI) {
364
+ return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);
365
+ }
366
+ // If we encounter a non-terminated (legacy) entity while parsing strictly, then ignore it.
367
+ if (this.decodeMode !== DecodingMode.Strict) {
368
+ this.result = this.treeIndex;
369
+ this.consumed += this.excess;
370
+ this.excess = 0;
371
+ }
372
+ }
373
+ }
374
+ return -1;
375
+ }
376
+ /**
377
+ * Emit a named entity that was not terminated with a semicolon.
378
+ *
379
+ * @returns The number of characters consumed.
380
+ */
381
+ emitNotTerminatedNamedEntity() {
382
+ var _a;
383
+ const { result, decodeTree } = this;
384
+ const valueLength = (decodeTree[result] & BinTrieFlags.VALUE_LENGTH) >> 14;
385
+ this.emitNamedEntityData(result, valueLength, this.consumed);
386
+ (_a = this.errors) === null || _a === void 0 ? void 0 : _a.missingSemicolonAfterCharacterReference();
387
+ return this.consumed;
388
+ }
389
+ /**
390
+ * Emit a named entity.
391
+ *
392
+ * @param result The index of the entity in the decode tree.
393
+ * @param valueLength The number of bytes in the entity.
394
+ * @param consumed The number of characters consumed.
395
+ *
396
+ * @returns The number of characters consumed.
397
+ */
398
+ emitNamedEntityData(result, valueLength, consumed) {
399
+ const { decodeTree } = this;
400
+ this.emitCodePoint(valueLength === 1
401
+ ? decodeTree[result] & ~BinTrieFlags.VALUE_LENGTH
402
+ : decodeTree[result + 1], consumed);
403
+ if (valueLength === 3) {
404
+ // For multi-byte values, we need to emit the second byte.
405
+ this.emitCodePoint(decodeTree[result + 2], consumed);
406
+ }
407
+ return consumed;
408
+ }
409
+ /**
410
+ * Signal to the parser that the end of the input was reached.
411
+ *
412
+ * Remaining data will be emitted and relevant errors will be produced.
413
+ *
414
+ * @returns The number of characters consumed.
415
+ */
416
+ end() {
417
+ var _a;
418
+ switch (this.state) {
419
+ case EntityDecoderState.NamedEntity: {
420
+ // Emit a named entity if we have one.
421
+ return this.result !== 0 &&
422
+ (this.decodeMode !== DecodingMode.Attribute ||
423
+ this.result === this.treeIndex)
424
+ ? this.emitNotTerminatedNamedEntity()
425
+ : 0;
426
+ }
427
+ // Otherwise, emit a numeric entity if we have one.
428
+ case EntityDecoderState.NumericDecimal: {
429
+ return this.emitNumericEntity(0, 2);
430
+ }
431
+ case EntityDecoderState.NumericHex: {
432
+ return this.emitNumericEntity(0, 3);
433
+ }
434
+ case EntityDecoderState.NumericStart: {
435
+ (_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);
436
+ return 0;
437
+ }
438
+ case EntityDecoderState.EntityStart: {
439
+ // Return 0 if we have no entity.
440
+ return 0;
441
+ }
442
+ }
443
+ }
444
+ }
445
+ /**
446
+ * Creates a function that decodes entities in a string.
447
+ *
448
+ * @param decodeTree The decode tree.
449
+ * @returns A function that decodes entities in a string.
450
+ */
451
+ function getDecoder(decodeTree) {
452
+ let returnValue = "";
453
+ const decoder = new EntityDecoder(decodeTree, (data) => (returnValue += fromCodePoint(data)));
454
+ return function decodeWithTrie(input, decodeMode) {
455
+ let lastIndex = 0;
456
+ let offset = 0;
457
+ while ((offset = input.indexOf("&", offset)) >= 0) {
458
+ returnValue += input.slice(lastIndex, offset);
459
+ decoder.startEntity(decodeMode);
460
+ const length = decoder.write(input,
461
+ // Skip the "&"
462
+ offset + 1);
463
+ if (length < 0) {
464
+ lastIndex = offset + decoder.end();
465
+ break;
466
+ }
467
+ lastIndex = offset + length;
468
+ // If `length` is 0, skip the current `&` and continue.
469
+ offset = length === 0 ? lastIndex + 1 : lastIndex;
470
+ }
471
+ const result = returnValue + input.slice(lastIndex);
472
+ // Make sure we don't keep a reference to the final string.
473
+ returnValue = "";
474
+ return result;
475
+ };
476
+ }
477
+ /**
478
+ * Determines the branch of the current node that is taken given the current
479
+ * character. This function is used to traverse the trie.
480
+ *
481
+ * @param decodeTree The trie.
482
+ * @param current The current node.
483
+ * @param nodeIdx The index right after the current node and its value.
484
+ * @param char The current character.
485
+ * @returns The index of the next node, or -1 if no branch is taken.
486
+ */
487
+ function determineBranch(decodeTree, current, nodeIndex, char) {
488
+ const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
489
+ const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
490
+ // Case 1: Single branch encoded in jump offset
491
+ if (branchCount === 0) {
492
+ return jumpOffset !== 0 && char === jumpOffset ? nodeIndex : -1;
493
+ }
494
+ // Case 2: Multiple branches encoded in jump table
495
+ if (jumpOffset) {
496
+ const value = char - jumpOffset;
497
+ return value < 0 || value >= branchCount
498
+ ? -1
499
+ : decodeTree[nodeIndex + value] - 1;
500
+ }
501
+ // Case 3: Multiple branches encoded in dictionary
502
+ // Binary search for the character.
503
+ let lo = nodeIndex;
504
+ let hi = lo + branchCount - 1;
505
+ while (lo <= hi) {
506
+ const mid = (lo + hi) >>> 1;
507
+ const midValue = decodeTree[mid];
508
+ if (midValue < char) {
509
+ lo = mid + 1;
510
+ }
511
+ else if (midValue > char) {
512
+ hi = mid - 1;
513
+ }
514
+ else {
515
+ return decodeTree[mid + branchCount];
516
+ }
517
+ }
518
+ return -1;
519
+ }
520
+ const xmlDecoder = /* #__PURE__ */ getDecoder(xmlDecodeTree);
521
+ /**
522
+ * Decodes an XML string, requiring all entities to be terminated by a semicolon.
523
+ *
524
+ * @param xmlString The string to decode.
525
+ * @returns The decoded string.
526
+ */
527
+ function decodeXML(xmlString) {
528
+ return xmlDecoder(xmlString, DecodingMode.Strict);
529
+ }
530
+
531
+ const attrRE = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;
532
+
533
+ function stringify$1(tag) {
534
+ const res = {
535
+ type: 'tag',
536
+ name: '',
537
+ voidElement: false,
538
+ attribs: {},
539
+ children: []
540
+ };
541
+
542
+ const tagMatch = tag.match(/<\/?([^\s]+?)[/\s>]/);
543
+ if (tagMatch) {
544
+ res.name = tagMatch[1];
545
+ if (tag.charAt(tag.length - 2) === '/') {
546
+ res.voidElement = true;
547
+ }
548
+
549
+ // handle comment tag
550
+ if (res.name.startsWith('!--')) {
551
+ const endIndex = tag.indexOf('-->');
552
+ return {
553
+ type: 'comment',
554
+ comment: endIndex !== -1 ? tag.slice(4, endIndex) : ''
555
+ }
556
+ }
557
+ }
558
+
559
+ const reg = new RegExp(attrRE);
560
+ let result = null;
561
+ for (;;) {
562
+ result = reg.exec(tag);
563
+
564
+ if (result === null) {
565
+ break
566
+ }
567
+
568
+ if (!result[0].trim()) {
569
+ continue
570
+ }
571
+
572
+ if (result[1]) {
573
+ const attr = result[1].trim();
574
+ let arr = [attr, ''];
575
+
576
+ if (attr.indexOf('=') > -1) {
577
+ arr = attr.split('=');
578
+ }
579
+
580
+ res.attribs[arr[0]] = arr[1];
581
+ reg.lastIndex--;
582
+ } else if (result[2]) {
583
+ res.attribs[result[2]] = result[3].trim().substring(1, result[3].length - 1);
584
+ }
585
+ }
586
+
587
+ return res
588
+ }
589
+
590
+ const tagRE = /<[a-zA-Z0-9\-!/](?:"[^"]*"|'[^']*'|[^'">])*>/g;
591
+ const whitespaceRE = /^\s*$/;
592
+
593
+ const textContainerNames = ['mtext', 'mi', 'mn', 'mo', 'ms'];
594
+
595
+ function parse(html, options = {}) {
596
+ const result = [];
597
+ const arr = [];
598
+ let current;
599
+ let level = -1;
600
+
601
+ html.replace(tagRE, (tag, index) => {
602
+ const isOpen = tag.charAt(1) !== '/';
603
+ const isComment = tag.startsWith('<!--');
604
+ const start = index + tag.length;
605
+ const nextChar = html.charAt(start);
606
+ let parent;
607
+
608
+ if (isComment) {
609
+ const comment = stringify$1(tag);
610
+
611
+ // if we're at root, push new base node
612
+ if (level < 0) {
613
+ result.push(comment);
614
+ return result
615
+ }
616
+ parent = arr[level];
617
+ parent.children.push(comment);
618
+ return result
619
+ }
620
+
621
+ if (isOpen) {
622
+ level++;
623
+
624
+ current = stringify$1(tag);
625
+ if (current.type === 'tag' && options.components?.[current.name]) {
626
+ current.type = 'component';
627
+ }
628
+
629
+ if (
630
+ textContainerNames.includes(current.name) &&
631
+ !current.voidElement &&
632
+ nextChar &&
633
+ nextChar !== '<'
634
+ ) {
635
+ const data = html.slice(start, html.indexOf('<', start)).trim();
636
+ current.children.push({
637
+ type: 'text',
638
+ data: options.disableDecode ? data : decodeXML(data)
639
+ });
640
+ }
641
+
642
+ // if we're at root, push new base node
643
+ if (level === 0) {
644
+ result.push(current);
645
+ }
646
+
647
+ parent = arr[level - 1];
648
+
649
+ if (parent) {
650
+ parent.children.push(current);
651
+ }
652
+
653
+ arr[level] = current;
654
+ }
655
+
656
+ if (!isOpen || current.voidElement) {
657
+ if (level > -1 && (current.voidElement || current.name === tag.slice(2, -1))) {
658
+ level--;
659
+ // move current up a level to match the end tag
660
+ current = level === -1 ? result : arr[level];
661
+ }
662
+ if (
663
+ level > -1 &&
664
+ textContainerNames.includes[arr[level].name] &&
665
+ nextChar !== '<' &&
666
+ nextChar
667
+ ) {
668
+ // trailing text node
669
+ parent = arr[level].children;
670
+
671
+ // calculate correct end of the content slice in case there's
672
+ // no tag after the text node.
673
+ const end = html.indexOf('<', start);
674
+ let data = html.slice(start, end === -1 ? undefined : end);
675
+ // if a node is nothing but whitespace, collapse it as the spec states:
676
+ // https://www.w3.org/TR/html4/struct/text.html#h-9.1
677
+ if (whitespaceRE.test(data)) {
678
+ data = ' ';
679
+ }
680
+ // don't add whitespace-only text nodes if they would be trailing text nodes
681
+ // or if they would be leading whitespace-only text nodes:
682
+ // * end > -1 indicates this is not a trailing text node
683
+ // * leading node is when level is -1 and parent has length 0
684
+ if ((end > -1 && level + parent.length >= 0) || data !== ' ') {
685
+ parent.push({
686
+ type: 'text',
687
+ data: options.disableDecode ? data : decodeXML(data)
688
+ });
689
+ }
690
+ }
691
+ }
692
+ });
693
+
694
+ return result
695
+ }
696
+
697
+ function attrString(attribs) {
698
+ const buff = [];
699
+ for (const key in attribs) {
700
+ buff.push(`${key}="${attribs[key]}"`);
701
+ }
702
+ if (!buff.length) {
703
+ return ''
704
+ }
705
+ return ` ${buff.join(' ')}`
706
+ }
707
+
708
+ function escapeXmlText(str) {
709
+ return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
710
+ }
711
+
712
+ function stringify(buff, doc) {
713
+ switch (doc.type) {
714
+ case 'text':
715
+ return buff + escapeXmlText(doc.data)
716
+ case 'tag': {
717
+ const voidElement =
718
+ doc.voidElement || (!doc.children.length && doc.attribs['xml:space'] !== 'preserve');
719
+ buff += `<${doc.name}${doc.attribs ? attrString(doc.attribs) : ''}${voidElement ? '/>' : '>'}`;
720
+ if (voidElement) {
721
+ return buff
722
+ }
723
+ return `${buff + doc.children.reduce(stringify, '')}</${doc.name}>`
724
+ }
725
+ case 'comment':
726
+ buff += `<!--${doc.comment}-->`;
727
+ return buff
728
+ }
729
+ }
730
+
731
+ function stringifyDoc(doc) {
732
+ return doc.reduce((token, rootEl) => token + stringify('', rootEl), '')
733
+ }
734
+
735
+ function math(element, targetParent, previousSibling, nextSibling, ancestors) {
736
+ targetParent.name = 'm:oMath';
737
+ targetParent.attribs = {
738
+ 'xmlns:m': 'http://schemas.openxmlformats.org/officeDocument/2006/math',
739
+ 'xmlns:w': 'http://schemas.openxmlformats.org/wordprocessingml/2006/main'
740
+ };
741
+ targetParent.type = 'tag';
742
+ targetParent.children = [];
743
+ return targetParent
744
+ }
745
+
746
+ function semantics(element, targetParent, previousSibling, nextSibling, ancestors) {
747
+ // Ignore as default behavior
748
+ return targetParent
749
+ }
750
+
751
+ function menclose(element, targetParent, previousSibling, nextSibling, ancestors) {
752
+ const type = element.attribs?.notation?.split(' ')[0] || 'longdiv';
753
+
754
+ const targetElement = {
755
+ type: 'tag',
756
+ name: 'm:e',
757
+ attribs: {},
758
+ children: []
759
+ };
760
+
761
+ if (type === 'longdiv') {
762
+ targetParent.children.push({
763
+ type: 'tag',
764
+ name: 'm:rad',
765
+ attribs: {},
766
+ children: [
767
+ {
768
+ type: 'tag',
769
+ name: 'm:radPr',
770
+ attribs: {},
771
+ children: [{ type: 'tag', name: 'm:degHide', attribs: { 'm:val': 'on' }, children: [] }]
772
+ },
773
+ { type: 'tag', name: 'm:deg', attribs: {}, children: [] },
774
+ targetElement
775
+ ]
776
+ });
777
+ } else {
778
+ const hide = {
779
+ t: { type: 'tag', name: 'm:hideTop', attribs: { 'm:val': 'on' }, children: [] },
780
+ b: { type: 'tag', name: 'm:hideBot', attribs: { 'm:val': 'on' }, children: [] },
781
+ l: { type: 'tag', name: 'm:hideLeft', attribs: { 'm:val': 'on' }, children: [] },
782
+ r: { type: 'tag', name: 'm:hideRight', attribs: { 'm:val': 'on' }, children: [] }
783
+ };
784
+ const borderBoxPr = { type: 'tag', name: 'm:borderBoxPr', attribs: {}, children: [] };
785
+
786
+ const containerElement = {
787
+ type: 'tag',
788
+ name: 'm:borderBox',
789
+ attribs: {},
790
+ children: []
791
+ };
792
+ switch (type) {
793
+ case 'actuarial':
794
+ case 'radical':
795
+ case 'box':
796
+ containerElement.children = [targetElement];
797
+ break
798
+ case 'left':
799
+ case 'roundedbox':
800
+ borderBoxPr.children = [hide.t, hide.b, hide.r];
801
+ containerElement.children = [borderBoxPr, targetElement];
802
+ break
803
+ case 'right':
804
+ case 'circle':
805
+ borderBoxPr.children = [hide.t, hide.b, hide.l];
806
+ containerElement.children = [borderBoxPr, targetElement];
807
+ break
808
+ case 'top':
809
+ borderBoxPr.children = [hide.b, hide.l, hide.r];
810
+ containerElement.children = [borderBoxPr, targetElement];
811
+ break
812
+ case 'bottom':
813
+ borderBoxPr.children = [hide.t, hide.l, hide.r];
814
+ containerElement.children = [borderBoxPr, targetElement];
815
+ break
816
+ case 'updiagonalstrike':
817
+ borderBoxPr.children = [
818
+ hide.t,
819
+ hide.b,
820
+ hide.l,
821
+ hide.r,
822
+ { type: 'tag', name: 'm:strikeBLTR', attribs: { 'm:val': 'on' }, children: [] }
823
+ ];
824
+ containerElement.children = [borderBoxPr, targetElement];
825
+ break
826
+ case 'downdiagonalstrike':
827
+ borderBoxPr.children = [
828
+ hide.t,
829
+ hide.b,
830
+ hide.l,
831
+ hide.r,
832
+ { type: 'tag', name: 'm:strikeTLBR', attribs: { 'm:val': 'on' }, children: [] }
833
+ ];
834
+ containerElement.children = [borderBoxPr, targetElement];
835
+ break
836
+ case 'verticalstrike':
837
+ borderBoxPr.children = [
838
+ hide.t,
839
+ hide.b,
840
+ hide.l,
841
+ hide.r,
842
+ { type: 'tag', name: 'm:strikeV', attribs: { 'm:val': 'on' }, children: [] }
843
+ ];
844
+ containerElement.children = [borderBoxPr, targetElement];
845
+ break
846
+ case 'horizontalstrike':
847
+ borderBoxPr.children = [
848
+ hide.t,
849
+ hide.b,
850
+ hide.l,
851
+ hide.r,
852
+ { type: 'tag', name: 'm:strikeH', attribs: { 'm:val': 'on' }, children: [] }
853
+ ];
854
+ containerElement.children = [borderBoxPr, targetElement];
855
+ break
856
+ default:
857
+ borderBoxPr.children = [hide.t, hide.b, hide.l, hide.r];
858
+ containerElement.children = [borderBoxPr, targetElement];
859
+ break
860
+ }
861
+ targetParent.children.push(containerElement);
862
+ }
863
+ return targetElement
864
+ }
865
+
866
+ function mfrac(element, targetParent, previousSibling, nextSibling, ancestors) {
867
+ if (element.children.length !== 2) {
868
+ // treat as mrow
869
+ return targetParent
870
+ }
871
+
872
+ const numerator = element.children[0];
873
+ const denumerator = element.children[1];
874
+ const numeratorTarget = {
875
+ name: 'm:num',
876
+ type: 'tag',
877
+ attribs: {},
878
+ children: []
879
+ };
880
+ const denumeratorTarget = {
881
+ name: 'm:den',
882
+ type: 'tag',
883
+ attribs: {},
884
+ children: []
885
+ };
886
+ ancestors = [...ancestors];
887
+ ancestors.unshift(element);
888
+ walker(numerator, numeratorTarget, false, false, ancestors);
889
+ walker(denumerator, denumeratorTarget, false, false, ancestors);
890
+ const lt = element.attribs?.linethickness;
891
+ const fracType = (lt === '0' || lt === '0px' || lt === '0em' || lt === '0pt') ? 'noBar' : 'bar';
892
+ targetParent.children.push({
893
+ type: 'tag',
894
+ name: 'm:f',
895
+ attribs: {},
896
+ children: [
897
+ {
898
+ type: 'tag',
899
+ name: 'm:fPr',
900
+ attribs: {},
901
+ children: [
902
+ {
903
+ type: 'tag',
904
+ name: 'm:type',
905
+ attribs: {
906
+ 'm:val': fracType
907
+ },
908
+ children: []
909
+ }
910
+ ]
911
+ },
912
+ numeratorTarget,
913
+ denumeratorTarget
914
+ ]
915
+ });
916
+ // Don't iterate over children in the usual way.
917
+ }
918
+
919
+ function mglyph(element, targetParent, previousSibling, nextSibling, ancestors) {
920
+ // No support in omml. Output alt text.
921
+ if (element.attribs?.alt) {
922
+ targetParent.children.push({
923
+ type: 'text',
924
+ data: element.attribs.alt
925
+ });
926
+ }
927
+ }
928
+
929
+ function mmultiscripts(element, targetParent, previousSibling, nextSibling, ancestors) {
930
+ if (element.children.length === 0) {
931
+ // Don't use
932
+ return
933
+ }
934
+
935
+ const base = element.children[0];
936
+ const postSubs = [];
937
+ const postSupers = [];
938
+ const preSubs = [];
939
+ const preSupers = [];
940
+ const children = element.children.slice(1);
941
+ let dividerFound = false;
942
+ children.forEach((child, index) => {
943
+ if (child.name === 'mprescripts') {
944
+ dividerFound = true;
945
+ } else if (child.name !== 'none') {
946
+ if (index % 2) {
947
+ if (dividerFound) {
948
+ preSubs.push(child);
949
+ } else {
950
+ postSupers.push(child);
951
+ }
952
+ } else {
953
+ if (dividerFound) {
954
+ preSupers.push(child);
955
+ } else {
956
+ postSubs.push(child);
957
+ }
958
+ }
959
+ }
960
+ });
961
+ ancestors = [...ancestors];
962
+ ancestors.unshift(element);
963
+ const tempTarget = {
964
+ children: []
965
+ };
966
+ walker(base, tempTarget, false, false, ancestors);
967
+ let topTarget = tempTarget.children[0];
968
+
969
+ if (postSubs.length || postSupers.length) {
970
+ const subscriptTarget = {
971
+ name: 'm:sub',
972
+ type: 'tag',
973
+ attribs: {},
974
+ children: []
975
+ };
976
+ postSubs.forEach((subscript) => walker(subscript, subscriptTarget, false, false, ancestors));
977
+
978
+ const superscriptTarget = {
979
+ name: 'm:sup',
980
+ type: 'tag',
981
+ attribs: {},
982
+ children: []
983
+ };
984
+
985
+ postSupers.forEach((superscript) =>
986
+ walker(superscript, superscriptTarget, false, false, ancestors)
987
+ );
988
+
989
+ const topPostTarget = {
990
+ type: 'tag',
991
+ attribs: {},
992
+ children: [
993
+ {
994
+ type: 'tag',
995
+ name: 'm:e',
996
+ attribs: {},
997
+ children: [topTarget]
998
+ }
999
+ ]
1000
+ };
1001
+ if (postSubs.length && postSupers.length) {
1002
+ topPostTarget.name = 'm:sSubSup';
1003
+ topPostTarget.children.push(subscriptTarget);
1004
+ topPostTarget.children.push(superscriptTarget);
1005
+ } else if (postSubs.length) {
1006
+ topPostTarget.name = 'm:sSub';
1007
+ topPostTarget.children.push(subscriptTarget);
1008
+ } else {
1009
+ topPostTarget.name = 'm:sSup';
1010
+ topPostTarget.children.push(superscriptTarget);
1011
+ }
1012
+ topTarget = topPostTarget;
1013
+ }
1014
+
1015
+ if (preSubs.length || preSupers.length) {
1016
+ const preSubscriptTarget = {
1017
+ name: 'm:sub',
1018
+ type: 'tag',
1019
+ attribs: {},
1020
+ children: []
1021
+ };
1022
+ preSubs.forEach((subscript) => walker(subscript, preSubscriptTarget, false, false, ancestors));
1023
+
1024
+ const preSuperscriptTarget = {
1025
+ name: 'm:sup',
1026
+ type: 'tag',
1027
+ attribs: {},
1028
+ children: []
1029
+ };
1030
+
1031
+ preSupers.forEach((superscript) =>
1032
+ walker(superscript, preSuperscriptTarget, false, false, ancestors)
1033
+ );
1034
+ const topPreTarget = {
1035
+ name: 'm:sPre',
1036
+ type: 'tag',
1037
+ attribs: {},
1038
+ children: [
1039
+ {
1040
+ name: 'm:e',
1041
+ type: 'tag',
1042
+ attribs: {},
1043
+ children: [topTarget]
1044
+ },
1045
+ preSubscriptTarget,
1046
+ preSuperscriptTarget
1047
+ ]
1048
+ };
1049
+ topTarget = topPreTarget;
1050
+ }
1051
+ targetParent.children.push(topTarget);
1052
+ // Don't iterate over children in the usual way.
1053
+ }
1054
+
1055
+ function mrow(element, targetParent, previousSibling, nextSibling, ancestors) {
1056
+ // Detect fence pattern: <mo fence="true">OPEN ... <mo fence="true">CLOSE
1057
+ // Convert to OMML <m:d> delimiter (e.g. binomial, \left(\right))
1058
+ const children = element.children || [];
1059
+ if (children.length >= 2) {
1060
+ const first = children[0];
1061
+ const last = children[children.length - 1];
1062
+ if (first?.name === 'mo' && first?.attribs?.fence === 'true' &&
1063
+ last?.name === 'mo' && last?.attribs?.fence === 'true') {
1064
+ const begChar = first.children?.[0]?.data || '(';
1065
+ const endChar = last.children?.[0]?.data || ')';
1066
+ const dNode = {
1067
+ type: 'tag', name: 'm:d', attribs: {}, children: [
1068
+ { type: 'tag', name: 'm:dPr', attribs: {}, children: [
1069
+ { type: 'tag', name: 'm:begChr', attribs: { 'm:val': begChar }, children: [] },
1070
+ { type: 'tag', name: 'm:endChr', attribs: { 'm:val': endChar }, children: [] },
1071
+ { type: 'tag', name: 'm:ctrlPr', attribs: {}, children: [] }
1072
+ ]},
1073
+ { type: 'tag', name: 'm:e', attribs: {}, children: [] }
1074
+ ]
1075
+ };
1076
+ targetParent.children.push(dNode);
1077
+ // Mark fence operators so the walker child loop skips them
1078
+ first.skipInWalker = true;
1079
+ last.skipInWalker = true;
1080
+ // Return <m:e> as target — inner children go here
1081
+ return dNode.children[1]
1082
+ }
1083
+ }
1084
+ // isNary redirect is now handled in walker's child loop
1085
+ return targetParent
1086
+ }
1087
+
1088
+ function mspace(element, targetParent, previousSibling, nextSibling, ancestors) {
1089
+ targetParent.children.push({
1090
+ name: 'm:r',
1091
+ type: 'tag',
1092
+ attribs: {},
1093
+ children: [
1094
+ {
1095
+ name: 'm:t',
1096
+ type: 'tag',
1097
+ attribs: {
1098
+ 'xml:space': 'preserve'
1099
+ },
1100
+ children: [
1101
+ {
1102
+ type: 'text',
1103
+ data: ' '
1104
+ }
1105
+ ]
1106
+ }
1107
+ ]
1108
+ });
1109
+ }
1110
+
1111
+ function msqrt(element, targetParent, previousSibling, nextSibling, ancestors) {
1112
+ const targetElement = {
1113
+ name: 'm:e',
1114
+ type: 'tag',
1115
+ attribs: {},
1116
+ children: []
1117
+ };
1118
+ targetParent.children.push({
1119
+ name: 'm:rad',
1120
+ type: 'tag',
1121
+ attribs: {},
1122
+ children: [
1123
+ {
1124
+ name: 'm:radPr',
1125
+ type: 'tag',
1126
+ attribs: {},
1127
+ children: [
1128
+ {
1129
+ name: 'm:degHide',
1130
+ type: 'tag',
1131
+ attribs: {
1132
+ 'm:val': 'on'
1133
+ },
1134
+ children: []
1135
+ }
1136
+ ]
1137
+ },
1138
+ {
1139
+ name: 'm:deg',
1140
+ type: 'tag',
1141
+ attribs: {},
1142
+ children: []
1143
+ },
1144
+ targetElement
1145
+ ]
1146
+ });
1147
+ return targetElement
1148
+ }
1149
+
1150
+ function mstyle(element, targetParent, previousSibling, nextSibling, ancestors) {
1151
+ // Ignore as default behavior
1152
+ return targetParent
1153
+ }
1154
+
1155
+ function getTextContent(node, trim = true) {
1156
+ let returnString = '';
1157
+ if (node.type === 'text') {
1158
+ let text = node.data.replace(/[\u2062]|[\u200B]/g, '');
1159
+ if (trim) {
1160
+ text = text.trim();
1161
+ }
1162
+ returnString += text;
1163
+ } else if (node.children) {
1164
+ node.children.forEach((subNode) => {
1165
+ returnString += getTextContent(subNode, trim);
1166
+ });
1167
+ }
1168
+ return returnString
1169
+ }
1170
+
1171
+ const NARY_REGEXP = /^[\u220f-\u2211]|[\u2229-\u2233]|[\u22c0-\u22c3]$/;
1172
+ const GROW_REGEXP = /^\u220f|\u2211|[\u2229-\u222b]|\u222e|\u222f|\u2232|\u2233|[\u22c0-\u22c3]$/;
1173
+
1174
+ function getNary(node) {
1175
+ // Check if node contains only a nary operator.
1176
+ const text = getTextContent(node);
1177
+ if (NARY_REGEXP.test(text)) {
1178
+ return text
1179
+ }
1180
+ return false
1181
+ }
1182
+
1183
+ function getNaryTarget(naryChar, element, type, subHide = false, supHide = false) {
1184
+ const stretchy = element.attribs?.stretchy;
1185
+ const grow =
1186
+ stretchy === 'true' ? '1' : stretchy === 'false' ? '0' : GROW_REGEXP.test(naryChar) ? '1' : '0';
1187
+ return {
1188
+ type: 'tag',
1189
+ name: 'm:nary',
1190
+ attribs: {},
1191
+ children: [
1192
+ {
1193
+ type: 'tag',
1194
+ name: 'm:naryPr',
1195
+ attribs: {},
1196
+ children: [
1197
+ { type: 'tag', name: 'm:chr', attribs: { 'm:val': naryChar }, children: [] },
1198
+ { type: 'tag', name: 'm:limLoc', attribs: { 'm:val': type }, children: [] },
1199
+ { type: 'tag', name: 'm:grow', attribs: { 'm:val': grow }, children: [] },
1200
+ {
1201
+ type: 'tag',
1202
+ name: 'm:subHide',
1203
+ attribs: { 'm:val': subHide ? 'on' : 'off' },
1204
+ children: []
1205
+ },
1206
+ {
1207
+ type: 'tag',
1208
+ name: 'm:supHide',
1209
+ attribs: { 'm:val': supHide ? 'on' : 'off' },
1210
+ children: []
1211
+ }
1212
+ ]
1213
+ }
1214
+ ]
1215
+ }
1216
+ }
1217
+
1218
+ function addScriptlevel(target, ancestors) {
1219
+ const scriptlevel = ancestors.find((ancestor) => ancestor.attribs?.scriptlevel)?.attribs
1220
+ ?.scriptlevel;
1221
+ if (['0', '1', '2'].includes(scriptlevel)) {
1222
+ target.children.unshift({
1223
+ type: 'tag',
1224
+ name: 'm:argPr',
1225
+ attribs: {},
1226
+ children: [
1227
+ {
1228
+ type: 'tag',
1229
+ name: 'm:scrLvl',
1230
+ attribs: { 'm:val': scriptlevel },
1231
+ children: []
1232
+ }
1233
+ ]
1234
+ });
1235
+ }
1236
+ }
1237
+
1238
+ function msub(element, targetParent, previousSibling, nextSibling, ancestors) {
1239
+ // Subscript
1240
+ if (element.children.length !== 2) {
1241
+ // treat as mrow
1242
+ return targetParent
1243
+ }
1244
+ ancestors = [...ancestors];
1245
+ ancestors.unshift(element);
1246
+ const base = element.children[0];
1247
+ const subscript = element.children[1];
1248
+
1249
+ let topTarget;
1250
+ //
1251
+ // m:nAry
1252
+ //
1253
+ // Conditions:
1254
+ // 1. base text must be nary operator
1255
+ // 2. no accents
1256
+ const naryChar = getNary(base);
1257
+ if (
1258
+ naryChar &&
1259
+ element.attribs?.accent?.toLowerCase() !== 'true' &&
1260
+ element.attribs?.accentunder?.toLowerCase() !== 'true'
1261
+ ) {
1262
+ topTarget = getNaryTarget(naryChar, element, 'subSup', false, true);
1263
+ element.isNary = true;
1264
+ } else {
1265
+ // Check for empty base → prescript pattern (LaTeX {}_{sub}X)
1266
+ const isEmptyBase = base.name === 'mrow' && (!base.children || base.children.length === 0);
1267
+
1268
+ if (isEmptyBase) {
1269
+ topTarget = {
1270
+ type: 'tag',
1271
+ name: 'm:sPre',
1272
+ attribs: {},
1273
+ children: [
1274
+ {
1275
+ type: 'tag',
1276
+ name: 'm:sPrePr',
1277
+ attribs: {},
1278
+ children: [
1279
+ {
1280
+ type: 'tag',
1281
+ name: 'm:ctrlPr',
1282
+ attribs: {},
1283
+ children: []
1284
+ }
1285
+ ]
1286
+ }
1287
+ ]
1288
+ };
1289
+ element.isPrescript = true;
1290
+ } else {
1291
+ const baseTarget = {
1292
+ name: 'm:e',
1293
+ type: 'tag',
1294
+ attribs: {},
1295
+ children: []
1296
+ };
1297
+ walker(base, baseTarget, false, false, ancestors);
1298
+ topTarget = {
1299
+ type: 'tag',
1300
+ name: 'm:sSub',
1301
+ attribs: {},
1302
+ children: [
1303
+ {
1304
+ type: 'tag',
1305
+ name: 'm:sSubPr',
1306
+ attribs: {},
1307
+ children: [
1308
+ {
1309
+ type: 'tag',
1310
+ name: 'm:ctrlPr',
1311
+ attribs: {},
1312
+ children: []
1313
+ }
1314
+ ]
1315
+ },
1316
+ baseTarget
1317
+ ]
1318
+ };
1319
+ }
1320
+ }
1321
+
1322
+ const subscriptTarget = {
1323
+ name: 'm:sub',
1324
+ type: 'tag',
1325
+ attribs: {},
1326
+ children: []
1327
+ };
1328
+
1329
+ walker(subscript, subscriptTarget, false, false, ancestors);
1330
+ topTarget.children.push(subscriptTarget);
1331
+ if (element.isNary) {
1332
+ topTarget.children.push({ type: 'tag', name: 'm:sup', attribs: {}, children: [] });
1333
+ topTarget.children.push({ type: 'tag', name: 'm:e', attribs: {}, children: [] });
1334
+ }
1335
+ // For prescript, add empty m:sup and m:e (base filled by walker redirect)
1336
+ if (element.isPrescript) {
1337
+ topTarget.children.push({ type: 'tag', name: 'm:sup', attribs: {}, children: [] });
1338
+ topTarget.children.push({ type: 'tag', name: 'm:e', attribs: {}, children: [] });
1339
+ }
1340
+ targetParent.children.push(topTarget);
1341
+ // Don't iterate over children in the usual way.
1342
+ }
1343
+
1344
+ function msubsup(element, targetParent, previousSibling, nextSibling, ancestors) {
1345
+ // Sub + superscript
1346
+ if (element.children.length !== 3) {
1347
+ // treat as mrow
1348
+ return targetParent
1349
+ }
1350
+
1351
+ ancestors = [...ancestors];
1352
+ ancestors.unshift(element);
1353
+
1354
+ const base = element.children[0];
1355
+ const subscript = element.children[1];
1356
+ const superscript = element.children[2];
1357
+
1358
+ let topTarget;
1359
+ //
1360
+ // m:nAry
1361
+ //
1362
+ // Conditions:
1363
+ // 1. base text must be nary operator
1364
+ // 2. no accents
1365
+ const naryChar = getNary(base);
1366
+ if (
1367
+ naryChar &&
1368
+ element.attribs?.accent?.toLowerCase() !== 'true' &&
1369
+ element.attribs?.accentunder?.toLowerCase() !== 'true'
1370
+ ) {
1371
+ topTarget = getNaryTarget(naryChar, element, 'subSup');
1372
+ element.isNary = true;
1373
+ } else {
1374
+ // Check for empty base → prescript pattern (LaTeX {}^{sup}_{sub}X)
1375
+ const isEmptyBase = base.name === 'mrow' && (!base.children || base.children.length === 0);
1376
+
1377
+ if (isEmptyBase) {
1378
+ topTarget = {
1379
+ type: 'tag',
1380
+ name: 'm:sPre',
1381
+ attribs: {},
1382
+ children: [
1383
+ {
1384
+ type: 'tag',
1385
+ name: 'm:sPrePr',
1386
+ attribs: {},
1387
+ children: [
1388
+ {
1389
+ type: 'tag',
1390
+ name: 'm:ctrlPr',
1391
+ attribs: {},
1392
+ children: []
1393
+ }
1394
+ ]
1395
+ }
1396
+ ]
1397
+ };
1398
+ element.isPrescript = true;
1399
+ } else {
1400
+ // Regular m:sSubSup
1401
+ const baseTarget = {
1402
+ name: 'm:e',
1403
+ type: 'tag',
1404
+ attribs: {},
1405
+ children: []
1406
+ };
1407
+
1408
+ walker(base, baseTarget, false, false, ancestors);
1409
+ topTarget = {
1410
+ type: 'tag',
1411
+ name: 'm:sSubSup',
1412
+ attribs: {},
1413
+ children: [
1414
+ {
1415
+ type: 'tag',
1416
+ name: 'm:sSubSupPr',
1417
+ attribs: {},
1418
+ children: [
1419
+ {
1420
+ type: 'tag',
1421
+ name: 'm:ctrlPr',
1422
+ attribs: {},
1423
+ children: []
1424
+ }
1425
+ ]
1426
+ },
1427
+ baseTarget
1428
+ ]
1429
+ };
1430
+ }
1431
+ }
1432
+
1433
+ const subscriptTarget = {
1434
+ name: 'm:sub',
1435
+ type: 'tag',
1436
+ attribs: {},
1437
+ children: []
1438
+ };
1439
+ const superscriptTarget = {
1440
+ name: 'm:sup',
1441
+ type: 'tag',
1442
+ attribs: {},
1443
+ children: []
1444
+ };
1445
+ walker(subscript, subscriptTarget, false, false, ancestors);
1446
+ walker(superscript, superscriptTarget, false, false, ancestors);
1447
+ topTarget.children.push(subscriptTarget);
1448
+ topTarget.children.push(superscriptTarget);
1449
+ if (element.isNary) {
1450
+ topTarget.children.push({ type: 'tag', name: 'm:e', attribs: {}, children: [] });
1451
+ }
1452
+ if (element.isPrescript) {
1453
+ topTarget.children.push({ type: 'tag', name: 'm:e', attribs: {}, children: [] });
1454
+ }
1455
+ targetParent.children.push(topTarget);
1456
+ // Don't iterate over children in the usual way.
1457
+ }
1458
+
1459
+ function msup(element, targetParent, previousSibling, nextSibling, ancestors) {
1460
+ // Superscript
1461
+ if (element.children.length !== 2) {
1462
+ // treat as mrow
1463
+ return targetParent
1464
+ }
1465
+ ancestors = [...ancestors];
1466
+ ancestors.unshift(element);
1467
+ const base = element.children[0];
1468
+ const superscript = element.children[1];
1469
+
1470
+ let topTarget;
1471
+ //
1472
+ // m:nAry
1473
+ //
1474
+ // Conditions:
1475
+ // 1. base text must be nary operator
1476
+ // 2. no accents
1477
+ const naryChar = getNary(base);
1478
+ if (
1479
+ naryChar &&
1480
+ element.attribs?.accent?.toLowerCase() !== 'true' &&
1481
+ element.attribs?.accentunder?.toLowerCase() !== 'true'
1482
+ ) {
1483
+ topTarget = getNaryTarget(naryChar, element, 'subSup', true);
1484
+ element.isNary = true;
1485
+ topTarget.children.push({ type: 'tag', name: 'm:sub' });
1486
+ } else {
1487
+ // Check for empty base → prescript pattern (LaTeX {}^{sup}X)
1488
+ const isEmptyBase = base.name === 'mrow' && (!base.children || base.children.length === 0);
1489
+
1490
+ if (isEmptyBase) {
1491
+ topTarget = {
1492
+ type: 'tag',
1493
+ name: 'm:sPre',
1494
+ attribs: {},
1495
+ children: [
1496
+ {
1497
+ type: 'tag',
1498
+ name: 'm:sPrePr',
1499
+ attribs: {},
1500
+ children: [
1501
+ {
1502
+ type: 'tag',
1503
+ name: 'm:ctrlPr',
1504
+ attribs: {},
1505
+ children: []
1506
+ }
1507
+ ]
1508
+ }
1509
+ ]
1510
+ };
1511
+ element.isPrescript = true;
1512
+ } else {
1513
+ const baseTarget = {
1514
+ name: 'm:e',
1515
+ type: 'tag',
1516
+ attribs: {},
1517
+ children: []
1518
+ };
1519
+ walker(base, baseTarget, false, false, ancestors);
1520
+
1521
+ topTarget = {
1522
+ type: 'tag',
1523
+ name: 'm:sSup',
1524
+ attribs: {},
1525
+ children: [
1526
+ {
1527
+ type: 'tag',
1528
+ name: 'm:sSupPr',
1529
+ attribs: {},
1530
+ children: [
1531
+ {
1532
+ type: 'tag',
1533
+ name: 'm:ctrlPr',
1534
+ attribs: {},
1535
+ children: []
1536
+ }
1537
+ ]
1538
+ },
1539
+ baseTarget
1540
+ ]
1541
+ };
1542
+ }
1543
+ }
1544
+
1545
+ const superscriptTarget = {
1546
+ name: 'm:sup',
1547
+ type: 'tag',
1548
+ attribs: {},
1549
+ children: []
1550
+ };
1551
+
1552
+ walker(superscript, superscriptTarget, false, false, ancestors);
1553
+
1554
+ // For prescript, also add an empty m:sub
1555
+ if (element.isPrescript) {
1556
+ topTarget.children.push({ type: 'tag', name: 'm:sub', attribs: {}, children: [] });
1557
+ }
1558
+ topTarget.children.push(superscriptTarget);
1559
+ if (element.isNary) {
1560
+ topTarget.children.push({ type: 'tag', name: 'm:e', attribs: {}, children: [] });
1561
+ }
1562
+ if (element.isPrescript) {
1563
+ topTarget.children.push({ type: 'tag', name: 'm:e', attribs: {}, children: [] });
1564
+ }
1565
+ targetParent.children.push(topTarget);
1566
+ // Don't iterate over children in the usual way.
1567
+ }
1568
+
1569
+ function mtable(element, targetParent, previousSibling, nextSibling, ancestors) {
1570
+ const cellsPerRowCount = Math.max(...element.children.map((row) => row.children.length));
1571
+ const targetElement = {
1572
+ name: 'm:m',
1573
+ type: 'tag',
1574
+ attribs: {},
1575
+ children: [
1576
+ {
1577
+ name: 'm:mPr',
1578
+ type: 'tag',
1579
+ attribs: {},
1580
+ children: [
1581
+ {
1582
+ name: 'm:baseJc',
1583
+ type: 'tag',
1584
+ attribs: {
1585
+ 'm:val': 'center'
1586
+ },
1587
+ children: []
1588
+ },
1589
+ {
1590
+ name: 'm:plcHide',
1591
+ type: 'tag',
1592
+ attribs: {
1593
+ 'm:val': 'on'
1594
+ },
1595
+ children: []
1596
+ },
1597
+ {
1598
+ name: 'm:mcs',
1599
+ type: 'tag',
1600
+ attribs: {},
1601
+ children: [
1602
+ {
1603
+ name: 'm:mc',
1604
+ type: 'tag',
1605
+ attribs: {},
1606
+ children: [
1607
+ {
1608
+ name: 'm:mcPr',
1609
+ type: 'tag',
1610
+ attribs: {},
1611
+ children: [
1612
+ {
1613
+ name: 'm:count',
1614
+ type: 'tag',
1615
+ attribs: {
1616
+ 'm:val': cellsPerRowCount.toString()
1617
+ },
1618
+ children: []
1619
+ },
1620
+ {
1621
+ name: 'm:mcJc',
1622
+ type: 'tag',
1623
+ attribs: {
1624
+ 'm:val': 'center'
1625
+ },
1626
+ children: []
1627
+ }
1628
+ ]
1629
+ }
1630
+ ]
1631
+ }
1632
+ ]
1633
+ }
1634
+ ]
1635
+ }
1636
+ ]
1637
+ };
1638
+ targetParent.children.push(targetElement);
1639
+ return targetElement
1640
+ }
1641
+
1642
+ function mtd(element, targetParent, previousSibling, nextSibling, ancestors) {
1643
+ // table cell
1644
+ const targetElement = {
1645
+ name: 'm:e',
1646
+ type: 'tag',
1647
+ attribs: {},
1648
+ children: []
1649
+ };
1650
+ targetParent.children.push(targetElement);
1651
+ return targetElement
1652
+ }
1653
+
1654
+ function mtr(element, targetParent, previousSibling, nextSibling, ancestors) {
1655
+ // table row
1656
+ const targetElement = {
1657
+ name: 'm:mr',
1658
+ type: 'tag',
1659
+ attribs: {},
1660
+ children: []
1661
+ };
1662
+ targetParent.children.push(targetElement);
1663
+ return targetElement
1664
+ }
1665
+
1666
+ function munderover(element, targetParent, previousSibling, nextSibling, ancestors) {
1667
+ // Munderover
1668
+ if (element.children.length !== 3) {
1669
+ // treat as mrow
1670
+ return targetParent
1671
+ }
1672
+
1673
+ ancestors = [...ancestors];
1674
+ ancestors.unshift(element);
1675
+
1676
+ const base = element.children[0];
1677
+ const underscript = element.children[1];
1678
+ const overscript = element.children[2];
1679
+
1680
+ //
1681
+ // m:nAry
1682
+ //
1683
+ // Conditions:
1684
+ // 1. base text must be nary operator
1685
+ // 2. no accents
1686
+ const naryChar = getNary(base);
1687
+ if (
1688
+ naryChar &&
1689
+ element.attributes?.accent?.toLowerCase() !== 'true' &&
1690
+ element.attributes?.accentunder?.toLowerCase() !== 'true'
1691
+ ) {
1692
+ const topTarget = getNaryTarget(naryChar, element, 'undOvr');
1693
+ element.isNary = true;
1694
+ const subscriptTarget = {
1695
+ name: 'm:sub',
1696
+ type: 'tag',
1697
+ attribs: {},
1698
+ children: []
1699
+ };
1700
+ const superscriptTarget = {
1701
+ name: 'm:sup',
1702
+ type: 'tag',
1703
+ attribs: {},
1704
+ children: []
1705
+ };
1706
+ walker(underscript, subscriptTarget, false, false, ancestors);
1707
+ walker(overscript, superscriptTarget, false, false, ancestors);
1708
+ topTarget.children.push(subscriptTarget);
1709
+ topTarget.children.push(superscriptTarget);
1710
+ topTarget.children.push({ type: 'tag', name: 'm:e', attribs: {}, children: [] });
1711
+ targetParent.children.push(topTarget);
1712
+ return
1713
+ }
1714
+
1715
+ // Fallback: m:limUpp()m:limlow
1716
+
1717
+ const baseTarget = {
1718
+ name: 'm:e',
1719
+ type: 'tag',
1720
+ attribs: {},
1721
+ children: []
1722
+ };
1723
+
1724
+ walker(base, baseTarget, false, false, ancestors);
1725
+
1726
+ const underscriptTarget = {
1727
+ name: 'm:lim',
1728
+ type: 'tag',
1729
+ attribs: {},
1730
+ children: []
1731
+ };
1732
+ const overscriptTarget = {
1733
+ name: 'm:lim',
1734
+ type: 'tag',
1735
+ attribs: {},
1736
+ children: []
1737
+ };
1738
+
1739
+ walker(underscript, underscriptTarget, false, false, ancestors);
1740
+ walker(overscript, overscriptTarget, false, false, ancestors);
1741
+ targetParent.children.push({
1742
+ type: 'tag',
1743
+ name: 'm:limUpp',
1744
+ attribs: {},
1745
+ children: [
1746
+ {
1747
+ type: 'tag',
1748
+ name: 'm:e',
1749
+ attribs: {},
1750
+ children: [
1751
+ {
1752
+ type: 'tag',
1753
+ name: 'm:limLow',
1754
+ attribs: {},
1755
+ children: [baseTarget, underscriptTarget]
1756
+ }
1757
+ ]
1758
+ },
1759
+ overscriptTarget
1760
+ ]
1761
+ });
1762
+ // Don't iterate over children in the usual way.
1763
+ }
1764
+
1765
+ function getStyle(element, ancestors, previousStyle = {}) {
1766
+ const elAttributes = element.attribs || {};
1767
+ const color =
1768
+ elAttributes.mathcolor ||
1769
+ ancestors.find(
1770
+ (element) => element.name === 'mstyle' && element.attribs && element.attribs.color
1771
+ )?.attribs.color ||
1772
+ '';
1773
+ // const minsize = parseFloat(elAttributes.scriptminsize || ancestors.find(element => element.name === 'mstyle' && element.attribs && element.attribs.scriptminsize)?.attribs.scriptminsize || '8pt')
1774
+ // const sizemultiplier = parseFloat(elAttributes.scriptsizemultiplier || ancestors.find(element => element.name === 'mstyle' && element.attribs && element.attribs.scriptsizemultiplier)?.attribs.scriptsizemultiplier || '0.71')
1775
+ const size =
1776
+ elAttributes.mathsize ||
1777
+ ancestors.find(
1778
+ (element) => element.name === 'mstyle' && element.attribs && element.attribs.mathsize
1779
+ )?.attribs.mathsize ||
1780
+ '';
1781
+ const scriptlevel =
1782
+ elAttributes.scriptlevel ||
1783
+ ancestors.find(
1784
+ (element) => element.name === 'mstyle' && element.attribs && element.attribs.scriptlevel
1785
+ )?.attribs.scriptlevel ||
1786
+ '';
1787
+ const background =
1788
+ elAttributes.mathbackground ||
1789
+ ancestors.find(
1790
+ (element) => element.name === 'mstyle' && element.attribs && element.attribs.mathbackground
1791
+ )?.attribs.mathbackground ||
1792
+ '';
1793
+ let variant =
1794
+ elAttributes.mathvariant ||
1795
+ ancestors.find(
1796
+ (element) => element.name === 'mstyle' && element.attribs && element.attribs.mathvariant
1797
+ )?.attribs.mathvariant ||
1798
+ '';
1799
+ if (variant === 'b-i') {
1800
+ variant = 'bold-italic';
1801
+ }
1802
+ const fontweight =
1803
+ elAttributes.fontweight ||
1804
+ ancestors.find(
1805
+ (element) => element.name === 'mstyle' && element.attribs && element.attribs.fontweight
1806
+ )?.attribs.fontweight ||
1807
+ '';
1808
+ if (fontweight === 'bold' && !['bold', 'bold-italic'].includes(variant)) {
1809
+ if (variant.includes('italic')) {
1810
+ variant = 'bold-italic';
1811
+ } else {
1812
+ variant = 'bold';
1813
+ }
1814
+ } else if (fontweight === 'normal' && ['bold', 'bold-italic'].includes(variant)) {
1815
+ if (variant.includes('italic')) {
1816
+ variant = 'italic';
1817
+ } else {
1818
+ variant = '';
1819
+ }
1820
+ }
1821
+ const fontstyle =
1822
+ elAttributes.fontstyle ||
1823
+ ancestors.find(
1824
+ (element) => element.name === 'mstyle' && element.attribs && element.attribs.fontstyle
1825
+ )?.attribs.fontstyle ||
1826
+ '';
1827
+ if (fontstyle === 'italic' && !['italic', 'bold-italic'].includes(variant)) {
1828
+ if (variant.includes('bold')) {
1829
+ variant = 'bold-italic';
1830
+ } else {
1831
+ variant = 'italic';
1832
+ }
1833
+ } else if (fontstyle === 'normal' && ['italic', 'bold-italic'].includes(variant)) {
1834
+ if (variant.includes('bold')) {
1835
+ variant = 'bold';
1836
+ } else {
1837
+ variant = '';
1838
+ }
1839
+ }
1840
+ // Override variant for some types
1841
+ if (!elAttributes.mathvariant) {
1842
+ const textContent = getTextContent(element);
1843
+ if (
1844
+ previousStyle.variant === '' &&
1845
+ ((element.name === 'mi' && textContent.length > 1) ||
1846
+ (element.name === 'mn' && !/^\d+\.\d+$/.test(textContent)))
1847
+ ) {
1848
+ variant = '';
1849
+ } else if (
1850
+ ['mi', 'mn', 'mo'].includes(element.name) &&
1851
+ ['italic', 'bold-italic'].includes(previousStyle.variant)
1852
+ ) {
1853
+ if (fontweight === 'bold') {
1854
+ variant = 'bold-italic';
1855
+ } else {
1856
+ variant = 'italic';
1857
+ }
1858
+ }
1859
+ }
1860
+
1861
+ return {
1862
+ color,
1863
+ variant,
1864
+ size,
1865
+ scriptlevel,
1866
+ background,
1867
+ fontstyle
1868
+ }
1869
+ }
1870
+
1871
+ const STYLES = {
1872
+ bold: 'b',
1873
+ italic: 'i',
1874
+ 'bold-italic': 'bi'
1875
+ };
1876
+
1877
+ function textContainer(element, targetParent, previousSibling, nextSibling, ancestors, textType) {
1878
+ // isNary redirect is now handled in walker's child loop
1879
+
1880
+ const hasMglyphChild = element.children?.find((element) => element.name === 'mglyph');
1881
+ const style = getStyle(element, ancestors, previousSibling?.style);
1882
+ element.style = style; // Add it to element to make it comparable
1883
+ element.hasMglyphChild = hasMglyphChild;
1884
+ const styleSame =
1885
+ Object.keys(style).every((key) => {
1886
+ const previousStyle = previousSibling?.style;
1887
+ return previousStyle && style[key] === previousStyle[key]
1888
+ }) && previousSibling?.hasMglyphChild === hasMglyphChild;
1889
+ const sameGroup = // Only group mtexts or mi, mn, mo with oneanother.
1890
+ textType === previousSibling?.name ||
1891
+ (['mi', 'mn', 'mo'].includes(textType) && ['mi', 'mn', 'mo'].includes(previousSibling?.name));
1892
+ let targetElement;
1893
+ const lastChild = targetParent.children[targetParent.children.length - 1];
1894
+ if (sameGroup && styleSame && !hasMglyphChild && lastChild?.name === 'm:r') {
1895
+ targetElement = lastChild.children[lastChild.children.length - 1];
1896
+ } else {
1897
+ const rElement = {
1898
+ name: 'm:r',
1899
+ type: 'tag',
1900
+ attribs: {},
1901
+ children: []
1902
+ };
1903
+
1904
+ if (style.variant) {
1905
+ const wrPr = {
1906
+ name: 'w:rPr',
1907
+ type: 'tag',
1908
+ attribs: {},
1909
+ children: []
1910
+ };
1911
+ if (style.variant.includes('bold')) {
1912
+ wrPr.children.push({ name: 'w:b', type: 'tag', attribs: {}, children: [] });
1913
+ }
1914
+ if (style.variant.includes('italic')) {
1915
+ wrPr.children.push({ name: 'w:i', type: 'tag', attribs: {}, children: [] });
1916
+ }
1917
+ rElement.children.push(wrPr);
1918
+ const mrPr = {
1919
+ name: 'm:rPr',
1920
+ type: 'tag',
1921
+ attribs: {},
1922
+ children: [
1923
+ {
1924
+ name: 'm:nor',
1925
+ type: 'tag',
1926
+ attribs: {},
1927
+ children: []
1928
+ }
1929
+ ]
1930
+ };
1931
+ if (style.variant !== 'italic') {
1932
+ mrPr.children.push({
1933
+ name: 'm:sty',
1934
+ type: 'tag',
1935
+ attribs: {
1936
+ 'm:val': STYLES[style.variant]
1937
+ },
1938
+ children: []
1939
+ });
1940
+ }
1941
+ rElement.children.push(mrPr);
1942
+ } else if (hasMglyphChild || textType === 'mtext') {
1943
+ rElement.children.push({
1944
+ name: 'm:rPr',
1945
+ type: 'tag',
1946
+ attribs: {},
1947
+ children: [
1948
+ {
1949
+ name: 'm:nor',
1950
+ type: 'tag',
1951
+ attribs: {},
1952
+ children: []
1953
+ }
1954
+ ]
1955
+ });
1956
+ } else if (style.fontstyle === 'normal' || (textType === 'ms' && style.fontstyle === '')) {
1957
+ rElement.children.push({
1958
+ name: 'm:rPr',
1959
+ type: 'tag',
1960
+ attribs: {},
1961
+ children: [
1962
+ {
1963
+ name: 'm:sty',
1964
+ type: 'tag',
1965
+ attribs: { 'm:val': 'p' },
1966
+ children: []
1967
+ }
1968
+ ]
1969
+ });
1970
+ }
1971
+
1972
+ targetElement = {
1973
+ name: 'm:t',
1974
+ type: 'tag',
1975
+ attribs: {
1976
+ 'xml:space': 'preserve'
1977
+ },
1978
+ children: []
1979
+ };
1980
+ rElement.children.push(targetElement);
1981
+ targetParent.children.push(rElement);
1982
+ }
1983
+ return targetElement
1984
+ }
1985
+
1986
+ function mtext(element, targetParent, previousSibling, nextSibling, ancestors) {
1987
+ return textContainer(element, targetParent, previousSibling, nextSibling, ancestors, 'mtext')
1988
+ }
1989
+
1990
+ function mi(element, targetParent, previousSibling, nextSibling, ancestors) {
1991
+ return textContainer(element, targetParent, previousSibling, nextSibling, ancestors, 'mi')
1992
+ }
1993
+
1994
+ function mn(element, targetParent, previousSibling, nextSibling, ancestors) {
1995
+ return textContainer(element, targetParent, previousSibling, nextSibling, ancestors, 'mn')
1996
+ }
1997
+
1998
+ function mo(element, targetParent, previousSibling, nextSibling, ancestors) {
1999
+ return textContainer(element, targetParent, previousSibling, nextSibling, ancestors, 'mo')
2000
+ }
2001
+
2002
+ function ms(element, targetParent, previousSibling, nextSibling, ancestors) {
2003
+ return textContainer(element, targetParent, previousSibling, nextSibling, ancestors, 'ms')
2004
+ }
2005
+
2006
+ const UPPER_COMBINATION = {
2007
+ '\u2190': '\u20D6', // arrow left
2008
+ '\u27F5': '\u20D6', // arrow left, long
2009
+ '\u2192': '\u20D7', // arrow right
2010
+ '\u27F6': '\u20D7', // arrow right, long
2011
+ '\u00B4': '\u0301', // accute
2012
+ '\u02DD': '\u030B', // accute, double
2013
+ '\u02D8': '\u0306', // breve
2014
+ ˇ: '\u030C', // caron
2015
+ '\u00B8': '\u0312', // cedilla
2016
+ '\u005E': '\u0302', // circumflex accent
2017
+ '\u00A8': '\u0308', // diaresis
2018
+ '\u02D9': '\u0307', // dot above
2019
+ '\u0060': '\u0300', // grave accent
2020
+ '\u002D': '\u0305', // hyphen -> overline
2021
+ '\u00AF': '\u0305', // macron
2022
+ '\u2212': '\u0305', // minus -> overline
2023
+ '\u002E': '\u0307', // period -> dot above
2024
+ '\u007E': '\u0303', // tilde
2025
+ '\u02DC': '\u0303' // small tilde
2026
+ };
2027
+
2028
+ function underOrOver(element, targetParent, previousSibling, nextSibling, ancestors, direction) {
2029
+ // Munder/Mover
2030
+
2031
+ if (element.children.length !== 2) {
2032
+ // treat as mrow
2033
+ return targetParent
2034
+ }
2035
+
2036
+ ancestors = [...ancestors];
2037
+ ancestors.unshift(element);
2038
+
2039
+ const base = element.children[0];
2040
+ const script = element.children[1];
2041
+
2042
+ // Munder/Mover can be translated to ooml in different ways.
2043
+
2044
+ // First we check for m:nAry.
2045
+ //
2046
+ // m:nAry
2047
+ //
2048
+ // Conditions:
2049
+ // 1. base text must be nary operator
2050
+ // 2. no accents
2051
+ const naryChar = getNary(base);
2052
+
2053
+ if (
2054
+ naryChar &&
2055
+ element.attribs?.accent?.toLowerCase() !== 'true' &&
2056
+ element.attribs?.accentunder?.toLowerCase() !== 'true'
2057
+ ) {
2058
+ const topTarget = getNaryTarget(
2059
+ naryChar,
2060
+ element,
2061
+ 'undOvr',
2062
+ direction === 'over',
2063
+ direction === 'under'
2064
+ );
2065
+ element.isNary = true;
2066
+
2067
+ const subscriptTarget = {
2068
+ name: 'm:sub',
2069
+ type: 'tag',
2070
+ attribs: {},
2071
+ children: []
2072
+ };
2073
+ const superscriptTarget = {
2074
+ name: 'm:sup',
2075
+ type: 'tag',
2076
+ attribs: {},
2077
+ children: []
2078
+ };
2079
+ walker(
2080
+ script,
2081
+ direction === 'under' ? subscriptTarget : superscriptTarget,
2082
+ false,
2083
+ false,
2084
+ ancestors
2085
+ );
2086
+ topTarget.children.push(subscriptTarget);
2087
+ topTarget.children.push(superscriptTarget);
2088
+ topTarget.children.push({ type: 'tag', name: 'm:e', attribs: {}, children: [] });
2089
+ targetParent.children.push(topTarget);
2090
+ return
2091
+ }
2092
+
2093
+ const scriptText = getTextContent(script);
2094
+
2095
+ const baseTarget = {
2096
+ name: 'm:e',
2097
+ type: 'tag',
2098
+ attribs: {},
2099
+ children: []
2100
+ };
2101
+ walker(base, baseTarget, false, false, ancestors);
2102
+
2103
+ //
2104
+ // m:bar
2105
+ //
2106
+ // Then we check whether it should be an m:bar.
2107
+ // This happens if:
2108
+ // 1. The script text is a single character that corresponds to
2109
+ // \u0332/\u005F (underbar) or \u0305/\u00AF (overbar)
2110
+ // 2. The type of the script element is mo.
2111
+ if (
2112
+ (direction === 'under' && script.name === 'mo' && ['\u0332', '\u005F'].includes(scriptText)) ||
2113
+ (direction === 'over' && script.name === 'mo' && ['\u0305', '\u00AF'].includes(scriptText))
2114
+ ) {
2115
+ // m:bar
2116
+ targetParent.children.push({
2117
+ type: 'tag',
2118
+ name: 'm:bar',
2119
+ attribs: {},
2120
+ children: [
2121
+ {
2122
+ type: 'tag',
2123
+ name: 'm:barPr',
2124
+ attribs: {},
2125
+ children: [
2126
+ {
2127
+ type: 'tag',
2128
+ name: 'm:pos',
2129
+ attribs: {
2130
+ 'm:val': direction === 'under' ? 'bot' : 'top'
2131
+ },
2132
+ children: []
2133
+ }
2134
+ ]
2135
+ },
2136
+ {
2137
+ type: 'tag',
2138
+ name: 'm:e',
2139
+ attribs: {},
2140
+ children: [
2141
+ {
2142
+ type: 'tag',
2143
+ name: direction === 'under' ? 'm:sSub' : 'm:sSup',
2144
+ attribs: {},
2145
+ children: [
2146
+ {
2147
+ type: 'tag',
2148
+ name: direction === 'under' ? 'm:sSubPr' : 'm:sSupPr',
2149
+ attribs: {},
2150
+ children: [{ type: 'tag', name: 'm:ctrlPr', attribs: {}, children: [] }]
2151
+ },
2152
+ baseTarget,
2153
+ { type: 'tag', name: 'm:sub', attribs: {}, children: [] }
2154
+ ]
2155
+ }
2156
+ ]
2157
+ }
2158
+ ]
2159
+ });
2160
+ return
2161
+ }
2162
+
2163
+ // m:acc
2164
+ //
2165
+ // Next we try to see if it is an m:acc. This is the case if:
2166
+ // 1. The scriptText is 0-1 characters long.
2167
+ // 2. The script is an mo-element
2168
+ // 3. The accent is set.
2169
+ if (
2170
+ (direction === 'under' &&
2171
+ element.attribs?.accentunder?.toLowerCase() === 'true' &&
2172
+ script.name === 'mo' &&
2173
+ scriptText.length < 2) ||
2174
+ (direction === 'over' &&
2175
+ element.attribs?.accent?.toLowerCase() === 'true' &&
2176
+ script.name === 'mo' &&
2177
+ scriptText.length < 2)
2178
+ ) {
2179
+ // m:acc
2180
+ targetParent.children.push({
2181
+ type: 'tag',
2182
+ name: 'm:acc',
2183
+ attribs: {},
2184
+ children: [
2185
+ {
2186
+ type: 'tag',
2187
+ name: 'm:accPr',
2188
+ attribs: {},
2189
+ children: [
2190
+ {
2191
+ type: 'tag',
2192
+ name: 'm:chr',
2193
+ attribs: {
2194
+ 'm:val': UPPER_COMBINATION[scriptText] || scriptText
2195
+ },
2196
+ children: []
2197
+ }
2198
+ ]
2199
+ },
2200
+ baseTarget
2201
+ ]
2202
+ });
2203
+ return
2204
+ }
2205
+ // m:groupChr
2206
+ //
2207
+ // Now we try m:groupChr. Conditions are:
2208
+ // 1. Base is an 'mrow' and script is an 'mo'.
2209
+ // 2. Script length is 1.
2210
+ // 3. No accent
2211
+ if (
2212
+ element.attribs?.accent?.toLowerCase() !== 'true' &&
2213
+ element.attribs?.accentunder?.toLowerCase() !== 'true' &&
2214
+ script.name === 'mo' &&
2215
+ base.name === 'mrow' &&
2216
+ scriptText.length === 1
2217
+ ) {
2218
+ targetParent.children.push({
2219
+ type: 'tag',
2220
+ name: 'm:groupChr',
2221
+ attribs: {},
2222
+ children: [
2223
+ {
2224
+ type: 'tag',
2225
+ name: 'm:groupChrPr',
2226
+ attribs: {},
2227
+ children: [
2228
+ {
2229
+ type: 'tag',
2230
+ name: 'm:chr',
2231
+ attribs: {
2232
+ 'm:val': scriptText,
2233
+ 'm:pos': direction === 'under' ? 'bot' : 'top'
2234
+ },
2235
+ children: []
2236
+ }
2237
+ ]
2238
+ },
2239
+ baseTarget
2240
+ ]
2241
+ });
2242
+ return
2243
+ }
2244
+ // Fallback: m:lim
2245
+
2246
+ const scriptTarget = {
2247
+ name: 'm:lim',
2248
+ type: 'tag',
2249
+ attribs: {},
2250
+ children: []
2251
+ };
2252
+
2253
+ walker(script, scriptTarget, false, false, ancestors);
2254
+ targetParent.children.push({
2255
+ type: 'tag',
2256
+ name: direction === 'under' ? 'm:limLow' : 'm:limUpp',
2257
+ attribs: {},
2258
+ children: [baseTarget, scriptTarget]
2259
+ });
2260
+ // Don't iterate over children in the usual way.
2261
+ }
2262
+
2263
+ function munder(element, targetParent, previousSibling, nextSibling, ancestors) {
2264
+ return underOrOver(element, targetParent, previousSibling, nextSibling, ancestors, 'under')
2265
+ }
2266
+
2267
+ function mover(element, targetParent, previousSibling, nextSibling, ancestors) {
2268
+ return underOrOver(element, targetParent, previousSibling, nextSibling, ancestors, 'over')
2269
+ }
2270
+
2271
+ function mroot(element, targetParent, previousSibling, nextSibling, ancestors) {
2272
+ // Root
2273
+ if (element.children.length !== 2) {
2274
+ // treat as mrow
2275
+ return targetParent
2276
+ }
2277
+ ancestors = [...ancestors];
2278
+ ancestors.unshift(element);
2279
+ const base = element.children[0];
2280
+ const root = element.children[1];
2281
+
2282
+ const baseTarget = {
2283
+ type: 'tag',
2284
+ name: 'm:e',
2285
+ attribs: {},
2286
+ children: []
2287
+ };
2288
+ walker(base, baseTarget, false, false, ancestors);
2289
+
2290
+ const rootTarget = {
2291
+ type: 'tag',
2292
+ name: 'm:deg',
2293
+ attribs: {},
2294
+ children: []
2295
+ };
2296
+ walker(root, rootTarget, false, false, ancestors);
2297
+
2298
+ const rootText = getTextContent(root);
2299
+
2300
+ targetParent.children.push({
2301
+ type: 'tag',
2302
+ name: 'm:rad',
2303
+ attribs: {},
2304
+ children: [
2305
+ {
2306
+ type: 'tag',
2307
+ name: 'm:radPr',
2308
+ attribs: {},
2309
+ children: [
2310
+ {
2311
+ type: 'tag',
2312
+ name: 'm:degHide',
2313
+ attribs: { 'm:val': rootText.length ? 'off' : 'on' },
2314
+ children: []
2315
+ }
2316
+ ]
2317
+ },
2318
+ rootTarget,
2319
+ baseTarget
2320
+ ]
2321
+ });
2322
+ }
2323
+
2324
+ function text(element, targetParent, previousSibling, nextSibling, ancestors) {
2325
+ let text = element.data.replace(/[\u2062]|[\u200B]/g, '');
2326
+ if (ancestors.find((element) => ['mi', 'mn', 'mo'].includes(element.name))) {
2327
+ text = text.replace(/\s/g, '');
2328
+ } else {
2329
+ const ms = ancestors.find((element) => element.name === 'ms');
2330
+ if (ms) {
2331
+ text = (ms.attribs?.lquote || '"') + text + (ms.attribs?.rquote || '"');
2332
+ }
2333
+ }
2334
+ if (text.length) {
2335
+ if (
2336
+ targetParent.children.length &&
2337
+ targetParent.children[targetParent.children.length - 1].type === 'text'
2338
+ ) {
2339
+ targetParent.children[targetParent.children.length - 1].data += text;
2340
+ } else {
2341
+ targetParent.children.push({
2342
+ type: 'text',
2343
+ data: text
2344
+ });
2345
+ }
2346
+ }
2347
+ return targetParent
2348
+ }
2349
+
2350
+ var mathmlHandlers = /*#__PURE__*/Object.freeze({
2351
+ __proto__: null,
2352
+ math: math,
2353
+ menclose: menclose,
2354
+ mfrac: mfrac,
2355
+ mglyph: mglyph,
2356
+ mi: mi,
2357
+ mmultiscripts: mmultiscripts,
2358
+ mn: mn,
2359
+ mo: mo,
2360
+ mover: mover,
2361
+ mroot: mroot,
2362
+ mrow: mrow,
2363
+ ms: ms,
2364
+ mspace: mspace,
2365
+ msqrt: msqrt,
2366
+ mstyle: mstyle,
2367
+ msub: msub,
2368
+ msubsup: msubsup,
2369
+ msup: msup,
2370
+ mtable: mtable,
2371
+ mtd: mtd,
2372
+ mtext: mtext,
2373
+ mtr: mtr,
2374
+ munder: munder,
2375
+ munderover: munderover,
2376
+ semantics: semantics,
2377
+ text: text
2378
+ });
2379
+
2380
+ function walker(
2381
+ element,
2382
+ targetParent,
2383
+ previousSibling = false,
2384
+ nextSibling = false,
2385
+ ancestors = []
2386
+ ) {
2387
+ if (
2388
+ !previousSibling &&
2389
+ ['m:deg', 'm:den', 'm:e', 'm:fName', 'm:lim', 'm:num', 'm:sub', 'm:sup'].includes(
2390
+ targetParent.name
2391
+ )
2392
+ ) {
2393
+ // We are walking through the first element within one of the
2394
+ // elements where an <m:argPr> might occur. The <m:argPr> can specify
2395
+ // the scriptlevel, but it only makes sense if there is some content.
2396
+ // The fact that we are here means that there is at least one content item.
2397
+ // So we will check whether to add the m:rPr.
2398
+ // For possible parent types, see
2399
+ // https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.math.argumentproperties?view=openxml-2.8.1#remarks
2400
+ addScriptlevel(targetParent, ancestors);
2401
+ }
2402
+ let targetElement;
2403
+ const nameOrType = element.name || element.type;
2404
+ if (mathmlHandlers[nameOrType]) {
2405
+ targetElement = mathmlHandlers[nameOrType](
2406
+ element,
2407
+ targetParent,
2408
+ previousSibling,
2409
+ nextSibling,
2410
+ ancestors
2411
+ );
2412
+ } else {
2413
+ if (nameOrType && nameOrType !== 'root') {
2414
+ console.warn(`Type not supported: ${nameOrType}`);
2415
+ }
2416
+
2417
+ targetElement = targetParent;
2418
+ }
2419
+
2420
+ if (!targetElement) {
2421
+ // Target element hasn't been assigned, so don't handle children.
2422
+ return
2423
+ }
2424
+ if (element.children?.length) {
2425
+ ancestors = [...ancestors];
2426
+ ancestors.unshift(element);
2427
+ // Track nary body redirect: after a nary operator, redirect subsequent
2428
+ // siblings into its <m:e> until a relational operator (=, <, >, etc.) is
2429
+ // encountered. Chains through nested nary operators (e.g. double
2430
+ // integrals ∫∫).
2431
+ let naryBodyTarget = null;
2432
+ // Track prescript redirect: after a msubsup with empty base (e.g.
2433
+ // {}^{14}_{6}C), redirect the next sibling into <m:sPre>'s <m:e>.
2434
+ let prescriptTarget = null;
2435
+ for (let i = 0; i < element.children.length; i++) {
2436
+ const child = element.children[i];
2437
+ if (child.skipInWalker) continue
2438
+
2439
+ // A relational/separator <mo> or <mtext> stops the nary redirect so
2440
+ // that content after the operand stays outside the nary body.
2441
+ // Examples: ∑ aᵢ = S → operand is aᵢ (stopped by =)
2442
+ // ∑ aᵢ, bⱼ → operand is aᵢ (stopped by ,)
2443
+ // ∑ aᵢ \text{ for } i → operand is aᵢ (stopped by mtext)
2444
+ if (naryBodyTarget) {
2445
+ if (child.name === 'mo') {
2446
+ const txt = child.children?.[0]?.data;
2447
+ if (txt && /^[=<>≤≥≠≈≡∼≲≳≪≫∈∉⊂⊃⊆⊇⊄⊅≺≻⪯⪰∝≅≃≍≎∥⊥⊢⊣⊨⊩,;:∣]$/.test(txt)) {
2448
+ naryBodyTarget = null;
2449
+ }
2450
+ } else if (child.name === 'mtext') {
2451
+ naryBodyTarget = null;
2452
+ }
2453
+ }
2454
+
2455
+ const effectiveTarget = prescriptTarget || naryBodyTarget || targetElement;
2456
+ walker(
2457
+ child,
2458
+ effectiveTarget,
2459
+ element.children[i - 1],
2460
+ element.children[i + 1],
2461
+ ancestors
2462
+ );
2463
+ if (child.isNary) {
2464
+ // Chain into the new nary's <m:e>
2465
+ const naryNode = effectiveTarget.children[effectiveTarget.children.length - 1];
2466
+ naryBodyTarget = naryNode.children[naryNode.children.length - 1];
2467
+ }
2468
+ if (child.isPrescript) {
2469
+ // Redirect next sibling into <m:sPre>'s <m:e>
2470
+ const preNode = effectiveTarget.children[effectiveTarget.children.length - 1];
2471
+ prescriptTarget = preNode.children[preNode.children.length - 1];
2472
+ } else if (prescriptTarget) {
2473
+ // One element consumed; stop prescript redirect
2474
+ prescriptTarget = null;
2475
+ }
2476
+ }
2477
+ }
2478
+ }
2479
+
2480
+ class MML2OMML {
2481
+ constructor(mmlString, options = {}) {
2482
+ this.inString = mmlString;
2483
+ this.inXML = parse(mmlString, options);
2484
+ this.outXML = false;
2485
+ this.outString = false;
2486
+ }
2487
+
2488
+ run() {
2489
+ const outXML = {};
2490
+ walker({ children: this.inXML, type: 'root' }, outXML);
2491
+ this.outXML = outXML;
2492
+ }
2493
+
2494
+ getResult() {
2495
+ this.outString = stringifyDoc([this.outXML]);
2496
+ return this.outString
2497
+ }
2498
+ }
2499
+
2500
+ const mml2omml = (mmlString, options) => {
2501
+ const converter = new MML2OMML(mmlString, options);
2502
+ converter.run();
2503
+ return converter.getResult()
2504
+ };
2505
+
2506
+ export { mml2omml };
2507
+ //# sourceMappingURL=index.js.map
packages/mathml2omml/dist/index.js.map ADDED
The diff for this file is too large to render. See raw diff
 
packages/mathml2omml/node_modules/.bin/baseline-browser-mapping ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ #!/usr/bin/env node
2
+ "use strict";const{getCompatibleVersions:e}=require("./index.cjs"),a=process.argv.slice(2),s={};for(let e=0;e<a.length;e++){const r=a[e];r&&("-h"===r||"--help"===r?s.help=!0:"--include-downstream-browsers"===r?s["include-downstream-browsers"]=!0:"--list-all-compatible-versions"===r?s["list-all-compatible-versions"]=!0:"--include-kaios"===r?s["include-kaios"]=!0:"--suppress-warnings"===r?s["suppress-warnings"]=!0:r.startsWith("--target-year=")?s["target-year"]=r.substring(14):"--target-year"===r?s["target-year"]=a[++e]:r.startsWith("--widely-available-on-date=")?s["widely-available-on-date"]=r.substring(27):"--widely-available-on-date"===r?s["widely-available-on-date"]=a[++e]:r.startsWith("--override-last-updated=")?s["override-last-updated"]=r.substring(24):"--override-last-updated"===r?s["override-last-updated"]=a[++e]:(console.error(`Unknown argument: ${r}`),process.exit(1)))}s.help&&(console.log("\nGet Baseline Widely available browser versions or Baseline year browser versions.\n\nUsage: baseline-browser-mapping [options]\n\nOptions:\n --target-year Pass a year between 2015 and the current year to get browser versions compatible \n with all Newly Available features as of the end of the year specified.\n --widely-available-on-date Pass a date in the format 'YYYY-MM-DD' to get versions compatible with Widely \n available on the specified date.\n --include-downstream-browsers Whether to include browsers that use the same engines as a core Baseline browser.\n --include-kaios Whether to include KaiOS in downstream browsers. Requires --include-downstream-browsers.\n --list-all-compatible-versions Whether to include only the minimum compatible browser versions or all compatible versions.\n --suppress-warnings Supress potential warnings about data staleness when using a very recent feature cut off date.\n --override-last-updated Override the last updated date for the baseline data for debugging purposes.\n -h, --help Show help\n\nExamples:\n npx baseline-browser-mapping --target-year 2020\n npx baseline-browser-mapping --widely-available-on-date 2023-04-05\n npx baseline-browser-mapping --include-downstream-browsers\n npx baseline-browser-mapping --list-all-compatible-versions\n".trim()),process.exit(0)),console.log(e({targetYear:s["target-year"]?Number.parseInt(s["target-year"]):void 0,widelyAvailableOnDate:s["widely-available-on-date"],includeDownstreamBrowsers:s["include-downstream-browsers"],listAllCompatibleVersions:s["list-all-compatible-versions"],includeKaiOS:s["include-kaios"],suppressWarnings:s["suppress-warnings"],overrideLastUpdated:s["override-last-updated"]?Number.parseInt(s["override-last-updated"]):void 0}));
packages/mathml2omml/node_modules/.bin/biome ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ const { platform, arch, env, version, release } = process;
3
+ const { execSync } = require("child_process");
4
+
5
+ function isMusl() {
6
+ let stderr;
7
+ try {
8
+ stderr = execSync("ldd --version", {
9
+ stdio: ['pipe', 'pipe', 'pipe']
10
+ });
11
+ } catch (err) {
12
+ stderr = err.stderr;
13
+ }
14
+ if (stderr.indexOf("musl") > -1) {
15
+ return true;
16
+ }
17
+ return false;
18
+ }
19
+
20
+ const PLATFORMS = {
21
+ win32: {
22
+ x64: "@biomejs/cli-win32-x64/biome.exe",
23
+ arm64: "@biomejs/cli-win32-arm64/biome.exe",
24
+ },
25
+ darwin: {
26
+ x64: "@biomejs/cli-darwin-x64/biome",
27
+ arm64: "@biomejs/cli-darwin-arm64/biome",
28
+ },
29
+ linux: {
30
+ x64: "@biomejs/cli-linux-x64/biome",
31
+ arm64: "@biomejs/cli-linux-arm64/biome",
32
+ },
33
+ "linux-musl": {
34
+ x64: "@biomejs/cli-linux-x64-musl/biome",
35
+ arm64: "@biomejs/cli-linux-arm64-musl/biome",
36
+ },
37
+ };
38
+ if (env.ROME_BINARY) {
39
+ console.warn(`[WARN] The environment variable "ROME_BINARY" is deprecated. Use "BIOME_BINARY" instead.`)
40
+ }
41
+
42
+ const binPath = env.BIOME_BINARY || env.ROME_BINARY ||
43
+ (platform === "linux" && isMusl()
44
+ ? PLATFORMS?.["linux-musl"]?.[arch]
45
+ : PLATFORMS?.[platform]?.[arch]
46
+ );
47
+
48
+ if (binPath) {
49
+ const packageManager = detectPackageManager();
50
+ const result = require("child_process").spawnSync(
51
+ require.resolve(binPath),
52
+ process.argv.slice(2),
53
+ {
54
+ shell: false,
55
+ stdio: "inherit",
56
+ env: {
57
+ ...env,
58
+ JS_RUNTIME_VERSION: version,
59
+ JS_RUNTIME_NAME: release.name,
60
+ ...(packageManager != null
61
+ ? { NODE_PACKAGE_MANAGER: packageManager }
62
+ : {}),
63
+ },
64
+ },
65
+ );
66
+
67
+ if (result.error) {
68
+ throw result.error;
69
+ }
70
+
71
+ process.exitCode = result.status;
72
+ } else {
73
+ console.error(
74
+ "The Biome CLI package doesn't ship with prebuilt binaries for your platform yet. " +
75
+ "You can still use the CLI by cloning the biome/tools repo from GitHub, " +
76
+ "and follow the instructions there to build the CLI for your platform.",
77
+ );
78
+ process.exitCode = 1;
79
+ }
80
+
81
+ /**
82
+ * NPM, Yarn, and other package manager set the `npm_config_user_agent`. It has the following format:
83
+ *
84
+ * ```
85
+ * "npm/8.3.0 node/v16.13.2 win32 x64 workspaces/false
86
+ * ```
87
+ *
88
+ * @returns The package manager string (`npm/8.3.0`) or null if the user agent string isn't set.
89
+ */
90
+ function detectPackageManager() {
91
+ const userAgent = env.npm_config_user_agent;
92
+
93
+ if (userAgent == null) {
94
+ return null;
95
+ }
96
+
97
+ return userAgent.split(" ")[0];
98
+ }
packages/mathml2omml/node_modules/.bin/browserslist ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ var fs = require('fs')
4
+ var updateDb = require('update-browserslist-db')
5
+
6
+ var browserslist = require('./')
7
+ var pkg = require('./package.json')
8
+
9
+ var args = process.argv.slice(2)
10
+
11
+ var USAGE =
12
+ 'Usage:\n' +
13
+ ' npx browserslist\n' +
14
+ ' npx browserslist "QUERIES"\n' +
15
+ ' npx browserslist --json "QUERIES"\n' +
16
+ ' npx browserslist --config="path/to/browserlist/file"\n' +
17
+ ' npx browserslist --coverage "QUERIES"\n' +
18
+ ' npx browserslist --coverage=US "QUERIES"\n' +
19
+ ' npx browserslist --coverage=US,RU,global "QUERIES"\n' +
20
+ ' npx browserslist --env="environment name defined in config"\n' +
21
+ ' npx browserslist --stats="path/to/browserlist/stats/file"\n' +
22
+ ' npx browserslist --mobile-to-desktop\n' +
23
+ ' npx browserslist --ignore-unknown-versions\n'
24
+
25
+ function isArg(arg) {
26
+ return args.some(function (str) {
27
+ return str === arg || str.indexOf(arg + '=') === 0
28
+ })
29
+ }
30
+
31
+ function error(msg) {
32
+ process.stderr.write('browserslist: ' + msg + '\n')
33
+ process.exit(1)
34
+ }
35
+
36
+ if (isArg('--help') || isArg('-h')) {
37
+ process.stdout.write(pkg.description + '.\n\n' + USAGE + '\n')
38
+ } else if (isArg('--version') || isArg('-v')) {
39
+ process.stdout.write('browserslist ' + pkg.version + '\n')
40
+ } else if (isArg('--update-db')) {
41
+ /* c8 ignore next 8 */
42
+ process.stdout.write(
43
+ 'The --update-db command is deprecated.\n' +
44
+ 'Please use npx update-browserslist-db@latest instead.\n'
45
+ )
46
+ process.stdout.write('Browserslist DB update will still be made.\n')
47
+ updateDb(function (str) {
48
+ process.stdout.write(str)
49
+ })
50
+ } else {
51
+ var mode = 'browsers'
52
+ var opts = {}
53
+ var queries
54
+ var areas
55
+
56
+ for (var i = 0; i < args.length; i++) {
57
+ if (args[i][0] !== '-') {
58
+ queries = args[i].replace(/^["']|["']$/g, '')
59
+ continue
60
+ }
61
+
62
+ var arg = args[i].split('=')
63
+ var name = arg[0]
64
+ var value = arg[1]
65
+
66
+ if (value) value = value.replace(/^["']|["']$/g, '')
67
+
68
+ if (name === '--config' || name === '-b') {
69
+ opts.config = value
70
+ } else if (name === '--env' || name === '-e') {
71
+ opts.env = value
72
+ } else if (name === '--stats' || name === '-s') {
73
+ opts.stats = value
74
+ } else if (name === '--coverage' || name === '-c') {
75
+ if (mode !== 'json') mode = 'coverage'
76
+ if (value) {
77
+ areas = value.split(',')
78
+ } else {
79
+ areas = ['global']
80
+ }
81
+ } else if (name === '--json') {
82
+ mode = 'json'
83
+ } else if (name === '--mobile-to-desktop') {
84
+ /* c8 ignore next */
85
+ opts.mobileToDesktop = true
86
+ } else if (name === '--ignore-unknown-versions') {
87
+ /* c8 ignore next */
88
+ opts.ignoreUnknownVersions = true
89
+ } else {
90
+ error('Unknown arguments ' + args[i] + '.\n\n' + USAGE)
91
+ }
92
+ }
93
+
94
+ var browsers
95
+ try {
96
+ browsers = browserslist(queries, opts)
97
+ } catch (e) {
98
+ if (e.name === 'BrowserslistError') {
99
+ error(e.message)
100
+ } /* c8 ignore start */ else {
101
+ throw e
102
+ } /* c8 ignore end */
103
+ }
104
+
105
+ var coverage
106
+ if (mode === 'browsers') {
107
+ browsers.forEach(function (browser) {
108
+ process.stdout.write(browser + '\n')
109
+ })
110
+ } else if (areas) {
111
+ coverage = areas.map(function (area) {
112
+ var stats
113
+ if (area !== 'global') {
114
+ stats = area
115
+ } else if (opts.stats) {
116
+ stats = JSON.parse(fs.readFileSync(opts.stats))
117
+ }
118
+ var result = browserslist.coverage(browsers, stats)
119
+ var round = Math.round(result * 100) / 100.0
120
+
121
+ return [area, round]
122
+ })
123
+
124
+ if (mode === 'coverage') {
125
+ var prefix = 'These browsers account for '
126
+ process.stdout.write(prefix)
127
+ coverage.forEach(function (data, index) {
128
+ var area = data[0]
129
+ var round = data[1]
130
+ var end = 'globally'
131
+ if (area && area !== 'global') {
132
+ end = 'in the ' + area.toUpperCase()
133
+ } else if (opts.stats) {
134
+ end = 'in custom statistics'
135
+ }
136
+
137
+ if (index !== 0) {
138
+ process.stdout.write(prefix.replace(/./g, ' '))
139
+ }
140
+
141
+ process.stdout.write(round + '% of all users ' + end + '\n')
142
+ })
143
+ }
144
+ }
145
+
146
+ if (mode === 'json') {
147
+ var data = { browsers: browsers }
148
+ if (coverage) {
149
+ data.coverage = coverage.reduce(function (object, j) {
150
+ object[j[0]] = j[1]
151
+ return object
152
+ }, {})
153
+ }
154
+ process.stdout.write(JSON.stringify(data, null, ' ') + '\n')
155
+ }
156
+ }
packages/mathml2omml/node_modules/.bin/create-jest ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ require('..').runCLI();
packages/mathml2omml/node_modules/.bin/esparse ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ /*
3
+ Copyright JS Foundation and other contributors, https://js.foundation/
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
18
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
+ */
25
+
26
+ /*jslint sloppy:true node:true rhino:true */
27
+
28
+ var fs, esprima, fname, forceFile, content, options, syntax;
29
+
30
+ if (typeof require === 'function') {
31
+ fs = require('fs');
32
+ try {
33
+ esprima = require('esprima');
34
+ } catch (e) {
35
+ esprima = require('../');
36
+ }
37
+ } else if (typeof load === 'function') {
38
+ try {
39
+ load('esprima.js');
40
+ } catch (e) {
41
+ load('../esprima.js');
42
+ }
43
+ }
44
+
45
+ // Shims to Node.js objects when running under Rhino.
46
+ if (typeof console === 'undefined' && typeof process === 'undefined') {
47
+ console = { log: print };
48
+ fs = { readFileSync: readFile };
49
+ process = { argv: arguments, exit: quit };
50
+ process.argv.unshift('esparse.js');
51
+ process.argv.unshift('rhino');
52
+ }
53
+
54
+ function showUsage() {
55
+ console.log('Usage:');
56
+ console.log(' esparse [options] [file.js]');
57
+ console.log();
58
+ console.log('Available options:');
59
+ console.log();
60
+ console.log(' --comment Gather all line and block comments in an array');
61
+ console.log(' --loc Include line-column location info for each syntax node');
62
+ console.log(' --range Include index-based range for each syntax node');
63
+ console.log(' --raw Display the raw value of literals');
64
+ console.log(' --tokens List all tokens in an array');
65
+ console.log(' --tolerant Tolerate errors on a best-effort basis (experimental)');
66
+ console.log(' -v, --version Shows program version');
67
+ console.log();
68
+ process.exit(1);
69
+ }
70
+
71
+ options = {};
72
+
73
+ process.argv.splice(2).forEach(function (entry) {
74
+
75
+ if (forceFile || entry === '-' || entry.slice(0, 1) !== '-') {
76
+ if (typeof fname === 'string') {
77
+ console.log('Error: more than one input file.');
78
+ process.exit(1);
79
+ } else {
80
+ fname = entry;
81
+ }
82
+ } else if (entry === '-h' || entry === '--help') {
83
+ showUsage();
84
+ } else if (entry === '-v' || entry === '--version') {
85
+ console.log('ECMAScript Parser (using Esprima version', esprima.version, ')');
86
+ console.log();
87
+ process.exit(0);
88
+ } else if (entry === '--comment') {
89
+ options.comment = true;
90
+ } else if (entry === '--loc') {
91
+ options.loc = true;
92
+ } else if (entry === '--range') {
93
+ options.range = true;
94
+ } else if (entry === '--raw') {
95
+ options.raw = true;
96
+ } else if (entry === '--tokens') {
97
+ options.tokens = true;
98
+ } else if (entry === '--tolerant') {
99
+ options.tolerant = true;
100
+ } else if (entry === '--') {
101
+ forceFile = true;
102
+ } else {
103
+ console.log('Error: unknown option ' + entry + '.');
104
+ process.exit(1);
105
+ }
106
+ });
107
+
108
+ // Special handling for regular expression literal since we need to
109
+ // convert it to a string literal, otherwise it will be decoded
110
+ // as object "{}" and the regular expression would be lost.
111
+ function adjustRegexLiteral(key, value) {
112
+ if (key === 'value' && value instanceof RegExp) {
113
+ value = value.toString();
114
+ }
115
+ return value;
116
+ }
117
+
118
+ function run(content) {
119
+ syntax = esprima.parse(content, options);
120
+ console.log(JSON.stringify(syntax, adjustRegexLiteral, 4));
121
+ }
122
+
123
+ try {
124
+ if (fname && (fname !== '-' || forceFile)) {
125
+ run(fs.readFileSync(fname, 'utf-8'));
126
+ } else {
127
+ var content = '';
128
+ process.stdin.resume();
129
+ process.stdin.on('data', function(chunk) {
130
+ content += chunk;
131
+ });
132
+ process.stdin.on('end', function() {
133
+ run(content);
134
+ });
135
+ }
136
+ } catch (e) {
137
+ console.log('Error: ' + e.message);
138
+ process.exit(1);
139
+ }
packages/mathml2omml/node_modules/.bin/esvalidate ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ /*
3
+ Copyright JS Foundation and other contributors, https://js.foundation/
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
18
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
+ */
25
+
26
+ /*jslint sloppy:true plusplus:true node:true rhino:true */
27
+ /*global phantom:true */
28
+
29
+ var fs, system, esprima, options, fnames, forceFile, count;
30
+
31
+ if (typeof esprima === 'undefined') {
32
+ // PhantomJS can only require() relative files
33
+ if (typeof phantom === 'object') {
34
+ fs = require('fs');
35
+ system = require('system');
36
+ esprima = require('./esprima');
37
+ } else if (typeof require === 'function') {
38
+ fs = require('fs');
39
+ try {
40
+ esprima = require('esprima');
41
+ } catch (e) {
42
+ esprima = require('../');
43
+ }
44
+ } else if (typeof load === 'function') {
45
+ try {
46
+ load('esprima.js');
47
+ } catch (e) {
48
+ load('../esprima.js');
49
+ }
50
+ }
51
+ }
52
+
53
+ // Shims to Node.js objects when running under PhantomJS 1.7+.
54
+ if (typeof phantom === 'object') {
55
+ fs.readFileSync = fs.read;
56
+ process = {
57
+ argv: [].slice.call(system.args),
58
+ exit: phantom.exit,
59
+ on: function (evt, callback) {
60
+ callback();
61
+ }
62
+ };
63
+ process.argv.unshift('phantomjs');
64
+ }
65
+
66
+ // Shims to Node.js objects when running under Rhino.
67
+ if (typeof console === 'undefined' && typeof process === 'undefined') {
68
+ console = { log: print };
69
+ fs = { readFileSync: readFile };
70
+ process = {
71
+ argv: arguments,
72
+ exit: quit,
73
+ on: function (evt, callback) {
74
+ callback();
75
+ }
76
+ };
77
+ process.argv.unshift('esvalidate.js');
78
+ process.argv.unshift('rhino');
79
+ }
80
+
81
+ function showUsage() {
82
+ console.log('Usage:');
83
+ console.log(' esvalidate [options] [file.js...]');
84
+ console.log();
85
+ console.log('Available options:');
86
+ console.log();
87
+ console.log(' --format=type Set the report format, plain (default) or junit');
88
+ console.log(' -v, --version Print program version');
89
+ console.log();
90
+ process.exit(1);
91
+ }
92
+
93
+ options = {
94
+ format: 'plain'
95
+ };
96
+
97
+ fnames = [];
98
+
99
+ process.argv.splice(2).forEach(function (entry) {
100
+
101
+ if (forceFile || entry === '-' || entry.slice(0, 1) !== '-') {
102
+ fnames.push(entry);
103
+ } else if (entry === '-h' || entry === '--help') {
104
+ showUsage();
105
+ } else if (entry === '-v' || entry === '--version') {
106
+ console.log('ECMAScript Validator (using Esprima version', esprima.version, ')');
107
+ console.log();
108
+ process.exit(0);
109
+ } else if (entry.slice(0, 9) === '--format=') {
110
+ options.format = entry.slice(9);
111
+ if (options.format !== 'plain' && options.format !== 'junit') {
112
+ console.log('Error: unknown report format ' + options.format + '.');
113
+ process.exit(1);
114
+ }
115
+ } else if (entry === '--') {
116
+ forceFile = true;
117
+ } else {
118
+ console.log('Error: unknown option ' + entry + '.');
119
+ process.exit(1);
120
+ }
121
+ });
122
+
123
+ if (fnames.length === 0) {
124
+ fnames.push('');
125
+ }
126
+
127
+ if (options.format === 'junit') {
128
+ console.log('<?xml version="1.0" encoding="UTF-8"?>');
129
+ console.log('<testsuites>');
130
+ }
131
+
132
+ count = 0;
133
+
134
+ function run(fname, content) {
135
+ var timestamp, syntax, name;
136
+ try {
137
+ if (typeof content !== 'string') {
138
+ throw content;
139
+ }
140
+
141
+ if (content[0] === '#' && content[1] === '!') {
142
+ content = '//' + content.substr(2, content.length);
143
+ }
144
+
145
+ timestamp = Date.now();
146
+ syntax = esprima.parse(content, { tolerant: true });
147
+
148
+ if (options.format === 'junit') {
149
+
150
+ name = fname;
151
+ if (name.lastIndexOf('/') >= 0) {
152
+ name = name.slice(name.lastIndexOf('/') + 1);
153
+ }
154
+
155
+ console.log('<testsuite name="' + fname + '" errors="0" ' +
156
+ ' failures="' + syntax.errors.length + '" ' +
157
+ ' tests="' + syntax.errors.length + '" ' +
158
+ ' time="' + Math.round((Date.now() - timestamp) / 1000) +
159
+ '">');
160
+
161
+ syntax.errors.forEach(function (error) {
162
+ var msg = error.message;
163
+ msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
164
+ console.log(' <testcase name="Line ' + error.lineNumber + ': ' + msg + '" ' +
165
+ ' time="0">');
166
+ console.log(' <error type="SyntaxError" message="' + error.message + '">' +
167
+ error.message + '(' + name + ':' + error.lineNumber + ')' +
168
+ '</error>');
169
+ console.log(' </testcase>');
170
+ });
171
+
172
+ console.log('</testsuite>');
173
+
174
+ } else if (options.format === 'plain') {
175
+
176
+ syntax.errors.forEach(function (error) {
177
+ var msg = error.message;
178
+ msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
179
+ msg = fname + ':' + error.lineNumber + ': ' + msg;
180
+ console.log(msg);
181
+ ++count;
182
+ });
183
+
184
+ }
185
+ } catch (e) {
186
+ ++count;
187
+ if (options.format === 'junit') {
188
+ console.log('<testsuite name="' + fname + '" errors="1" failures="0" tests="1" ' +
189
+ ' time="' + Math.round((Date.now() - timestamp) / 1000) + '">');
190
+ console.log(' <testcase name="' + e.message + '" ' + ' time="0">');
191
+ console.log(' <error type="ParseError" message="' + e.message + '">' +
192
+ e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') +
193
+ ')</error>');
194
+ console.log(' </testcase>');
195
+ console.log('</testsuite>');
196
+ } else {
197
+ console.log(fname + ':' + e.lineNumber + ': ' + e.message.replace(/^Line\ [0-9]*\:\ /, ''));
198
+ }
199
+ }
200
+ }
201
+
202
+ fnames.forEach(function (fname) {
203
+ var content = '';
204
+ try {
205
+ if (fname && (fname !== '-' || forceFile)) {
206
+ content = fs.readFileSync(fname, 'utf-8');
207
+ } else {
208
+ fname = '';
209
+ process.stdin.resume();
210
+ process.stdin.on('data', function(chunk) {
211
+ content += chunk;
212
+ });
213
+ process.stdin.on('end', function() {
214
+ run(fname, content);
215
+ });
216
+ return;
217
+ }
218
+ } catch (e) {
219
+ content = e;
220
+ }
221
+ run(fname, content);
222
+ });
223
+
224
+ process.on('exit', function () {
225
+ if (options.format === 'junit') {
226
+ console.log('</testsuites>');
227
+ }
228
+
229
+ if (count > 0) {
230
+ process.exit(1);
231
+ }
232
+
233
+ if (count === 0 && typeof phantom === 'object') {
234
+ process.exit(0);
235
+ }
236
+ });
packages/mathml2omml/node_modules/.bin/husky ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ import f, { writeFileSync as w } from 'fs'
3
+ import i from './index.js'
4
+
5
+ let p, a, n, s, o, d
6
+
7
+ p = process
8
+ a = p.argv[2]
9
+
10
+ if (a == 'init') {
11
+ n = 'package.json'
12
+ s = f.readFileSync(n)
13
+ o = JSON.parse(s)
14
+ ;(o.scripts ||= {}).prepare = 'husky'
15
+ w(n, JSON.stringify(o, 0, /\t/.test(s) ? '\t' : 2) + '\n')
16
+ p.stdout.write(i())
17
+ try { f.mkdirSync('.husky') } catch {}
18
+ w('.husky/pre-commit', (p.env.npm_config_user_agent?.split('/')[0] ?? 'npm') + ' test\n')
19
+ p.exit()
20
+ }
21
+
22
+ d = c => console.error(`husky - ${c} command is DEPRECATED`)
23
+ if (['add', 'set', 'uninstall'].includes(a)) { d(a); p.exit(1) }
24
+ if (a == 'install') d(a)
25
+
26
+ p.stdout.write(i(a == 'install' ? undefined : a))
packages/mathml2omml/node_modules/.bin/import-local-fixture ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ const importLocal = require('..');
4
+
5
+ if (importLocal(__filename)) {
6
+ console.log('local');
7
+ }
packages/mathml2omml/node_modules/.bin/jest ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ const importLocal = require('import-local');
10
+
11
+ if (!importLocal(__filename)) {
12
+ require('jest-cli/bin/jest');
13
+ }
packages/mathml2omml/node_modules/.bin/js-yaml ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+
4
+ 'use strict';
5
+
6
+ /*eslint-disable no-console*/
7
+
8
+
9
+ // stdlib
10
+ var fs = require('fs');
11
+
12
+
13
+ // 3rd-party
14
+ var argparse = require('argparse');
15
+
16
+
17
+ // internal
18
+ var yaml = require('..');
19
+
20
+
21
+ ////////////////////////////////////////////////////////////////////////////////
22
+
23
+
24
+ var cli = new argparse.ArgumentParser({
25
+ prog: 'js-yaml',
26
+ version: require('../package.json').version,
27
+ addHelp: true
28
+ });
29
+
30
+
31
+ cli.addArgument([ '-c', '--compact' ], {
32
+ help: 'Display errors in compact mode',
33
+ action: 'storeTrue'
34
+ });
35
+
36
+
37
+ // deprecated (not needed after we removed output colors)
38
+ // option suppressed, but not completely removed for compatibility
39
+ cli.addArgument([ '-j', '--to-json' ], {
40
+ help: argparse.Const.SUPPRESS,
41
+ dest: 'json',
42
+ action: 'storeTrue'
43
+ });
44
+
45
+
46
+ cli.addArgument([ '-t', '--trace' ], {
47
+ help: 'Show stack trace on error',
48
+ action: 'storeTrue'
49
+ });
50
+
51
+ cli.addArgument([ 'file' ], {
52
+ help: 'File to read, utf-8 encoded without BOM',
53
+ nargs: '?',
54
+ defaultValue: '-'
55
+ });
56
+
57
+
58
+ ////////////////////////////////////////////////////////////////////////////////
59
+
60
+
61
+ var options = cli.parseArgs();
62
+
63
+
64
+ ////////////////////////////////////////////////////////////////////////////////
65
+
66
+ function readFile(filename, encoding, callback) {
67
+ if (options.file === '-') {
68
+ // read from stdin
69
+
70
+ var chunks = [];
71
+
72
+ process.stdin.on('data', function (chunk) {
73
+ chunks.push(chunk);
74
+ });
75
+
76
+ process.stdin.on('end', function () {
77
+ return callback(null, Buffer.concat(chunks).toString(encoding));
78
+ });
79
+ } else {
80
+ fs.readFile(filename, encoding, callback);
81
+ }
82
+ }
83
+
84
+ readFile(options.file, 'utf8', function (error, input) {
85
+ var output, isYaml;
86
+
87
+ if (error) {
88
+ if (error.code === 'ENOENT') {
89
+ console.error('File not found: ' + options.file);
90
+ process.exit(2);
91
+ }
92
+
93
+ console.error(
94
+ options.trace && error.stack ||
95
+ error.message ||
96
+ String(error));
97
+
98
+ process.exit(1);
99
+ }
100
+
101
+ try {
102
+ output = JSON.parse(input);
103
+ isYaml = false;
104
+ } catch (err) {
105
+ if (err instanceof SyntaxError) {
106
+ try {
107
+ output = [];
108
+ yaml.loadAll(input, function (doc) { output.push(doc); }, {});
109
+ isYaml = true;
110
+
111
+ if (output.length === 0) output = null;
112
+ else if (output.length === 1) output = output[0];
113
+
114
+ } catch (e) {
115
+ if (options.trace && err.stack) console.error(e.stack);
116
+ else console.error(e.toString(options.compact));
117
+
118
+ process.exit(1);
119
+ }
120
+ } else {
121
+ console.error(
122
+ options.trace && err.stack ||
123
+ err.message ||
124
+ String(err));
125
+
126
+ process.exit(1);
127
+ }
128
+ }
129
+
130
+ if (isYaml) console.log(JSON.stringify(output, null, ' '));
131
+ else console.log(yaml.dump(output));
132
+ });
packages/mathml2omml/node_modules/.bin/jsesc ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ (function() {
3
+
4
+ var fs = require('fs');
5
+ var stringEscape = require('../jsesc.js');
6
+ var strings = process.argv.splice(2);
7
+ var stdin = process.stdin;
8
+ var data;
9
+ var timeout;
10
+ var isObject = false;
11
+ var options = {};
12
+ var log = console.log;
13
+
14
+ var main = function() {
15
+ var option = strings[0];
16
+
17
+ if (/^(?:-h|--help|undefined)$/.test(option)) {
18
+ log(
19
+ 'jsesc v%s - https://mths.be/jsesc',
20
+ stringEscape.version
21
+ );
22
+ log([
23
+ '\nUsage:\n',
24
+ '\tjsesc [string]',
25
+ '\tjsesc [-s | --single-quotes] [string]',
26
+ '\tjsesc [-d | --double-quotes] [string]',
27
+ '\tjsesc [-w | --wrap] [string]',
28
+ '\tjsesc [-e | --escape-everything] [string]',
29
+ '\tjsesc [-t | --escape-etago] [string]',
30
+ '\tjsesc [-6 | --es6] [string]',
31
+ '\tjsesc [-l | --lowercase-hex] [string]',
32
+ '\tjsesc [-j | --json] [string]',
33
+ '\tjsesc [-o | --object] [stringified_object]', // `JSON.parse()` the argument
34
+ '\tjsesc [-p | --pretty] [string]', // `compact: false`
35
+ '\tjsesc [-v | --version]',
36
+ '\tjsesc [-h | --help]',
37
+ '\nExamples:\n',
38
+ '\tjsesc \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
39
+ '\tjsesc --json \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
40
+ '\tjsesc --json --escape-everything \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
41
+ '\tjsesc --double-quotes --wrap \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
42
+ '\techo \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\' | jsesc'
43
+ ].join('\n'));
44
+ return process.exit(1);
45
+ }
46
+
47
+ if (/^(?:-v|--version)$/.test(option)) {
48
+ log('v%s', stringEscape.version);
49
+ return process.exit(1);
50
+ }
51
+
52
+ strings.forEach(function(string) {
53
+ // Process options
54
+ if (/^(?:-s|--single-quotes)$/.test(string)) {
55
+ options.quotes = 'single';
56
+ return;
57
+ }
58
+ if (/^(?:-d|--double-quotes)$/.test(string)) {
59
+ options.quotes = 'double';
60
+ return;
61
+ }
62
+ if (/^(?:-w|--wrap)$/.test(string)) {
63
+ options.wrap = true;
64
+ return;
65
+ }
66
+ if (/^(?:-e|--escape-everything)$/.test(string)) {
67
+ options.escapeEverything = true;
68
+ return;
69
+ }
70
+ if (/^(?:-t|--escape-etago)$/.test(string)) {
71
+ options.escapeEtago = true;
72
+ return;
73
+ }
74
+ if (/^(?:-6|--es6)$/.test(string)) {
75
+ options.es6 = true;
76
+ return;
77
+ }
78
+ if (/^(?:-l|--lowercase-hex)$/.test(string)) {
79
+ options.lowercaseHex = true;
80
+ return;
81
+ }
82
+ if (/^(?:-j|--json)$/.test(string)) {
83
+ options.json = true;
84
+ return;
85
+ }
86
+ if (/^(?:-o|--object)$/.test(string)) {
87
+ isObject = true;
88
+ return;
89
+ }
90
+ if (/^(?:-p|--pretty)$/.test(string)) {
91
+ isObject = true;
92
+ options.compact = false;
93
+ return;
94
+ }
95
+
96
+ // Process string(s)
97
+ var result;
98
+ try {
99
+ if (isObject) {
100
+ string = JSON.parse(string);
101
+ }
102
+ result = stringEscape(string, options);
103
+ log(result);
104
+ } catch(error) {
105
+ log(error.message + '\n');
106
+ log('Error: failed to escape.');
107
+ log('If you think this is a bug in jsesc, please report it:');
108
+ log('https://github.com/mathiasbynens/jsesc/issues/new');
109
+ log(
110
+ '\nStack trace using jsesc@%s:\n',
111
+ stringEscape.version
112
+ );
113
+ log(error.stack);
114
+ return process.exit(1);
115
+ }
116
+ });
117
+ // Return with exit status 0 outside of the `forEach` loop, in case
118
+ // multiple strings were passed in.
119
+ return process.exit(0);
120
+
121
+ };
122
+
123
+ if (stdin.isTTY) {
124
+ // handle shell arguments
125
+ main();
126
+ } else {
127
+ // Either the script is called from within a non-TTY context,
128
+ // or `stdin` content is being piped in.
129
+ if (!process.stdout.isTTY) { // called from a non-TTY context
130
+ timeout = setTimeout(function() {
131
+ // if no piped data arrived after a while, handle shell arguments
132
+ main();
133
+ }, 250);
134
+ }
135
+
136
+ data = '';
137
+ stdin.on('data', function(chunk) {
138
+ clearTimeout(timeout);
139
+ data += chunk;
140
+ });
141
+ stdin.on('end', function() {
142
+ strings.push(data.trim());
143
+ main();
144
+ });
145
+ stdin.resume();
146
+ }
147
+
148
+ }());
packages/mathml2omml/node_modules/.bin/json5 ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs')
4
+ const path = require('path')
5
+ const pkg = require('../package.json')
6
+ const JSON5 = require('./')
7
+
8
+ const argv = parseArgs()
9
+
10
+ if (argv.version) {
11
+ version()
12
+ } else if (argv.help) {
13
+ usage()
14
+ } else {
15
+ const inFilename = argv.defaults[0]
16
+
17
+ let readStream
18
+ if (inFilename) {
19
+ readStream = fs.createReadStream(inFilename)
20
+ } else {
21
+ readStream = process.stdin
22
+ }
23
+
24
+ let json5 = ''
25
+ readStream.on('data', data => {
26
+ json5 += data
27
+ })
28
+
29
+ readStream.on('end', () => {
30
+ let space
31
+ if (argv.space === 't' || argv.space === 'tab') {
32
+ space = '\t'
33
+ } else {
34
+ space = Number(argv.space)
35
+ }
36
+
37
+ let value
38
+ try {
39
+ value = JSON5.parse(json5)
40
+ if (!argv.validate) {
41
+ const json = JSON.stringify(value, null, space)
42
+
43
+ let writeStream
44
+
45
+ // --convert is for backward compatibility with v0.5.1. If
46
+ // specified with <file> and not --out-file, then a file with
47
+ // the same name but with a .json extension will be written.
48
+ if (argv.convert && inFilename && !argv.outFile) {
49
+ const parsedFilename = path.parse(inFilename)
50
+ const outFilename = path.format(
51
+ Object.assign(
52
+ parsedFilename,
53
+ {base: path.basename(parsedFilename.base, parsedFilename.ext) + '.json'}
54
+ )
55
+ )
56
+
57
+ writeStream = fs.createWriteStream(outFilename)
58
+ } else if (argv.outFile) {
59
+ writeStream = fs.createWriteStream(argv.outFile)
60
+ } else {
61
+ writeStream = process.stdout
62
+ }
63
+
64
+ writeStream.write(json)
65
+ }
66
+ } catch (err) {
67
+ console.error(err.message)
68
+ process.exit(1)
69
+ }
70
+ })
71
+ }
72
+
73
+ function parseArgs () {
74
+ let convert
75
+ let space
76
+ let validate
77
+ let outFile
78
+ let version
79
+ let help
80
+ const defaults = []
81
+
82
+ const args = process.argv.slice(2)
83
+ for (let i = 0; i < args.length; i++) {
84
+ const arg = args[i]
85
+ switch (arg) {
86
+ case '--convert':
87
+ case '-c':
88
+ convert = true
89
+ break
90
+
91
+ case '--space':
92
+ case '-s':
93
+ space = args[++i]
94
+ break
95
+
96
+ case '--validate':
97
+ case '-v':
98
+ validate = true
99
+ break
100
+
101
+ case '--out-file':
102
+ case '-o':
103
+ outFile = args[++i]
104
+ break
105
+
106
+ case '--version':
107
+ case '-V':
108
+ version = true
109
+ break
110
+
111
+ case '--help':
112
+ case '-h':
113
+ help = true
114
+ break
115
+
116
+ default:
117
+ defaults.push(arg)
118
+ break
119
+ }
120
+ }
121
+
122
+ return {
123
+ convert,
124
+ space,
125
+ validate,
126
+ outFile,
127
+ version,
128
+ help,
129
+ defaults,
130
+ }
131
+ }
132
+
133
+ function version () {
134
+ console.log(pkg.version)
135
+ }
136
+
137
+ function usage () {
138
+ console.log(
139
+ `
140
+ Usage: json5 [options] <file>
141
+
142
+ If <file> is not provided, then STDIN is used.
143
+
144
+ Options:
145
+
146
+ -s, --space The number of spaces to indent or 't' for tabs
147
+ -o, --out-file [file] Output to the specified file, otherwise STDOUT
148
+ -v, --validate Validate JSON5 but do not output JSON
149
+ -V, --version Output the version number
150
+ -h, --help Output usage information`
151
+ )
152
+ }
packages/mathml2omml/node_modules/.bin/lint-staged ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ import { userInfo } from 'node:os'
4
+
5
+ import { supportsColor } from 'chalk'
6
+ import { Option, program } from 'commander'
7
+ import debug from 'debug'
8
+
9
+ import lintStaged from '../lib/index.js'
10
+ import { CONFIG_STDIN_ERROR, RESTORE_STASH_EXAMPLE } from '../lib/messages.js'
11
+ import { readStdin } from '../lib/readStdin.js'
12
+ import { getVersion } from '../lib/version.js'
13
+
14
+ // Force colors for packages that depend on https://www.npmjs.com/package/supports-color
15
+ if (supportsColor) {
16
+ process.env.FORCE_COLOR = supportsColor.level.toString()
17
+ }
18
+
19
+ const debugLog = debug('lint-staged:bin')
20
+
21
+ // Do not terminate main Listr process on SIGINT
22
+ process.on('SIGINT', () => {})
23
+
24
+ program.version(await getVersion())
25
+
26
+ /**
27
+ * This shouldn't be necessary for lint-staged, but add migration step just in case
28
+ * to preserve old behavior of "commander".
29
+ *
30
+ * @todo remove this in the major version
31
+ * @see https://github.com/tj/commander.js/releases/tag/v13.0.0
32
+ * */
33
+ program.allowExcessArguments()
34
+
35
+ program.option('--allow-empty', 'allow empty commits when tasks revert all staged changes', false)
36
+
37
+ program.option(
38
+ '-p, --concurrent <number|boolean>',
39
+ 'the number of tasks to run concurrently, or false for serial',
40
+ true
41
+ )
42
+
43
+ program.option('-c, --config [path]', 'path to configuration file, or - to read from stdin')
44
+
45
+ program.option('--cwd [path]', 'run all tasks in specific directory, instead of the current')
46
+
47
+ program.option('-d, --debug', 'print additional debug information', false)
48
+
49
+ program.addOption(
50
+ new Option(
51
+ '--diff [string]',
52
+ 'override the default "--staged" flag of "git diff" to get list of files. Implies "--no-stash".'
53
+ ).implies({ stash: false })
54
+ )
55
+
56
+ program.option(
57
+ '--diff-filter [string]',
58
+ 'override the default "--diff-filter=ACMR" flag of "git diff" to get list of files'
59
+ )
60
+
61
+ program.option('--max-arg-length [number]', 'maximum length of the command-line argument string', 0)
62
+
63
+ /**
64
+ * We don't want to show the `--stash` flag because it's on by default, and only show the
65
+ * negatable flag `--no-stash` in stead. There seems to be a bug in Commander.js where
66
+ * configuring only the latter won't actually set the default value.
67
+ */
68
+ program
69
+ .addOption(
70
+ new Option('--stash', 'enable the backup stash, and revert in case of errors')
71
+ .default(true)
72
+ .hideHelp()
73
+ )
74
+ .addOption(
75
+ new Option(
76
+ '--no-stash',
77
+ 'disable the backup stash, and do not revert in case of errors. Implies "--no-hide-partially-staged".'
78
+ )
79
+ .default(false)
80
+ .implies({ hidePartiallyStaged: false })
81
+ )
82
+
83
+ /**
84
+ * We don't want to show the `--hide-partially-staged` flag because it's on by default, and only show the
85
+ * negatable flag `--no-hide-partially-staged` in stead. There seems to be a bug in Commander.js where
86
+ * configuring only the latter won't actually set the default value.
87
+ */
88
+ program
89
+ .addOption(
90
+ new Option('--hide-partially-staged', 'hide unstaged changes from partially staged files')
91
+ .default(true)
92
+ .hideHelp()
93
+ )
94
+ .addOption(
95
+ new Option(
96
+ '--no-hide-partially-staged',
97
+ 'disable hiding unstaged changes from partially staged files'
98
+ ).default(false)
99
+ )
100
+
101
+ program.option('-q, --quiet', 'disable lint-staged’s own console output', false)
102
+
103
+ program.option('-r, --relative', 'pass relative filepaths to tasks', false)
104
+
105
+ program.option('-x, --shell [path]', 'skip parsing of tasks for better shell support', false)
106
+
107
+ program.option(
108
+ '-v, --verbose',
109
+ 'show task output even when tasks succeed; by default only failed output is shown',
110
+ false
111
+ )
112
+
113
+ program.addHelpText('afterAll', '\n' + RESTORE_STASH_EXAMPLE)
114
+
115
+ const cliOptions = program.parse(process.argv).opts()
116
+
117
+ if (cliOptions.debug) {
118
+ debug.enable('lint-staged*')
119
+ }
120
+
121
+ const options = {
122
+ allowEmpty: !!cliOptions.allowEmpty,
123
+ concurrent: JSON.parse(cliOptions.concurrent),
124
+ configPath: cliOptions.config,
125
+ cwd: cliOptions.cwd,
126
+ debug: !!cliOptions.debug,
127
+ diff: cliOptions.diff,
128
+ diffFilter: cliOptions.diffFilter,
129
+ maxArgLength: cliOptions.maxArgLength || undefined,
130
+ quiet: !!cliOptions.quiet,
131
+ relative: !!cliOptions.relative,
132
+ shell: cliOptions.shell /* Either a boolean or a string pointing to the shell */,
133
+ stash: !!cliOptions.stash, // commander inverts `no-<x>` flags to `!x`
134
+ hidePartiallyStaged: !!cliOptions.hidePartiallyStaged, // commander inverts `no-<x>` flags to `!x`
135
+ verbose: !!cliOptions.verbose,
136
+ }
137
+
138
+ try {
139
+ const { shell } = userInfo()
140
+ debugLog('Using shell: %s', shell)
141
+ } catch {
142
+ debugLog('Could not determine current shell')
143
+ }
144
+
145
+ debugLog('Options parsed from command-line: %o', options)
146
+
147
+ if (options.configPath === '-') {
148
+ delete options.configPath
149
+ try {
150
+ debugLog('Reading config from stdin')
151
+ options.config = JSON.parse(await readStdin())
152
+ } catch (error) {
153
+ debugLog(CONFIG_STDIN_ERROR, error)
154
+ console.error(CONFIG_STDIN_ERROR)
155
+ process.exit(1)
156
+ }
157
+ }
158
+
159
+ try {
160
+ const passed = await lintStaged(options)
161
+ process.exitCode = passed ? 0 : 1
162
+ } catch {
163
+ process.exitCode = 1
164
+ }
packages/mathml2omml/node_modules/.bin/node-which ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ var which = require("../")
3
+ if (process.argv.length < 3)
4
+ usage()
5
+
6
+ function usage () {
7
+ console.error('usage: which [-as] program ...')
8
+ process.exit(1)
9
+ }
10
+
11
+ var all = false
12
+ var silent = false
13
+ var dashdash = false
14
+ var args = process.argv.slice(2).filter(function (arg) {
15
+ if (dashdash || !/^-/.test(arg))
16
+ return true
17
+
18
+ if (arg === '--') {
19
+ dashdash = true
20
+ return false
21
+ }
22
+
23
+ var flags = arg.substr(1).split('')
24
+ for (var f = 0; f < flags.length; f++) {
25
+ var flag = flags[f]
26
+ switch (flag) {
27
+ case 's':
28
+ silent = true
29
+ break
30
+ case 'a':
31
+ all = true
32
+ break
33
+ default:
34
+ console.error('which: illegal option -- ' + flag)
35
+ usage()
36
+ }
37
+ }
38
+ return false
39
+ })
40
+
41
+ process.exit(args.reduce(function (pv, current) {
42
+ try {
43
+ var f = which.sync(current, { all: all })
44
+ if (all)
45
+ f = f.join('\n')
46
+ if (!silent)
47
+ console.log(f)
48
+ return pv;
49
+ } catch (e) {
50
+ return 1;
51
+ }
52
+ }, 0))
packages/mathml2omml/node_modules/.bin/parser ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ /* eslint-disable no-var, unicorn/prefer-node-protocol */
3
+
4
+ var parser = require("..");
5
+ var fs = require("fs");
6
+
7
+ var filename = process.argv[2];
8
+ if (!filename) {
9
+ console.error("no filename specified");
10
+ } else {
11
+ var file = fs.readFileSync(filename, "utf8");
12
+ var ast = parser.parse(file);
13
+
14
+ console.log(JSON.stringify(ast, null, " "));
15
+ }
packages/mathml2omml/node_modules/.bin/pidtree ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict';
4
+
5
+ var os = require('os');
6
+ var pidtree = require('..');
7
+
8
+ // The method startsWith is not defined on string objects in node 0.10
9
+ // eslint-disable-next-line no-extend-native
10
+ String.prototype.startsWith = function(suffix) {
11
+ return this.substring(0, suffix.length) === suffix;
12
+ };
13
+
14
+ function help() {
15
+ var help =
16
+ ' Usage\n' +
17
+ ' $ pidtree <ppid>\n' +
18
+ '\n' +
19
+ 'Options\n' +
20
+ ' --list To print the pids as a list.\n' +
21
+ '\n' +
22
+ 'Examples\n' +
23
+ ' $ pidtree\n' +
24
+ ' $ pidtree --list\n' +
25
+ ' $ pidtree 1\n' +
26
+ ' $ pidtree 1 --list\n';
27
+ console.log(help);
28
+ }
29
+
30
+ function list(ppid) {
31
+ pidtree(ppid === undefined ? -1 : ppid, function(err, list) {
32
+ if (err) {
33
+ console.error(err.message);
34
+ return;
35
+ }
36
+
37
+ console.log(list.join(os.EOL));
38
+ });
39
+ }
40
+
41
+ function tree(ppid) {
42
+ pidtree(ppid, {advanced: true}, function(err, list) {
43
+ if (err) {
44
+ console.error(err.message);
45
+ return;
46
+ }
47
+
48
+ var parents = {}; // Hash Map of parents
49
+ var tree = {}; // Adiacency Hash Map
50
+ while (list.length > 0) {
51
+ var element = list.pop();
52
+ if (tree[element.ppid]) {
53
+ tree[element.ppid].push(element.pid);
54
+ } else {
55
+ tree[element.ppid] = [element.pid];
56
+ }
57
+
58
+ if (ppid === -1) {
59
+ parents[element.pid] = element.ppid;
60
+ }
61
+ }
62
+
63
+ var roots = [ppid];
64
+ if (ppid === -1) {
65
+ // Get all the roots
66
+ roots = Object.keys(tree).filter(function(node) {
67
+ return parents[node] === undefined;
68
+ });
69
+ }
70
+
71
+ roots.forEach(function(root) {
72
+ print(tree, root);
73
+ });
74
+ });
75
+
76
+ function print(tree, start) {
77
+ function printBranch(node, branch) {
78
+ var isGraphHead = branch.length === 0;
79
+ var children = tree[node] || [];
80
+
81
+ var branchHead = '';
82
+ if (!isGraphHead) {
83
+ branchHead = children.length > 0 ? '┬ ' : '─ ';
84
+ }
85
+
86
+ console.log(branch + branchHead + node);
87
+
88
+ var baseBranch = branch;
89
+ if (!isGraphHead) {
90
+ var isChildOfLastBranch = branch.slice(-2) === '└─';
91
+ baseBranch = branch.slice(0, -2) + (isChildOfLastBranch ? ' ' : '| ');
92
+ }
93
+
94
+ var nextBranch = baseBranch + '├─';
95
+ var lastBranch = baseBranch + '└─';
96
+ children.forEach(function(child, index) {
97
+ printBranch(
98
+ child,
99
+ children.length - 1 === index ? lastBranch : nextBranch
100
+ );
101
+ });
102
+ }
103
+
104
+ printBranch(start, '');
105
+ }
106
+ }
107
+
108
+ function run() {
109
+ var flag;
110
+ var ppid;
111
+ for (var i = 2; i < process.argv.length; i++) {
112
+ if (process.argv[i].startsWith('--')) {
113
+ flag = process.argv[i];
114
+ } else {
115
+ ppid = process.argv[i];
116
+ }
117
+ }
118
+
119
+ if (ppid === undefined) {
120
+ ppid = -1;
121
+ }
122
+
123
+ if (flag === '--list') list(ppid);
124
+ else if (flag === undefined) tree(ppid);
125
+ else help();
126
+ }
127
+
128
+ run();
packages/mathml2omml/node_modules/.bin/resolve ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict';
4
+
5
+ var path = require('path');
6
+ var fs = require('fs');
7
+
8
+ if (
9
+ String(process.env.npm_lifecycle_script).slice(0, 8) !== 'resolve '
10
+ && (
11
+ !process.argv
12
+ || process.argv.length < 2
13
+ || (process.argv[1] !== __filename && fs.statSync(process.argv[1]).ino !== fs.statSync(__filename).ino)
14
+ || (process.env.npm_lifecycle_event !== 'npx' && process.env._ && fs.realpathSync(path.resolve(process.env._)) !== __filename)
15
+ )
16
+ ) {
17
+ console.error('Error: `resolve` must be run directly as an executable');
18
+ process.exit(1);
19
+ }
20
+
21
+ var supportsPreserveSymlinkFlag = require('supports-preserve-symlinks-flag');
22
+
23
+ var preserveSymlinks = false;
24
+ for (var i = 2; i < process.argv.length; i += 1) {
25
+ if (process.argv[i].slice(0, 2) === '--') {
26
+ if (supportsPreserveSymlinkFlag && process.argv[i] === '--preserve-symlinks') {
27
+ preserveSymlinks = true;
28
+ } else if (process.argv[i].length > 2) {
29
+ console.error('Unknown argument ' + process.argv[i].replace(/[=].*$/, ''));
30
+ process.exit(2);
31
+ }
32
+ process.argv.splice(i, 1);
33
+ i -= 1;
34
+ if (process.argv[i] === '--') { break; } // eslint-disable-line no-restricted-syntax
35
+ }
36
+ }
37
+
38
+ if (process.argv.length < 3) {
39
+ console.error('Error: `resolve` expects a specifier');
40
+ process.exit(2);
41
+ }
42
+
43
+ var resolve = require('../');
44
+
45
+ var result = resolve.sync(process.argv[2], {
46
+ basedir: process.cwd(),
47
+ preserveSymlinks: preserveSymlinks
48
+ });
49
+
50
+ console.log(result);
packages/mathml2omml/node_modules/.bin/rollup ADDED
@@ -0,0 +1,1912 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ /*
3
+ @license
4
+ Rollup.js v4.60.2
5
+ Sat, 18 Apr 2026 13:58:01 GMT - commit a6be82b8abd747458afdc7484319f7b5deb92535
6
+
7
+ https://github.com/rollup/rollup
8
+
9
+ Released under the MIT License.
10
+ */
11
+ 'use strict';
12
+
13
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
14
+
15
+ const process$1 = require('node:process');
16
+ const rollup = require('../shared/rollup.js');
17
+ const require$$2 = require('util');
18
+ const require$$0 = require('path');
19
+ const require$$0$1 = require('fs');
20
+ const parseAst_js = require('../shared/parseAst.js');
21
+ const fseventsImporter = require('../shared/fsevents-importer.js');
22
+ const promises = require('node:fs/promises');
23
+ const path = require('node:path');
24
+ const loadConfigFile_js = require('../shared/loadConfigFile.js');
25
+ require('../native.js');
26
+ require('node:perf_hooks');
27
+ require('node:url');
28
+ require('../getLogFilter.js');
29
+
30
+ const help = "rollup version 4.60.2\n=====================================\n\nUsage: rollup [options] <entry file>\n\nOptions:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, Rollup will try to load configuration files in\n the following order:\n rollup.config.mjs -> rollup.config.cjs -> rollup.config.js)\n-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)\n-e, --external <ids> Comma-separate list of module IDs to exclude\n-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)\n-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs\n-h, --help Show this help message\n-i, --input <filename> Input (alternative to <entry file>)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n-n, --name <name> Name for UMD export\n-o, --file <output> Single output file (if absent, prints to stdout)\n-p, --plugin <plugin> Use the plugin specified (may be repeated)\n-v, --version Show version number\n-w, --watch Watch files in bundle and rebuild on changes\n--amd.autoId Generate the AMD ID based off the chunk name\n--amd.basePath <prefix> Path to prepend to auto generated AMD ID\n--amd.define <name> Function to use in place of `define`\n--amd.forceJsExtensionForImports Use `.js` extension in AMD imports\n--amd.id <id> ID for AMD module (default is anonymous)\n--assetFileNames <pattern> Name pattern for emitted assets\n--banner <text> Code to insert at top of bundle (outside wrapper)\n--chunkFileNames <pattern> Name pattern for emitted secondary chunks\n--compact Minify wrapper code\n--context <variable> Specify top-level `this` value\n--no-dynamicImportInCjs Write external dynamic CommonJS imports as require\n--entryFileNames <pattern> Name pattern for emitted entry chunks\n--environment <values> Settings passed to config file (see example)\n--no-esModule Do not add __esModule property\n--exports <mode> Specify export mode (auto, default, named, none)\n--extend Extend global variable defined by --name\n--no-externalImportAttributes Omit import attributes in \"es\" output\n--no-externalLiveBindings Do not generate code to support live bindings\n--failAfterWarnings Exit with an error if the build produced warnings\n--filterLogs <filter> Filter log messages\n--footer <text> Code to insert at end of bundle (outside wrapper)\n--forceExit Force exit the process when done\n--no-freeze Do not freeze namespace objects\n--generatedCode <preset> Which code features to use (es5/es2015)\n--generatedCode.arrowFunctions Use arrow functions in generated code\n--generatedCode.constBindings Use \"const\" in generated code\n--generatedCode.objectShorthand Use shorthand properties in generated code\n--no-generatedCode.reservedNamesAsProps Always quote reserved names as props\n--generatedCode.symbols Use symbols in generated code\n--hashCharacters <name> Use the specified character set for file hashes\n--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks\n--importAttributesKey <name> Use the specified keyword for import attributes\n--no-indent Don't indent result\n--inlineDynamicImports Create single bundle when using dynamic imports\n--no-interop Do not include interop block\n--intro <text> Code to insert at top of bundle (inside wrapper)\n--logLevel <level> Which kind of logs to display\n--no-makeAbsoluteExternalsRelative Prevent normalization of external imports\n--maxParallelFileOps <value> How many files to read in parallel\n--minifyInternalExports Force or disable minification of internal exports\n--noConflict Generate a noConflict method for UMD globals\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--perf Display performance timings\n--no-preserveEntrySignatures Avoid facade chunks for entry points\n--preserveModules Preserve module structure\n--preserveModulesRoot Put preserved modules under this path at root level\n--preserveSymlinks Do not follow symlinks when resolving files\n--no-reexportProtoFromExternal Ignore `__proto__` in star re-exports\n--no-sanitizeFileName Do not replace invalid characters in file names\n--shimMissingExports Create shim variables for missing exports\n--silent Don't print warnings\n--sourcemapBaseUrl <url> Emit absolute sourcemap URLs with given base\n--sourcemapDebugIds Emit unique debug ids in source and sourcemaps\n--sourcemapExcludeSources Do not include source code in source maps\n--sourcemapFile <file> Specify bundle position for source maps\n--sourcemapFileNames <pattern> Name pattern for emitted sourcemaps\n--stdin=ext Specify file extension used for stdin input\n--no-stdin Do not read \"-\" from stdin\n--no-strict Don't emit `\"use strict\";` in the generated modules\n--strictDeprecations Throw errors for deprecated features\n--no-systemNullSetters Do not replace empty SystemJS setters with `null`\n--no-treeshake Disable tree-shaking optimisations\n--no-treeshake.annotations Ignore pure call annotations\n--treeshake.correctVarValueBeforeDeclaration Deoptimize variables until declared\n--treeshake.manualPureFunctions <names> Manually declare functions as pure\n--no-treeshake.moduleSideEffects Assume modules have no side effects\n--no-treeshake.propertyReadSideEffects Ignore property access side effects\n--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking\n--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw\n--validate Validate output\n--waitForBundleInput Wait for bundle input files\n--watch.allowInputInsideOutputPath Whether the input path is allowed to be a\n subpath of the output path\n--watch.buildDelay <number> Throttle watch rebuilds\n--no-watch.clearScreen Do not clear the screen when rebuilding\n--watch.exclude <files> Exclude files from being watched\n--watch.include <files> Limit watching to specified files\n--watch.onBundleEnd <cmd> Shell command to run on `\"BUNDLE_END\"` event\n--watch.onBundleStart <cmd> Shell command to run on `\"BUNDLE_START\"` event\n--watch.onEnd <cmd> Shell command to run on `\"END\"` event\n--watch.onError <cmd> Shell command to run on `\"ERROR\"` event\n--watch.onStart <cmd> Shell command to run on `\"START\"` event\n--watch.skipWrite Do not write files to disk when watching\n\nExamples:\n\n# use settings in config file\nrollup -c\n\n# in config file, process.env.INCLUDE_DEPS === 'true'\n# and process.env.BUILD === 'production'\nrollup -c --environment INCLUDE_DEPS,BUILD:production\n\n# create CommonJS bundle.js from src/main.js\nrollup --format=cjs --file=bundle.js -- src/main.js\n\n# create self-executing IIFE using `window.jQuery`\n# and `window._` as external globals\nrollup -f iife --globals jquery:jQuery,lodash:_ \\\n -i src/app.js -o build/app.js -m build/app.js.map\n\nNotes:\n\n* When piping to stdout, only inline sourcemaps are permitted\n\nFor more information visit https://rollupjs.org\n";
31
+
32
+ /**
33
+ * @license
34
+ * Copyright (c) 2016, Contributors
35
+ * SPDX-License-Identifier: ISC
36
+ */
37
+ function camelCase(str) {
38
+ // Handle the case where an argument is provided as camel case, e.g., fooBar.
39
+ // by ensuring that the string isn't already mixed case:
40
+ const isCamelCase = str !== str.toLowerCase() && str !== str.toUpperCase();
41
+ if (!isCamelCase) {
42
+ str = str.toLowerCase();
43
+ }
44
+ if (str.indexOf('-') === -1 && str.indexOf('_') === -1) {
45
+ return str;
46
+ }
47
+ else {
48
+ let camelcase = '';
49
+ let nextChrUpper = false;
50
+ const leadingHyphens = str.match(/^-+/);
51
+ for (let i = leadingHyphens ? leadingHyphens[0].length : 0; i < str.length; i++) {
52
+ let chr = str.charAt(i);
53
+ if (nextChrUpper) {
54
+ nextChrUpper = false;
55
+ chr = chr.toUpperCase();
56
+ }
57
+ if (i !== 0 && (chr === '-' || chr === '_')) {
58
+ nextChrUpper = true;
59
+ }
60
+ else if (chr !== '-' && chr !== '_') {
61
+ camelcase += chr;
62
+ }
63
+ }
64
+ return camelcase;
65
+ }
66
+ }
67
+ function decamelize(str, joinString) {
68
+ const lowercase = str.toLowerCase();
69
+ joinString = joinString || '-';
70
+ let notCamelcase = '';
71
+ for (let i = 0; i < str.length; i++) {
72
+ const chrLower = lowercase.charAt(i);
73
+ const chrString = str.charAt(i);
74
+ if (chrLower !== chrString && i > 0) {
75
+ notCamelcase += `${joinString}${lowercase.charAt(i)}`;
76
+ }
77
+ else {
78
+ notCamelcase += chrString;
79
+ }
80
+ }
81
+ return notCamelcase;
82
+ }
83
+ function looksLikeNumber(x) {
84
+ if (x === null || x === undefined)
85
+ return false;
86
+ // if loaded from config, may already be a number.
87
+ if (typeof x === 'number')
88
+ return true;
89
+ // hexadecimal.
90
+ if (/^0x[0-9a-f]+$/i.test(x))
91
+ return true;
92
+ // don't treat 0123 as a number; as it drops the leading '0'.
93
+ if (/^0[^.]/.test(x))
94
+ return false;
95
+ return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
96
+ }
97
+
98
+ /**
99
+ * @license
100
+ * Copyright (c) 2016, Contributors
101
+ * SPDX-License-Identifier: ISC
102
+ */
103
+ // take an un-split argv string and tokenize it.
104
+ function tokenizeArgString(argString) {
105
+ if (Array.isArray(argString)) {
106
+ return argString.map(e => typeof e !== 'string' ? e + '' : e);
107
+ }
108
+ argString = argString.trim();
109
+ let i = 0;
110
+ let prevC = null;
111
+ let c = null;
112
+ let opening = null;
113
+ const args = [];
114
+ for (let ii = 0; ii < argString.length; ii++) {
115
+ prevC = c;
116
+ c = argString.charAt(ii);
117
+ // split on spaces unless we're in quotes.
118
+ if (c === ' ' && !opening) {
119
+ if (!(prevC === ' ')) {
120
+ i++;
121
+ }
122
+ continue;
123
+ }
124
+ // don't split the string if we're in matching
125
+ // opening or closing single and double quotes.
126
+ if (c === opening) {
127
+ opening = null;
128
+ }
129
+ else if ((c === "'" || c === '"') && !opening) {
130
+ opening = c;
131
+ }
132
+ if (!args[i])
133
+ args[i] = '';
134
+ args[i] += c;
135
+ }
136
+ return args;
137
+ }
138
+
139
+ /**
140
+ * @license
141
+ * Copyright (c) 2016, Contributors
142
+ * SPDX-License-Identifier: ISC
143
+ */
144
+ var DefaultValuesForTypeKey;
145
+ (function (DefaultValuesForTypeKey) {
146
+ DefaultValuesForTypeKey["BOOLEAN"] = "boolean";
147
+ DefaultValuesForTypeKey["STRING"] = "string";
148
+ DefaultValuesForTypeKey["NUMBER"] = "number";
149
+ DefaultValuesForTypeKey["ARRAY"] = "array";
150
+ })(DefaultValuesForTypeKey || (DefaultValuesForTypeKey = {}));
151
+
152
+ /**
153
+ * @license
154
+ * Copyright (c) 2016, Contributors
155
+ * SPDX-License-Identifier: ISC
156
+ */
157
+ let mixin;
158
+ class YargsParser {
159
+ constructor(_mixin) {
160
+ mixin = _mixin;
161
+ }
162
+ parse(argsInput, options) {
163
+ const opts = Object.assign({
164
+ alias: undefined,
165
+ array: undefined,
166
+ boolean: undefined,
167
+ config: undefined,
168
+ configObjects: undefined,
169
+ configuration: undefined,
170
+ coerce: undefined,
171
+ count: undefined,
172
+ default: undefined,
173
+ envPrefix: undefined,
174
+ narg: undefined,
175
+ normalize: undefined,
176
+ string: undefined,
177
+ number: undefined,
178
+ __: undefined,
179
+ key: undefined
180
+ }, options);
181
+ // allow a string argument to be passed in rather
182
+ // than an argv array.
183
+ const args = tokenizeArgString(argsInput);
184
+ // tokenizeArgString adds extra quotes to args if argsInput is a string
185
+ // only strip those extra quotes in processValue if argsInput is a string
186
+ const inputIsString = typeof argsInput === 'string';
187
+ // aliases might have transitive relationships, normalize this.
188
+ const aliases = combineAliases(Object.assign(Object.create(null), opts.alias));
189
+ const configuration = Object.assign({
190
+ 'boolean-negation': true,
191
+ 'camel-case-expansion': true,
192
+ 'combine-arrays': false,
193
+ 'dot-notation': true,
194
+ 'duplicate-arguments-array': true,
195
+ 'flatten-duplicate-arrays': true,
196
+ 'greedy-arrays': true,
197
+ 'halt-at-non-option': false,
198
+ 'nargs-eats-options': false,
199
+ 'negation-prefix': 'no-',
200
+ 'parse-numbers': true,
201
+ 'parse-positional-numbers': true,
202
+ 'populate--': false,
203
+ 'set-placeholder-key': false,
204
+ 'short-option-groups': true,
205
+ 'strip-aliased': false,
206
+ 'strip-dashed': false,
207
+ 'unknown-options-as-args': false
208
+ }, opts.configuration);
209
+ const defaults = Object.assign(Object.create(null), opts.default);
210
+ const configObjects = opts.configObjects || [];
211
+ const envPrefix = opts.envPrefix;
212
+ const notFlagsOption = configuration['populate--'];
213
+ const notFlagsArgv = notFlagsOption ? '--' : '_';
214
+ const newAliases = Object.create(null);
215
+ const defaulted = Object.create(null);
216
+ // allow a i18n handler to be passed in, default to a fake one (util.format).
217
+ const __ = opts.__ || mixin.format;
218
+ const flags = {
219
+ aliases: Object.create(null),
220
+ arrays: Object.create(null),
221
+ bools: Object.create(null),
222
+ strings: Object.create(null),
223
+ numbers: Object.create(null),
224
+ counts: Object.create(null),
225
+ normalize: Object.create(null),
226
+ configs: Object.create(null),
227
+ nargs: Object.create(null),
228
+ coercions: Object.create(null),
229
+ keys: []
230
+ };
231
+ const negative = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/;
232
+ const negatedBoolean = new RegExp('^--' + configuration['negation-prefix'] + '(.+)');
233
+ [].concat(opts.array || []).filter(Boolean).forEach(function (opt) {
234
+ const key = typeof opt === 'object' ? opt.key : opt;
235
+ // assign to flags[bools|strings|numbers]
236
+ const assignment = Object.keys(opt).map(function (key) {
237
+ const arrayFlagKeys = {
238
+ boolean: 'bools',
239
+ string: 'strings',
240
+ number: 'numbers'
241
+ };
242
+ return arrayFlagKeys[key];
243
+ }).filter(Boolean).pop();
244
+ // assign key to be coerced
245
+ if (assignment) {
246
+ flags[assignment][key] = true;
247
+ }
248
+ flags.arrays[key] = true;
249
+ flags.keys.push(key);
250
+ });
251
+ [].concat(opts.boolean || []).filter(Boolean).forEach(function (key) {
252
+ flags.bools[key] = true;
253
+ flags.keys.push(key);
254
+ });
255
+ [].concat(opts.string || []).filter(Boolean).forEach(function (key) {
256
+ flags.strings[key] = true;
257
+ flags.keys.push(key);
258
+ });
259
+ [].concat(opts.number || []).filter(Boolean).forEach(function (key) {
260
+ flags.numbers[key] = true;
261
+ flags.keys.push(key);
262
+ });
263
+ [].concat(opts.count || []).filter(Boolean).forEach(function (key) {
264
+ flags.counts[key] = true;
265
+ flags.keys.push(key);
266
+ });
267
+ [].concat(opts.normalize || []).filter(Boolean).forEach(function (key) {
268
+ flags.normalize[key] = true;
269
+ flags.keys.push(key);
270
+ });
271
+ if (typeof opts.narg === 'object') {
272
+ Object.entries(opts.narg).forEach(([key, value]) => {
273
+ if (typeof value === 'number') {
274
+ flags.nargs[key] = value;
275
+ flags.keys.push(key);
276
+ }
277
+ });
278
+ }
279
+ if (typeof opts.coerce === 'object') {
280
+ Object.entries(opts.coerce).forEach(([key, value]) => {
281
+ if (typeof value === 'function') {
282
+ flags.coercions[key] = value;
283
+ flags.keys.push(key);
284
+ }
285
+ });
286
+ }
287
+ if (typeof opts.config !== 'undefined') {
288
+ if (Array.isArray(opts.config) || typeof opts.config === 'string') {
289
+ [].concat(opts.config).filter(Boolean).forEach(function (key) {
290
+ flags.configs[key] = true;
291
+ });
292
+ }
293
+ else if (typeof opts.config === 'object') {
294
+ Object.entries(opts.config).forEach(([key, value]) => {
295
+ if (typeof value === 'boolean' || typeof value === 'function') {
296
+ flags.configs[key] = value;
297
+ }
298
+ });
299
+ }
300
+ }
301
+ // create a lookup table that takes into account all
302
+ // combinations of aliases: {f: ['foo'], foo: ['f']}
303
+ extendAliases(opts.key, aliases, opts.default, flags.arrays);
304
+ // apply default values to all aliases.
305
+ Object.keys(defaults).forEach(function (key) {
306
+ (flags.aliases[key] || []).forEach(function (alias) {
307
+ defaults[alias] = defaults[key];
308
+ });
309
+ });
310
+ let error = null;
311
+ checkConfiguration();
312
+ let notFlags = [];
313
+ const argv = Object.assign(Object.create(null), { _: [] });
314
+ // TODO(bcoe): for the first pass at removing object prototype we didn't
315
+ // remove all prototypes from objects returned by this API, we might want
316
+ // to gradually move towards doing so.
317
+ const argvReturn = {};
318
+ for (let i = 0; i < args.length; i++) {
319
+ const arg = args[i];
320
+ const truncatedArg = arg.replace(/^-{3,}/, '---');
321
+ let broken;
322
+ let key;
323
+ let letters;
324
+ let m;
325
+ let next;
326
+ let value;
327
+ // any unknown option (except for end-of-options, "--")
328
+ if (arg !== '--' && /^-/.test(arg) && isUnknownOptionAsArg(arg)) {
329
+ pushPositional(arg);
330
+ // ---, ---=, ----, etc,
331
+ }
332
+ else if (truncatedArg.match(/^---+(=|$)/)) {
333
+ // options without key name are invalid.
334
+ pushPositional(arg);
335
+ continue;
336
+ // -- separated by =
337
+ }
338
+ else if (arg.match(/^--.+=/) || (!configuration['short-option-groups'] && arg.match(/^-.+=/))) {
339
+ // Using [\s\S] instead of . because js doesn't support the
340
+ // 'dotall' regex modifier. See:
341
+ // http://stackoverflow.com/a/1068308/13216
342
+ m = arg.match(/^--?([^=]+)=([\s\S]*)$/);
343
+ // arrays format = '--f=a b c'
344
+ if (m !== null && Array.isArray(m) && m.length >= 3) {
345
+ if (checkAllAliases(m[1], flags.arrays)) {
346
+ i = eatArray(i, m[1], args, m[2]);
347
+ }
348
+ else if (checkAllAliases(m[1], flags.nargs) !== false) {
349
+ // nargs format = '--f=monkey washing cat'
350
+ i = eatNargs(i, m[1], args, m[2]);
351
+ }
352
+ else {
353
+ setArg(m[1], m[2], true);
354
+ }
355
+ }
356
+ }
357
+ else if (arg.match(negatedBoolean) && configuration['boolean-negation']) {
358
+ m = arg.match(negatedBoolean);
359
+ if (m !== null && Array.isArray(m) && m.length >= 2) {
360
+ key = m[1];
361
+ setArg(key, checkAllAliases(key, flags.arrays) ? [false] : false);
362
+ }
363
+ // -- separated by space.
364
+ }
365
+ else if (arg.match(/^--.+/) || (!configuration['short-option-groups'] && arg.match(/^-[^-]+/))) {
366
+ m = arg.match(/^--?(.+)/);
367
+ if (m !== null && Array.isArray(m) && m.length >= 2) {
368
+ key = m[1];
369
+ if (checkAllAliases(key, flags.arrays)) {
370
+ // array format = '--foo a b c'
371
+ i = eatArray(i, key, args);
372
+ }
373
+ else if (checkAllAliases(key, flags.nargs) !== false) {
374
+ // nargs format = '--foo a b c'
375
+ // should be truthy even if: flags.nargs[key] === 0
376
+ i = eatNargs(i, key, args);
377
+ }
378
+ else {
379
+ next = args[i + 1];
380
+ if (next !== undefined && (!next.match(/^-/) ||
381
+ next.match(negative)) &&
382
+ !checkAllAliases(key, flags.bools) &&
383
+ !checkAllAliases(key, flags.counts)) {
384
+ setArg(key, next);
385
+ i++;
386
+ }
387
+ else if (/^(true|false)$/.test(next)) {
388
+ setArg(key, next);
389
+ i++;
390
+ }
391
+ else {
392
+ setArg(key, defaultValue(key));
393
+ }
394
+ }
395
+ }
396
+ // dot-notation flag separated by '='.
397
+ }
398
+ else if (arg.match(/^-.\..+=/)) {
399
+ m = arg.match(/^-([^=]+)=([\s\S]*)$/);
400
+ if (m !== null && Array.isArray(m) && m.length >= 3) {
401
+ setArg(m[1], m[2]);
402
+ }
403
+ // dot-notation flag separated by space.
404
+ }
405
+ else if (arg.match(/^-.\..+/) && !arg.match(negative)) {
406
+ next = args[i + 1];
407
+ m = arg.match(/^-(.\..+)/);
408
+ if (m !== null && Array.isArray(m) && m.length >= 2) {
409
+ key = m[1];
410
+ if (next !== undefined && !next.match(/^-/) &&
411
+ !checkAllAliases(key, flags.bools) &&
412
+ !checkAllAliases(key, flags.counts)) {
413
+ setArg(key, next);
414
+ i++;
415
+ }
416
+ else {
417
+ setArg(key, defaultValue(key));
418
+ }
419
+ }
420
+ }
421
+ else if (arg.match(/^-[^-]+/) && !arg.match(negative)) {
422
+ letters = arg.slice(1, -1).split('');
423
+ broken = false;
424
+ for (let j = 0; j < letters.length; j++) {
425
+ next = arg.slice(j + 2);
426
+ if (letters[j + 1] && letters[j + 1] === '=') {
427
+ value = arg.slice(j + 3);
428
+ key = letters[j];
429
+ if (checkAllAliases(key, flags.arrays)) {
430
+ // array format = '-f=a b c'
431
+ i = eatArray(i, key, args, value);
432
+ }
433
+ else if (checkAllAliases(key, flags.nargs) !== false) {
434
+ // nargs format = '-f=monkey washing cat'
435
+ i = eatNargs(i, key, args, value);
436
+ }
437
+ else {
438
+ setArg(key, value);
439
+ }
440
+ broken = true;
441
+ break;
442
+ }
443
+ if (next === '-') {
444
+ setArg(letters[j], next);
445
+ continue;
446
+ }
447
+ // current letter is an alphabetic character and next value is a number
448
+ if (/[A-Za-z]/.test(letters[j]) &&
449
+ /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next) &&
450
+ checkAllAliases(next, flags.bools) === false) {
451
+ setArg(letters[j], next);
452
+ broken = true;
453
+ break;
454
+ }
455
+ if (letters[j + 1] && letters[j + 1].match(/\W/)) {
456
+ setArg(letters[j], next);
457
+ broken = true;
458
+ break;
459
+ }
460
+ else {
461
+ setArg(letters[j], defaultValue(letters[j]));
462
+ }
463
+ }
464
+ key = arg.slice(-1)[0];
465
+ if (!broken && key !== '-') {
466
+ if (checkAllAliases(key, flags.arrays)) {
467
+ // array format = '-f a b c'
468
+ i = eatArray(i, key, args);
469
+ }
470
+ else if (checkAllAliases(key, flags.nargs) !== false) {
471
+ // nargs format = '-f a b c'
472
+ // should be truthy even if: flags.nargs[key] === 0
473
+ i = eatNargs(i, key, args);
474
+ }
475
+ else {
476
+ next = args[i + 1];
477
+ if (next !== undefined && (!/^(-|--)[^-]/.test(next) ||
478
+ next.match(negative)) &&
479
+ !checkAllAliases(key, flags.bools) &&
480
+ !checkAllAliases(key, flags.counts)) {
481
+ setArg(key, next);
482
+ i++;
483
+ }
484
+ else if (/^(true|false)$/.test(next)) {
485
+ setArg(key, next);
486
+ i++;
487
+ }
488
+ else {
489
+ setArg(key, defaultValue(key));
490
+ }
491
+ }
492
+ }
493
+ }
494
+ else if (arg.match(/^-[0-9]$/) &&
495
+ arg.match(negative) &&
496
+ checkAllAliases(arg.slice(1), flags.bools)) {
497
+ // single-digit boolean alias, e.g: xargs -0
498
+ key = arg.slice(1);
499
+ setArg(key, defaultValue(key));
500
+ }
501
+ else if (arg === '--') {
502
+ notFlags = args.slice(i + 1);
503
+ break;
504
+ }
505
+ else if (configuration['halt-at-non-option']) {
506
+ notFlags = args.slice(i);
507
+ break;
508
+ }
509
+ else {
510
+ pushPositional(arg);
511
+ }
512
+ }
513
+ // order of precedence:
514
+ // 1. command line arg
515
+ // 2. value from env var
516
+ // 3. value from config file
517
+ // 4. value from config objects
518
+ // 5. configured default value
519
+ applyEnvVars(argv, true); // special case: check env vars that point to config file
520
+ applyEnvVars(argv, false);
521
+ setConfig(argv);
522
+ setConfigObjects();
523
+ applyDefaultsAndAliases(argv, flags.aliases, defaults, true);
524
+ applyCoercions(argv);
525
+ if (configuration['set-placeholder-key'])
526
+ setPlaceholderKeys(argv);
527
+ // for any counts either not in args or without an explicit default, set to 0
528
+ Object.keys(flags.counts).forEach(function (key) {
529
+ if (!hasKey(argv, key.split('.')))
530
+ setArg(key, 0);
531
+ });
532
+ // '--' defaults to undefined.
533
+ if (notFlagsOption && notFlags.length)
534
+ argv[notFlagsArgv] = [];
535
+ notFlags.forEach(function (key) {
536
+ argv[notFlagsArgv].push(key);
537
+ });
538
+ if (configuration['camel-case-expansion'] && configuration['strip-dashed']) {
539
+ Object.keys(argv).filter(key => key !== '--' && key.includes('-')).forEach(key => {
540
+ delete argv[key];
541
+ });
542
+ }
543
+ if (configuration['strip-aliased']) {
544
+ [].concat(...Object.keys(aliases).map(k => aliases[k])).forEach(alias => {
545
+ if (configuration['camel-case-expansion'] && alias.includes('-')) {
546
+ delete argv[alias.split('.').map(prop => camelCase(prop)).join('.')];
547
+ }
548
+ delete argv[alias];
549
+ });
550
+ }
551
+ // Push argument into positional array, applying numeric coercion:
552
+ function pushPositional(arg) {
553
+ const maybeCoercedNumber = maybeCoerceNumber('_', arg);
554
+ if (typeof maybeCoercedNumber === 'string' || typeof maybeCoercedNumber === 'number') {
555
+ argv._.push(maybeCoercedNumber);
556
+ }
557
+ }
558
+ // how many arguments should we consume, based
559
+ // on the nargs option?
560
+ function eatNargs(i, key, args, argAfterEqualSign) {
561
+ let ii;
562
+ let toEat = checkAllAliases(key, flags.nargs);
563
+ // NaN has a special meaning for the array type, indicating that one or
564
+ // more values are expected.
565
+ toEat = typeof toEat !== 'number' || isNaN(toEat) ? 1 : toEat;
566
+ if (toEat === 0) {
567
+ if (!isUndefined(argAfterEqualSign)) {
568
+ error = Error(__('Argument unexpected for: %s', key));
569
+ }
570
+ setArg(key, defaultValue(key));
571
+ return i;
572
+ }
573
+ let available = isUndefined(argAfterEqualSign) ? 0 : 1;
574
+ if (configuration['nargs-eats-options']) {
575
+ // classic behavior, yargs eats positional and dash arguments.
576
+ if (args.length - (i + 1) + available < toEat) {
577
+ error = Error(__('Not enough arguments following: %s', key));
578
+ }
579
+ available = toEat;
580
+ }
581
+ else {
582
+ // nargs will not consume flag arguments, e.g., -abc, --foo,
583
+ // and terminates when one is observed.
584
+ for (ii = i + 1; ii < args.length; ii++) {
585
+ if (!args[ii].match(/^-[^0-9]/) || args[ii].match(negative) || isUnknownOptionAsArg(args[ii]))
586
+ available++;
587
+ else
588
+ break;
589
+ }
590
+ if (available < toEat)
591
+ error = Error(__('Not enough arguments following: %s', key));
592
+ }
593
+ let consumed = Math.min(available, toEat);
594
+ if (!isUndefined(argAfterEqualSign) && consumed > 0) {
595
+ setArg(key, argAfterEqualSign);
596
+ consumed--;
597
+ }
598
+ for (ii = i + 1; ii < (consumed + i + 1); ii++) {
599
+ setArg(key, args[ii]);
600
+ }
601
+ return (i + consumed);
602
+ }
603
+ // if an option is an array, eat all non-hyphenated arguments
604
+ // following it... YUM!
605
+ // e.g., --foo apple banana cat becomes ["apple", "banana", "cat"]
606
+ function eatArray(i, key, args, argAfterEqualSign) {
607
+ let argsToSet = [];
608
+ let next = argAfterEqualSign || args[i + 1];
609
+ // If both array and nargs are configured, enforce the nargs count:
610
+ const nargsCount = checkAllAliases(key, flags.nargs);
611
+ if (checkAllAliases(key, flags.bools) && !(/^(true|false)$/.test(next))) {
612
+ argsToSet.push(true);
613
+ }
614
+ else if (isUndefined(next) ||
615
+ (isUndefined(argAfterEqualSign) && /^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next))) {
616
+ // for keys without value ==> argsToSet remains an empty []
617
+ // set user default value, if available
618
+ if (defaults[key] !== undefined) {
619
+ const defVal = defaults[key];
620
+ argsToSet = Array.isArray(defVal) ? defVal : [defVal];
621
+ }
622
+ }
623
+ else {
624
+ // value in --option=value is eaten as is
625
+ if (!isUndefined(argAfterEqualSign)) {
626
+ argsToSet.push(processValue(key, argAfterEqualSign, true));
627
+ }
628
+ for (let ii = i + 1; ii < args.length; ii++) {
629
+ if ((!configuration['greedy-arrays'] && argsToSet.length > 0) ||
630
+ (nargsCount && typeof nargsCount === 'number' && argsToSet.length >= nargsCount))
631
+ break;
632
+ next = args[ii];
633
+ if (/^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next))
634
+ break;
635
+ i = ii;
636
+ argsToSet.push(processValue(key, next, inputIsString));
637
+ }
638
+ }
639
+ // If both array and nargs are configured, create an error if less than
640
+ // nargs positionals were found. NaN has special meaning, indicating
641
+ // that at least one value is required (more are okay).
642
+ if (typeof nargsCount === 'number' && ((nargsCount && argsToSet.length < nargsCount) ||
643
+ (isNaN(nargsCount) && argsToSet.length === 0))) {
644
+ error = Error(__('Not enough arguments following: %s', key));
645
+ }
646
+ setArg(key, argsToSet);
647
+ return i;
648
+ }
649
+ function setArg(key, val, shouldStripQuotes = inputIsString) {
650
+ if (/-/.test(key) && configuration['camel-case-expansion']) {
651
+ const alias = key.split('.').map(function (prop) {
652
+ return camelCase(prop);
653
+ }).join('.');
654
+ addNewAlias(key, alias);
655
+ }
656
+ const value = processValue(key, val, shouldStripQuotes);
657
+ const splitKey = key.split('.');
658
+ setKey(argv, splitKey, value);
659
+ // handle populating aliases of the full key
660
+ if (flags.aliases[key]) {
661
+ flags.aliases[key].forEach(function (x) {
662
+ const keyProperties = x.split('.');
663
+ setKey(argv, keyProperties, value);
664
+ });
665
+ }
666
+ // handle populating aliases of the first element of the dot-notation key
667
+ if (splitKey.length > 1 && configuration['dot-notation']) {
668
+ (flags.aliases[splitKey[0]] || []).forEach(function (x) {
669
+ let keyProperties = x.split('.');
670
+ // expand alias with nested objects in key
671
+ const a = [].concat(splitKey);
672
+ a.shift(); // nuke the old key.
673
+ keyProperties = keyProperties.concat(a);
674
+ // populate alias only if is not already an alias of the full key
675
+ // (already populated above)
676
+ if (!(flags.aliases[key] || []).includes(keyProperties.join('.'))) {
677
+ setKey(argv, keyProperties, value);
678
+ }
679
+ });
680
+ }
681
+ // Set normalize getter and setter when key is in 'normalize' but isn't an array
682
+ if (checkAllAliases(key, flags.normalize) && !checkAllAliases(key, flags.arrays)) {
683
+ const keys = [key].concat(flags.aliases[key] || []);
684
+ keys.forEach(function (key) {
685
+ Object.defineProperty(argvReturn, key, {
686
+ enumerable: true,
687
+ get() {
688
+ return val;
689
+ },
690
+ set(value) {
691
+ val = typeof value === 'string' ? mixin.normalize(value) : value;
692
+ }
693
+ });
694
+ });
695
+ }
696
+ }
697
+ function addNewAlias(key, alias) {
698
+ if (!(flags.aliases[key] && flags.aliases[key].length)) {
699
+ flags.aliases[key] = [alias];
700
+ newAliases[alias] = true;
701
+ }
702
+ if (!(flags.aliases[alias] && flags.aliases[alias].length)) {
703
+ addNewAlias(alias, key);
704
+ }
705
+ }
706
+ function processValue(key, val, shouldStripQuotes) {
707
+ // strings may be quoted, clean this up as we assign values.
708
+ if (shouldStripQuotes) {
709
+ val = stripQuotes(val);
710
+ }
711
+ // handle parsing boolean arguments --foo=true --bar false.
712
+ if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
713
+ if (typeof val === 'string')
714
+ val = val === 'true';
715
+ }
716
+ let value = Array.isArray(val)
717
+ ? val.map(function (v) { return maybeCoerceNumber(key, v); })
718
+ : maybeCoerceNumber(key, val);
719
+ // increment a count given as arg (either no value or value parsed as boolean)
720
+ if (checkAllAliases(key, flags.counts) && (isUndefined(value) || typeof value === 'boolean')) {
721
+ value = increment();
722
+ }
723
+ // Set normalized value when key is in 'normalize' and in 'arrays'
724
+ if (checkAllAliases(key, flags.normalize) && checkAllAliases(key, flags.arrays)) {
725
+ if (Array.isArray(val))
726
+ value = val.map((val) => { return mixin.normalize(val); });
727
+ else
728
+ value = mixin.normalize(val);
729
+ }
730
+ return value;
731
+ }
732
+ function maybeCoerceNumber(key, value) {
733
+ if (!configuration['parse-positional-numbers'] && key === '_')
734
+ return value;
735
+ if (!checkAllAliases(key, flags.strings) && !checkAllAliases(key, flags.bools) && !Array.isArray(value)) {
736
+ const shouldCoerceNumber = looksLikeNumber(value) && configuration['parse-numbers'] && (Number.isSafeInteger(Math.floor(parseFloat(`${value}`))));
737
+ if (shouldCoerceNumber || (!isUndefined(value) && checkAllAliases(key, flags.numbers))) {
738
+ value = Number(value);
739
+ }
740
+ }
741
+ return value;
742
+ }
743
+ // set args from config.json file, this should be
744
+ // applied last so that defaults can be applied.
745
+ function setConfig(argv) {
746
+ const configLookup = Object.create(null);
747
+ // expand defaults/aliases, in-case any happen to reference
748
+ // the config.json file.
749
+ applyDefaultsAndAliases(configLookup, flags.aliases, defaults);
750
+ Object.keys(flags.configs).forEach(function (configKey) {
751
+ const configPath = argv[configKey] || configLookup[configKey];
752
+ if (configPath) {
753
+ try {
754
+ let config = null;
755
+ const resolvedConfigPath = mixin.resolve(mixin.cwd(), configPath);
756
+ const resolveConfig = flags.configs[configKey];
757
+ if (typeof resolveConfig === 'function') {
758
+ try {
759
+ config = resolveConfig(resolvedConfigPath);
760
+ }
761
+ catch (e) {
762
+ config = e;
763
+ }
764
+ if (config instanceof Error) {
765
+ error = config;
766
+ return;
767
+ }
768
+ }
769
+ else {
770
+ config = mixin.require(resolvedConfigPath);
771
+ }
772
+ setConfigObject(config);
773
+ }
774
+ catch (ex) {
775
+ // Deno will receive a PermissionDenied error if an attempt is
776
+ // made to load config without the --allow-read flag:
777
+ if (ex.name === 'PermissionDenied')
778
+ error = ex;
779
+ else if (argv[configKey])
780
+ error = Error(__('Invalid JSON config file: %s', configPath));
781
+ }
782
+ }
783
+ });
784
+ }
785
+ // set args from config object.
786
+ // it recursively checks nested objects.
787
+ function setConfigObject(config, prev) {
788
+ Object.keys(config).forEach(function (key) {
789
+ const value = config[key];
790
+ const fullKey = prev ? prev + '.' + key : key;
791
+ // if the value is an inner object and we have dot-notation
792
+ // enabled, treat inner objects in config the same as
793
+ // heavily nested dot notations (foo.bar.apple).
794
+ if (typeof value === 'object' && value !== null && !Array.isArray(value) && configuration['dot-notation']) {
795
+ // if the value is an object but not an array, check nested object
796
+ setConfigObject(value, fullKey);
797
+ }
798
+ else {
799
+ // setting arguments via CLI takes precedence over
800
+ // values within the config file.
801
+ if (!hasKey(argv, fullKey.split('.')) || (checkAllAliases(fullKey, flags.arrays) && configuration['combine-arrays'])) {
802
+ setArg(fullKey, value);
803
+ }
804
+ }
805
+ });
806
+ }
807
+ // set all config objects passed in opts
808
+ function setConfigObjects() {
809
+ if (typeof configObjects !== 'undefined') {
810
+ configObjects.forEach(function (configObject) {
811
+ setConfigObject(configObject);
812
+ });
813
+ }
814
+ }
815
+ function applyEnvVars(argv, configOnly) {
816
+ if (typeof envPrefix === 'undefined')
817
+ return;
818
+ const prefix = typeof envPrefix === 'string' ? envPrefix : '';
819
+ const env = mixin.env();
820
+ Object.keys(env).forEach(function (envVar) {
821
+ if (prefix === '' || envVar.lastIndexOf(prefix, 0) === 0) {
822
+ // get array of nested keys and convert them to camel case
823
+ const keys = envVar.split('__').map(function (key, i) {
824
+ if (i === 0) {
825
+ key = key.substring(prefix.length);
826
+ }
827
+ return camelCase(key);
828
+ });
829
+ if (((configOnly && flags.configs[keys.join('.')]) || !configOnly) && !hasKey(argv, keys)) {
830
+ setArg(keys.join('.'), env[envVar]);
831
+ }
832
+ }
833
+ });
834
+ }
835
+ function applyCoercions(argv) {
836
+ let coerce;
837
+ const applied = new Set();
838
+ Object.keys(argv).forEach(function (key) {
839
+ if (!applied.has(key)) { // If we haven't already coerced this option via one of its aliases
840
+ coerce = checkAllAliases(key, flags.coercions);
841
+ if (typeof coerce === 'function') {
842
+ try {
843
+ const value = maybeCoerceNumber(key, coerce(argv[key]));
844
+ ([].concat(flags.aliases[key] || [], key)).forEach(ali => {
845
+ applied.add(ali);
846
+ argv[ali] = value;
847
+ });
848
+ }
849
+ catch (err) {
850
+ error = err;
851
+ }
852
+ }
853
+ }
854
+ });
855
+ }
856
+ function setPlaceholderKeys(argv) {
857
+ flags.keys.forEach((key) => {
858
+ // don't set placeholder keys for dot notation options 'foo.bar'.
859
+ if (~key.indexOf('.'))
860
+ return;
861
+ if (typeof argv[key] === 'undefined')
862
+ argv[key] = undefined;
863
+ });
864
+ return argv;
865
+ }
866
+ function applyDefaultsAndAliases(obj, aliases, defaults, canLog = false) {
867
+ Object.keys(defaults).forEach(function (key) {
868
+ if (!hasKey(obj, key.split('.'))) {
869
+ setKey(obj, key.split('.'), defaults[key]);
870
+ if (canLog)
871
+ defaulted[key] = true;
872
+ (aliases[key] || []).forEach(function (x) {
873
+ if (hasKey(obj, x.split('.')))
874
+ return;
875
+ setKey(obj, x.split('.'), defaults[key]);
876
+ });
877
+ }
878
+ });
879
+ }
880
+ function hasKey(obj, keys) {
881
+ let o = obj;
882
+ if (!configuration['dot-notation'])
883
+ keys = [keys.join('.')];
884
+ keys.slice(0, -1).forEach(function (key) {
885
+ o = (o[key] || {});
886
+ });
887
+ const key = keys[keys.length - 1];
888
+ if (typeof o !== 'object')
889
+ return false;
890
+ else
891
+ return key in o;
892
+ }
893
+ function setKey(obj, keys, value) {
894
+ let o = obj;
895
+ if (!configuration['dot-notation'])
896
+ keys = [keys.join('.')];
897
+ keys.slice(0, -1).forEach(function (key) {
898
+ // TODO(bcoe): in the next major version of yargs, switch to
899
+ // Object.create(null) for dot notation:
900
+ key = sanitizeKey(key);
901
+ if (typeof o === 'object' && o[key] === undefined) {
902
+ o[key] = {};
903
+ }
904
+ if (typeof o[key] !== 'object' || Array.isArray(o[key])) {
905
+ // ensure that o[key] is an array, and that the last item is an empty object.
906
+ if (Array.isArray(o[key])) {
907
+ o[key].push({});
908
+ }
909
+ else {
910
+ o[key] = [o[key], {}];
911
+ }
912
+ // we want to update the empty object at the end of the o[key] array, so set o to that object
913
+ o = o[key][o[key].length - 1];
914
+ }
915
+ else {
916
+ o = o[key];
917
+ }
918
+ });
919
+ // TODO(bcoe): in the next major version of yargs, switch to
920
+ // Object.create(null) for dot notation:
921
+ const key = sanitizeKey(keys[keys.length - 1]);
922
+ const isTypeArray = checkAllAliases(keys.join('.'), flags.arrays);
923
+ const isValueArray = Array.isArray(value);
924
+ let duplicate = configuration['duplicate-arguments-array'];
925
+ // nargs has higher priority than duplicate
926
+ if (!duplicate && checkAllAliases(key, flags.nargs)) {
927
+ duplicate = true;
928
+ if ((!isUndefined(o[key]) && flags.nargs[key] === 1) || (Array.isArray(o[key]) && o[key].length === flags.nargs[key])) {
929
+ o[key] = undefined;
930
+ }
931
+ }
932
+ if (value === increment()) {
933
+ o[key] = increment(o[key]);
934
+ }
935
+ else if (Array.isArray(o[key])) {
936
+ if (duplicate && isTypeArray && isValueArray) {
937
+ o[key] = configuration['flatten-duplicate-arrays'] ? o[key].concat(value) : (Array.isArray(o[key][0]) ? o[key] : [o[key]]).concat([value]);
938
+ }
939
+ else if (!duplicate && Boolean(isTypeArray) === Boolean(isValueArray)) {
940
+ o[key] = value;
941
+ }
942
+ else {
943
+ o[key] = o[key].concat([value]);
944
+ }
945
+ }
946
+ else if (o[key] === undefined && isTypeArray) {
947
+ o[key] = isValueArray ? value : [value];
948
+ }
949
+ else if (duplicate && !(o[key] === undefined ||
950
+ checkAllAliases(key, flags.counts) ||
951
+ checkAllAliases(key, flags.bools))) {
952
+ o[key] = [o[key], value];
953
+ }
954
+ else {
955
+ o[key] = value;
956
+ }
957
+ }
958
+ // extend the aliases list with inferred aliases.
959
+ function extendAliases(...args) {
960
+ args.forEach(function (obj) {
961
+ Object.keys(obj || {}).forEach(function (key) {
962
+ // short-circuit if we've already added a key
963
+ // to the aliases array, for example it might
964
+ // exist in both 'opts.default' and 'opts.key'.
965
+ if (flags.aliases[key])
966
+ return;
967
+ flags.aliases[key] = [].concat(aliases[key] || []);
968
+ // For "--option-name", also set argv.optionName
969
+ flags.aliases[key].concat(key).forEach(function (x) {
970
+ if (/-/.test(x) && configuration['camel-case-expansion']) {
971
+ const c = camelCase(x);
972
+ if (c !== key && flags.aliases[key].indexOf(c) === -1) {
973
+ flags.aliases[key].push(c);
974
+ newAliases[c] = true;
975
+ }
976
+ }
977
+ });
978
+ // For "--optionName", also set argv['option-name']
979
+ flags.aliases[key].concat(key).forEach(function (x) {
980
+ if (x.length > 1 && /[A-Z]/.test(x) && configuration['camel-case-expansion']) {
981
+ const c = decamelize(x, '-');
982
+ if (c !== key && flags.aliases[key].indexOf(c) === -1) {
983
+ flags.aliases[key].push(c);
984
+ newAliases[c] = true;
985
+ }
986
+ }
987
+ });
988
+ flags.aliases[key].forEach(function (x) {
989
+ flags.aliases[x] = [key].concat(flags.aliases[key].filter(function (y) {
990
+ return x !== y;
991
+ }));
992
+ });
993
+ });
994
+ });
995
+ }
996
+ function checkAllAliases(key, flag) {
997
+ const toCheck = [].concat(flags.aliases[key] || [], key);
998
+ const keys = Object.keys(flag);
999
+ const setAlias = toCheck.find(key => keys.includes(key));
1000
+ return setAlias ? flag[setAlias] : false;
1001
+ }
1002
+ function hasAnyFlag(key) {
1003
+ const flagsKeys = Object.keys(flags);
1004
+ const toCheck = [].concat(flagsKeys.map(k => flags[k]));
1005
+ return toCheck.some(function (flag) {
1006
+ return Array.isArray(flag) ? flag.includes(key) : flag[key];
1007
+ });
1008
+ }
1009
+ function hasFlagsMatching(arg, ...patterns) {
1010
+ const toCheck = [].concat(...patterns);
1011
+ return toCheck.some(function (pattern) {
1012
+ const match = arg.match(pattern);
1013
+ return match && hasAnyFlag(match[1]);
1014
+ });
1015
+ }
1016
+ // based on a simplified version of the short flag group parsing logic
1017
+ function hasAllShortFlags(arg) {
1018
+ // if this is a negative number, or doesn't start with a single hyphen, it's not a short flag group
1019
+ if (arg.match(negative) || !arg.match(/^-[^-]+/)) {
1020
+ return false;
1021
+ }
1022
+ let hasAllFlags = true;
1023
+ let next;
1024
+ const letters = arg.slice(1).split('');
1025
+ for (let j = 0; j < letters.length; j++) {
1026
+ next = arg.slice(j + 2);
1027
+ if (!hasAnyFlag(letters[j])) {
1028
+ hasAllFlags = false;
1029
+ break;
1030
+ }
1031
+ if ((letters[j + 1] && letters[j + 1] === '=') ||
1032
+ next === '-' ||
1033
+ (/[A-Za-z]/.test(letters[j]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) ||
1034
+ (letters[j + 1] && letters[j + 1].match(/\W/))) {
1035
+ break;
1036
+ }
1037
+ }
1038
+ return hasAllFlags;
1039
+ }
1040
+ function isUnknownOptionAsArg(arg) {
1041
+ return configuration['unknown-options-as-args'] && isUnknownOption(arg);
1042
+ }
1043
+ function isUnknownOption(arg) {
1044
+ arg = arg.replace(/^-{3,}/, '--');
1045
+ // ignore negative numbers
1046
+ if (arg.match(negative)) {
1047
+ return false;
1048
+ }
1049
+ // if this is a short option group and all of them are configured, it isn't unknown
1050
+ if (hasAllShortFlags(arg)) {
1051
+ return false;
1052
+ }
1053
+ // e.g. '--count=2'
1054
+ const flagWithEquals = /^-+([^=]+?)=[\s\S]*$/;
1055
+ // e.g. '-a' or '--arg'
1056
+ const normalFlag = /^-+([^=]+?)$/;
1057
+ // e.g. '-a-'
1058
+ const flagEndingInHyphen = /^-+([^=]+?)-$/;
1059
+ // e.g. '-abc123'
1060
+ const flagEndingInDigits = /^-+([^=]+?\d+)$/;
1061
+ // e.g. '-a/usr/local'
1062
+ const flagEndingInNonWordCharacters = /^-+([^=]+?)\W+.*$/;
1063
+ // check the different types of flag styles, including negatedBoolean, a pattern defined near the start of the parse method
1064
+ return !hasFlagsMatching(arg, flagWithEquals, negatedBoolean, normalFlag, flagEndingInHyphen, flagEndingInDigits, flagEndingInNonWordCharacters);
1065
+ }
1066
+ // make a best effort to pick a default value
1067
+ // for an option based on name and type.
1068
+ function defaultValue(key) {
1069
+ if (!checkAllAliases(key, flags.bools) &&
1070
+ !checkAllAliases(key, flags.counts) &&
1071
+ `${key}` in defaults) {
1072
+ return defaults[key];
1073
+ }
1074
+ else {
1075
+ return defaultForType(guessType(key));
1076
+ }
1077
+ }
1078
+ // return a default value, given the type of a flag.,
1079
+ function defaultForType(type) {
1080
+ const def = {
1081
+ [DefaultValuesForTypeKey.BOOLEAN]: true,
1082
+ [DefaultValuesForTypeKey.STRING]: '',
1083
+ [DefaultValuesForTypeKey.NUMBER]: undefined,
1084
+ [DefaultValuesForTypeKey.ARRAY]: []
1085
+ };
1086
+ return def[type];
1087
+ }
1088
+ // given a flag, enforce a default type.
1089
+ function guessType(key) {
1090
+ let type = DefaultValuesForTypeKey.BOOLEAN;
1091
+ if (checkAllAliases(key, flags.strings))
1092
+ type = DefaultValuesForTypeKey.STRING;
1093
+ else if (checkAllAliases(key, flags.numbers))
1094
+ type = DefaultValuesForTypeKey.NUMBER;
1095
+ else if (checkAllAliases(key, flags.bools))
1096
+ type = DefaultValuesForTypeKey.BOOLEAN;
1097
+ else if (checkAllAliases(key, flags.arrays))
1098
+ type = DefaultValuesForTypeKey.ARRAY;
1099
+ return type;
1100
+ }
1101
+ function isUndefined(num) {
1102
+ return num === undefined;
1103
+ }
1104
+ // check user configuration settings for inconsistencies
1105
+ function checkConfiguration() {
1106
+ // count keys should not be set as array/narg
1107
+ Object.keys(flags.counts).find(key => {
1108
+ if (checkAllAliases(key, flags.arrays)) {
1109
+ error = Error(__('Invalid configuration: %s, opts.count excludes opts.array.', key));
1110
+ return true;
1111
+ }
1112
+ else if (checkAllAliases(key, flags.nargs)) {
1113
+ error = Error(__('Invalid configuration: %s, opts.count excludes opts.narg.', key));
1114
+ return true;
1115
+ }
1116
+ return false;
1117
+ });
1118
+ }
1119
+ return {
1120
+ aliases: Object.assign({}, flags.aliases),
1121
+ argv: Object.assign(argvReturn, argv),
1122
+ configuration: configuration,
1123
+ defaulted: Object.assign({}, defaulted),
1124
+ error: error,
1125
+ newAliases: Object.assign({}, newAliases)
1126
+ };
1127
+ }
1128
+ }
1129
+ // if any aliases reference each other, we should
1130
+ // merge them together.
1131
+ function combineAliases(aliases) {
1132
+ const aliasArrays = [];
1133
+ const combined = Object.create(null);
1134
+ let change = true;
1135
+ // turn alias lookup hash {key: ['alias1', 'alias2']} into
1136
+ // a simple array ['key', 'alias1', 'alias2']
1137
+ Object.keys(aliases).forEach(function (key) {
1138
+ aliasArrays.push([].concat(aliases[key], key));
1139
+ });
1140
+ // combine arrays until zero changes are
1141
+ // made in an iteration.
1142
+ while (change) {
1143
+ change = false;
1144
+ for (let i = 0; i < aliasArrays.length; i++) {
1145
+ for (let ii = i + 1; ii < aliasArrays.length; ii++) {
1146
+ const intersect = aliasArrays[i].filter(function (v) {
1147
+ return aliasArrays[ii].indexOf(v) !== -1;
1148
+ });
1149
+ if (intersect.length) {
1150
+ aliasArrays[i] = aliasArrays[i].concat(aliasArrays[ii]);
1151
+ aliasArrays.splice(ii, 1);
1152
+ change = true;
1153
+ break;
1154
+ }
1155
+ }
1156
+ }
1157
+ }
1158
+ // map arrays back to the hash-lookup (de-dupe while
1159
+ // we're at it).
1160
+ aliasArrays.forEach(function (aliasArray) {
1161
+ aliasArray = aliasArray.filter(function (v, i, self) {
1162
+ return self.indexOf(v) === i;
1163
+ });
1164
+ const lastAlias = aliasArray.pop();
1165
+ if (lastAlias !== undefined && typeof lastAlias === 'string') {
1166
+ combined[lastAlias] = aliasArray;
1167
+ }
1168
+ });
1169
+ return combined;
1170
+ }
1171
+ // this function should only be called when a count is given as an arg
1172
+ // it is NOT called to set a default value
1173
+ // thus we can start the count at 1 instead of 0
1174
+ function increment(orig) {
1175
+ return orig !== undefined ? orig + 1 : 1;
1176
+ }
1177
+ // TODO(bcoe): in the next major version of yargs, switch to
1178
+ // Object.create(null) for dot notation:
1179
+ function sanitizeKey(key) {
1180
+ if (key === '__proto__')
1181
+ return '___proto___';
1182
+ return key;
1183
+ }
1184
+ function stripQuotes(val) {
1185
+ return (typeof val === 'string' &&
1186
+ (val[0] === "'" || val[0] === '"') &&
1187
+ val[val.length - 1] === val[0])
1188
+ ? val.substring(1, val.length - 1)
1189
+ : val;
1190
+ }
1191
+
1192
+ /**
1193
+ * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
1194
+ * CJS and ESM environments.
1195
+ *
1196
+ * @license
1197
+ * Copyright (c) 2016, Contributors
1198
+ * SPDX-License-Identifier: ISC
1199
+ */
1200
+ var _a, _b, _c;
1201
+ // See https://github.com/yargs/yargs-parser#supported-nodejs-versions for our
1202
+ // version support policy. The YARGS_MIN_NODE_VERSION is used for testing only.
1203
+ const minNodeVersion = (process && process.env && process.env.YARGS_MIN_NODE_VERSION)
1204
+ ? Number(process.env.YARGS_MIN_NODE_VERSION)
1205
+ : 12;
1206
+ const nodeVersion = (_b = (_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node) !== null && _b !== void 0 ? _b : (_c = process === null || process === void 0 ? void 0 : process.version) === null || _c === void 0 ? void 0 : _c.slice(1);
1207
+ if (nodeVersion) {
1208
+ const major = Number(nodeVersion.match(/^([^.]+)/)[1]);
1209
+ if (major < minNodeVersion) {
1210
+ throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
1211
+ }
1212
+ }
1213
+ // Creates a yargs-parser instance using Node.js standard libraries:
1214
+ const env = process ? process.env : {};
1215
+ const parser = new YargsParser({
1216
+ cwd: process.cwd,
1217
+ env: () => {
1218
+ return env;
1219
+ },
1220
+ format: require$$2.format,
1221
+ normalize: require$$0.normalize,
1222
+ resolve: require$$0.resolve,
1223
+ // TODO: figure out a way to combine ESM and CJS coverage, such that
1224
+ // we can exercise all the lines below:
1225
+ require: (path) => {
1226
+ if (typeof require !== 'undefined') {
1227
+ return require(path);
1228
+ }
1229
+ else if (path.match(/\.json$/)) {
1230
+ // Addresses: https://github.com/yargs/yargs/issues/2040
1231
+ return JSON.parse(require$$0$1.readFileSync(path, 'utf8'));
1232
+ }
1233
+ else {
1234
+ throw Error('only .json config files are supported in ESM');
1235
+ }
1236
+ }
1237
+ });
1238
+ const yargsParser = function Parser(args, opts) {
1239
+ const result = parser.parse(args.slice(), opts);
1240
+ return result.argv;
1241
+ };
1242
+ yargsParser.detailed = function (args, opts) {
1243
+ return parser.parse(args.slice(), opts);
1244
+ };
1245
+ yargsParser.camelCase = camelCase;
1246
+ yargsParser.decamelize = decamelize;
1247
+ yargsParser.looksLikeNumber = looksLikeNumber;
1248
+
1249
+ /******************************************************************************
1250
+ Copyright (c) Microsoft Corporation.
1251
+
1252
+ Permission to use, copy, modify, and/or distribute this software for any
1253
+ purpose with or without fee is hereby granted.
1254
+
1255
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1256
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1257
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1258
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1259
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1260
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1261
+ PERFORMANCE OF THIS SOFTWARE.
1262
+ ***************************************************************************** */
1263
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
1264
+
1265
+
1266
+ function __addDisposableResource(env, value, async) {
1267
+ if (value !== null && value !== void 0) {
1268
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
1269
+ var dispose, inner;
1270
+ if (async) {
1271
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
1272
+ dispose = value[Symbol.asyncDispose];
1273
+ }
1274
+ if (dispose === void 0) {
1275
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
1276
+ dispose = value[Symbol.dispose];
1277
+ if (async) inner = dispose;
1278
+ }
1279
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
1280
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
1281
+ env.stack.push({ value: value, dispose: dispose, async: async });
1282
+ }
1283
+ else if (async) {
1284
+ env.stack.push({ async: true });
1285
+ }
1286
+ return value;
1287
+
1288
+ }
1289
+
1290
+ var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
1291
+ var e = new Error(message);
1292
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1293
+ };
1294
+
1295
+ function __disposeResources(env) {
1296
+ function fail(e) {
1297
+ env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
1298
+ env.hasError = true;
1299
+ }
1300
+ var r, s = 0;
1301
+ function next() {
1302
+ while (r = env.stack.pop()) {
1303
+ try {
1304
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
1305
+ if (r.dispose) {
1306
+ var result = r.dispose.call(r.value);
1307
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
1308
+ }
1309
+ else s |= 1;
1310
+ }
1311
+ catch (e) {
1312
+ fail(e);
1313
+ }
1314
+ }
1315
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
1316
+ if (env.hasError) throw env.error;
1317
+ }
1318
+ return next();
1319
+ }
1320
+
1321
+ const toZeroIfInfinity = value => Number.isFinite(value) ? value : 0;
1322
+
1323
+ function parseNumber(milliseconds) {
1324
+ return {
1325
+ days: Math.trunc(milliseconds / 86_400_000),
1326
+ hours: Math.trunc(milliseconds / 3_600_000 % 24),
1327
+ minutes: Math.trunc(milliseconds / 60_000 % 60),
1328
+ seconds: Math.trunc(milliseconds / 1000 % 60),
1329
+ milliseconds: Math.trunc(milliseconds % 1000),
1330
+ microseconds: Math.trunc(toZeroIfInfinity(milliseconds * 1000) % 1000),
1331
+ nanoseconds: Math.trunc(toZeroIfInfinity(milliseconds * 1e6) % 1000),
1332
+ };
1333
+ }
1334
+
1335
+ function parseBigint(milliseconds) {
1336
+ return {
1337
+ days: milliseconds / 86_400_000n,
1338
+ hours: milliseconds / 3_600_000n % 24n,
1339
+ minutes: milliseconds / 60_000n % 60n,
1340
+ seconds: milliseconds / 1000n % 60n,
1341
+ milliseconds: milliseconds % 1000n,
1342
+ microseconds: 0n,
1343
+ nanoseconds: 0n,
1344
+ };
1345
+ }
1346
+
1347
+ function parseMilliseconds(milliseconds) {
1348
+ switch (typeof milliseconds) {
1349
+ case 'number': {
1350
+ if (Number.isFinite(milliseconds)) {
1351
+ return parseNumber(milliseconds);
1352
+ }
1353
+
1354
+ break;
1355
+ }
1356
+
1357
+ case 'bigint': {
1358
+ return parseBigint(milliseconds);
1359
+ }
1360
+
1361
+ // No default
1362
+ }
1363
+
1364
+ throw new TypeError('Expected a finite number or bigint');
1365
+ }
1366
+
1367
+ const isZero = value => value === 0 || value === 0n;
1368
+ const pluralize = (word, count) => (count === 1 || count === 1n) ? word : `${word}s`;
1369
+
1370
+ const SECOND_ROUNDING_EPSILON = 0.000_000_1;
1371
+ const ONE_DAY_IN_MILLISECONDS = 24n * 60n * 60n * 1000n;
1372
+
1373
+ function prettyMilliseconds(milliseconds, options) {
1374
+ const isBigInt = typeof milliseconds === 'bigint';
1375
+ if (!isBigInt && !Number.isFinite(milliseconds)) {
1376
+ throw new TypeError('Expected a finite number or bigint');
1377
+ }
1378
+
1379
+ options = {...options};
1380
+
1381
+ const sign = milliseconds < 0 ? '-' : '';
1382
+ milliseconds = milliseconds < 0 ? -milliseconds : milliseconds; // Cannot use `Math.abs()` because of BigInt support.
1383
+
1384
+ if (options.colonNotation) {
1385
+ options.compact = false;
1386
+ options.formatSubMilliseconds = false;
1387
+ options.separateMilliseconds = false;
1388
+ options.verbose = false;
1389
+ }
1390
+
1391
+ if (options.compact) {
1392
+ options.unitCount = 1;
1393
+ options.secondsDecimalDigits = 0;
1394
+ options.millisecondsDecimalDigits = 0;
1395
+ }
1396
+
1397
+ let result = [];
1398
+
1399
+ const floorDecimals = (value, decimalDigits) => {
1400
+ const flooredInterimValue = Math.floor((value * (10 ** decimalDigits)) + SECOND_ROUNDING_EPSILON);
1401
+ const flooredValue = Math.round(flooredInterimValue) / (10 ** decimalDigits);
1402
+ return flooredValue.toFixed(decimalDigits);
1403
+ };
1404
+
1405
+ const add = (value, long, short, valueString) => {
1406
+ if (
1407
+ (result.length === 0 || !options.colonNotation)
1408
+ && isZero(value)
1409
+ && !(options.colonNotation && short === 'm')) {
1410
+ return;
1411
+ }
1412
+
1413
+ valueString ??= String(value);
1414
+ if (options.colonNotation) {
1415
+ const wholeDigits = valueString.includes('.') ? valueString.split('.')[0].length : valueString.length;
1416
+ const minLength = result.length > 0 ? 2 : 1;
1417
+ valueString = '0'.repeat(Math.max(0, minLength - wholeDigits)) + valueString;
1418
+ } else {
1419
+ valueString += options.verbose ? ' ' + pluralize(long, value) : short;
1420
+ }
1421
+
1422
+ result.push(valueString);
1423
+ };
1424
+
1425
+ const parsed = parseMilliseconds(milliseconds);
1426
+ const days = BigInt(parsed.days);
1427
+
1428
+ if (options.hideYearAndDays) {
1429
+ add((BigInt(days) * 24n) + BigInt(parsed.hours), 'hour', 'h');
1430
+ } else {
1431
+ if (options.hideYear) {
1432
+ add(days, 'day', 'd');
1433
+ } else {
1434
+ add(days / 365n, 'year', 'y');
1435
+ add(days % 365n, 'day', 'd');
1436
+ }
1437
+
1438
+ add(Number(parsed.hours), 'hour', 'h');
1439
+ }
1440
+
1441
+ add(Number(parsed.minutes), 'minute', 'm');
1442
+
1443
+ if (!options.hideSeconds) {
1444
+ if (
1445
+ options.separateMilliseconds
1446
+ || options.formatSubMilliseconds
1447
+ || (!options.colonNotation && milliseconds < 1000 && !options.subSecondsAsDecimals)
1448
+ ) {
1449
+ const seconds = Number(parsed.seconds);
1450
+ const milliseconds = Number(parsed.milliseconds);
1451
+ const microseconds = Number(parsed.microseconds);
1452
+ const nanoseconds = Number(parsed.nanoseconds);
1453
+
1454
+ add(seconds, 'second', 's');
1455
+
1456
+ if (options.formatSubMilliseconds) {
1457
+ add(milliseconds, 'millisecond', 'ms');
1458
+ add(microseconds, 'microsecond', 'µs');
1459
+ add(nanoseconds, 'nanosecond', 'ns');
1460
+ } else {
1461
+ const millisecondsAndBelow
1462
+ = milliseconds
1463
+ + (microseconds / 1000)
1464
+ + (nanoseconds / 1e6);
1465
+
1466
+ const millisecondsDecimalDigits
1467
+ = typeof options.millisecondsDecimalDigits === 'number'
1468
+ ? options.millisecondsDecimalDigits
1469
+ : 0;
1470
+
1471
+ const roundedMilliseconds = millisecondsAndBelow >= 1
1472
+ ? Math.round(millisecondsAndBelow)
1473
+ : Math.ceil(millisecondsAndBelow);
1474
+
1475
+ const millisecondsString = millisecondsDecimalDigits
1476
+ ? millisecondsAndBelow.toFixed(millisecondsDecimalDigits)
1477
+ : roundedMilliseconds;
1478
+
1479
+ add(
1480
+ Number.parseFloat(millisecondsString),
1481
+ 'millisecond',
1482
+ 'ms',
1483
+ millisecondsString,
1484
+ );
1485
+ }
1486
+ } else {
1487
+ const seconds = (
1488
+ (isBigInt ? Number(milliseconds % ONE_DAY_IN_MILLISECONDS) : milliseconds)
1489
+ / 1000
1490
+ ) % 60;
1491
+ const secondsDecimalDigits
1492
+ = typeof options.secondsDecimalDigits === 'number'
1493
+ ? options.secondsDecimalDigits
1494
+ : 1;
1495
+ const secondsFixed = floorDecimals(seconds, secondsDecimalDigits);
1496
+ const secondsString = options.keepDecimalsOnWholeSeconds
1497
+ ? secondsFixed
1498
+ : secondsFixed.replace(/\.0+$/, '');
1499
+ add(Number.parseFloat(secondsString), 'second', 's', secondsString);
1500
+ }
1501
+ }
1502
+
1503
+ if (result.length === 0) {
1504
+ return sign + '0' + (options.verbose ? ' milliseconds' : 'ms');
1505
+ }
1506
+
1507
+ const separator = options.colonNotation ? ':' : ' ';
1508
+ if (typeof options.unitCount === 'number') {
1509
+ result = result.slice(0, Math.max(options.unitCount, 1));
1510
+ }
1511
+
1512
+ return sign + result.join(separator);
1513
+ }
1514
+
1515
+ const BYTE_UNITS = [
1516
+ 'B',
1517
+ 'kB',
1518
+ 'MB',
1519
+ 'GB',
1520
+ 'TB',
1521
+ 'PB',
1522
+ 'EB',
1523
+ 'ZB',
1524
+ 'YB',
1525
+ ];
1526
+
1527
+ const BIBYTE_UNITS = [
1528
+ 'B',
1529
+ 'KiB',
1530
+ 'MiB',
1531
+ 'GiB',
1532
+ 'TiB',
1533
+ 'PiB',
1534
+ 'EiB',
1535
+ 'ZiB',
1536
+ 'YiB',
1537
+ ];
1538
+
1539
+ const BIT_UNITS = [
1540
+ 'b',
1541
+ 'kbit',
1542
+ 'Mbit',
1543
+ 'Gbit',
1544
+ 'Tbit',
1545
+ 'Pbit',
1546
+ 'Ebit',
1547
+ 'Zbit',
1548
+ 'Ybit',
1549
+ ];
1550
+
1551
+ const BIBIT_UNITS = [
1552
+ 'b',
1553
+ 'kibit',
1554
+ 'Mibit',
1555
+ 'Gibit',
1556
+ 'Tibit',
1557
+ 'Pibit',
1558
+ 'Eibit',
1559
+ 'Zibit',
1560
+ 'Yibit',
1561
+ ];
1562
+
1563
+ /*
1564
+ Formats the given number using `Number#toLocaleString`.
1565
+ - If locale is a string, the value is expected to be a locale-key (for example: `de`).
1566
+ - If locale is true, the system default locale is used for translation.
1567
+ - If no value for locale is specified, the number is returned unmodified.
1568
+ */
1569
+ const toLocaleString = (number, locale, options) => {
1570
+ let result = number;
1571
+ if (typeof locale === 'string' || Array.isArray(locale)) {
1572
+ result = number.toLocaleString(locale, options);
1573
+ } else if (locale === true || options !== undefined) {
1574
+ result = number.toLocaleString(undefined, options);
1575
+ }
1576
+
1577
+ return result;
1578
+ };
1579
+
1580
+ const log10 = numberOrBigInt => {
1581
+ if (typeof numberOrBigInt === 'number') {
1582
+ return Math.log10(numberOrBigInt);
1583
+ }
1584
+
1585
+ const string = numberOrBigInt.toString(10);
1586
+
1587
+ return string.length + Math.log10(`0.${string.slice(0, 15)}`);
1588
+ };
1589
+
1590
+ const log = numberOrBigInt => {
1591
+ if (typeof numberOrBigInt === 'number') {
1592
+ return Math.log(numberOrBigInt);
1593
+ }
1594
+
1595
+ return log10(numberOrBigInt) * Math.log(10);
1596
+ };
1597
+
1598
+ const divide = (numberOrBigInt, divisor) => {
1599
+ if (typeof numberOrBigInt === 'number') {
1600
+ return numberOrBigInt / divisor;
1601
+ }
1602
+
1603
+ const integerPart = numberOrBigInt / BigInt(divisor);
1604
+ const remainder = numberOrBigInt % BigInt(divisor);
1605
+ return Number(integerPart) + (Number(remainder) / divisor);
1606
+ };
1607
+
1608
+ const applyFixedWidth = (result, fixedWidth) => {
1609
+ if (fixedWidth === undefined) {
1610
+ return result;
1611
+ }
1612
+
1613
+ if (typeof fixedWidth !== 'number' || !Number.isSafeInteger(fixedWidth) || fixedWidth < 0) {
1614
+ throw new TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof fixedWidth}: ${fixedWidth}`);
1615
+ }
1616
+
1617
+ if (fixedWidth === 0) {
1618
+ return result;
1619
+ }
1620
+
1621
+ return result.length < fixedWidth ? result.padStart(fixedWidth, ' ') : result;
1622
+ };
1623
+
1624
+ const buildLocaleOptions = options => {
1625
+ const {minimumFractionDigits, maximumFractionDigits} = options;
1626
+
1627
+ if (minimumFractionDigits === undefined && maximumFractionDigits === undefined) {
1628
+ return undefined;
1629
+ }
1630
+
1631
+ return {
1632
+ ...(minimumFractionDigits !== undefined && {minimumFractionDigits}),
1633
+ ...(maximumFractionDigits !== undefined && {maximumFractionDigits}),
1634
+ roundingMode: 'trunc',
1635
+ };
1636
+ };
1637
+
1638
+ function prettyBytes(number, options) {
1639
+ if (typeof number !== 'bigint' && !Number.isFinite(number)) {
1640
+ throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
1641
+ }
1642
+
1643
+ options = {
1644
+ bits: false,
1645
+ binary: false,
1646
+ space: true,
1647
+ nonBreakingSpace: false,
1648
+ ...options,
1649
+ };
1650
+
1651
+ const UNITS = options.bits
1652
+ ? (options.binary ? BIBIT_UNITS : BIT_UNITS)
1653
+ : (options.binary ? BIBYTE_UNITS : BYTE_UNITS);
1654
+
1655
+ const separator = options.space ? (options.nonBreakingSpace ? '\u00A0' : ' ') : '';
1656
+
1657
+ // Handle signed zero case
1658
+ const isZero = typeof number === 'number' ? number === 0 : number === 0n;
1659
+ if (options.signed && isZero) {
1660
+ const result = ` 0${separator}${UNITS[0]}`;
1661
+ return applyFixedWidth(result, options.fixedWidth);
1662
+ }
1663
+
1664
+ const isNegative = number < 0;
1665
+ const prefix = isNegative ? '-' : (options.signed ? '+' : '');
1666
+
1667
+ if (isNegative) {
1668
+ number = -number;
1669
+ }
1670
+
1671
+ const localeOptions = buildLocaleOptions(options);
1672
+ let result;
1673
+
1674
+ if (number < 1) {
1675
+ const numberString = toLocaleString(number, options.locale, localeOptions);
1676
+ result = prefix + numberString + separator + UNITS[0];
1677
+ } else {
1678
+ const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
1679
+ number = divide(number, (options.binary ? 1024 : 1000) ** exponent);
1680
+
1681
+ if (!localeOptions) {
1682
+ const minPrecision = Math.max(3, Math.floor(number).toString().length);
1683
+ number = number.toPrecision(minPrecision);
1684
+ }
1685
+
1686
+ const numberString = toLocaleString(Number(number), options.locale, localeOptions);
1687
+ const unit = UNITS[exponent];
1688
+ result = prefix + numberString + separator + unit;
1689
+ }
1690
+
1691
+ return applyFixedWidth(result, options.fixedWidth);
1692
+ }
1693
+
1694
+ function printTimings(timings) {
1695
+ for (const [label, [time, memory, total]] of Object.entries(timings)) {
1696
+ const appliedColor = label[0] === '#' ? (label[1] === '#' ? rollup.bold : rollup.underline) : (text) => text;
1697
+ const row = `${label}: ${time.toFixed(0)}ms, ${prettyBytes(memory)} / ${prettyBytes(total)}`;
1698
+ console.info(appliedColor(row));
1699
+ }
1700
+ }
1701
+
1702
+ async function build(inputOptions, warnings, silent = false) {
1703
+ const env_1 = { stack: [], error: void 0, hasError: false };
1704
+ try {
1705
+ const outputOptions = inputOptions.output;
1706
+ const useStdout = !outputOptions[0].file && !outputOptions[0].dir;
1707
+ const start = Date.now();
1708
+ const files = useStdout ? ['stdout'] : outputOptions.map(t => parseAst_js.relativeId(t.file || t.dir));
1709
+ if (!silent) {
1710
+ let inputFiles;
1711
+ if (typeof inputOptions.input === 'string') {
1712
+ inputFiles = inputOptions.input;
1713
+ }
1714
+ else if (Array.isArray(inputOptions.input)) {
1715
+ inputFiles = inputOptions.input.join(', ');
1716
+ }
1717
+ else if (typeof inputOptions.input === 'object' && inputOptions.input !== null) {
1718
+ inputFiles = Object.values(inputOptions.input).join(', ');
1719
+ }
1720
+ rollup.stderr(rollup.cyan(`\n${rollup.bold(inputFiles)} → ${rollup.bold(files.join(', '))}...`));
1721
+ }
1722
+ const bundle = __addDisposableResource(env_1, await rollup.rollup(inputOptions), true);
1723
+ if (useStdout) {
1724
+ const output = outputOptions[0];
1725
+ if (output.sourcemap && output.sourcemap !== 'inline') {
1726
+ rollup.handleError(parseAst_js.logOnlyInlineSourcemapsForStdout());
1727
+ }
1728
+ const { output: outputs } = await bundle.generate(output);
1729
+ for (const file of outputs) {
1730
+ if (outputs.length > 1)
1731
+ process$1.stdout.write(`\n${rollup.cyan(rollup.bold(`//→ ${file.fileName}:`))}\n`);
1732
+ process$1.stdout.write(file.type === 'asset' ? file.source : file.code);
1733
+ }
1734
+ if (!silent) {
1735
+ warnings.flush();
1736
+ }
1737
+ return;
1738
+ }
1739
+ await Promise.all(outputOptions.map(bundle.write));
1740
+ if (!silent) {
1741
+ warnings.flush();
1742
+ rollup.stderr(rollup.green(`created ${rollup.bold(files.join(', '))} in ${rollup.bold(prettyMilliseconds(Date.now() - start))}`));
1743
+ if (bundle && bundle.getTimings) {
1744
+ printTimings(bundle.getTimings());
1745
+ }
1746
+ }
1747
+ }
1748
+ catch (e_1) {
1749
+ env_1.error = e_1;
1750
+ env_1.hasError = true;
1751
+ }
1752
+ finally {
1753
+ const result_1 = __disposeResources(env_1);
1754
+ if (result_1)
1755
+ await result_1;
1756
+ }
1757
+ }
1758
+
1759
+ const DEFAULT_CONFIG_BASE = 'rollup.config';
1760
+ async function getConfigPath(commandConfig) {
1761
+ if (commandConfig === true) {
1762
+ return path.resolve(await findConfigFileNameInCwd());
1763
+ }
1764
+ if (commandConfig.slice(0, 5) === 'node:') {
1765
+ const packageName = commandConfig.slice(5);
1766
+ try {
1767
+ return require.resolve(`rollup-config-${packageName}`, { paths: [process$1.cwd()] });
1768
+ }
1769
+ catch {
1770
+ try {
1771
+ return require.resolve(packageName, { paths: [process$1.cwd()] });
1772
+ }
1773
+ catch (error) {
1774
+ if (error.code === 'MODULE_NOT_FOUND') {
1775
+ rollup.handleError(parseAst_js.logMissingExternalConfig(commandConfig));
1776
+ }
1777
+ throw error;
1778
+ }
1779
+ }
1780
+ }
1781
+ return path.resolve(commandConfig);
1782
+ }
1783
+ async function findConfigFileNameInCwd() {
1784
+ const filesInWorkingDirectory = new Set(await promises.readdir(process$1.cwd()));
1785
+ for (const extension of ['mjs', 'cjs', 'ts']) {
1786
+ const fileName = `${DEFAULT_CONFIG_BASE}.${extension}`;
1787
+ if (filesInWorkingDirectory.has(fileName))
1788
+ return fileName;
1789
+ }
1790
+ return `${DEFAULT_CONFIG_BASE}.js`;
1791
+ }
1792
+
1793
+ async function loadConfigFromCommand(commandOptions, watchMode) {
1794
+ const warnings = loadConfigFile_js.batchWarnings(commandOptions);
1795
+ if (!commandOptions.input && (commandOptions.stdin || !process$1.stdin.isTTY)) {
1796
+ commandOptions.input = loadConfigFile_js.stdinName;
1797
+ }
1798
+ const options = await rollup.mergeOptions({ input: [] }, watchMode, commandOptions, warnings.log);
1799
+ await loadConfigFile_js.addCommandPluginsToInputOptions(options, commandOptions);
1800
+ return { options: [options], warnings };
1801
+ }
1802
+
1803
+ async function runRollup(command) {
1804
+ let inputSource;
1805
+ if (command._.length > 0) {
1806
+ if (command.input) {
1807
+ rollup.handleError(parseAst_js.logDuplicateImportOptions());
1808
+ }
1809
+ inputSource = command._;
1810
+ }
1811
+ else if (typeof command.input === 'string') {
1812
+ inputSource = [command.input];
1813
+ }
1814
+ else {
1815
+ inputSource = command.input;
1816
+ }
1817
+ if (inputSource && inputSource.length > 0) {
1818
+ if (inputSource.some((input) => input.includes('='))) {
1819
+ command.input = {};
1820
+ for (const input of inputSource) {
1821
+ const equalsIndex = input.indexOf('=');
1822
+ const value = input.slice(Math.max(0, equalsIndex + 1));
1823
+ const key = input.slice(0, Math.max(0, equalsIndex)) || parseAst_js.getAliasName(input);
1824
+ command.input[key] = value;
1825
+ }
1826
+ }
1827
+ else {
1828
+ command.input = inputSource;
1829
+ }
1830
+ }
1831
+ if (command.environment) {
1832
+ const environment = Array.isArray(command.environment)
1833
+ ? command.environment
1834
+ : [command.environment];
1835
+ for (const argument of environment) {
1836
+ for (const pair of argument.split(',')) {
1837
+ const [key, ...value] = pair.split(':');
1838
+ process$1.env[key] = value.length === 0 ? String(true) : value.join(':');
1839
+ }
1840
+ }
1841
+ }
1842
+ if (rollup.isWatchEnabled(command.watch)) {
1843
+ await fseventsImporter.loadFsEvents();
1844
+ const { watch } = await Promise.resolve().then(() => require('../shared/watch-cli.js'));
1845
+ await watch(command);
1846
+ }
1847
+ else {
1848
+ try {
1849
+ const { options, warnings } = await getConfigs(command);
1850
+ try {
1851
+ for (const inputOptions of options) {
1852
+ if (!inputOptions.cache) {
1853
+ // We explicitly disable the cache when unused as the CLI will not
1854
+ // use the cache object on the bundle when not in watch mode. This
1855
+ // improves performance as the cache is not generated.
1856
+ inputOptions.cache = false;
1857
+ }
1858
+ await build(inputOptions, warnings, command.silent);
1859
+ }
1860
+ if (command.failAfterWarnings && warnings.warningOccurred) {
1861
+ warnings.flush();
1862
+ rollup.handleError(parseAst_js.logFailAfterWarnings());
1863
+ }
1864
+ }
1865
+ catch (error) {
1866
+ warnings.flush();
1867
+ rollup.handleError(error);
1868
+ }
1869
+ }
1870
+ catch (error) {
1871
+ rollup.handleError(error);
1872
+ }
1873
+ }
1874
+ }
1875
+ async function getConfigs(command) {
1876
+ if (command.config) {
1877
+ const configFile = await getConfigPath(command.config);
1878
+ const { options, warnings } = await loadConfigFile_js.loadConfigFile(configFile, command, false);
1879
+ return { options, warnings };
1880
+ }
1881
+ return await loadConfigFromCommand(command, false);
1882
+ }
1883
+
1884
+ const command = yargsParser(process$1.argv.slice(2), {
1885
+ alias: rollup.commandAliases,
1886
+ configuration: { 'camel-case-expansion': false }
1887
+ });
1888
+ if (command.help || (process$1.argv.length <= 2 && process$1.stdin.isTTY)) {
1889
+ console.log(`\n${help}\n`);
1890
+ }
1891
+ else if (command.version) {
1892
+ console.log(`rollup v${rollup.version}`);
1893
+ }
1894
+ else {
1895
+ try {
1896
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
1897
+ require('source-map-support').install();
1898
+ }
1899
+ catch {
1900
+ // do nothing
1901
+ }
1902
+ const promise = runRollup(command);
1903
+ if (command.forceExit) {
1904
+ promise.then(() => process$1.exit());
1905
+ }
1906
+ }
1907
+
1908
+ exports.getConfigPath = getConfigPath;
1909
+ exports.loadConfigFromCommand = loadConfigFromCommand;
1910
+ exports.prettyMilliseconds = prettyMilliseconds;
1911
+ exports.printTimings = printTimings;
1912
+ //# sourceMappingURL=rollup.map
packages/mathml2omml/node_modules/.bin/semver ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ // Standalone semver comparison program.
3
+ // Exits successfully and prints matching version(s) if
4
+ // any supplied version is valid and passes all tests.
5
+
6
+ var argv = process.argv.slice(2)
7
+
8
+ var versions = []
9
+
10
+ var range = []
11
+
12
+ var inc = null
13
+
14
+ var version = require('../package.json').version
15
+
16
+ var loose = false
17
+
18
+ var includePrerelease = false
19
+
20
+ var coerce = false
21
+
22
+ var rtl = false
23
+
24
+ var identifier
25
+
26
+ var semver = require('../semver')
27
+
28
+ var reverse = false
29
+
30
+ var options = {}
31
+
32
+ main()
33
+
34
+ function main () {
35
+ if (!argv.length) return help()
36
+ while (argv.length) {
37
+ var a = argv.shift()
38
+ var indexOfEqualSign = a.indexOf('=')
39
+ if (indexOfEqualSign !== -1) {
40
+ a = a.slice(0, indexOfEqualSign)
41
+ argv.unshift(a.slice(indexOfEqualSign + 1))
42
+ }
43
+ switch (a) {
44
+ case '-rv': case '-rev': case '--rev': case '--reverse':
45
+ reverse = true
46
+ break
47
+ case '-l': case '--loose':
48
+ loose = true
49
+ break
50
+ case '-p': case '--include-prerelease':
51
+ includePrerelease = true
52
+ break
53
+ case '-v': case '--version':
54
+ versions.push(argv.shift())
55
+ break
56
+ case '-i': case '--inc': case '--increment':
57
+ switch (argv[0]) {
58
+ case 'major': case 'minor': case 'patch': case 'prerelease':
59
+ case 'premajor': case 'preminor': case 'prepatch':
60
+ inc = argv.shift()
61
+ break
62
+ default:
63
+ inc = 'patch'
64
+ break
65
+ }
66
+ break
67
+ case '--preid':
68
+ identifier = argv.shift()
69
+ break
70
+ case '-r': case '--range':
71
+ range.push(argv.shift())
72
+ break
73
+ case '-c': case '--coerce':
74
+ coerce = true
75
+ break
76
+ case '--rtl':
77
+ rtl = true
78
+ break
79
+ case '--ltr':
80
+ rtl = false
81
+ break
82
+ case '-h': case '--help': case '-?':
83
+ return help()
84
+ default:
85
+ versions.push(a)
86
+ break
87
+ }
88
+ }
89
+
90
+ var options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl }
91
+
92
+ versions = versions.map(function (v) {
93
+ return coerce ? (semver.coerce(v, options) || { version: v }).version : v
94
+ }).filter(function (v) {
95
+ return semver.valid(v)
96
+ })
97
+ if (!versions.length) return fail()
98
+ if (inc && (versions.length !== 1 || range.length)) { return failInc() }
99
+
100
+ for (var i = 0, l = range.length; i < l; i++) {
101
+ versions = versions.filter(function (v) {
102
+ return semver.satisfies(v, range[i], options)
103
+ })
104
+ if (!versions.length) return fail()
105
+ }
106
+ return success(versions)
107
+ }
108
+
109
+ function failInc () {
110
+ console.error('--inc can only be used on a single version with no range')
111
+ fail()
112
+ }
113
+
114
+ function fail () { process.exit(1) }
115
+
116
+ function success () {
117
+ var compare = reverse ? 'rcompare' : 'compare'
118
+ versions.sort(function (a, b) {
119
+ return semver[compare](a, b, options)
120
+ }).map(function (v) {
121
+ return semver.clean(v, options)
122
+ }).map(function (v) {
123
+ return inc ? semver.inc(v, inc, options, identifier) : v
124
+ }).forEach(function (v, i, _) { console.log(v) })
125
+ }
126
+
127
+ function help () {
128
+ console.log(['SemVer ' + version,
129
+ '',
130
+ 'A JavaScript implementation of the https://semver.org/ specification',
131
+ 'Copyright Isaac Z. Schlueter',
132
+ '',
133
+ 'Usage: semver [options] <version> [<version> [...]]',
134
+ 'Prints valid versions sorted by SemVer precedence',
135
+ '',
136
+ 'Options:',
137
+ '-r --range <range>',
138
+ ' Print versions that match the specified range.',
139
+ '',
140
+ '-i --increment [<level>]',
141
+ ' Increment a version by the specified level. Level can',
142
+ ' be one of: major, minor, patch, premajor, preminor,',
143
+ " prepatch, or prerelease. Default level is 'patch'.",
144
+ ' Only one version may be specified.',
145
+ '',
146
+ '--preid <identifier>',
147
+ ' Identifier to be used to prefix premajor, preminor,',
148
+ ' prepatch or prerelease version increments.',
149
+ '',
150
+ '-l --loose',
151
+ ' Interpret versions and ranges loosely',
152
+ '',
153
+ '-p --include-prerelease',
154
+ ' Always include prerelease versions in range matching',
155
+ '',
156
+ '-c --coerce',
157
+ ' Coerce a string into SemVer if possible',
158
+ ' (does not imply --loose)',
159
+ '',
160
+ '--rtl',
161
+ ' Coerce version strings right to left',
162
+ '',
163
+ '--ltr',
164
+ ' Coerce version strings left to right (default)',
165
+ '',
166
+ 'Program exits successfully if any valid version satisfies',
167
+ 'all supplied ranges, and prints all satisfying versions.',
168
+ '',
169
+ 'If no satisfying versions are found, then exits failure.',
170
+ '',
171
+ 'Versions are printed in ascending order, so supplying',
172
+ 'multiple versions to the utility will just sort them.'
173
+ ].join('\n'))
174
+ }
packages/mathml2omml/node_modules/.bin/update-browserslist-db ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ let { readFileSync } = require('fs')
4
+ let { join } = require('path')
5
+
6
+ require('./check-npm-version')
7
+ let updateDb = require('./')
8
+
9
+ const ROOT = __dirname
10
+
11
+ function getPackage() {
12
+ return JSON.parse(readFileSync(join(ROOT, 'package.json')))
13
+ }
14
+
15
+ let args = process.argv.slice(2)
16
+
17
+ let USAGE = 'Usage:\n npx update-browserslist-db\n'
18
+
19
+ function isArg(arg) {
20
+ return args.some(i => i === arg)
21
+ }
22
+
23
+ function error(msg) {
24
+ process.stderr.write('update-browserslist-db: ' + msg + '\n')
25
+ process.exit(1)
26
+ }
27
+
28
+ if (isArg('--help') || isArg('-h')) {
29
+ process.stdout.write(getPackage().description + '.\n\n' + USAGE + '\n')
30
+ } else if (isArg('--version') || isArg('-v')) {
31
+ process.stdout.write('browserslist-lint ' + getPackage().version + '\n')
32
+ } else {
33
+ try {
34
+ updateDb()
35
+ } catch (e) {
36
+ if (e.name === 'BrowserslistUpdateError') {
37
+ error(e.message)
38
+ } else {
39
+ throw e
40
+ }
41
+ }
42
+ }
packages/mathml2omml/node_modules/.bin/yaml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ import { UserError, cli, help } from './dist/cli.mjs'
4
+
5
+ cli(process.stdin, error => {
6
+ if (error instanceof UserError) {
7
+ if (error.code === UserError.ARGS) console.error(`${help}\n`)
8
+ console.error(error.message)
9
+ process.exitCode = error.code
10
+ } else if (error) throw error
11
+ })
packages/mathml2omml/node_modules/.package-lock.json ADDED
The diff for this file is too large to render. See raw diff
 
packages/mathml2omml/node_modules/@babel/code-frame/LICENSE ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2014-present Sebastian McKenzie and other contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
packages/mathml2omml/node_modules/@babel/code-frame/README.md ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # @babel/code-frame
2
+
3
+ > Generate errors that contain a code frame that point to source locations.
4
+
5
+ See our website [@babel/code-frame](https://babeljs.io/docs/babel-code-frame) for more information.
6
+
7
+ ## Install
8
+
9
+ Using npm:
10
+
11
+ ```sh
12
+ npm install --save-dev @babel/code-frame
13
+ ```
14
+
15
+ or using yarn:
16
+
17
+ ```sh
18
+ yarn add @babel/code-frame --dev
19
+ ```
packages/mathml2omml/node_modules/@babel/code-frame/lib/index.js ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var picocolors = require('picocolors');
6
+ var jsTokens = require('js-tokens');
7
+ var helperValidatorIdentifier = require('@babel/helper-validator-identifier');
8
+
9
+ function isColorSupported() {
10
+ return (typeof process === "object" && (process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false") ? false : picocolors.isColorSupported
11
+ );
12
+ }
13
+ const compose = (f, g) => v => f(g(v));
14
+ function buildDefs(colors) {
15
+ return {
16
+ keyword: colors.cyan,
17
+ capitalized: colors.yellow,
18
+ jsxIdentifier: colors.yellow,
19
+ punctuator: colors.yellow,
20
+ number: colors.magenta,
21
+ string: colors.green,
22
+ regex: colors.magenta,
23
+ comment: colors.gray,
24
+ invalid: compose(compose(colors.white, colors.bgRed), colors.bold),
25
+ gutter: colors.gray,
26
+ marker: compose(colors.red, colors.bold),
27
+ message: compose(colors.red, colors.bold),
28
+ reset: colors.reset
29
+ };
30
+ }
31
+ const defsOn = buildDefs(picocolors.createColors(true));
32
+ const defsOff = buildDefs(picocolors.createColors(false));
33
+ function getDefs(enabled) {
34
+ return enabled ? defsOn : defsOff;
35
+ }
36
+
37
+ const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
38
+ const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
39
+ const BRACKET = /^[()[\]{}]$/;
40
+ let tokenize;
41
+ const JSX_TAG = /^[a-z][\w-]*$/i;
42
+ const getTokenType = function (token, offset, text) {
43
+ if (token.type === "name") {
44
+ const tokenValue = token.value;
45
+ if (helperValidatorIdentifier.isKeyword(tokenValue) || helperValidatorIdentifier.isStrictReservedWord(tokenValue, true) || sometimesKeywords.has(tokenValue)) {
46
+ return "keyword";
47
+ }
48
+ if (JSX_TAG.test(tokenValue) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) === "</")) {
49
+ return "jsxIdentifier";
50
+ }
51
+ const firstChar = String.fromCodePoint(tokenValue.codePointAt(0));
52
+ if (firstChar !== firstChar.toLowerCase()) {
53
+ return "capitalized";
54
+ }
55
+ }
56
+ if (token.type === "punctuator" && BRACKET.test(token.value)) {
57
+ return "bracket";
58
+ }
59
+ if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
60
+ return "punctuator";
61
+ }
62
+ return token.type;
63
+ };
64
+ tokenize = function* (text) {
65
+ let match;
66
+ while (match = jsTokens.default.exec(text)) {
67
+ const token = jsTokens.matchToToken(match);
68
+ yield {
69
+ type: getTokenType(token, match.index, text),
70
+ value: token.value
71
+ };
72
+ }
73
+ };
74
+ function highlight(text) {
75
+ if (text === "") return "";
76
+ const defs = getDefs(true);
77
+ let highlighted = "";
78
+ for (const {
79
+ type,
80
+ value
81
+ } of tokenize(text)) {
82
+ if (type in defs) {
83
+ highlighted += value.split(NEWLINE$1).map(str => defs[type](str)).join("\n");
84
+ } else {
85
+ highlighted += value;
86
+ }
87
+ }
88
+ return highlighted;
89
+ }
90
+
91
+ let deprecationWarningShown = false;
92
+ const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
93
+ function getMarkerLines(loc, source, opts, startLineBaseZero) {
94
+ const startLoc = Object.assign({
95
+ column: 0,
96
+ line: -1
97
+ }, loc.start);
98
+ const endLoc = Object.assign({}, startLoc, loc.end);
99
+ const {
100
+ linesAbove = 2,
101
+ linesBelow = 3
102
+ } = opts || {};
103
+ const startLine = startLoc.line - startLineBaseZero;
104
+ const startColumn = startLoc.column;
105
+ const endLine = endLoc.line - startLineBaseZero;
106
+ const endColumn = endLoc.column;
107
+ let start = Math.max(startLine - (linesAbove + 1), 0);
108
+ let end = Math.min(source.length, endLine + linesBelow);
109
+ if (startLine === -1) {
110
+ start = 0;
111
+ }
112
+ if (endLine === -1) {
113
+ end = source.length;
114
+ }
115
+ const lineDiff = endLine - startLine;
116
+ const markerLines = {};
117
+ if (lineDiff) {
118
+ for (let i = 0; i <= lineDiff; i++) {
119
+ const lineNumber = i + startLine;
120
+ if (!startColumn) {
121
+ markerLines[lineNumber] = true;
122
+ } else if (i === 0) {
123
+ const sourceLength = source[lineNumber - 1].length;
124
+ markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
125
+ } else if (i === lineDiff) {
126
+ markerLines[lineNumber] = [0, endColumn];
127
+ } else {
128
+ const sourceLength = source[lineNumber - i].length;
129
+ markerLines[lineNumber] = [0, sourceLength];
130
+ }
131
+ }
132
+ } else {
133
+ if (startColumn === endColumn) {
134
+ if (startColumn) {
135
+ markerLines[startLine] = [startColumn, 0];
136
+ } else {
137
+ markerLines[startLine] = true;
138
+ }
139
+ } else {
140
+ markerLines[startLine] = [startColumn, endColumn - startColumn];
141
+ }
142
+ }
143
+ return {
144
+ start,
145
+ end,
146
+ markerLines
147
+ };
148
+ }
149
+ function codeFrameColumns(rawLines, loc, opts = {}) {
150
+ const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode;
151
+ const startLineBaseZero = (opts.startLine || 1) - 1;
152
+ const defs = getDefs(shouldHighlight);
153
+ const lines = rawLines.split(NEWLINE);
154
+ const {
155
+ start,
156
+ end,
157
+ markerLines
158
+ } = getMarkerLines(loc, lines, opts, startLineBaseZero);
159
+ const hasColumns = loc.start && typeof loc.start.column === "number";
160
+ const numberMaxWidth = String(end + startLineBaseZero).length;
161
+ const highlightedLines = shouldHighlight ? highlight(rawLines) : rawLines;
162
+ let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
163
+ const number = start + 1 + index;
164
+ const paddedNumber = ` ${number + startLineBaseZero}`.slice(-numberMaxWidth);
165
+ const gutter = ` ${paddedNumber} |`;
166
+ const hasMarker = markerLines[number];
167
+ const lastMarkerLine = !markerLines[number + 1];
168
+ if (hasMarker) {
169
+ let markerLine = "";
170
+ if (Array.isArray(hasMarker)) {
171
+ const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
172
+ const numberOfMarkers = hasMarker[1] || 1;
173
+ markerLine = ["\n ", defs.gutter(gutter.replace(/\d/g, " ")), " ", markerSpacing, defs.marker("^").repeat(numberOfMarkers)].join("");
174
+ if (lastMarkerLine && opts.message) {
175
+ markerLine += " " + defs.message(opts.message);
176
+ }
177
+ }
178
+ return [defs.marker(">"), defs.gutter(gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
179
+ } else {
180
+ return ` ${defs.gutter(gutter)}${line.length > 0 ? ` ${line}` : ""}`;
181
+ }
182
+ }).join("\n");
183
+ if (opts.message && !hasColumns) {
184
+ frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
185
+ }
186
+ if (shouldHighlight) {
187
+ return defs.reset(frame);
188
+ } else {
189
+ return frame;
190
+ }
191
+ }
192
+ function index (rawLines, lineNumber, colNumber, opts = {}) {
193
+ if (!deprecationWarningShown) {
194
+ deprecationWarningShown = true;
195
+ const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
196
+ if (process.emitWarning) {
197
+ process.emitWarning(message, "DeprecationWarning");
198
+ } else {
199
+ const deprecationError = new Error(message);
200
+ deprecationError.name = "DeprecationWarning";
201
+ console.warn(new Error(message));
202
+ }
203
+ }
204
+ colNumber = Math.max(colNumber, 0);
205
+ const location = {
206
+ start: {
207
+ column: colNumber,
208
+ line: lineNumber
209
+ }
210
+ };
211
+ return codeFrameColumns(rawLines, location, opts);
212
+ }
213
+
214
+ exports.codeFrameColumns = codeFrameColumns;
215
+ exports.default = index;
216
+ exports.highlight = highlight;
217
+ //# sourceMappingURL=index.js.map
packages/mathml2omml/node_modules/@babel/code-frame/lib/index.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"index.js","sources":["../src/defs.ts","../src/highlight.ts","../src/index.ts"],"sourcesContent":["import picocolors, { createColors } from \"picocolors\";\nimport type { Colors, Formatter } from \"picocolors/types\";\n\nexport function isColorSupported() {\n return (\n // See https://github.com/alexeyraspopov/picocolors/issues/62\n typeof process === \"object\" &&\n (process.env.FORCE_COLOR === \"0\" || process.env.FORCE_COLOR === \"false\")\n ? false\n : picocolors.isColorSupported\n );\n}\n\nexport type InternalTokenType =\n | \"keyword\"\n | \"capitalized\"\n | \"jsxIdentifier\"\n | \"punctuator\"\n | \"number\"\n | \"string\"\n | \"regex\"\n | \"comment\"\n | \"invalid\";\n\ntype UITokens = \"gutter\" | \"marker\" | \"message\";\n\nexport type Defs = Record<InternalTokenType | UITokens | \"reset\", Formatter>;\n\nconst compose: <T, U, V>(f: (gv: U) => V, g: (v: T) => U) => (v: T) => V =\n (f, g) => v =>\n f(g(v));\n\n/**\n * Styles for token types.\n */\nfunction buildDefs(colors: Colors): Defs {\n return {\n keyword: colors.cyan,\n capitalized: colors.yellow,\n jsxIdentifier: colors.yellow,\n punctuator: colors.yellow,\n number: colors.magenta,\n string: colors.green,\n regex: colors.magenta,\n comment: colors.gray,\n invalid: compose(compose(colors.white, colors.bgRed), colors.bold),\n\n gutter: colors.gray,\n marker: compose(colors.red, colors.bold),\n message: compose(colors.red, colors.bold),\n\n reset: colors.reset,\n };\n}\n\nconst defsOn = buildDefs(createColors(true));\nconst defsOff = buildDefs(createColors(false));\n\nexport function getDefs(enabled: boolean): Defs {\n return enabled ? defsOn : defsOff;\n}\n","import type { Token as JSToken, JSXToken } from \"js-tokens\";\nimport jsTokens from \"js-tokens\";\n// We inline this package\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as charCodes from \"charcodes\";\n\nimport {\n isStrictReservedWord,\n isKeyword,\n} from \"@babel/helper-validator-identifier\";\n\nimport { getDefs, type InternalTokenType } from \"./defs.ts\";\n\n/**\n * Names that are always allowed as identifiers, but also appear as keywords\n * within certain syntactic productions.\n *\n * https://tc39.es/ecma262/#sec-keywords-and-reserved-words\n *\n * `target` has been omitted since it is very likely going to be a false\n * positive.\n */\nconst sometimesKeywords = new Set([\"as\", \"async\", \"from\", \"get\", \"of\", \"set\"]);\n\ntype Token = {\n type: InternalTokenType | \"uncolored\";\n value: string;\n};\n\n/**\n * RegExp to test for newlines in terminal.\n */\nconst NEWLINE = /\\r\\n|[\\n\\r\\u2028\\u2029]/;\n\n/**\n * RegExp to test for the three types of brackets.\n */\nconst BRACKET = /^[()[\\]{}]$/;\n\nlet tokenize: (\n text: string,\n) => Generator<{ type: InternalTokenType | \"uncolored\"; value: string }>;\n\nif (process.env.BABEL_8_BREAKING) {\n /**\n * Get the type of token, specifying punctuator type.\n */\n const getTokenType = function (\n token: JSToken | JSXToken,\n ): InternalTokenType | \"uncolored\" {\n if (token.type === \"IdentifierName\") {\n const tokenValue = token.value;\n if (\n isKeyword(tokenValue) ||\n isStrictReservedWord(tokenValue, true) ||\n sometimesKeywords.has(tokenValue)\n ) {\n return \"keyword\";\n }\n\n const firstChar = tokenValue.charCodeAt(0);\n if (firstChar < 128) {\n // ASCII characters\n if (\n firstChar >= charCodes.uppercaseA &&\n firstChar <= charCodes.uppercaseZ\n ) {\n return \"capitalized\";\n }\n } else {\n const firstChar = String.fromCodePoint(tokenValue.codePointAt(0));\n if (firstChar !== firstChar.toLowerCase()) {\n return \"capitalized\";\n }\n }\n }\n\n if (token.type === \"Punctuator\" && BRACKET.test(token.value)) {\n return \"uncolored\";\n }\n\n if (token.type === \"Invalid\" && token.value === \"@\") {\n return \"punctuator\";\n }\n\n switch (token.type) {\n case \"NumericLiteral\":\n return \"number\";\n\n case \"StringLiteral\":\n case \"JSXString\":\n case \"NoSubstitutionTemplate\":\n return \"string\";\n\n case \"RegularExpressionLiteral\":\n return \"regex\";\n\n case \"Punctuator\":\n case \"JSXPunctuator\":\n return \"punctuator\";\n\n case \"MultiLineComment\":\n case \"SingleLineComment\":\n return \"comment\";\n\n case \"Invalid\":\n case \"JSXInvalid\":\n return \"invalid\";\n\n case \"JSXIdentifier\":\n return \"jsxIdentifier\";\n\n default:\n return \"uncolored\";\n }\n };\n\n /**\n * Turn a string of JS into an array of objects.\n */\n tokenize = function* (text: string): Generator<Token> {\n for (const token of jsTokens(text, { jsx: true })) {\n switch (token.type) {\n case \"TemplateHead\":\n yield { type: \"string\", value: token.value.slice(0, -2) };\n yield { type: \"punctuator\", value: \"${\" };\n break;\n\n case \"TemplateMiddle\":\n yield { type: \"punctuator\", value: \"}\" };\n yield { type: \"string\", value: token.value.slice(1, -2) };\n yield { type: \"punctuator\", value: \"${\" };\n break;\n\n case \"TemplateTail\":\n yield { type: \"punctuator\", value: \"}\" };\n yield { type: \"string\", value: token.value.slice(1) };\n break;\n\n default:\n yield {\n type: getTokenType(token),\n value: token.value,\n };\n }\n }\n };\n} else {\n /**\n * RegExp to test for what seems to be a JSX tag name.\n */\n const JSX_TAG = /^[a-z][\\w-]*$/i;\n\n // The token here is defined in js-tokens@4. However we don't bother\n // typing it since the whole block will be removed in Babel 8\n const getTokenType = function (token: any, offset: number, text: string) {\n if (token.type === \"name\") {\n const tokenValue = token.value;\n if (\n isKeyword(tokenValue) ||\n isStrictReservedWord(tokenValue, true) ||\n sometimesKeywords.has(tokenValue)\n ) {\n return \"keyword\";\n }\n\n if (\n JSX_TAG.test(tokenValue) &&\n (text[offset - 1] === \"<\" || text.slice(offset - 2, offset) === \"</\")\n ) {\n return \"jsxIdentifier\";\n }\n\n const firstChar = String.fromCodePoint(tokenValue.codePointAt(0));\n if (firstChar !== firstChar.toLowerCase()) {\n return \"capitalized\";\n }\n }\n\n if (token.type === \"punctuator\" && BRACKET.test(token.value)) {\n return \"bracket\";\n }\n\n if (\n token.type === \"invalid\" &&\n (token.value === \"@\" || token.value === \"#\")\n ) {\n return \"punctuator\";\n }\n\n return token.type;\n };\n\n tokenize = function* (text: string) {\n let match;\n while ((match = (jsTokens as any).default.exec(text))) {\n const token = (jsTokens as any).matchToToken(match);\n\n yield {\n type: getTokenType(token, match.index, text),\n value: token.value,\n };\n }\n };\n}\n\nexport function highlight(text: string) {\n if (text === \"\") return \"\";\n\n const defs = getDefs(true);\n\n let highlighted = \"\";\n\n for (const { type, value } of tokenize(text)) {\n if (type in defs) {\n highlighted += value\n .split(NEWLINE)\n .map(str => defs[type as InternalTokenType](str))\n .join(\"\\n\");\n } else {\n highlighted += value;\n }\n }\n\n return highlighted;\n}\n","import { getDefs, isColorSupported } from \"./defs.ts\";\nimport { highlight } from \"./highlight.ts\";\n\nexport { highlight };\n\nlet deprecationWarningShown = false;\n\ntype Location = {\n column: number;\n line: number;\n};\n\ntype NodeLocation = {\n end?: Location;\n start: Location;\n};\n\nexport interface Options {\n /** Syntax highlight the code as JavaScript for terminals. default: false */\n highlightCode?: boolean;\n /** The number of lines to show above the error. default: 2 */\n linesAbove?: number;\n /** The number of lines to show below the error. default: 3 */\n linesBelow?: number;\n /** The line number corresponding to the first line in `rawLines`. default: 1 */\n startLine?: number;\n /**\n * Forcibly syntax highlight the code as JavaScript (for non-terminals);\n * overrides highlightCode.\n * default: false\n */\n forceColor?: boolean;\n /**\n * Pass in a string to be displayed inline (if possible) next to the\n * highlighted location in the code. If it can't be positioned inline,\n * it will be placed above the code frame.\n * default: nothing\n */\n message?: string;\n}\n\n/**\n * RegExp to test for newlines in terminal.\n */\n\nconst NEWLINE = /\\r\\n|[\\n\\r\\u2028\\u2029]/;\n\n/**\n * Extract what lines should be marked and highlighted.\n */\n\ntype MarkerLines = Record<number, true | [number, number]>;\n\nfunction getMarkerLines(\n loc: NodeLocation,\n source: string[],\n opts: Options,\n startLineBaseZero: number,\n): {\n start: number;\n end: number;\n markerLines: MarkerLines;\n} {\n const startLoc: Location = {\n column: 0,\n line: -1,\n ...loc.start,\n };\n const endLoc: Location = {\n ...startLoc,\n ...loc.end,\n };\n const { linesAbove = 2, linesBelow = 3 } = opts || {};\n const startLine = startLoc.line - startLineBaseZero;\n const startColumn = startLoc.column;\n const endLine = endLoc.line - startLineBaseZero;\n const endColumn = endLoc.column;\n\n let start = Math.max(startLine - (linesAbove + 1), 0);\n let end = Math.min(source.length, endLine + linesBelow);\n\n if (startLine === -1) {\n start = 0;\n }\n\n if (endLine === -1) {\n end = source.length;\n }\n\n const lineDiff = endLine - startLine;\n const markerLines: MarkerLines = {};\n\n if (lineDiff) {\n for (let i = 0; i <= lineDiff; i++) {\n const lineNumber = i + startLine;\n\n if (!startColumn) {\n markerLines[lineNumber] = true;\n } else if (i === 0) {\n const sourceLength = source[lineNumber - 1].length;\n\n markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];\n } else if (i === lineDiff) {\n markerLines[lineNumber] = [0, endColumn];\n } else {\n const sourceLength = source[lineNumber - i].length;\n\n markerLines[lineNumber] = [0, sourceLength];\n }\n }\n } else {\n if (startColumn === endColumn) {\n if (startColumn) {\n markerLines[startLine] = [startColumn, 0];\n } else {\n markerLines[startLine] = true;\n }\n } else {\n markerLines[startLine] = [startColumn, endColumn - startColumn];\n }\n }\n\n return { start, end, markerLines };\n}\n\nexport function codeFrameColumns(\n rawLines: string,\n loc: NodeLocation,\n opts: Options = {},\n): string {\n const shouldHighlight =\n opts.forceColor || (isColorSupported() && opts.highlightCode);\n const startLineBaseZero = (opts.startLine || 1) - 1;\n const defs = getDefs(shouldHighlight);\n\n const lines = rawLines.split(NEWLINE);\n const { start, end, markerLines } = getMarkerLines(\n loc,\n lines,\n opts,\n startLineBaseZero,\n );\n const hasColumns = loc.start && typeof loc.start.column === \"number\";\n\n const numberMaxWidth = String(end + startLineBaseZero).length;\n\n const highlightedLines = shouldHighlight ? highlight(rawLines) : rawLines;\n\n let frame = highlightedLines\n .split(NEWLINE, end)\n .slice(start, end)\n .map((line, index) => {\n const number = start + 1 + index;\n const paddedNumber = ` ${number + startLineBaseZero}`.slice(\n -numberMaxWidth,\n );\n const gutter = ` ${paddedNumber} |`;\n const hasMarker = markerLines[number];\n const lastMarkerLine = !markerLines[number + 1];\n if (hasMarker) {\n let markerLine = \"\";\n if (Array.isArray(hasMarker)) {\n const markerSpacing = line\n .slice(0, Math.max(hasMarker[0] - 1, 0))\n .replace(/[^\\t]/g, \" \");\n const numberOfMarkers = hasMarker[1] || 1;\n\n markerLine = [\n \"\\n \",\n defs.gutter(gutter.replace(/\\d/g, \" \")),\n \" \",\n markerSpacing,\n defs.marker(\"^\").repeat(numberOfMarkers),\n ].join(\"\");\n\n if (lastMarkerLine && opts.message) {\n markerLine += \" \" + defs.message(opts.message);\n }\n }\n return [\n defs.marker(\">\"),\n defs.gutter(gutter),\n line.length > 0 ? ` ${line}` : \"\",\n markerLine,\n ].join(\"\");\n } else {\n return ` ${defs.gutter(gutter)}${line.length > 0 ? ` ${line}` : \"\"}`;\n }\n })\n .join(\"\\n\");\n\n if (opts.message && !hasColumns) {\n frame = `${\" \".repeat(numberMaxWidth + 1)}${opts.message}\\n${frame}`;\n }\n\n if (shouldHighlight) {\n return defs.reset(frame);\n } else {\n return frame;\n }\n}\n\n/**\n * Create a code frame, adding line numbers, code highlighting, and pointing to a given position.\n */\n\nexport default function (\n rawLines: string,\n lineNumber: number,\n colNumber?: number | null,\n opts: Options = {},\n): string {\n if (!deprecationWarningShown) {\n deprecationWarningShown = true;\n\n const message =\n \"Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.\";\n\n if (process.emitWarning) {\n // A string is directly supplied to emitWarning, because when supplying an\n // Error object node throws in the tests because of different contexts\n process.emitWarning(message, \"DeprecationWarning\");\n } else {\n const deprecationError = new Error(message);\n deprecationError.name = \"DeprecationWarning\";\n console.warn(new Error(message));\n }\n }\n\n colNumber = Math.max(colNumber, 0);\n\n const location: NodeLocation = {\n start: { column: colNumber, line: lineNumber },\n };\n\n return codeFrameColumns(rawLines, location, opts);\n}\n"],"names":["isColorSupported","process","env","FORCE_COLOR","picocolors","compose","f","g","v","buildDefs","colors","keyword","cyan","capitalized","yellow","jsxIdentifier","punctuator","number","magenta","string","green","regex","comment","gray","invalid","white","bgRed","bold","gutter","marker","red","message","reset","defsOn","createColors","defsOff","getDefs","enabled","sometimesKeywords","Set","NEWLINE","BRACKET","tokenize","JSX_TAG","getTokenType","token","offset","text","type","tokenValue","value","isKeyword","isStrictReservedWord","has","test","slice","firstChar","String","fromCodePoint","codePointAt","toLowerCase","match","jsTokens","default","exec","matchToToken","index","highlight","defs","highlighted","split","map","str","join","deprecationWarningShown","getMarkerLines","loc","source","opts","startLineBaseZero","startLoc","Object","assign","column","line","start","endLoc","end","linesAbove","linesBelow","startLine","startColumn","endLine","endColumn","Math","max","min","length","lineDiff","markerLines","i","lineNumber","sourceLength","codeFrameColumns","rawLines","shouldHighlight","forceColor","highlightCode","lines","hasColumns","numberMaxWidth","highlightedLines","frame","paddedNumber","hasMarker","lastMarkerLine","markerLine","Array","isArray","markerSpacing","replace","numberOfMarkers","repeat","colNumber","emitWarning","deprecationError","Error","name","console","warn","location"],"mappings":";;;;;;;;AAGO,SAASA,gBAAgBA,GAAG;EACjC,QAEE,OAAOC,OAAO,KAAK,QAAQ,KACxBA,OAAO,CAACC,GAAG,CAACC,WAAW,KAAK,GAAG,IAAIF,OAAO,CAACC,GAAG,CAACC,WAAW,KAAK,OAAO,CAAC,GACtE,KAAK,GACLC,UAAU,CAACJ,gBAAAA;AAAgB,IAAA;AAEnC,CAAA;AAiBA,MAAMK,OAAkE,GACtEA,CAACC,CAAC,EAAEC,CAAC,KAAKC,CAAC,IACTF,CAAC,CAACC,CAAC,CAACC,CAAC,CAAC,CAAC,CAAA;AAKX,SAASC,SAASA,CAACC,MAAc,EAAQ;EACvC,OAAO;IACLC,OAAO,EAAED,MAAM,CAACE,IAAI;IACpBC,WAAW,EAAEH,MAAM,CAACI,MAAM;IAC1BC,aAAa,EAAEL,MAAM,CAACI,MAAM;IAC5BE,UAAU,EAAEN,MAAM,CAACI,MAAM;IACzBG,MAAM,EAAEP,MAAM,CAACQ,OAAO;IACtBC,MAAM,EAAET,MAAM,CAACU,KAAK;IACpBC,KAAK,EAAEX,MAAM,CAACQ,OAAO;IACrBI,OAAO,EAAEZ,MAAM,CAACa,IAAI;AACpBC,IAAAA,OAAO,EAAEnB,OAAO,CAACA,OAAO,CAACK,MAAM,CAACe,KAAK,EAAEf,MAAM,CAACgB,KAAK,CAAC,EAAEhB,MAAM,CAACiB,IAAI,CAAC;IAElEC,MAAM,EAAElB,MAAM,CAACa,IAAI;IACnBM,MAAM,EAAExB,OAAO,CAACK,MAAM,CAACoB,GAAG,EAAEpB,MAAM,CAACiB,IAAI,CAAC;IACxCI,OAAO,EAAE1B,OAAO,CAACK,MAAM,CAACoB,GAAG,EAAEpB,MAAM,CAACiB,IAAI,CAAC;IAEzCK,KAAK,EAAEtB,MAAM,CAACsB,KAAAA;GACf,CAAA;AACH,CAAA;AAEA,MAAMC,MAAM,GAAGxB,SAAS,CAACyB,uBAAY,CAAC,IAAI,CAAC,CAAC,CAAA;AAC5C,MAAMC,OAAO,GAAG1B,SAAS,CAACyB,uBAAY,CAAC,KAAK,CAAC,CAAC,CAAA;AAEvC,SAASE,OAAOA,CAACC,OAAgB,EAAQ;AAC9C,EAAA,OAAOA,OAAO,GAAGJ,MAAM,GAAGE,OAAO,CAAA;AACnC;;ACtCA,MAAMG,iBAAiB,GAAG,IAAIC,GAAG,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;AAU9E,MAAMC,SAAO,GAAG,yBAAyB,CAAA;AAKzC,MAAMC,OAAO,GAAG,aAAa,CAAA;AAE7B,IAAIC,QAEoE,CAAA;AA8GtE,MAAMC,OAAO,GAAG,gBAAgB,CAAA;AAIhC,MAAMC,YAAY,GAAG,UAAUC,KAAU,EAAEC,MAAc,EAAEC,IAAY,EAAE;AACvE,EAAA,IAAIF,KAAK,CAACG,IAAI,KAAK,MAAM,EAAE;AACzB,IAAA,MAAMC,UAAU,GAAGJ,KAAK,CAACK,KAAK,CAAA;AAC9B,IAAA,IACEC,mCAAS,CAACF,UAAU,CAAC,IACrBG,8CAAoB,CAACH,UAAU,EAAE,IAAI,CAAC,IACtCX,iBAAiB,CAACe,GAAG,CAACJ,UAAU,CAAC,EACjC;AACA,MAAA,OAAO,SAAS,CAAA;AAClB,KAAA;AAEA,IAAA,IACEN,OAAO,CAACW,IAAI,CAACL,UAAU,CAAC,KACvBF,IAAI,CAACD,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,IAAIC,IAAI,CAACQ,KAAK,CAACT,MAAM,GAAG,CAAC,EAAEA,MAAM,CAAC,KAAK,IAAI,CAAC,EACrE;AACA,MAAA,OAAO,eAAe,CAAA;AACxB,KAAA;AAEA,IAAA,MAAMU,SAAS,GAAGC,MAAM,CAACC,aAAa,CAACT,UAAU,CAACU,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;AACjE,IAAA,IAAIH,SAAS,KAAKA,SAAS,CAACI,WAAW,EAAE,EAAE;AACzC,MAAA,OAAO,aAAa,CAAA;AACtB,KAAA;AACF,GAAA;AAEA,EAAA,IAAIf,KAAK,CAACG,IAAI,KAAK,YAAY,IAAIP,OAAO,CAACa,IAAI,CAACT,KAAK,CAACK,KAAK,CAAC,EAAE;AAC5D,IAAA,OAAO,SAAS,CAAA;AAClB,GAAA;AAEA,EAAA,IACEL,KAAK,CAACG,IAAI,KAAK,SAAS,KACvBH,KAAK,CAACK,KAAK,KAAK,GAAG,IAAIL,KAAK,CAACK,KAAK,KAAK,GAAG,CAAC,EAC5C;AACA,IAAA,OAAO,YAAY,CAAA;AACrB,GAAA;EAEA,OAAOL,KAAK,CAACG,IAAI,CAAA;AACnB,CAAC,CAAA;AAEDN,QAAQ,GAAG,WAAWK,IAAY,EAAE;AAClC,EAAA,IAAIc,KAAK,CAAA;EACT,OAAQA,KAAK,GAAIC,QAAQ,CAASC,OAAO,CAACC,IAAI,CAACjB,IAAI,CAAC,EAAG;AACrD,IAAA,MAAMF,KAAK,GAAIiB,QAAQ,CAASG,YAAY,CAACJ,KAAK,CAAC,CAAA;IAEnD,MAAM;MACJb,IAAI,EAAEJ,YAAY,CAACC,KAAK,EAAEgB,KAAK,CAACK,KAAK,EAAEnB,IAAI,CAAC;MAC5CG,KAAK,EAAEL,KAAK,CAACK,KAAAA;KACd,CAAA;AACH,GAAA;AACF,CAAC,CAAA;AAGI,SAASiB,SAASA,CAACpB,IAAY,EAAE;AACtC,EAAA,IAAIA,IAAI,KAAK,EAAE,EAAE,OAAO,EAAE,CAAA;AAE1B,EAAA,MAAMqB,IAAI,GAAGhC,OAAO,CAAC,IAAI,CAAC,CAAA;EAE1B,IAAIiC,WAAW,GAAG,EAAE,CAAA;AAEpB,EAAA,KAAK,MAAM;IAAErB,IAAI;AAAEE,IAAAA,KAAAA;AAAM,GAAC,IAAIR,QAAQ,CAACK,IAAI,CAAC,EAAE;IAC5C,IAAIC,IAAI,IAAIoB,IAAI,EAAE;MAChBC,WAAW,IAAInB,KAAK,CACjBoB,KAAK,CAAC9B,SAAO,CAAC,CACd+B,GAAG,CAACC,GAAG,IAAIJ,IAAI,CAACpB,IAAI,CAAsB,CAACwB,GAAG,CAAC,CAAC,CAChDC,IAAI,CAAC,IAAI,CAAC,CAAA;AACf,KAAC,MAAM;AACLJ,MAAAA,WAAW,IAAInB,KAAK,CAAA;AACtB,KAAA;AACF,GAAA;AAEA,EAAA,OAAOmB,WAAW,CAAA;AACpB;;AC5NA,IAAIK,uBAAuB,GAAG,KAAK,CAAA;AAwCnC,MAAMlC,OAAO,GAAG,yBAAyB,CAAA;AAQzC,SAASmC,cAAcA,CACrBC,GAAiB,EACjBC,MAAgB,EAChBC,IAAa,EACbC,iBAAyB,EAKzB;AACA,EAAA,MAAMC,QAAkB,GAAAC,MAAA,CAAAC,MAAA,CAAA;AACtBC,IAAAA,MAAM,EAAE,CAAC;AACTC,IAAAA,IAAI,EAAE,CAAC,CAAA;GACJR,EAAAA,GAAG,CAACS,KAAK,CACb,CAAA;EACD,MAAMC,MAAgB,GAAAL,MAAA,CAAAC,MAAA,CACjBF,EAAAA,EAAAA,QAAQ,EACRJ,GAAG,CAACW,GAAG,CACX,CAAA;EACD,MAAM;AAAEC,IAAAA,UAAU,GAAG,CAAC;AAAEC,IAAAA,UAAU,GAAG,CAAA;AAAE,GAAC,GAAGX,IAAI,IAAI,EAAE,CAAA;AACrD,EAAA,MAAMY,SAAS,GAAGV,QAAQ,CAACI,IAAI,GAAGL,iBAAiB,CAAA;AACnD,EAAA,MAAMY,WAAW,GAAGX,QAAQ,CAACG,MAAM,CAAA;AACnC,EAAA,MAAMS,OAAO,GAAGN,MAAM,CAACF,IAAI,GAAGL,iBAAiB,CAAA;AAC/C,EAAA,MAAMc,SAAS,GAAGP,MAAM,CAACH,MAAM,CAAA;AAE/B,EAAA,IAAIE,KAAK,GAAGS,IAAI,CAACC,GAAG,CAACL,SAAS,IAAIF,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AACrD,EAAA,IAAID,GAAG,GAAGO,IAAI,CAACE,GAAG,CAACnB,MAAM,CAACoB,MAAM,EAAEL,OAAO,GAAGH,UAAU,CAAC,CAAA;AAEvD,EAAA,IAAIC,SAAS,KAAK,CAAC,CAAC,EAAE;AACpBL,IAAAA,KAAK,GAAG,CAAC,CAAA;AACX,GAAA;AAEA,EAAA,IAAIO,OAAO,KAAK,CAAC,CAAC,EAAE;IAClBL,GAAG,GAAGV,MAAM,CAACoB,MAAM,CAAA;AACrB,GAAA;AAEA,EAAA,MAAMC,QAAQ,GAAGN,OAAO,GAAGF,SAAS,CAAA;EACpC,MAAMS,WAAwB,GAAG,EAAE,CAAA;AAEnC,EAAA,IAAID,QAAQ,EAAE;IACZ,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,IAAIF,QAAQ,EAAEE,CAAC,EAAE,EAAE;AAClC,MAAA,MAAMC,UAAU,GAAGD,CAAC,GAAGV,SAAS,CAAA;MAEhC,IAAI,CAACC,WAAW,EAAE;AAChBQ,QAAAA,WAAW,CAACE,UAAU,CAAC,GAAG,IAAI,CAAA;AAChC,OAAC,MAAM,IAAID,CAAC,KAAK,CAAC,EAAE;QAClB,MAAME,YAAY,GAAGzB,MAAM,CAACwB,UAAU,GAAG,CAAC,CAAC,CAACJ,MAAM,CAAA;AAElDE,QAAAA,WAAW,CAACE,UAAU,CAAC,GAAG,CAACV,WAAW,EAAEW,YAAY,GAAGX,WAAW,GAAG,CAAC,CAAC,CAAA;AACzE,OAAC,MAAM,IAAIS,CAAC,KAAKF,QAAQ,EAAE;QACzBC,WAAW,CAACE,UAAU,CAAC,GAAG,CAAC,CAAC,EAAER,SAAS,CAAC,CAAA;AAC1C,OAAC,MAAM;QACL,MAAMS,YAAY,GAAGzB,MAAM,CAACwB,UAAU,GAAGD,CAAC,CAAC,CAACH,MAAM,CAAA;QAElDE,WAAW,CAACE,UAAU,CAAC,GAAG,CAAC,CAAC,EAAEC,YAAY,CAAC,CAAA;AAC7C,OAAA;AACF,KAAA;AACF,GAAC,MAAM;IACL,IAAIX,WAAW,KAAKE,SAAS,EAAE;AAC7B,MAAA,IAAIF,WAAW,EAAE;QACfQ,WAAW,CAACT,SAAS,CAAC,GAAG,CAACC,WAAW,EAAE,CAAC,CAAC,CAAA;AAC3C,OAAC,MAAM;AACLQ,QAAAA,WAAW,CAACT,SAAS,CAAC,GAAG,IAAI,CAAA;AAC/B,OAAA;AACF,KAAC,MAAM;MACLS,WAAW,CAACT,SAAS,CAAC,GAAG,CAACC,WAAW,EAAEE,SAAS,GAAGF,WAAW,CAAC,CAAA;AACjE,KAAA;AACF,GAAA;EAEA,OAAO;IAAEN,KAAK;IAAEE,GAAG;AAAEY,IAAAA,WAAAA;GAAa,CAAA;AACpC,CAAA;AAEO,SAASI,gBAAgBA,CAC9BC,QAAgB,EAChB5B,GAAiB,EACjBE,IAAa,GAAG,EAAE,EACV;AACR,EAAA,MAAM2B,eAAe,GACnB3B,IAAI,CAAC4B,UAAU,IAAK1G,gBAAgB,EAAE,IAAI8E,IAAI,CAAC6B,aAAc,CAAA;EAC/D,MAAM5B,iBAAiB,GAAG,CAACD,IAAI,CAACY,SAAS,IAAI,CAAC,IAAI,CAAC,CAAA;AACnD,EAAA,MAAMtB,IAAI,GAAGhC,OAAO,CAACqE,eAAe,CAAC,CAAA;AAErC,EAAA,MAAMG,KAAK,GAAGJ,QAAQ,CAAClC,KAAK,CAAC9B,OAAO,CAAC,CAAA;EACrC,MAAM;IAAE6C,KAAK;IAAEE,GAAG;AAAEY,IAAAA,WAAAA;GAAa,GAAGxB,cAAc,CAChDC,GAAG,EACHgC,KAAK,EACL9B,IAAI,EACJC,iBACF,CAAC,CAAA;AACD,EAAA,MAAM8B,UAAU,GAAGjC,GAAG,CAACS,KAAK,IAAI,OAAOT,GAAG,CAACS,KAAK,CAACF,MAAM,KAAK,QAAQ,CAAA;EAEpE,MAAM2B,cAAc,GAAGrD,MAAM,CAAC8B,GAAG,GAAGR,iBAAiB,CAAC,CAACkB,MAAM,CAAA;EAE7D,MAAMc,gBAAgB,GAAGN,eAAe,GAAGtC,SAAS,CAACqC,QAAQ,CAAC,GAAGA,QAAQ,CAAA;EAEzE,IAAIQ,KAAK,GAAGD,gBAAgB,CACzBzC,KAAK,CAAC9B,OAAO,EAAE+C,GAAG,CAAC,CACnBhC,KAAK,CAAC8B,KAAK,EAAEE,GAAG,CAAC,CACjBhB,GAAG,CAAC,CAACa,IAAI,EAAElB,KAAK,KAAK;AACpB,IAAA,MAAMjD,MAAM,GAAGoE,KAAK,GAAG,CAAC,GAAGnB,KAAK,CAAA;AAChC,IAAA,MAAM+C,YAAY,GAAG,CAAIhG,CAAAA,EAAAA,MAAM,GAAG8D,iBAAiB,CAAE,CAAA,CAACxB,KAAK,CACzD,CAACuD,cACH,CAAC,CAAA;AACD,IAAA,MAAMlF,MAAM,GAAG,CAAIqF,CAAAA,EAAAA,YAAY,CAAI,EAAA,CAAA,CAAA;AACnC,IAAA,MAAMC,SAAS,GAAGf,WAAW,CAAClF,MAAM,CAAC,CAAA;IACrC,MAAMkG,cAAc,GAAG,CAAChB,WAAW,CAAClF,MAAM,GAAG,CAAC,CAAC,CAAA;AAC/C,IAAA,IAAIiG,SAAS,EAAE;MACb,IAAIE,UAAU,GAAG,EAAE,CAAA;AACnB,MAAA,IAAIC,KAAK,CAACC,OAAO,CAACJ,SAAS,CAAC,EAAE;AAC5B,QAAA,MAAMK,aAAa,GAAGnC,IAAI,CACvB7B,KAAK,CAAC,CAAC,EAAEuC,IAAI,CAACC,GAAG,CAACmB,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CACvCM,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;AACzB,QAAA,MAAMC,eAAe,GAAGP,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AAEzCE,QAAAA,UAAU,GAAG,CACX,KAAK,EACLhD,IAAI,CAACxC,MAAM,CAACA,MAAM,CAAC4F,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,EACvC,GAAG,EACHD,aAAa,EACbnD,IAAI,CAACvC,MAAM,CAAC,GAAG,CAAC,CAAC6F,MAAM,CAACD,eAAe,CAAC,CACzC,CAAChD,IAAI,CAAC,EAAE,CAAC,CAAA;AAEV,QAAA,IAAI0C,cAAc,IAAIrC,IAAI,CAAC/C,OAAO,EAAE;UAClCqF,UAAU,IAAI,GAAG,GAAGhD,IAAI,CAACrC,OAAO,CAAC+C,IAAI,CAAC/C,OAAO,CAAC,CAAA;AAChD,SAAA;AACF,OAAA;AACA,MAAA,OAAO,CACLqC,IAAI,CAACvC,MAAM,CAAC,GAAG,CAAC,EAChBuC,IAAI,CAACxC,MAAM,CAACA,MAAM,CAAC,EACnBwD,IAAI,CAACa,MAAM,GAAG,CAAC,GAAG,CAAA,CAAA,EAAIb,IAAI,CAAE,CAAA,GAAG,EAAE,EACjCgC,UAAU,CACX,CAAC3C,IAAI,CAAC,EAAE,CAAC,CAAA;AACZ,KAAC,MAAM;AACL,MAAA,OAAO,IAAIL,IAAI,CAACxC,MAAM,CAACA,MAAM,CAAC,CAAGwD,EAAAA,IAAI,CAACa,MAAM,GAAG,CAAC,GAAG,CAAA,CAAA,EAAIb,IAAI,CAAE,CAAA,GAAG,EAAE,CAAE,CAAA,CAAA;AACtE,KAAA;AACF,GAAC,CAAC,CACDX,IAAI,CAAC,IAAI,CAAC,CAAA;AAEb,EAAA,IAAIK,IAAI,CAAC/C,OAAO,IAAI,CAAC8E,UAAU,EAAE;AAC/BG,IAAAA,KAAK,GAAG,CAAG,EAAA,GAAG,CAACU,MAAM,CAACZ,cAAc,GAAG,CAAC,CAAC,GAAGhC,IAAI,CAAC/C,OAAO,CAAA,EAAA,EAAKiF,KAAK,CAAE,CAAA,CAAA;AACtE,GAAA;AAEA,EAAA,IAAIP,eAAe,EAAE;AACnB,IAAA,OAAOrC,IAAI,CAACpC,KAAK,CAACgF,KAAK,CAAC,CAAA;AAC1B,GAAC,MAAM;AACL,IAAA,OAAOA,KAAK,CAAA;AACd,GAAA;AACF,CAAA;AAMe,cAAA,EACbR,QAAgB,EAChBH,UAAkB,EAClBsB,SAAyB,EACzB7C,IAAa,GAAG,EAAE,EACV;EACR,IAAI,CAACJ,uBAAuB,EAAE;AAC5BA,IAAAA,uBAAuB,GAAG,IAAI,CAAA;IAE9B,MAAM3C,OAAO,GACX,qGAAqG,CAAA;IAEvG,IAAI9B,OAAO,CAAC2H,WAAW,EAAE;AAGvB3H,MAAAA,OAAO,CAAC2H,WAAW,CAAC7F,OAAO,EAAE,oBAAoB,CAAC,CAAA;AACpD,KAAC,MAAM;AACL,MAAA,MAAM8F,gBAAgB,GAAG,IAAIC,KAAK,CAAC/F,OAAO,CAAC,CAAA;MAC3C8F,gBAAgB,CAACE,IAAI,GAAG,oBAAoB,CAAA;MAC5CC,OAAO,CAACC,IAAI,CAAC,IAAIH,KAAK,CAAC/F,OAAO,CAAC,CAAC,CAAA;AAClC,KAAA;AACF,GAAA;EAEA4F,SAAS,GAAG7B,IAAI,CAACC,GAAG,CAAC4B,SAAS,EAAE,CAAC,CAAC,CAAA;AAElC,EAAA,MAAMO,QAAsB,GAAG;AAC7B7C,IAAAA,KAAK,EAAE;AAAEF,MAAAA,MAAM,EAAEwC,SAAS;AAAEvC,MAAAA,IAAI,EAAEiB,UAAAA;AAAW,KAAA;GAC9C,CAAA;AAED,EAAA,OAAOE,gBAAgB,CAACC,QAAQ,EAAE0B,QAAQ,EAAEpD,IAAI,CAAC,CAAA;AACnD;;;;;;"}
packages/mathml2omml/node_modules/@babel/code-frame/package.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@babel/code-frame",
3
+ "version": "7.29.0",
4
+ "description": "Generate errors that contain a code frame that point to source locations.",
5
+ "author": "The Babel Team (https://babel.dev/team)",
6
+ "homepage": "https://babel.dev/docs/en/next/babel-code-frame",
7
+ "bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen",
8
+ "license": "MIT",
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/babel/babel.git",
15
+ "directory": "packages/babel-code-frame"
16
+ },
17
+ "main": "./lib/index.js",
18
+ "dependencies": {
19
+ "@babel/helper-validator-identifier": "^7.28.5",
20
+ "js-tokens": "^4.0.0",
21
+ "picocolors": "^1.1.1"
22
+ },
23
+ "devDependencies": {
24
+ "charcodes": "^0.2.0",
25
+ "import-meta-resolve": "^4.1.0",
26
+ "strip-ansi": "^4.0.0"
27
+ },
28
+ "engines": {
29
+ "node": ">=6.9.0"
30
+ },
31
+ "type": "commonjs"
32
+ }
packages/mathml2omml/node_modules/@babel/compat-data/LICENSE ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2014-present Sebastian McKenzie and other contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
packages/mathml2omml/node_modules/@babel/compat-data/README.md ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # @babel/compat-data
2
+
3
+ > The compat-data to determine required Babel plugins
4
+
5
+ See our website [@babel/compat-data](https://babeljs.io/docs/babel-compat-data) for more information.
6
+
7
+ ## Install
8
+
9
+ Using npm:
10
+
11
+ ```sh
12
+ npm install --save @babel/compat-data
13
+ ```
14
+
15
+ or using yarn:
16
+
17
+ ```sh
18
+ yarn add @babel/compat-data
19
+ ```
packages/mathml2omml/node_modules/@babel/compat-data/corejs2-built-ins.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ // Todo (Babel 8): remove this file as Babel 8 drop support of core-js 2
2
+ module.exports = require("./data/corejs2-built-ins.json");
packages/mathml2omml/node_modules/@babel/compat-data/corejs3-shipped-proposals.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ // Todo (Babel 8): remove this file now that it is included in babel-plugin-polyfill-corejs3
2
+ module.exports = require("./data/corejs3-shipped-proposals.json");
packages/mathml2omml/node_modules/@babel/compat-data/data/corejs2-built-ins.json ADDED
@@ -0,0 +1,2106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "es6.array.copy-within": {
3
+ "chrome": "45",
4
+ "opera": "32",
5
+ "edge": "12",
6
+ "firefox": "32",
7
+ "safari": "9",
8
+ "node": "4",
9
+ "deno": "1",
10
+ "ios": "9",
11
+ "samsung": "5",
12
+ "rhino": "1.7.13",
13
+ "opera_mobile": "32",
14
+ "electron": "0.31"
15
+ },
16
+ "es6.array.every": {
17
+ "chrome": "5",
18
+ "opera": "10.10",
19
+ "edge": "12",
20
+ "firefox": "2",
21
+ "safari": "3.1",
22
+ "node": "0.4",
23
+ "deno": "1",
24
+ "ie": "9",
25
+ "android": "4",
26
+ "ios": "6",
27
+ "phantom": "1.9",
28
+ "samsung": "1",
29
+ "rhino": "1.7.13",
30
+ "opera_mobile": "10.1",
31
+ "electron": "0.20"
32
+ },
33
+ "es6.array.fill": {
34
+ "chrome": "45",
35
+ "opera": "32",
36
+ "edge": "12",
37
+ "firefox": "31",
38
+ "safari": "7.1",
39
+ "node": "4",
40
+ "deno": "1",
41
+ "ios": "8",
42
+ "samsung": "5",
43
+ "rhino": "1.7.13",
44
+ "opera_mobile": "32",
45
+ "electron": "0.31"
46
+ },
47
+ "es6.array.filter": {
48
+ "chrome": "51",
49
+ "opera": "38",
50
+ "edge": "13",
51
+ "firefox": "48",
52
+ "safari": "10",
53
+ "node": "6.5",
54
+ "deno": "1",
55
+ "ios": "10",
56
+ "samsung": "5",
57
+ "opera_mobile": "41",
58
+ "electron": "1.2"
59
+ },
60
+ "es6.array.find": {
61
+ "chrome": "45",
62
+ "opera": "32",
63
+ "edge": "12",
64
+ "firefox": "25",
65
+ "safari": "7.1",
66
+ "node": "4",
67
+ "deno": "1",
68
+ "ios": "8",
69
+ "samsung": "5",
70
+ "rhino": "1.7.13",
71
+ "opera_mobile": "32",
72
+ "electron": "0.31"
73
+ },
74
+ "es6.array.find-index": {
75
+ "chrome": "45",
76
+ "opera": "32",
77
+ "edge": "12",
78
+ "firefox": "25",
79
+ "safari": "7.1",
80
+ "node": "4",
81
+ "deno": "1",
82
+ "ios": "8",
83
+ "samsung": "5",
84
+ "rhino": "1.7.13",
85
+ "opera_mobile": "32",
86
+ "electron": "0.31"
87
+ },
88
+ "es7.array.flat-map": {
89
+ "chrome": "69",
90
+ "opera": "56",
91
+ "edge": "79",
92
+ "firefox": "62",
93
+ "safari": "12",
94
+ "node": "11",
95
+ "deno": "1",
96
+ "ios": "12",
97
+ "samsung": "10",
98
+ "rhino": "1.7.15",
99
+ "opera_mobile": "48",
100
+ "electron": "4.0"
101
+ },
102
+ "es6.array.for-each": {
103
+ "chrome": "5",
104
+ "opera": "10.10",
105
+ "edge": "12",
106
+ "firefox": "2",
107
+ "safari": "3.1",
108
+ "node": "0.4",
109
+ "deno": "1",
110
+ "ie": "9",
111
+ "android": "4",
112
+ "ios": "6",
113
+ "phantom": "1.9",
114
+ "samsung": "1",
115
+ "rhino": "1.7.13",
116
+ "opera_mobile": "10.1",
117
+ "electron": "0.20"
118
+ },
119
+ "es6.array.from": {
120
+ "chrome": "51",
121
+ "opera": "38",
122
+ "edge": "15",
123
+ "firefox": "36",
124
+ "safari": "10",
125
+ "node": "6.5",
126
+ "deno": "1",
127
+ "ios": "10",
128
+ "samsung": "5",
129
+ "rhino": "1.7.15",
130
+ "opera_mobile": "41",
131
+ "electron": "1.2"
132
+ },
133
+ "es7.array.includes": {
134
+ "chrome": "47",
135
+ "opera": "34",
136
+ "edge": "14",
137
+ "firefox": "102",
138
+ "safari": "10",
139
+ "node": "6",
140
+ "deno": "1",
141
+ "ios": "10",
142
+ "samsung": "5",
143
+ "rhino": "1.8",
144
+ "opera_mobile": "34",
145
+ "electron": "0.36"
146
+ },
147
+ "es6.array.index-of": {
148
+ "chrome": "5",
149
+ "opera": "10.10",
150
+ "edge": "12",
151
+ "firefox": "2",
152
+ "safari": "3.1",
153
+ "node": "0.4",
154
+ "deno": "1",
155
+ "ie": "9",
156
+ "android": "4",
157
+ "ios": "6",
158
+ "phantom": "1.9",
159
+ "samsung": "1",
160
+ "rhino": "1.7.13",
161
+ "opera_mobile": "10.1",
162
+ "electron": "0.20"
163
+ },
164
+ "es6.array.is-array": {
165
+ "chrome": "5",
166
+ "opera": "10.50",
167
+ "edge": "12",
168
+ "firefox": "4",
169
+ "safari": "4",
170
+ "node": "0.4",
171
+ "deno": "1",
172
+ "ie": "9",
173
+ "android": "4",
174
+ "ios": "6",
175
+ "phantom": "1.9",
176
+ "samsung": "1",
177
+ "rhino": "1.7.13",
178
+ "opera_mobile": "10.1",
179
+ "electron": "0.20"
180
+ },
181
+ "es6.array.iterator": {
182
+ "chrome": "66",
183
+ "opera": "53",
184
+ "edge": "12",
185
+ "firefox": "60",
186
+ "safari": "9",
187
+ "node": "10",
188
+ "deno": "1",
189
+ "ios": "9",
190
+ "samsung": "9",
191
+ "rhino": "1.7.13",
192
+ "opera_mobile": "47",
193
+ "electron": "3.0"
194
+ },
195
+ "es6.array.last-index-of": {
196
+ "chrome": "5",
197
+ "opera": "10.10",
198
+ "edge": "12",
199
+ "firefox": "2",
200
+ "safari": "3.1",
201
+ "node": "0.4",
202
+ "deno": "1",
203
+ "ie": "9",
204
+ "android": "4",
205
+ "ios": "6",
206
+ "phantom": "1.9",
207
+ "samsung": "1",
208
+ "rhino": "1.7.13",
209
+ "opera_mobile": "10.1",
210
+ "electron": "0.20"
211
+ },
212
+ "es6.array.map": {
213
+ "chrome": "51",
214
+ "opera": "38",
215
+ "edge": "13",
216
+ "firefox": "48",
217
+ "safari": "10",
218
+ "node": "6.5",
219
+ "deno": "1",
220
+ "ios": "10",
221
+ "samsung": "5",
222
+ "opera_mobile": "41",
223
+ "electron": "1.2"
224
+ },
225
+ "es6.array.of": {
226
+ "chrome": "45",
227
+ "opera": "32",
228
+ "edge": "12",
229
+ "firefox": "25",
230
+ "safari": "9",
231
+ "node": "4",
232
+ "deno": "1",
233
+ "ios": "9",
234
+ "samsung": "5",
235
+ "rhino": "1.7.13",
236
+ "opera_mobile": "32",
237
+ "electron": "0.31"
238
+ },
239
+ "es6.array.reduce": {
240
+ "chrome": "5",
241
+ "opera": "10.50",
242
+ "edge": "12",
243
+ "firefox": "3",
244
+ "safari": "4",
245
+ "node": "0.4",
246
+ "deno": "1",
247
+ "ie": "9",
248
+ "android": "4",
249
+ "ios": "6",
250
+ "phantom": "1.9",
251
+ "samsung": "1",
252
+ "rhino": "1.7.13",
253
+ "opera_mobile": "10.1",
254
+ "electron": "0.20"
255
+ },
256
+ "es6.array.reduce-right": {
257
+ "chrome": "5",
258
+ "opera": "10.50",
259
+ "edge": "12",
260
+ "firefox": "3",
261
+ "safari": "4",
262
+ "node": "0.4",
263
+ "deno": "1",
264
+ "ie": "9",
265
+ "android": "4",
266
+ "ios": "6",
267
+ "phantom": "1.9",
268
+ "samsung": "1",
269
+ "rhino": "1.7.13",
270
+ "opera_mobile": "10.1",
271
+ "electron": "0.20"
272
+ },
273
+ "es6.array.slice": {
274
+ "chrome": "51",
275
+ "opera": "38",
276
+ "edge": "13",
277
+ "firefox": "48",
278
+ "safari": "10",
279
+ "node": "6.5",
280
+ "deno": "1",
281
+ "ios": "10",
282
+ "samsung": "5",
283
+ "opera_mobile": "41",
284
+ "electron": "1.2"
285
+ },
286
+ "es6.array.some": {
287
+ "chrome": "5",
288
+ "opera": "10.10",
289
+ "edge": "12",
290
+ "firefox": "2",
291
+ "safari": "3.1",
292
+ "node": "0.4",
293
+ "deno": "1",
294
+ "ie": "9",
295
+ "android": "4",
296
+ "ios": "6",
297
+ "phantom": "1.9",
298
+ "samsung": "1",
299
+ "rhino": "1.7.13",
300
+ "opera_mobile": "10.1",
301
+ "electron": "0.20"
302
+ },
303
+ "es6.array.sort": {
304
+ "chrome": "63",
305
+ "opera": "50",
306
+ "edge": "12",
307
+ "firefox": "5",
308
+ "safari": "12",
309
+ "node": "10",
310
+ "deno": "1",
311
+ "ie": "9",
312
+ "ios": "12",
313
+ "samsung": "8",
314
+ "rhino": "1.7.13",
315
+ "opera_mobile": "46",
316
+ "electron": "3.0"
317
+ },
318
+ "es6.array.species": {
319
+ "chrome": "51",
320
+ "opera": "38",
321
+ "edge": "13",
322
+ "firefox": "48",
323
+ "safari": "10",
324
+ "node": "6.5",
325
+ "deno": "1",
326
+ "ios": "10",
327
+ "samsung": "5",
328
+ "rhino": "1.7.15",
329
+ "opera_mobile": "41",
330
+ "electron": "1.2"
331
+ },
332
+ "es6.date.now": {
333
+ "chrome": "5",
334
+ "opera": "10.50",
335
+ "edge": "12",
336
+ "firefox": "2",
337
+ "safari": "4",
338
+ "node": "0.4",
339
+ "deno": "1",
340
+ "ie": "9",
341
+ "android": "4",
342
+ "ios": "6",
343
+ "phantom": "1.9",
344
+ "samsung": "1",
345
+ "rhino": "1.7.13",
346
+ "opera_mobile": "10.1",
347
+ "electron": "0.20"
348
+ },
349
+ "es6.date.to-iso-string": {
350
+ "chrome": "5",
351
+ "opera": "10.50",
352
+ "edge": "12",
353
+ "firefox": "3.5",
354
+ "safari": "4",
355
+ "node": "0.4",
356
+ "deno": "1",
357
+ "ie": "9",
358
+ "android": "4",
359
+ "ios": "6",
360
+ "phantom": "1.9",
361
+ "samsung": "1",
362
+ "rhino": "1.7.13",
363
+ "opera_mobile": "10.1",
364
+ "electron": "0.20"
365
+ },
366
+ "es6.date.to-json": {
367
+ "chrome": "5",
368
+ "opera": "12.10",
369
+ "edge": "12",
370
+ "firefox": "4",
371
+ "safari": "10",
372
+ "node": "0.4",
373
+ "deno": "1",
374
+ "ie": "9",
375
+ "android": "4",
376
+ "ios": "10",
377
+ "samsung": "1",
378
+ "rhino": "1.7.13",
379
+ "opera_mobile": "12.1",
380
+ "electron": "0.20"
381
+ },
382
+ "es6.date.to-primitive": {
383
+ "chrome": "47",
384
+ "opera": "34",
385
+ "edge": "15",
386
+ "firefox": "44",
387
+ "safari": "10",
388
+ "node": "6",
389
+ "deno": "1",
390
+ "ios": "10",
391
+ "samsung": "5",
392
+ "rhino": "1.8",
393
+ "opera_mobile": "34",
394
+ "electron": "0.36"
395
+ },
396
+ "es6.date.to-string": {
397
+ "chrome": "5",
398
+ "opera": "10.50",
399
+ "edge": "12",
400
+ "firefox": "2",
401
+ "safari": "3.1",
402
+ "node": "0.4",
403
+ "deno": "1",
404
+ "ie": "10",
405
+ "android": "4",
406
+ "ios": "6",
407
+ "phantom": "1.9",
408
+ "samsung": "1",
409
+ "rhino": "1.7.13",
410
+ "opera_mobile": "10.1",
411
+ "electron": "0.20"
412
+ },
413
+ "es6.function.bind": {
414
+ "chrome": "7",
415
+ "opera": "12",
416
+ "edge": "12",
417
+ "firefox": "4",
418
+ "safari": "5.1",
419
+ "node": "0.4",
420
+ "deno": "1",
421
+ "ie": "9",
422
+ "android": "4",
423
+ "ios": "6",
424
+ "phantom": "1.9",
425
+ "samsung": "1",
426
+ "rhino": "1.7.13",
427
+ "opera_mobile": "12",
428
+ "electron": "0.20"
429
+ },
430
+ "es6.function.has-instance": {
431
+ "chrome": "51",
432
+ "opera": "38",
433
+ "edge": "15",
434
+ "firefox": "50",
435
+ "safari": "10",
436
+ "node": "6.5",
437
+ "deno": "1",
438
+ "ios": "10",
439
+ "samsung": "5",
440
+ "opera_mobile": "41",
441
+ "electron": "1.2"
442
+ },
443
+ "es6.function.name": {
444
+ "chrome": "5",
445
+ "opera": "10.50",
446
+ "edge": "14",
447
+ "firefox": "2",
448
+ "safari": "4",
449
+ "node": "0.4",
450
+ "deno": "1",
451
+ "android": "4",
452
+ "ios": "6",
453
+ "phantom": "1.9",
454
+ "samsung": "1",
455
+ "rhino": "1.7.13",
456
+ "opera_mobile": "10.1",
457
+ "electron": "0.20"
458
+ },
459
+ "es6.map": {
460
+ "chrome": "51",
461
+ "opera": "38",
462
+ "edge": "15",
463
+ "firefox": "53",
464
+ "safari": "10",
465
+ "node": "6.5",
466
+ "deno": "1",
467
+ "ios": "10",
468
+ "samsung": "5",
469
+ "opera_mobile": "41",
470
+ "electron": "1.2"
471
+ },
472
+ "es6.math.acosh": {
473
+ "chrome": "38",
474
+ "opera": "25",
475
+ "edge": "12",
476
+ "firefox": "25",
477
+ "safari": "7.1",
478
+ "node": "0.12",
479
+ "deno": "1",
480
+ "ios": "8",
481
+ "samsung": "3",
482
+ "rhino": "1.7.13",
483
+ "opera_mobile": "25",
484
+ "electron": "0.20"
485
+ },
486
+ "es6.math.asinh": {
487
+ "chrome": "38",
488
+ "opera": "25",
489
+ "edge": "12",
490
+ "firefox": "25",
491
+ "safari": "7.1",
492
+ "node": "0.12",
493
+ "deno": "1",
494
+ "ios": "8",
495
+ "samsung": "3",
496
+ "rhino": "1.7.13",
497
+ "opera_mobile": "25",
498
+ "electron": "0.20"
499
+ },
500
+ "es6.math.atanh": {
501
+ "chrome": "38",
502
+ "opera": "25",
503
+ "edge": "12",
504
+ "firefox": "25",
505
+ "safari": "7.1",
506
+ "node": "0.12",
507
+ "deno": "1",
508
+ "ios": "8",
509
+ "samsung": "3",
510
+ "rhino": "1.7.13",
511
+ "opera_mobile": "25",
512
+ "electron": "0.20"
513
+ },
514
+ "es6.math.cbrt": {
515
+ "chrome": "38",
516
+ "opera": "25",
517
+ "edge": "12",
518
+ "firefox": "25",
519
+ "safari": "7.1",
520
+ "node": "0.12",
521
+ "deno": "1",
522
+ "ios": "8",
523
+ "samsung": "3",
524
+ "rhino": "1.7.13",
525
+ "opera_mobile": "25",
526
+ "electron": "0.20"
527
+ },
528
+ "es6.math.clz32": {
529
+ "chrome": "38",
530
+ "opera": "25",
531
+ "edge": "12",
532
+ "firefox": "31",
533
+ "safari": "9",
534
+ "node": "0.12",
535
+ "deno": "1",
536
+ "ios": "9",
537
+ "samsung": "3",
538
+ "rhino": "1.7.13",
539
+ "opera_mobile": "25",
540
+ "electron": "0.20"
541
+ },
542
+ "es6.math.cosh": {
543
+ "chrome": "38",
544
+ "opera": "25",
545
+ "edge": "12",
546
+ "firefox": "25",
547
+ "safari": "7.1",
548
+ "node": "0.12",
549
+ "deno": "1",
550
+ "ios": "8",
551
+ "samsung": "3",
552
+ "rhino": "1.7.13",
553
+ "opera_mobile": "25",
554
+ "electron": "0.20"
555
+ },
556
+ "es6.math.expm1": {
557
+ "chrome": "38",
558
+ "opera": "25",
559
+ "edge": "12",
560
+ "firefox": "25",
561
+ "safari": "7.1",
562
+ "node": "0.12",
563
+ "deno": "1",
564
+ "ios": "8",
565
+ "samsung": "3",
566
+ "rhino": "1.7.13",
567
+ "opera_mobile": "25",
568
+ "electron": "0.20"
569
+ },
570
+ "es6.math.fround": {
571
+ "chrome": "38",
572
+ "opera": "25",
573
+ "edge": "12",
574
+ "firefox": "26",
575
+ "safari": "7.1",
576
+ "node": "0.12",
577
+ "deno": "1",
578
+ "ios": "8",
579
+ "samsung": "3",
580
+ "rhino": "1.7.13",
581
+ "opera_mobile": "25",
582
+ "electron": "0.20"
583
+ },
584
+ "es6.math.hypot": {
585
+ "chrome": "38",
586
+ "opera": "25",
587
+ "edge": "12",
588
+ "firefox": "27",
589
+ "safari": "7.1",
590
+ "node": "0.12",
591
+ "deno": "1",
592
+ "ios": "8",
593
+ "samsung": "3",
594
+ "rhino": "1.7.13",
595
+ "opera_mobile": "25",
596
+ "electron": "0.20"
597
+ },
598
+ "es6.math.imul": {
599
+ "chrome": "30",
600
+ "opera": "17",
601
+ "edge": "12",
602
+ "firefox": "23",
603
+ "safari": "7",
604
+ "node": "0.12",
605
+ "deno": "1",
606
+ "android": "4.4",
607
+ "ios": "7",
608
+ "samsung": "2",
609
+ "rhino": "1.7.13",
610
+ "opera_mobile": "18",
611
+ "electron": "0.20"
612
+ },
613
+ "es6.math.log1p": {
614
+ "chrome": "38",
615
+ "opera": "25",
616
+ "edge": "12",
617
+ "firefox": "25",
618
+ "safari": "7.1",
619
+ "node": "0.12",
620
+ "deno": "1",
621
+ "ios": "8",
622
+ "samsung": "3",
623
+ "rhino": "1.7.13",
624
+ "opera_mobile": "25",
625
+ "electron": "0.20"
626
+ },
627
+ "es6.math.log10": {
628
+ "chrome": "38",
629
+ "opera": "25",
630
+ "edge": "12",
631
+ "firefox": "25",
632
+ "safari": "7.1",
633
+ "node": "0.12",
634
+ "deno": "1",
635
+ "ios": "8",
636
+ "samsung": "3",
637
+ "rhino": "1.7.13",
638
+ "opera_mobile": "25",
639
+ "electron": "0.20"
640
+ },
641
+ "es6.math.log2": {
642
+ "chrome": "38",
643
+ "opera": "25",
644
+ "edge": "12",
645
+ "firefox": "25",
646
+ "safari": "7.1",
647
+ "node": "0.12",
648
+ "deno": "1",
649
+ "ios": "8",
650
+ "samsung": "3",
651
+ "rhino": "1.7.13",
652
+ "opera_mobile": "25",
653
+ "electron": "0.20"
654
+ },
655
+ "es6.math.sign": {
656
+ "chrome": "38",
657
+ "opera": "25",
658
+ "edge": "12",
659
+ "firefox": "25",
660
+ "safari": "9",
661
+ "node": "0.12",
662
+ "deno": "1",
663
+ "ios": "9",
664
+ "samsung": "3",
665
+ "rhino": "1.7.13",
666
+ "opera_mobile": "25",
667
+ "electron": "0.20"
668
+ },
669
+ "es6.math.sinh": {
670
+ "chrome": "38",
671
+ "opera": "25",
672
+ "edge": "12",
673
+ "firefox": "25",
674
+ "safari": "7.1",
675
+ "node": "0.12",
676
+ "deno": "1",
677
+ "ios": "8",
678
+ "samsung": "3",
679
+ "rhino": "1.7.13",
680
+ "opera_mobile": "25",
681
+ "electron": "0.20"
682
+ },
683
+ "es6.math.tanh": {
684
+ "chrome": "38",
685
+ "opera": "25",
686
+ "edge": "12",
687
+ "firefox": "25",
688
+ "safari": "7.1",
689
+ "node": "0.12",
690
+ "deno": "1",
691
+ "ios": "8",
692
+ "samsung": "3",
693
+ "rhino": "1.7.13",
694
+ "opera_mobile": "25",
695
+ "electron": "0.20"
696
+ },
697
+ "es6.math.trunc": {
698
+ "chrome": "38",
699
+ "opera": "25",
700
+ "edge": "12",
701
+ "firefox": "25",
702
+ "safari": "7.1",
703
+ "node": "0.12",
704
+ "deno": "1",
705
+ "ios": "8",
706
+ "samsung": "3",
707
+ "rhino": "1.7.13",
708
+ "opera_mobile": "25",
709
+ "electron": "0.20"
710
+ },
711
+ "es6.number.constructor": {
712
+ "chrome": "41",
713
+ "opera": "28",
714
+ "edge": "12",
715
+ "firefox": "36",
716
+ "safari": "9",
717
+ "node": "4",
718
+ "deno": "1",
719
+ "ios": "9",
720
+ "samsung": "3.4",
721
+ "rhino": "1.7.13",
722
+ "opera_mobile": "28",
723
+ "electron": "0.21"
724
+ },
725
+ "es6.number.epsilon": {
726
+ "chrome": "34",
727
+ "opera": "21",
728
+ "edge": "12",
729
+ "firefox": "25",
730
+ "safari": "9",
731
+ "node": "0.12",
732
+ "deno": "1",
733
+ "ios": "9",
734
+ "samsung": "2",
735
+ "rhino": "1.7.14",
736
+ "opera_mobile": "21",
737
+ "electron": "0.20"
738
+ },
739
+ "es6.number.is-finite": {
740
+ "chrome": "19",
741
+ "opera": "15",
742
+ "edge": "12",
743
+ "firefox": "16",
744
+ "safari": "9",
745
+ "node": "0.8",
746
+ "deno": "1",
747
+ "android": "4.1",
748
+ "ios": "9",
749
+ "samsung": "1.5",
750
+ "rhino": "1.7.13",
751
+ "opera_mobile": "14",
752
+ "electron": "0.20"
753
+ },
754
+ "es6.number.is-integer": {
755
+ "chrome": "34",
756
+ "opera": "21",
757
+ "edge": "12",
758
+ "firefox": "16",
759
+ "safari": "9",
760
+ "node": "0.12",
761
+ "deno": "1",
762
+ "ios": "9",
763
+ "samsung": "2",
764
+ "rhino": "1.7.13",
765
+ "opera_mobile": "21",
766
+ "electron": "0.20"
767
+ },
768
+ "es6.number.is-nan": {
769
+ "chrome": "19",
770
+ "opera": "15",
771
+ "edge": "12",
772
+ "firefox": "15",
773
+ "safari": "9",
774
+ "node": "0.8",
775
+ "deno": "1",
776
+ "android": "4.1",
777
+ "ios": "9",
778
+ "samsung": "1.5",
779
+ "rhino": "1.7.13",
780
+ "opera_mobile": "14",
781
+ "electron": "0.20"
782
+ },
783
+ "es6.number.is-safe-integer": {
784
+ "chrome": "34",
785
+ "opera": "21",
786
+ "edge": "12",
787
+ "firefox": "32",
788
+ "safari": "9",
789
+ "node": "0.12",
790
+ "deno": "1",
791
+ "ios": "9",
792
+ "samsung": "2",
793
+ "rhino": "1.7.13",
794
+ "opera_mobile": "21",
795
+ "electron": "0.20"
796
+ },
797
+ "es6.number.max-safe-integer": {
798
+ "chrome": "34",
799
+ "opera": "21",
800
+ "edge": "12",
801
+ "firefox": "31",
802
+ "safari": "9",
803
+ "node": "0.12",
804
+ "deno": "1",
805
+ "ios": "9",
806
+ "samsung": "2",
807
+ "rhino": "1.7.13",
808
+ "opera_mobile": "21",
809
+ "electron": "0.20"
810
+ },
811
+ "es6.number.min-safe-integer": {
812
+ "chrome": "34",
813
+ "opera": "21",
814
+ "edge": "12",
815
+ "firefox": "31",
816
+ "safari": "9",
817
+ "node": "0.12",
818
+ "deno": "1",
819
+ "ios": "9",
820
+ "samsung": "2",
821
+ "rhino": "1.7.13",
822
+ "opera_mobile": "21",
823
+ "electron": "0.20"
824
+ },
825
+ "es6.number.parse-float": {
826
+ "chrome": "34",
827
+ "opera": "21",
828
+ "edge": "12",
829
+ "firefox": "25",
830
+ "safari": "9",
831
+ "node": "0.12",
832
+ "deno": "1",
833
+ "ios": "9",
834
+ "samsung": "2",
835
+ "rhino": "1.7.14",
836
+ "opera_mobile": "21",
837
+ "electron": "0.20"
838
+ },
839
+ "es6.number.parse-int": {
840
+ "chrome": "34",
841
+ "opera": "21",
842
+ "edge": "12",
843
+ "firefox": "25",
844
+ "safari": "9",
845
+ "node": "0.12",
846
+ "deno": "1",
847
+ "ios": "9",
848
+ "samsung": "2",
849
+ "rhino": "1.7.14",
850
+ "opera_mobile": "21",
851
+ "electron": "0.20"
852
+ },
853
+ "es6.object.assign": {
854
+ "chrome": "49",
855
+ "opera": "36",
856
+ "edge": "13",
857
+ "firefox": "36",
858
+ "safari": "10",
859
+ "node": "6",
860
+ "deno": "1",
861
+ "ios": "10",
862
+ "samsung": "5",
863
+ "rhino": "1.8",
864
+ "opera_mobile": "36",
865
+ "electron": "0.37"
866
+ },
867
+ "es6.object.create": {
868
+ "chrome": "5",
869
+ "opera": "12",
870
+ "edge": "12",
871
+ "firefox": "4",
872
+ "safari": "4",
873
+ "node": "0.4",
874
+ "deno": "1",
875
+ "ie": "9",
876
+ "android": "4",
877
+ "ios": "6",
878
+ "phantom": "1.9",
879
+ "samsung": "1",
880
+ "rhino": "1.7.13",
881
+ "opera_mobile": "12",
882
+ "electron": "0.20"
883
+ },
884
+ "es7.object.define-getter": {
885
+ "chrome": "62",
886
+ "opera": "49",
887
+ "edge": "16",
888
+ "firefox": "48",
889
+ "safari": "9",
890
+ "node": "8.10",
891
+ "deno": "1",
892
+ "ios": "9",
893
+ "samsung": "8",
894
+ "opera_mobile": "46",
895
+ "electron": "3.0"
896
+ },
897
+ "es7.object.define-setter": {
898
+ "chrome": "62",
899
+ "opera": "49",
900
+ "edge": "16",
901
+ "firefox": "48",
902
+ "safari": "9",
903
+ "node": "8.10",
904
+ "deno": "1",
905
+ "ios": "9",
906
+ "samsung": "8",
907
+ "opera_mobile": "46",
908
+ "electron": "3.0"
909
+ },
910
+ "es6.object.define-property": {
911
+ "chrome": "5",
912
+ "opera": "12",
913
+ "edge": "12",
914
+ "firefox": "4",
915
+ "safari": "5.1",
916
+ "node": "0.4",
917
+ "deno": "1",
918
+ "ie": "9",
919
+ "android": "4",
920
+ "ios": "6",
921
+ "phantom": "1.9",
922
+ "samsung": "1",
923
+ "rhino": "1.7.13",
924
+ "opera_mobile": "12",
925
+ "electron": "0.20"
926
+ },
927
+ "es6.object.define-properties": {
928
+ "chrome": "5",
929
+ "opera": "12",
930
+ "edge": "12",
931
+ "firefox": "4",
932
+ "safari": "4",
933
+ "node": "0.4",
934
+ "deno": "1",
935
+ "ie": "9",
936
+ "android": "4",
937
+ "ios": "6",
938
+ "phantom": "1.9",
939
+ "samsung": "1",
940
+ "rhino": "1.7.13",
941
+ "opera_mobile": "12",
942
+ "electron": "0.20"
943
+ },
944
+ "es7.object.entries": {
945
+ "chrome": "54",
946
+ "opera": "41",
947
+ "edge": "14",
948
+ "firefox": "47",
949
+ "safari": "10.1",
950
+ "node": "7",
951
+ "deno": "1",
952
+ "ios": "10.3",
953
+ "samsung": "6",
954
+ "rhino": "1.7.14",
955
+ "opera_mobile": "41",
956
+ "electron": "1.4"
957
+ },
958
+ "es6.object.freeze": {
959
+ "chrome": "44",
960
+ "opera": "31",
961
+ "edge": "12",
962
+ "firefox": "35",
963
+ "safari": "9",
964
+ "node": "4",
965
+ "deno": "1",
966
+ "ios": "9",
967
+ "samsung": "4",
968
+ "rhino": "1.7.13",
969
+ "opera_mobile": "32",
970
+ "electron": "0.30"
971
+ },
972
+ "es6.object.get-own-property-descriptor": {
973
+ "chrome": "44",
974
+ "opera": "31",
975
+ "edge": "12",
976
+ "firefox": "35",
977
+ "safari": "9",
978
+ "node": "4",
979
+ "deno": "1",
980
+ "ios": "9",
981
+ "samsung": "4",
982
+ "rhino": "1.7.13",
983
+ "opera_mobile": "32",
984
+ "electron": "0.30"
985
+ },
986
+ "es7.object.get-own-property-descriptors": {
987
+ "chrome": "54",
988
+ "opera": "41",
989
+ "edge": "15",
990
+ "firefox": "50",
991
+ "safari": "10.1",
992
+ "node": "7",
993
+ "deno": "1",
994
+ "ios": "10.3",
995
+ "samsung": "6",
996
+ "rhino": "1.8",
997
+ "opera_mobile": "41",
998
+ "electron": "1.4"
999
+ },
1000
+ "es6.object.get-own-property-names": {
1001
+ "chrome": "40",
1002
+ "opera": "27",
1003
+ "edge": "12",
1004
+ "firefox": "33",
1005
+ "safari": "9",
1006
+ "node": "4",
1007
+ "deno": "1",
1008
+ "ios": "9",
1009
+ "samsung": "3.4",
1010
+ "rhino": "1.7.13",
1011
+ "opera_mobile": "27",
1012
+ "electron": "0.21"
1013
+ },
1014
+ "es6.object.get-prototype-of": {
1015
+ "chrome": "44",
1016
+ "opera": "31",
1017
+ "edge": "12",
1018
+ "firefox": "35",
1019
+ "safari": "9",
1020
+ "node": "4",
1021
+ "deno": "1",
1022
+ "ios": "9",
1023
+ "samsung": "4",
1024
+ "rhino": "1.7.13",
1025
+ "opera_mobile": "32",
1026
+ "electron": "0.30"
1027
+ },
1028
+ "es7.object.lookup-getter": {
1029
+ "chrome": "62",
1030
+ "opera": "49",
1031
+ "edge": "79",
1032
+ "firefox": "36",
1033
+ "safari": "9",
1034
+ "node": "8.10",
1035
+ "deno": "1",
1036
+ "ios": "9",
1037
+ "samsung": "8",
1038
+ "opera_mobile": "46",
1039
+ "electron": "3.0"
1040
+ },
1041
+ "es7.object.lookup-setter": {
1042
+ "chrome": "62",
1043
+ "opera": "49",
1044
+ "edge": "79",
1045
+ "firefox": "36",
1046
+ "safari": "9",
1047
+ "node": "8.10",
1048
+ "deno": "1",
1049
+ "ios": "9",
1050
+ "samsung": "8",
1051
+ "opera_mobile": "46",
1052
+ "electron": "3.0"
1053
+ },
1054
+ "es6.object.prevent-extensions": {
1055
+ "chrome": "44",
1056
+ "opera": "31",
1057
+ "edge": "12",
1058
+ "firefox": "35",
1059
+ "safari": "9",
1060
+ "node": "4",
1061
+ "deno": "1",
1062
+ "ios": "9",
1063
+ "samsung": "4",
1064
+ "rhino": "1.7.13",
1065
+ "opera_mobile": "32",
1066
+ "electron": "0.30"
1067
+ },
1068
+ "es6.object.to-string": {
1069
+ "chrome": "57",
1070
+ "opera": "44",
1071
+ "edge": "15",
1072
+ "firefox": "51",
1073
+ "safari": "10",
1074
+ "node": "8",
1075
+ "deno": "1",
1076
+ "ios": "10",
1077
+ "samsung": "7",
1078
+ "opera_mobile": "43",
1079
+ "electron": "1.7"
1080
+ },
1081
+ "es6.object.is": {
1082
+ "chrome": "19",
1083
+ "opera": "15",
1084
+ "edge": "12",
1085
+ "firefox": "22",
1086
+ "safari": "9",
1087
+ "node": "0.8",
1088
+ "deno": "1",
1089
+ "android": "4.1",
1090
+ "ios": "9",
1091
+ "samsung": "1.5",
1092
+ "rhino": "1.7.13",
1093
+ "opera_mobile": "14",
1094
+ "electron": "0.20"
1095
+ },
1096
+ "es6.object.is-frozen": {
1097
+ "chrome": "44",
1098
+ "opera": "31",
1099
+ "edge": "12",
1100
+ "firefox": "35",
1101
+ "safari": "9",
1102
+ "node": "4",
1103
+ "deno": "1",
1104
+ "ios": "9",
1105
+ "samsung": "4",
1106
+ "rhino": "1.7.13",
1107
+ "opera_mobile": "32",
1108
+ "electron": "0.30"
1109
+ },
1110
+ "es6.object.is-sealed": {
1111
+ "chrome": "44",
1112
+ "opera": "31",
1113
+ "edge": "12",
1114
+ "firefox": "35",
1115
+ "safari": "9",
1116
+ "node": "4",
1117
+ "deno": "1",
1118
+ "ios": "9",
1119
+ "samsung": "4",
1120
+ "rhino": "1.7.13",
1121
+ "opera_mobile": "32",
1122
+ "electron": "0.30"
1123
+ },
1124
+ "es6.object.is-extensible": {
1125
+ "chrome": "44",
1126
+ "opera": "31",
1127
+ "edge": "12",
1128
+ "firefox": "35",
1129
+ "safari": "9",
1130
+ "node": "4",
1131
+ "deno": "1",
1132
+ "ios": "9",
1133
+ "samsung": "4",
1134
+ "rhino": "1.7.13",
1135
+ "opera_mobile": "32",
1136
+ "electron": "0.30"
1137
+ },
1138
+ "es6.object.keys": {
1139
+ "chrome": "40",
1140
+ "opera": "27",
1141
+ "edge": "12",
1142
+ "firefox": "35",
1143
+ "safari": "9",
1144
+ "node": "4",
1145
+ "deno": "1",
1146
+ "ios": "9",
1147
+ "samsung": "3.4",
1148
+ "rhino": "1.7.13",
1149
+ "opera_mobile": "27",
1150
+ "electron": "0.21"
1151
+ },
1152
+ "es6.object.seal": {
1153
+ "chrome": "44",
1154
+ "opera": "31",
1155
+ "edge": "12",
1156
+ "firefox": "35",
1157
+ "safari": "9",
1158
+ "node": "4",
1159
+ "deno": "1",
1160
+ "ios": "9",
1161
+ "samsung": "4",
1162
+ "rhino": "1.7.13",
1163
+ "opera_mobile": "32",
1164
+ "electron": "0.30"
1165
+ },
1166
+ "es6.object.set-prototype-of": {
1167
+ "chrome": "34",
1168
+ "opera": "21",
1169
+ "edge": "12",
1170
+ "firefox": "31",
1171
+ "safari": "9",
1172
+ "node": "0.12",
1173
+ "deno": "1",
1174
+ "ie": "11",
1175
+ "ios": "9",
1176
+ "samsung": "2",
1177
+ "rhino": "1.7.13",
1178
+ "opera_mobile": "21",
1179
+ "electron": "0.20"
1180
+ },
1181
+ "es7.object.values": {
1182
+ "chrome": "54",
1183
+ "opera": "41",
1184
+ "edge": "14",
1185
+ "firefox": "47",
1186
+ "safari": "10.1",
1187
+ "node": "7",
1188
+ "deno": "1",
1189
+ "ios": "10.3",
1190
+ "samsung": "6",
1191
+ "rhino": "1.7.14",
1192
+ "opera_mobile": "41",
1193
+ "electron": "1.4"
1194
+ },
1195
+ "es6.promise": {
1196
+ "chrome": "51",
1197
+ "opera": "38",
1198
+ "edge": "14",
1199
+ "firefox": "45",
1200
+ "safari": "10",
1201
+ "node": "6.5",
1202
+ "deno": "1",
1203
+ "ios": "10",
1204
+ "samsung": "5",
1205
+ "rhino": "1.7.15",
1206
+ "opera_mobile": "41",
1207
+ "electron": "1.2"
1208
+ },
1209
+ "es7.promise.finally": {
1210
+ "chrome": "63",
1211
+ "opera": "50",
1212
+ "edge": "18",
1213
+ "firefox": "58",
1214
+ "safari": "11.1",
1215
+ "node": "10",
1216
+ "deno": "1",
1217
+ "ios": "11.3",
1218
+ "samsung": "8",
1219
+ "rhino": "1.7.15",
1220
+ "opera_mobile": "46",
1221
+ "electron": "3.0"
1222
+ },
1223
+ "es6.reflect.apply": {
1224
+ "chrome": "49",
1225
+ "opera": "36",
1226
+ "edge": "12",
1227
+ "firefox": "42",
1228
+ "safari": "10",
1229
+ "node": "6",
1230
+ "deno": "1",
1231
+ "ios": "10",
1232
+ "samsung": "5",
1233
+ "rhino": "1.8",
1234
+ "opera_mobile": "36",
1235
+ "electron": "0.37"
1236
+ },
1237
+ "es6.reflect.construct": {
1238
+ "chrome": "49",
1239
+ "opera": "36",
1240
+ "edge": "13",
1241
+ "firefox": "49",
1242
+ "safari": "10",
1243
+ "node": "6",
1244
+ "deno": "1",
1245
+ "ios": "10",
1246
+ "samsung": "5",
1247
+ "opera_mobile": "36",
1248
+ "electron": "0.37"
1249
+ },
1250
+ "es6.reflect.define-property": {
1251
+ "chrome": "49",
1252
+ "opera": "36",
1253
+ "edge": "13",
1254
+ "firefox": "42",
1255
+ "safari": "10",
1256
+ "node": "6",
1257
+ "deno": "1",
1258
+ "ios": "10",
1259
+ "samsung": "5",
1260
+ "rhino": "1.8",
1261
+ "opera_mobile": "36",
1262
+ "electron": "0.37"
1263
+ },
1264
+ "es6.reflect.delete-property": {
1265
+ "chrome": "49",
1266
+ "opera": "36",
1267
+ "edge": "12",
1268
+ "firefox": "42",
1269
+ "safari": "10",
1270
+ "node": "6",
1271
+ "deno": "1",
1272
+ "ios": "10",
1273
+ "samsung": "5",
1274
+ "rhino": "1.8",
1275
+ "opera_mobile": "36",
1276
+ "electron": "0.37"
1277
+ },
1278
+ "es6.reflect.get": {
1279
+ "chrome": "49",
1280
+ "opera": "36",
1281
+ "edge": "12",
1282
+ "firefox": "42",
1283
+ "safari": "10",
1284
+ "node": "6",
1285
+ "deno": "1",
1286
+ "ios": "10",
1287
+ "samsung": "5",
1288
+ "rhino": "1.8",
1289
+ "opera_mobile": "36",
1290
+ "electron": "0.37"
1291
+ },
1292
+ "es6.reflect.get-own-property-descriptor": {
1293
+ "chrome": "49",
1294
+ "opera": "36",
1295
+ "edge": "12",
1296
+ "firefox": "42",
1297
+ "safari": "10",
1298
+ "node": "6",
1299
+ "deno": "1",
1300
+ "ios": "10",
1301
+ "samsung": "5",
1302
+ "rhino": "1.8",
1303
+ "opera_mobile": "36",
1304
+ "electron": "0.37"
1305
+ },
1306
+ "es6.reflect.get-prototype-of": {
1307
+ "chrome": "49",
1308
+ "opera": "36",
1309
+ "edge": "12",
1310
+ "firefox": "42",
1311
+ "safari": "10",
1312
+ "node": "6",
1313
+ "deno": "1",
1314
+ "ios": "10",
1315
+ "samsung": "5",
1316
+ "rhino": "1.8",
1317
+ "opera_mobile": "36",
1318
+ "electron": "0.37"
1319
+ },
1320
+ "es6.reflect.has": {
1321
+ "chrome": "49",
1322
+ "opera": "36",
1323
+ "edge": "12",
1324
+ "firefox": "42",
1325
+ "safari": "10",
1326
+ "node": "6",
1327
+ "deno": "1",
1328
+ "ios": "10",
1329
+ "samsung": "5",
1330
+ "rhino": "1.8",
1331
+ "opera_mobile": "36",
1332
+ "electron": "0.37"
1333
+ },
1334
+ "es6.reflect.is-extensible": {
1335
+ "chrome": "49",
1336
+ "opera": "36",
1337
+ "edge": "12",
1338
+ "firefox": "42",
1339
+ "safari": "10",
1340
+ "node": "6",
1341
+ "deno": "1",
1342
+ "ios": "10",
1343
+ "samsung": "5",
1344
+ "rhino": "1.8",
1345
+ "opera_mobile": "36",
1346
+ "electron": "0.37"
1347
+ },
1348
+ "es6.reflect.own-keys": {
1349
+ "chrome": "49",
1350
+ "opera": "36",
1351
+ "edge": "12",
1352
+ "firefox": "42",
1353
+ "safari": "10",
1354
+ "node": "6",
1355
+ "deno": "1",
1356
+ "ios": "10",
1357
+ "samsung": "5",
1358
+ "rhino": "1.8",
1359
+ "opera_mobile": "36",
1360
+ "electron": "0.37"
1361
+ },
1362
+ "es6.reflect.prevent-extensions": {
1363
+ "chrome": "49",
1364
+ "opera": "36",
1365
+ "edge": "12",
1366
+ "firefox": "42",
1367
+ "safari": "10",
1368
+ "node": "6",
1369
+ "deno": "1",
1370
+ "ios": "10",
1371
+ "samsung": "5",
1372
+ "rhino": "1.8",
1373
+ "opera_mobile": "36",
1374
+ "electron": "0.37"
1375
+ },
1376
+ "es6.reflect.set": {
1377
+ "chrome": "49",
1378
+ "opera": "36",
1379
+ "edge": "12",
1380
+ "firefox": "42",
1381
+ "safari": "10",
1382
+ "node": "6",
1383
+ "deno": "1",
1384
+ "ios": "10",
1385
+ "samsung": "5",
1386
+ "rhino": "1.8",
1387
+ "opera_mobile": "36",
1388
+ "electron": "0.37"
1389
+ },
1390
+ "es6.reflect.set-prototype-of": {
1391
+ "chrome": "49",
1392
+ "opera": "36",
1393
+ "edge": "12",
1394
+ "firefox": "42",
1395
+ "safari": "10",
1396
+ "node": "6",
1397
+ "deno": "1",
1398
+ "ios": "10",
1399
+ "samsung": "5",
1400
+ "rhino": "1.8",
1401
+ "opera_mobile": "36",
1402
+ "electron": "0.37"
1403
+ },
1404
+ "es6.regexp.constructor": {
1405
+ "chrome": "50",
1406
+ "opera": "37",
1407
+ "edge": "79",
1408
+ "firefox": "40",
1409
+ "safari": "10",
1410
+ "node": "6",
1411
+ "deno": "1",
1412
+ "ios": "10",
1413
+ "samsung": "5",
1414
+ "opera_mobile": "37",
1415
+ "electron": "1.1"
1416
+ },
1417
+ "es6.regexp.flags": {
1418
+ "chrome": "49",
1419
+ "opera": "36",
1420
+ "edge": "79",
1421
+ "firefox": "37",
1422
+ "safari": "9",
1423
+ "node": "6",
1424
+ "deno": "1",
1425
+ "ios": "9",
1426
+ "samsung": "5",
1427
+ "rhino": "1.7.15",
1428
+ "opera_mobile": "36",
1429
+ "electron": "0.37"
1430
+ },
1431
+ "es6.regexp.match": {
1432
+ "chrome": "50",
1433
+ "opera": "37",
1434
+ "edge": "79",
1435
+ "firefox": "49",
1436
+ "safari": "10",
1437
+ "node": "6",
1438
+ "deno": "1",
1439
+ "ios": "10",
1440
+ "samsung": "5",
1441
+ "rhino": "1.7.13",
1442
+ "opera_mobile": "37",
1443
+ "electron": "1.1"
1444
+ },
1445
+ "es6.regexp.replace": {
1446
+ "chrome": "50",
1447
+ "opera": "37",
1448
+ "edge": "79",
1449
+ "firefox": "49",
1450
+ "safari": "10",
1451
+ "node": "6",
1452
+ "deno": "1",
1453
+ "ios": "10",
1454
+ "samsung": "5",
1455
+ "opera_mobile": "37",
1456
+ "electron": "1.1"
1457
+ },
1458
+ "es6.regexp.split": {
1459
+ "chrome": "50",
1460
+ "opera": "37",
1461
+ "edge": "79",
1462
+ "firefox": "49",
1463
+ "safari": "10",
1464
+ "node": "6",
1465
+ "deno": "1",
1466
+ "ios": "10",
1467
+ "samsung": "5",
1468
+ "opera_mobile": "37",
1469
+ "electron": "1.1"
1470
+ },
1471
+ "es6.regexp.search": {
1472
+ "chrome": "50",
1473
+ "opera": "37",
1474
+ "edge": "79",
1475
+ "firefox": "49",
1476
+ "safari": "10",
1477
+ "node": "6",
1478
+ "deno": "1",
1479
+ "ios": "10",
1480
+ "samsung": "5",
1481
+ "rhino": "1.7.13",
1482
+ "opera_mobile": "37",
1483
+ "electron": "1.1"
1484
+ },
1485
+ "es6.regexp.to-string": {
1486
+ "chrome": "50",
1487
+ "opera": "37",
1488
+ "edge": "79",
1489
+ "firefox": "39",
1490
+ "safari": "10",
1491
+ "node": "6",
1492
+ "deno": "1",
1493
+ "ios": "10",
1494
+ "samsung": "5",
1495
+ "rhino": "1.7.15",
1496
+ "opera_mobile": "37",
1497
+ "electron": "1.1"
1498
+ },
1499
+ "es6.set": {
1500
+ "chrome": "51",
1501
+ "opera": "38",
1502
+ "edge": "15",
1503
+ "firefox": "53",
1504
+ "safari": "10",
1505
+ "node": "6.5",
1506
+ "deno": "1",
1507
+ "ios": "10",
1508
+ "samsung": "5",
1509
+ "opera_mobile": "41",
1510
+ "electron": "1.2"
1511
+ },
1512
+ "es6.symbol": {
1513
+ "chrome": "51",
1514
+ "opera": "38",
1515
+ "edge": "79",
1516
+ "firefox": "51",
1517
+ "safari": "10",
1518
+ "node": "6.5",
1519
+ "deno": "1",
1520
+ "ios": "10",
1521
+ "samsung": "5",
1522
+ "opera_mobile": "41",
1523
+ "electron": "1.2"
1524
+ },
1525
+ "es7.symbol.async-iterator": {
1526
+ "chrome": "63",
1527
+ "opera": "50",
1528
+ "edge": "79",
1529
+ "firefox": "57",
1530
+ "safari": "12",
1531
+ "node": "10",
1532
+ "deno": "1",
1533
+ "ios": "12",
1534
+ "samsung": "8",
1535
+ "opera_mobile": "46",
1536
+ "electron": "3.0"
1537
+ },
1538
+ "es6.string.anchor": {
1539
+ "chrome": "5",
1540
+ "opera": "15",
1541
+ "edge": "12",
1542
+ "firefox": "17",
1543
+ "safari": "6",
1544
+ "node": "0.4",
1545
+ "deno": "1",
1546
+ "android": "4",
1547
+ "ios": "7",
1548
+ "phantom": "1.9",
1549
+ "samsung": "1",
1550
+ "rhino": "1.7.14",
1551
+ "opera_mobile": "14",
1552
+ "electron": "0.20"
1553
+ },
1554
+ "es6.string.big": {
1555
+ "chrome": "5",
1556
+ "opera": "15",
1557
+ "edge": "12",
1558
+ "firefox": "17",
1559
+ "safari": "6",
1560
+ "node": "0.4",
1561
+ "deno": "1",
1562
+ "android": "4",
1563
+ "ios": "7",
1564
+ "phantom": "1.9",
1565
+ "samsung": "1",
1566
+ "rhino": "1.7.14",
1567
+ "opera_mobile": "14",
1568
+ "electron": "0.20"
1569
+ },
1570
+ "es6.string.blink": {
1571
+ "chrome": "5",
1572
+ "opera": "15",
1573
+ "edge": "12",
1574
+ "firefox": "17",
1575
+ "safari": "6",
1576
+ "node": "0.4",
1577
+ "deno": "1",
1578
+ "android": "4",
1579
+ "ios": "7",
1580
+ "phantom": "1.9",
1581
+ "samsung": "1",
1582
+ "rhino": "1.7.14",
1583
+ "opera_mobile": "14",
1584
+ "electron": "0.20"
1585
+ },
1586
+ "es6.string.bold": {
1587
+ "chrome": "5",
1588
+ "opera": "15",
1589
+ "edge": "12",
1590
+ "firefox": "17",
1591
+ "safari": "6",
1592
+ "node": "0.4",
1593
+ "deno": "1",
1594
+ "android": "4",
1595
+ "ios": "7",
1596
+ "phantom": "1.9",
1597
+ "samsung": "1",
1598
+ "rhino": "1.7.14",
1599
+ "opera_mobile": "14",
1600
+ "electron": "0.20"
1601
+ },
1602
+ "es6.string.code-point-at": {
1603
+ "chrome": "41",
1604
+ "opera": "28",
1605
+ "edge": "12",
1606
+ "firefox": "29",
1607
+ "safari": "9",
1608
+ "node": "4",
1609
+ "deno": "1",
1610
+ "ios": "9",
1611
+ "samsung": "3.4",
1612
+ "rhino": "1.7.13",
1613
+ "opera_mobile": "28",
1614
+ "electron": "0.21"
1615
+ },
1616
+ "es6.string.ends-with": {
1617
+ "chrome": "41",
1618
+ "opera": "28",
1619
+ "edge": "12",
1620
+ "firefox": "29",
1621
+ "safari": "9",
1622
+ "node": "4",
1623
+ "deno": "1",
1624
+ "ios": "9",
1625
+ "samsung": "3.4",
1626
+ "rhino": "1.7.13",
1627
+ "opera_mobile": "28",
1628
+ "electron": "0.21"
1629
+ },
1630
+ "es6.string.fixed": {
1631
+ "chrome": "5",
1632
+ "opera": "15",
1633
+ "edge": "12",
1634
+ "firefox": "17",
1635
+ "safari": "6",
1636
+ "node": "0.4",
1637
+ "deno": "1",
1638
+ "android": "4",
1639
+ "ios": "7",
1640
+ "phantom": "1.9",
1641
+ "samsung": "1",
1642
+ "rhino": "1.7.14",
1643
+ "opera_mobile": "14",
1644
+ "electron": "0.20"
1645
+ },
1646
+ "es6.string.fontcolor": {
1647
+ "chrome": "5",
1648
+ "opera": "15",
1649
+ "edge": "12",
1650
+ "firefox": "17",
1651
+ "safari": "6",
1652
+ "node": "0.4",
1653
+ "deno": "1",
1654
+ "android": "4",
1655
+ "ios": "7",
1656
+ "phantom": "1.9",
1657
+ "samsung": "1",
1658
+ "rhino": "1.7.14",
1659
+ "opera_mobile": "14",
1660
+ "electron": "0.20"
1661
+ },
1662
+ "es6.string.fontsize": {
1663
+ "chrome": "5",
1664
+ "opera": "15",
1665
+ "edge": "12",
1666
+ "firefox": "17",
1667
+ "safari": "6",
1668
+ "node": "0.4",
1669
+ "deno": "1",
1670
+ "android": "4",
1671
+ "ios": "7",
1672
+ "phantom": "1.9",
1673
+ "samsung": "1",
1674
+ "rhino": "1.7.14",
1675
+ "opera_mobile": "14",
1676
+ "electron": "0.20"
1677
+ },
1678
+ "es6.string.from-code-point": {
1679
+ "chrome": "41",
1680
+ "opera": "28",
1681
+ "edge": "12",
1682
+ "firefox": "29",
1683
+ "safari": "9",
1684
+ "node": "4",
1685
+ "deno": "1",
1686
+ "ios": "9",
1687
+ "samsung": "3.4",
1688
+ "rhino": "1.7.13",
1689
+ "opera_mobile": "28",
1690
+ "electron": "0.21"
1691
+ },
1692
+ "es6.string.includes": {
1693
+ "chrome": "41",
1694
+ "opera": "28",
1695
+ "edge": "12",
1696
+ "firefox": "40",
1697
+ "safari": "9",
1698
+ "node": "4",
1699
+ "deno": "1",
1700
+ "ios": "9",
1701
+ "samsung": "3.4",
1702
+ "rhino": "1.7.13",
1703
+ "opera_mobile": "28",
1704
+ "electron": "0.21"
1705
+ },
1706
+ "es6.string.italics": {
1707
+ "chrome": "5",
1708
+ "opera": "15",
1709
+ "edge": "12",
1710
+ "firefox": "17",
1711
+ "safari": "6",
1712
+ "node": "0.4",
1713
+ "deno": "1",
1714
+ "android": "4",
1715
+ "ios": "7",
1716
+ "phantom": "1.9",
1717
+ "samsung": "1",
1718
+ "rhino": "1.7.14",
1719
+ "opera_mobile": "14",
1720
+ "electron": "0.20"
1721
+ },
1722
+ "es6.string.iterator": {
1723
+ "chrome": "38",
1724
+ "opera": "25",
1725
+ "edge": "12",
1726
+ "firefox": "36",
1727
+ "safari": "9",
1728
+ "node": "0.12",
1729
+ "deno": "1",
1730
+ "ios": "9",
1731
+ "samsung": "3",
1732
+ "rhino": "1.7.13",
1733
+ "opera_mobile": "25",
1734
+ "electron": "0.20"
1735
+ },
1736
+ "es6.string.link": {
1737
+ "chrome": "5",
1738
+ "opera": "15",
1739
+ "edge": "12",
1740
+ "firefox": "17",
1741
+ "safari": "6",
1742
+ "node": "0.4",
1743
+ "deno": "1",
1744
+ "android": "4",
1745
+ "ios": "7",
1746
+ "phantom": "1.9",
1747
+ "samsung": "1",
1748
+ "rhino": "1.7.14",
1749
+ "opera_mobile": "14",
1750
+ "electron": "0.20"
1751
+ },
1752
+ "es7.string.pad-start": {
1753
+ "chrome": "57",
1754
+ "opera": "44",
1755
+ "edge": "15",
1756
+ "firefox": "48",
1757
+ "safari": "10",
1758
+ "node": "8",
1759
+ "deno": "1",
1760
+ "ios": "10",
1761
+ "samsung": "7",
1762
+ "rhino": "1.7.13",
1763
+ "opera_mobile": "43",
1764
+ "electron": "1.7"
1765
+ },
1766
+ "es7.string.pad-end": {
1767
+ "chrome": "57",
1768
+ "opera": "44",
1769
+ "edge": "15",
1770
+ "firefox": "48",
1771
+ "safari": "10",
1772
+ "node": "8",
1773
+ "deno": "1",
1774
+ "ios": "10",
1775
+ "samsung": "7",
1776
+ "rhino": "1.7.13",
1777
+ "opera_mobile": "43",
1778
+ "electron": "1.7"
1779
+ },
1780
+ "es6.string.raw": {
1781
+ "chrome": "41",
1782
+ "opera": "28",
1783
+ "edge": "12",
1784
+ "firefox": "34",
1785
+ "safari": "9",
1786
+ "node": "4",
1787
+ "deno": "1",
1788
+ "ios": "9",
1789
+ "samsung": "3.4",
1790
+ "rhino": "1.7.14",
1791
+ "opera_mobile": "28",
1792
+ "electron": "0.21"
1793
+ },
1794
+ "es6.string.repeat": {
1795
+ "chrome": "41",
1796
+ "opera": "28",
1797
+ "edge": "12",
1798
+ "firefox": "24",
1799
+ "safari": "9",
1800
+ "node": "4",
1801
+ "deno": "1",
1802
+ "ios": "9",
1803
+ "samsung": "3.4",
1804
+ "rhino": "1.7.13",
1805
+ "opera_mobile": "28",
1806
+ "electron": "0.21"
1807
+ },
1808
+ "es6.string.small": {
1809
+ "chrome": "5",
1810
+ "opera": "15",
1811
+ "edge": "12",
1812
+ "firefox": "17",
1813
+ "safari": "6",
1814
+ "node": "0.4",
1815
+ "deno": "1",
1816
+ "android": "4",
1817
+ "ios": "7",
1818
+ "phantom": "1.9",
1819
+ "samsung": "1",
1820
+ "rhino": "1.7.14",
1821
+ "opera_mobile": "14",
1822
+ "electron": "0.20"
1823
+ },
1824
+ "es6.string.starts-with": {
1825
+ "chrome": "41",
1826
+ "opera": "28",
1827
+ "edge": "12",
1828
+ "firefox": "29",
1829
+ "safari": "9",
1830
+ "node": "4",
1831
+ "deno": "1",
1832
+ "ios": "9",
1833
+ "samsung": "3.4",
1834
+ "rhino": "1.7.13",
1835
+ "opera_mobile": "28",
1836
+ "electron": "0.21"
1837
+ },
1838
+ "es6.string.strike": {
1839
+ "chrome": "5",
1840
+ "opera": "15",
1841
+ "edge": "12",
1842
+ "firefox": "17",
1843
+ "safari": "6",
1844
+ "node": "0.4",
1845
+ "deno": "1",
1846
+ "android": "4",
1847
+ "ios": "7",
1848
+ "phantom": "1.9",
1849
+ "samsung": "1",
1850
+ "rhino": "1.7.14",
1851
+ "opera_mobile": "14",
1852
+ "electron": "0.20"
1853
+ },
1854
+ "es6.string.sub": {
1855
+ "chrome": "5",
1856
+ "opera": "15",
1857
+ "edge": "12",
1858
+ "firefox": "17",
1859
+ "safari": "6",
1860
+ "node": "0.4",
1861
+ "deno": "1",
1862
+ "android": "4",
1863
+ "ios": "7",
1864
+ "phantom": "1.9",
1865
+ "samsung": "1",
1866
+ "rhino": "1.7.14",
1867
+ "opera_mobile": "14",
1868
+ "electron": "0.20"
1869
+ },
1870
+ "es6.string.sup": {
1871
+ "chrome": "5",
1872
+ "opera": "15",
1873
+ "edge": "12",
1874
+ "firefox": "17",
1875
+ "safari": "6",
1876
+ "node": "0.4",
1877
+ "deno": "1",
1878
+ "android": "4",
1879
+ "ios": "7",
1880
+ "phantom": "1.9",
1881
+ "samsung": "1",
1882
+ "rhino": "1.7.14",
1883
+ "opera_mobile": "14",
1884
+ "electron": "0.20"
1885
+ },
1886
+ "es6.string.trim": {
1887
+ "chrome": "5",
1888
+ "opera": "10.50",
1889
+ "edge": "12",
1890
+ "firefox": "3.5",
1891
+ "safari": "4",
1892
+ "node": "0.4",
1893
+ "deno": "1",
1894
+ "ie": "9",
1895
+ "android": "4",
1896
+ "ios": "6",
1897
+ "phantom": "1.9",
1898
+ "samsung": "1",
1899
+ "rhino": "1.7.13",
1900
+ "opera_mobile": "10.1",
1901
+ "electron": "0.20"
1902
+ },
1903
+ "es7.string.trim-left": {
1904
+ "chrome": "66",
1905
+ "opera": "53",
1906
+ "edge": "79",
1907
+ "firefox": "61",
1908
+ "safari": "12",
1909
+ "node": "10",
1910
+ "deno": "1",
1911
+ "ios": "12",
1912
+ "samsung": "9",
1913
+ "rhino": "1.7.13",
1914
+ "opera_mobile": "47",
1915
+ "electron": "3.0"
1916
+ },
1917
+ "es7.string.trim-right": {
1918
+ "chrome": "66",
1919
+ "opera": "53",
1920
+ "edge": "79",
1921
+ "firefox": "61",
1922
+ "safari": "12",
1923
+ "node": "10",
1924
+ "deno": "1",
1925
+ "ios": "12",
1926
+ "samsung": "9",
1927
+ "rhino": "1.7.13",
1928
+ "opera_mobile": "47",
1929
+ "electron": "3.0"
1930
+ },
1931
+ "es6.typed.array-buffer": {
1932
+ "chrome": "51",
1933
+ "opera": "38",
1934
+ "edge": "13",
1935
+ "firefox": "48",
1936
+ "safari": "10",
1937
+ "node": "6.5",
1938
+ "deno": "1",
1939
+ "ios": "10",
1940
+ "samsung": "5",
1941
+ "opera_mobile": "41",
1942
+ "electron": "1.2"
1943
+ },
1944
+ "es6.typed.data-view": {
1945
+ "chrome": "5",
1946
+ "opera": "12",
1947
+ "edge": "12",
1948
+ "firefox": "15",
1949
+ "safari": "5.1",
1950
+ "node": "0.4",
1951
+ "deno": "1",
1952
+ "ie": "10",
1953
+ "android": "4",
1954
+ "ios": "6",
1955
+ "phantom": "1.9",
1956
+ "samsung": "1",
1957
+ "rhino": "1.7.13",
1958
+ "opera_mobile": "12",
1959
+ "electron": "0.20"
1960
+ },
1961
+ "es6.typed.int8-array": {
1962
+ "chrome": "51",
1963
+ "opera": "38",
1964
+ "edge": "13",
1965
+ "firefox": "48",
1966
+ "safari": "10",
1967
+ "node": "6.5",
1968
+ "deno": "1",
1969
+ "ios": "10",
1970
+ "samsung": "5",
1971
+ "opera_mobile": "41",
1972
+ "electron": "1.2"
1973
+ },
1974
+ "es6.typed.uint8-array": {
1975
+ "chrome": "51",
1976
+ "opera": "38",
1977
+ "edge": "13",
1978
+ "firefox": "48",
1979
+ "safari": "10",
1980
+ "node": "6.5",
1981
+ "deno": "1",
1982
+ "ios": "10",
1983
+ "samsung": "5",
1984
+ "opera_mobile": "41",
1985
+ "electron": "1.2"
1986
+ },
1987
+ "es6.typed.uint8-clamped-array": {
1988
+ "chrome": "51",
1989
+ "opera": "38",
1990
+ "edge": "13",
1991
+ "firefox": "48",
1992
+ "safari": "10",
1993
+ "node": "6.5",
1994
+ "deno": "1",
1995
+ "ios": "10",
1996
+ "samsung": "5",
1997
+ "opera_mobile": "41",
1998
+ "electron": "1.2"
1999
+ },
2000
+ "es6.typed.int16-array": {
2001
+ "chrome": "51",
2002
+ "opera": "38",
2003
+ "edge": "13",
2004
+ "firefox": "48",
2005
+ "safari": "10",
2006
+ "node": "6.5",
2007
+ "deno": "1",
2008
+ "ios": "10",
2009
+ "samsung": "5",
2010
+ "opera_mobile": "41",
2011
+ "electron": "1.2"
2012
+ },
2013
+ "es6.typed.uint16-array": {
2014
+ "chrome": "51",
2015
+ "opera": "38",
2016
+ "edge": "13",
2017
+ "firefox": "48",
2018
+ "safari": "10",
2019
+ "node": "6.5",
2020
+ "deno": "1",
2021
+ "ios": "10",
2022
+ "samsung": "5",
2023
+ "opera_mobile": "41",
2024
+ "electron": "1.2"
2025
+ },
2026
+ "es6.typed.int32-array": {
2027
+ "chrome": "51",
2028
+ "opera": "38",
2029
+ "edge": "13",
2030
+ "firefox": "48",
2031
+ "safari": "10",
2032
+ "node": "6.5",
2033
+ "deno": "1",
2034
+ "ios": "10",
2035
+ "samsung": "5",
2036
+ "opera_mobile": "41",
2037
+ "electron": "1.2"
2038
+ },
2039
+ "es6.typed.uint32-array": {
2040
+ "chrome": "51",
2041
+ "opera": "38",
2042
+ "edge": "13",
2043
+ "firefox": "48",
2044
+ "safari": "10",
2045
+ "node": "6.5",
2046
+ "deno": "1",
2047
+ "ios": "10",
2048
+ "samsung": "5",
2049
+ "opera_mobile": "41",
2050
+ "electron": "1.2"
2051
+ },
2052
+ "es6.typed.float32-array": {
2053
+ "chrome": "51",
2054
+ "opera": "38",
2055
+ "edge": "13",
2056
+ "firefox": "48",
2057
+ "safari": "10",
2058
+ "node": "6.5",
2059
+ "deno": "1",
2060
+ "ios": "10",
2061
+ "samsung": "5",
2062
+ "opera_mobile": "41",
2063
+ "electron": "1.2"
2064
+ },
2065
+ "es6.typed.float64-array": {
2066
+ "chrome": "51",
2067
+ "opera": "38",
2068
+ "edge": "13",
2069
+ "firefox": "48",
2070
+ "safari": "10",
2071
+ "node": "6.5",
2072
+ "deno": "1",
2073
+ "ios": "10",
2074
+ "samsung": "5",
2075
+ "opera_mobile": "41",
2076
+ "electron": "1.2"
2077
+ },
2078
+ "es6.weak-map": {
2079
+ "chrome": "51",
2080
+ "opera": "38",
2081
+ "edge": "15",
2082
+ "firefox": "53",
2083
+ "safari": "9",
2084
+ "node": "6.5",
2085
+ "deno": "1",
2086
+ "ios": "9",
2087
+ "samsung": "5",
2088
+ "rhino": "1.7.15",
2089
+ "opera_mobile": "41",
2090
+ "electron": "1.2"
2091
+ },
2092
+ "es6.weak-set": {
2093
+ "chrome": "51",
2094
+ "opera": "38",
2095
+ "edge": "15",
2096
+ "firefox": "53",
2097
+ "safari": "9",
2098
+ "node": "6.5",
2099
+ "deno": "1",
2100
+ "ios": "9",
2101
+ "samsung": "5",
2102
+ "rhino": "1.7.15",
2103
+ "opera_mobile": "41",
2104
+ "electron": "1.2"
2105
+ }
2106
+ }
packages/mathml2omml/node_modules/@babel/compat-data/data/corejs3-shipped-proposals.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ [
2
+ "esnext.promise.all-settled",
3
+ "esnext.string.match-all",
4
+ "esnext.global-this"
5
+ ]
packages/mathml2omml/node_modules/@babel/compat-data/data/native-modules.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "es6.module": {
3
+ "chrome": "61",
4
+ "and_chr": "61",
5
+ "edge": "16",
6
+ "firefox": "60",
7
+ "and_ff": "60",
8
+ "node": "13.2.0",
9
+ "opera": "48",
10
+ "op_mob": "45",
11
+ "safari": "10.1",
12
+ "ios": "10.3",
13
+ "samsung": "8.2",
14
+ "android": "61",
15
+ "electron": "2.0",
16
+ "ios_saf": "10.3"
17
+ }
18
+ }
packages/mathml2omml/node_modules/@babel/compat-data/data/overlapping-plugins.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "transform-async-to-generator": [
3
+ "bugfix/transform-async-arrows-in-class"
4
+ ],
5
+ "transform-parameters": [
6
+ "bugfix/transform-edge-default-parameters",
7
+ "bugfix/transform-safari-id-destructuring-collision-in-function-expression"
8
+ ],
9
+ "transform-function-name": [
10
+ "bugfix/transform-edge-function-name"
11
+ ],
12
+ "transform-block-scoping": [
13
+ "bugfix/transform-safari-block-shadowing",
14
+ "bugfix/transform-safari-for-shadowing"
15
+ ],
16
+ "transform-template-literals": [
17
+ "bugfix/transform-tagged-template-caching"
18
+ ],
19
+ "transform-optional-chaining": [
20
+ "bugfix/transform-v8-spread-parameters-in-optional-chaining"
21
+ ],
22
+ "proposal-optional-chaining": [
23
+ "bugfix/transform-v8-spread-parameters-in-optional-chaining"
24
+ ],
25
+ "transform-class-properties": [
26
+ "bugfix/transform-v8-static-class-fields-redefine-readonly",
27
+ "bugfix/transform-firefox-class-in-computed-class-key",
28
+ "bugfix/transform-safari-class-field-initializer-scope"
29
+ ],
30
+ "proposal-class-properties": [
31
+ "bugfix/transform-v8-static-class-fields-redefine-readonly",
32
+ "bugfix/transform-firefox-class-in-computed-class-key",
33
+ "bugfix/transform-safari-class-field-initializer-scope"
34
+ ]
35
+ }
packages/mathml2omml/node_modules/@babel/compat-data/data/plugin-bugfixes.json ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bugfix/transform-async-arrows-in-class": {
3
+ "chrome": "55",
4
+ "opera": "42",
5
+ "edge": "15",
6
+ "firefox": "52",
7
+ "safari": "11",
8
+ "node": "7.6",
9
+ "deno": "1",
10
+ "ios": "11",
11
+ "samsung": "6",
12
+ "opera_mobile": "42",
13
+ "electron": "1.6"
14
+ },
15
+ "bugfix/transform-edge-default-parameters": {
16
+ "chrome": "49",
17
+ "opera": "36",
18
+ "edge": "18",
19
+ "firefox": "52",
20
+ "safari": "10",
21
+ "node": "6",
22
+ "deno": "1",
23
+ "ios": "10",
24
+ "samsung": "5",
25
+ "opera_mobile": "36",
26
+ "electron": "0.37"
27
+ },
28
+ "bugfix/transform-edge-function-name": {
29
+ "chrome": "51",
30
+ "opera": "38",
31
+ "edge": "79",
32
+ "firefox": "53",
33
+ "safari": "10",
34
+ "node": "6.5",
35
+ "deno": "1",
36
+ "ios": "10",
37
+ "samsung": "5",
38
+ "opera_mobile": "41",
39
+ "electron": "1.2"
40
+ },
41
+ "bugfix/transform-safari-block-shadowing": {
42
+ "chrome": "49",
43
+ "opera": "36",
44
+ "edge": "12",
45
+ "firefox": "44",
46
+ "safari": "11",
47
+ "node": "6",
48
+ "deno": "1",
49
+ "ie": "11",
50
+ "ios": "11",
51
+ "samsung": "5",
52
+ "opera_mobile": "36",
53
+ "electron": "0.37"
54
+ },
55
+ "bugfix/transform-safari-for-shadowing": {
56
+ "chrome": "49",
57
+ "opera": "36",
58
+ "edge": "12",
59
+ "firefox": "4",
60
+ "safari": "11",
61
+ "node": "6",
62
+ "deno": "1",
63
+ "ie": "11",
64
+ "ios": "11",
65
+ "samsung": "5",
66
+ "rhino": "1.7.13",
67
+ "opera_mobile": "36",
68
+ "electron": "0.37"
69
+ },
70
+ "bugfix/transform-safari-id-destructuring-collision-in-function-expression": {
71
+ "chrome": "49",
72
+ "opera": "36",
73
+ "edge": "14",
74
+ "firefox": "2",
75
+ "safari": "16.3",
76
+ "node": "6",
77
+ "deno": "1",
78
+ "ios": "16.3",
79
+ "samsung": "5",
80
+ "opera_mobile": "36",
81
+ "electron": "0.37"
82
+ },
83
+ "bugfix/transform-tagged-template-caching": {
84
+ "chrome": "41",
85
+ "opera": "28",
86
+ "edge": "12",
87
+ "firefox": "34",
88
+ "safari": "13",
89
+ "node": "4",
90
+ "deno": "1",
91
+ "ios": "13",
92
+ "samsung": "3.4",
93
+ "rhino": "1.7.14",
94
+ "opera_mobile": "28",
95
+ "electron": "0.21"
96
+ },
97
+ "bugfix/transform-v8-spread-parameters-in-optional-chaining": {
98
+ "chrome": "91",
99
+ "opera": "77",
100
+ "edge": "91",
101
+ "firefox": "74",
102
+ "safari": "13.1",
103
+ "node": "16.9",
104
+ "deno": "1.9",
105
+ "ios": "13.4",
106
+ "samsung": "16",
107
+ "opera_mobile": "64",
108
+ "electron": "13.0"
109
+ },
110
+ "transform-optional-chaining": {
111
+ "chrome": "80",
112
+ "opera": "67",
113
+ "edge": "80",
114
+ "firefox": "74",
115
+ "safari": "13.1",
116
+ "node": "14",
117
+ "deno": "1",
118
+ "ios": "13.4",
119
+ "samsung": "13",
120
+ "rhino": "1.8",
121
+ "opera_mobile": "57",
122
+ "electron": "8.0"
123
+ },
124
+ "proposal-optional-chaining": {
125
+ "chrome": "80",
126
+ "opera": "67",
127
+ "edge": "80",
128
+ "firefox": "74",
129
+ "safari": "13.1",
130
+ "node": "14",
131
+ "deno": "1",
132
+ "ios": "13.4",
133
+ "samsung": "13",
134
+ "rhino": "1.8",
135
+ "opera_mobile": "57",
136
+ "electron": "8.0"
137
+ },
138
+ "transform-parameters": {
139
+ "chrome": "49",
140
+ "opera": "36",
141
+ "edge": "15",
142
+ "firefox": "52",
143
+ "safari": "10",
144
+ "node": "6",
145
+ "deno": "1",
146
+ "ios": "10",
147
+ "samsung": "5",
148
+ "opera_mobile": "36",
149
+ "electron": "0.37"
150
+ },
151
+ "transform-async-to-generator": {
152
+ "chrome": "55",
153
+ "opera": "42",
154
+ "edge": "15",
155
+ "firefox": "52",
156
+ "safari": "10.1",
157
+ "node": "7.6",
158
+ "deno": "1",
159
+ "ios": "10.3",
160
+ "samsung": "6",
161
+ "opera_mobile": "42",
162
+ "electron": "1.6"
163
+ },
164
+ "transform-template-literals": {
165
+ "chrome": "41",
166
+ "opera": "28",
167
+ "edge": "13",
168
+ "firefox": "34",
169
+ "safari": "9",
170
+ "node": "4",
171
+ "deno": "1",
172
+ "ios": "9",
173
+ "samsung": "3.4",
174
+ "opera_mobile": "28",
175
+ "electron": "0.21"
176
+ },
177
+ "transform-function-name": {
178
+ "chrome": "51",
179
+ "opera": "38",
180
+ "edge": "14",
181
+ "firefox": "53",
182
+ "safari": "10",
183
+ "node": "6.5",
184
+ "deno": "1",
185
+ "ios": "10",
186
+ "samsung": "5",
187
+ "opera_mobile": "41",
188
+ "electron": "1.2"
189
+ },
190
+ "transform-block-scoping": {
191
+ "chrome": "50",
192
+ "opera": "37",
193
+ "edge": "14",
194
+ "firefox": "53",
195
+ "safari": "10",
196
+ "node": "6",
197
+ "deno": "1",
198
+ "ios": "10",
199
+ "samsung": "5",
200
+ "opera_mobile": "37",
201
+ "electron": "1.1"
202
+ }
203
+ }